Searching on bounding box. More...
#include <meshTools/searchableBox.H>
Inheritance diagram for searchableBox:
Collaboration diagram for searchableBox:Public Member Functions | |
| TypeName ("searchableBox") | |
| Runtime type information. | |
| searchableBox (const IOobject &io, const treeBoundBox &bb) | |
| Construct from components. | |
| searchableBox (const IOobject &io, const dictionary &dict) | |
| Construct from dictionary (used by searchableSurface) | |
| virtual | ~searchableBox () |
| virtual const wordList & | regions () const |
| Names of regions. | |
| virtual bool | hasVolumeType () const |
| Whether supports volume type below. | |
| virtual label | size () const |
| Range of local indices that can be returned. | |
| virtual pointField | coordinates () const |
| Get representative set of element coordinates. | |
| pointIndexHit | findNearest (const point &sample, const scalar nearestDistSqr) const |
| Calculate nearest point on surface. Returns. | |
| pointIndexHit | findNearestOnEdge (const point &sample, const scalar nearestDistSqr) const |
| Calculate nearest point on edge. Returns. | |
| pointIndexHit | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint) const |
| Find nearest to segment. Returns. | |
| pointIndexHit | findLine (const point &start, const point &end) const |
| Find nearest intersection of line between start and end. | |
| pointIndexHit | findLineAny (const point &start, const point &end) const |
| Find any intersection of line between start and end. | |
| virtual void | findNearest (const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const |
| virtual void | findLine (const pointField &start, const pointField &end, List< pointIndexHit > &) const |
| Find first intersection on segment from start to end. | |
| virtual void | findLineAny (const pointField &start, const pointField &end, List< pointIndexHit > &) const |
| Return any intersection on segment from start to end. | |
| virtual void | findLineAll (const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const |
| Get all intersections in order from start to end. | |
| virtual void | getRegion (const List< pointIndexHit > &, labelList ®ion) const |
| From a set of points and indices get the region. | |
| virtual void | getNormal (const List< pointIndexHit > &, vectorField &normal) const |
| From a set of points and indices get the normal. | |
| virtual void | getVolumeType (const pointField &, List< volumeType > &) const |
| Determine type (inside/outside/mixed) for point. unknown if. | |
| bool | writeData (Ostream &) const |
| Pure virtual writaData function. | |
Public Member Functions inherited from searchableSurface | |
| TypeName ("searchableSurface") | |
| Runtime type information. | |
| declareRunTimeSelectionTable (autoPtr, searchableSurface, dict,(const IOobject &io, const dictionary &dict),(io, dict)) | |
| searchableSurface (const IOobject &io) | |
| virtual autoPtr < searchableSurface > | clone () const |
| Clone. | |
| virtual | ~searchableSurface () |
| virtual label | globalSize () const |
| Range of global indices that can be returned. | |
| virtual void | distribute (const List< treeBoundBox > &, const bool keepNonLocal, autoPtr< mapDistribute > &faceMap, autoPtr< mapDistribute > &pointMap) |
| Set bounds of surface. Bounds currently set as list of. | |
| virtual void | setField (const labelList &values) |
| WIP. Store element-wise field. | |
| virtual void | getField (const List< pointIndexHit > &, labelList &values) const |
| WIP. From a set of hits (points and. | |
Public Member Functions inherited from regIOobject | |
| TypeName ("regIOobject") | |
| Runtime type information. | |
| regIOobject (const IOobject &, const bool isTime=false) | |
| Construct from IOobject. Optional flag for if IOobject is the. | |
| regIOobject (const regIOobject &) | |
| Construct as copy. | |
| regIOobject (const regIOobject &, bool registerCopy) | |
| Construct as copy, and transferring registry registration to copy. | |
| virtual | ~regIOobject () |
| bool | checkIn () |
| Add object to registry. | |
| bool | checkOut () |
| Remove object from registry. | |
| bool | ownedByRegistry () const |
| Is this object owned by the registry? | |
| void | store () |
| Transfer ownership of this object to its registry. | |
| void | release () |
| Release ownership of this object from its registry. | |
| label | eventNo () const |
| Event number at last update. | |
| label & | eventNo () |
| Event number at last update. | |
| bool | upToDate (const word &) const |
| Am I uptodate with respect to other regIOobjects. | |
| bool | upToDate (const word &, const word &) const |
| bool | upToDate (const word &, const word &, const word &) const |
| bool | upToDate (const word &, const word &, const word &, const word &) const |
| void | setUpToDate () |
| Flag me as up to date. | |
| virtual void | rename (const word &newName) |
| Rename. | |
| Istream & | readStream (const word &) |
| Return Istream and check object type against that given. | |
| void | close () |
| Close Istream. | |
| virtual bool | readData (Istream &) |
| Virtual readData function. | |
| virtual bool | read () |
| Read object. | |
| virtual bool | modified () const |
| Return true if the object's file has been modified. | |
| virtual bool | readIfModified () |
| Read object if modified. | |
| virtual bool | writeObject (IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType) const |
| Write using given format, version and compression. | |
| virtual bool | write () const |
| Write using setting from DB. | |
| void | operator= (const IOobject &) |
Public Member Functions inherited from IOobject | |
| TypeName ("IOobject") | |
| Runtime type information. | |
| IOobject (const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true) | |
| Construct from name, instance, registry, io options. | |
| IOobject (const word &name, const fileName &instance, const fileName &local, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true) | |
| Construct from name, instance, local, registry, io options. | |
| IOobject (const fileName &path, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true) | |
| Construct from path, registry, io options. | |
| virtual | ~IOobject () |
| const Time & | time () const |
| Return time. | |
| const objectRegistry & | db () const |
| Return the local objectRegistry. | |
| const word & | name () const |
| Return name. | |
| const word & | headerClassName () const |
| Return name of the class name read from header. | |
| string & | note () |
| Return non-constant access to the optional note. | |
| const string & | note () const |
| Return the optional note. | |
| bool | registerObject () const |
| Register object created from this IOobject with registry if true. | |
| readOption | readOpt () const |
| readOption & | readOpt () |
| writeOption | writeOpt () const |
| writeOption & | writeOpt () |
| const fileName & | rootPath () const |
| const fileName & | caseName () const |
| const fileName & | instance () const |
| fileName & | instance () |
| const fileName & | local () const |
| fileName | path () const |
| Return complete path. | |
| fileName | path (const word &instance, const fileName &local="") const |
| Return complete path with alternative instance and local. | |
| fileName | objectPath () const |
| Return complete path + object name. | |
| fileName | filePath () const |
| Return complete path + object name if the file exists. | |
| bool | readHeader (Istream &) |
| Read header. | |
| bool | headerOk () |
| Read and check header info. | |
| bool | writeHeader (Ostream &) const |
| Write header. | |
| bool | good () const |
| bool | bad () const |
| InfoProxy< IOobject > | info () const |
| Return info proxy. | |
Public Member Functions inherited from treeBoundBox | |
| treeBoundBox () | |
| Construct null setting points to zero. | |
| treeBoundBox (const point &min, const point &max) | |
| Construct from components. | |
| treeBoundBox (const boundBox &bb) | |
| Construct from components. | |
| treeBoundBox (const UList< point > &) | |
| Construct as the bounding box of the given pointField. | |
| treeBoundBox (const UList< point > &, const UList< label > &meshPoints) | |
| Construct as subset of points. | |
| treeBoundBox (Istream &) | |
| Construct from Istream. | |
| scalar | typDim () const |
| Typical dimension length,height,width. | |
| pointField | points () const |
| vertex coordinates. In octant coding. | |
| point | corner (const direction) const |
| Corner point given octant. | |
| treeBoundBox | subBbox (const direction) const |
| Sub box given by octant number. Midpoint calculated. | |
| treeBoundBox | subBbox (const point &mid, const direction) const |
| Sub box given by octant number. Midpoint provided. | |
| direction | subOctant (const point &pt) const |
| Returns octant number given point and the calculated midpoint. | |
| direction | subOctant (const point &pt, bool &onEdge) const |
| Returns octant number given point and the calculated midpoint. | |
| void | searchOrder (const point &pt, FixedList< direction, 8 > &octantOrder) const |
| Calculates optimal order to look for nearest to point. | |
| bool | overlaps (const treeBoundBox &) const |
| Overlaps other boundingbox? | |
| bool | overlaps (const point &, const scalar radiusSqr) const |
| Overlaps boundingSphere (centre + sqr(radius))? | |
| bool | intersects (const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const |
| Intersects segment; set point to intersection position and face,. | |
| bool | intersects (const point &start, const point &end, point &pt) const |
| Like above but does not return faces point is on. | |
| bool | contains (const treeBoundBox &) const |
| fully contains other boundingBox? | |
| bool | contains (const point &) const |
| Contains point? (inside or on edge) | |
| bool | contains (const vector &dir, const point &) const |
| Contains point (inside or on edge) and moving in direction. | |
| direction | faceBits (const point &pt) const |
| Code position of pt on bounding box faces. | |
| direction | posBits (const point &) const |
| Position of point relative to bounding box. | |
| void | calcExtremities (const point &pt, point &nearest, point &furthest) const |
| Calculate nearest and furthest (to point) vertex coords of. | |
| scalar | maxDist (const point &) const |
| Returns distance point to furthest away corner. | |
| label | distanceCmp (const point &, const treeBoundBox &other) const |
| Compare distance to point with other bounding box. | |
| treeBoundBox | extend (Random &, const scalar s) const |
| Return slightly wider bounding box. | |
Public Member Functions inherited from boundBox | |
| boundBox () | |
| Construct null, setting points to zero. | |
| boundBox (const point &min, const point &max) | |
| Construct from components. | |
| boundBox (const pointField &, const bool doReduce=true) | |
| Construct as the bounding box of the given pointField. | |
| boundBox (const tmp< pointField > &, const bool doReduce=true) | |
| Construct as the bounding box of the given temporary pointField. | |
| boundBox (Istream &) | |
| Construct from Istream. | |
| const point & | min () const |
| Minimum describing the bounding box. | |
| const point & | max () const |
| Maximum describing the bounding box. | |
| point & | min () |
| Minimum describing the bounding box, non-const access. | |
| point & | max () |
| Maximum describing the bounding box, non-const access. | |
| point | midpoint () const |
| The midpoint of the bounding box. | |
| vector | span () const |
| The bounding box span (from minimum to maximum) | |
| scalar | mag () const |
| The magnitude of the bounding box span. | |
| scalar | minDim () const |
| Smallest length/height/width dimension. | |
| scalar | maxDim () const |
| Largest length/height/width dimension. | |
| scalar | avgDim () const |
| Average length/height/width dimension. | |
| bool | overlaps (const boundBox &bb) const |
| Overlaps/touches boundingBox? | |
| bool | containsInside (const point &pt) const |
| Contains point? (inside only) | |
Additional Inherited Members | |
Public Types inherited from searchableSurface | |
| enum | volumeType { UNKNOWN = 0, MIXED = 1, INSIDE = 2, OUTSIDE = 3 } |
| volume types More... | |
Public Types inherited from treeBoundBox | |
| enum | octantBit { RIGHTHALF = 0x1 << 0, TOPHALF = 0x1 << 1, FRONTHALF = 0x1 << 2 } |
| Bits used for octant/point coding. More... | |
| enum | faceId { LEFT = 0, RIGHT = 1, BOTTOM = 2, TOP = 3, BACK = 4, FRONT = 5 } |
| Face codes. More... | |
| enum | faceBit { NOFACE = 0, LEFTBIT = 0x1 << LEFT, RIGHTBIT = 0x1 << RIGHT, BOTTOMBIT = 0x1 << BOTTOM, TOPBIT = 0x1 << TOP, BACKBIT = 0x1 << BACK, FRONTBIT = 0x1 << FRONT } |
| Bits used for face coding. More... | |
| enum | edgeId { E01 = 0, E13 = 1, E23 = 2, E02 = 3, E45 = 4, E57 = 5, E67 = 6, E46 = 7, E04 = 8, E15 = 9, E37 = 10, E26 = 11 } |
| Edges codes. More... | |
Static Public Member Functions inherited from searchableSurface | |
| static autoPtr< searchableSurface > | New (const word &surfaceType, const IOobject &io, const dictionary &dict) |
| Return a reference to the selected searchableSurface. | |
Static Public Member Functions inherited from regIOobject | |
| template<class Type > | |
| static Type & | store (Type *) |
| Transfer ownership of the given object pointer to its registry. | |
| template<class Type > | |
| static Type & | store (autoPtr< Type > &) |
| Transfer ownership of the given object pointer to its registry. | |
Static Public Member Functions inherited from IOobject | |
| static bool | fileNameComponents (const fileName &path, fileName &instance, fileName &local, word &name) |
| Split path into instance, local, name components. | |
| template<class Stream > | |
| static Stream & | writeBanner (Stream &os, bool noHint=false) |
| Write the standard OpenFOAM file/dictionary banner. | |
| template<class Stream > | |
| static Stream & | writeDivider (Stream &os) |
| Write the standard file section divider. | |
| template<class Stream > | |
| static Stream & | writeEndDivider (Stream &os) |
| Write the standard end file divider. | |
Static Public Member Functions inherited from treeBoundBox | |
| static direction | neighbourFaceBits (const label &) |
| Face on which neighbour is. | |
| static direction | subOctant (const point &mid, const point &pt) |
| Returns octant number given point and midpoint. | |
| static direction | subOctant (const point &mid, const point &pt, bool &onEdge) |
| Returns octant number given point and midpoint. | |
| static direction | subOctant (const point &mid, const vector &dir, const point &pt, bool &onEdge) |
| Returns octant number given intersection and midpoint. | |
Static Public Attributes inherited from treeBoundBox | |
| static const scalar | great |
| The great value used for greatBox and invertedBox. | |
| static const treeBoundBox | greatBox |
| As per boundBox::greatBox, but with GREAT instead of VGREAT. | |
| static const treeBoundBox | invertedBox |
| As per boundBox::invertedBox, but with GREAT instead of VGREAT. | |
| static const faceList | faces |
| Face to point addressing. | |
| static const edgeList | edges |
| Edge to point addressing. | |
| static const FixedList< vector, 6 > | faceNormals |
| Per face the unit normal. | |
Static Public Attributes inherited from boundBox | |
| searchableBox | ( | const IOobject & | io, |
| const treeBoundBox & | bb | ||
| ) |
Construct from components.
Definition at line 165 of file searchableBox.C.
References Foam::exit(), Foam::FatalError, and FatalErrorIn.
| searchableBox | ( | const IOobject & | io, |
| const dictionary & | dict | ||
| ) |
Construct from dictionary (used by searchableSurface)
Definition at line 189 of file searchableBox.C.
References Foam::exit(), Foam::FatalError, and FatalErrorIn.
|
virtual |
Definition at line 214 of file searchableBox.C.
| TypeName | ( | "searchableBox" | ) |
Runtime type information.
|
virtual |
Names of regions.
Implements searchableSurface.
Definition at line 220 of file searchableBox.C.
References List< T >::setSize().
|
inlinevirtual |
Whether supports volume type below.
Implements searchableSurface.
Definition at line 118 of file searchableBox.H.
|
inlinevirtual |
Range of local indices that can be returned.
Implements searchableSurface.
Definition at line 124 of file searchableBox.H.
|
virtual |
Get representative set of element coordinates.
Usually the element centres (should be of length size()).
Implements searchableSurface.
Definition at line 231 of file searchableBox.C.
References treeBoundBox::faces, forAll, and treeBoundBox::points().
| Foam::pointIndexHit findNearest | ( | const point & | sample, |
| const scalar | nearestDistSqr | ||
| ) | const |
Calculate nearest point on surface. Returns.
label: relevant index in surface (=face 0..5)
Definition at line 247 of file searchableBox.C.
| Foam::pointIndexHit findNearestOnEdge | ( | const point & | sample, |
| const scalar | nearestDistSqr | ||
| ) | const |
Calculate nearest point on edge. Returns.
label: relevant index in surface(=?)
Definition at line 257 of file searchableBox.C.
References Foam::cmptMag(), dist, SortableList< T >::indices(), Foam::magSqr(), Foam::max(), Foam::min(), VectorSpace< Vector< scalar >, scalar, 3 >::nComponents, PointIndexHit< Point >::rawPoint(), PointIndexHit< Point >::setIndex(), PointIndexHit< Point >::setMiss(), and SortableList< T >::sort().
| Foam::pointIndexHit findNearest | ( | const linePointRef & | ln, |
| treeBoundBox & | tightest, | ||
| point & | linePoint | ||
| ) | const |
Find nearest to segment. Returns.
label: relevant index in shapes (=face 0..5)
Definition at line 327 of file searchableBox.C.
References notImplemented.
| Foam::pointIndexHit findLine | ( | const point & | start, |
| const point & | end | ||
| ) | const |
Find nearest intersection of line between start and end.
Definition at line 343 of file searchableBox.C.
References Foam::abort(), Foam::FatalError, FatalErrorIn, PointIndexHit< Point >::index(), Foam::max(), Foam::min(), VectorSpace< Vector< scalar >, scalar, 3 >::nComponents, PointIndexHit< Point >::rawPoint(), PointIndexHit< Point >::setHit(), and PointIndexHit< Point >::setIndex().
| Foam::pointIndexHit findLineAny | ( | const point & | start, |
| const point & | end | ||
| ) | const |
Find any intersection of line between start and end.
Definition at line 406 of file searchableBox.C.
|
virtual |
Implements searchableSurface.
Definition at line 416 of file searchableBox.C.
References forAll, List< T >::setSize(), and List< T >::size().
|
virtual |
Find first intersection on segment from start to end.
Note: searchableSurfacesQueries expects no intersection to be found if start==end. Is problem?
Implements searchableSurface.
Definition at line 434 of file searchableBox.C.
References forAll, List< T >::setSize(), and List< T >::size().
|
virtual |
Return any intersection on segment from start to end.
Implements searchableSurface.
Definition at line 450 of file searchableBox.C.
References forAll, List< T >::setSize(), and List< T >::size().
|
virtual |
Get all intersections in order from start to end.
Implements searchableSurface.
Definition at line 466 of file searchableBox.C.
References DynamicList< T, SizeInc, SizeMult, SizeDiv >::append(), DynamicList< T, SizeInc, SizeMult, SizeDiv >::clear(), List< T >::clear(), forAll, PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), Foam::magSqr(), List< T >::setSize(), List< T >::size(), Foam::sqrt(), and List< T >::transfer().
|
virtual |
From a set of points and indices get the region.
Implements searchableSurface.
Definition at line 534 of file searchableBox.C.
References List< T >::setSize(), and List< T >::size().
|
virtual |
From a set of points and indices get the normal.
Implements searchableSurface.
Definition at line 545 of file searchableBox.C.
References treeBoundBox::faceNormals, forAll, List< T >::setSize(), List< T >::size(), and Vector< scalar >::zero.
|
virtual |
Determine type (inside/outside/mixed) for point. unknown if.
cannot be determined (e.g. non-manifold surface)
Implements searchableSurface.
Definition at line 568 of file searchableBox.C.
References forAll, Foam::max(), Foam::min(), VectorSpace< Vector< scalar >, scalar, 3 >::nComponents, List< T >::setSize(), and List< T >::size().
|
inlinevirtual |
Pure virtual writaData function.
Must be defined in derived types
Implements regIOobject.
Definition at line 240 of file searchableBox.H.
References notImplemented.