Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
meshSearch Class Reference

Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search. More...

Inheritance diagram for meshSearch:
Inheritance graph
[legend]
Collaboration diagram for meshSearch:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("meshSearch")
 
 meshSearch (const polyMesh &mesh, const polyMesh::cellDecomposition=polyMesh::CELL_TETS)
 Construct from components. Constructs bb slightly bigger than. More...
 
 meshSearch (const polyMesh &mesh, const treeBoundBox &bb, const polyMesh::cellDecomposition=polyMesh::CELL_TETS)
 Construct with a custom bounding box. Any mesh element outside. More...
 
 ~meshSearch ()
 Destructor. More...
 
const polyMeshmesh () const
 
polyMesh::cellDecomposition decompMode () const
 
const indexedOctree< treeDataFace > & boundaryTree () const
 Get (demand driven) reference to octree holding all. More...
 
const indexedOctree< treeDataCell > & cellTree () const
 Get (demand driven) reference to octree holding all cells. More...
 
label findNearestCell (const point &location, const label seedCellI=-1, const bool useTreeSearch=true) const
 Find nearest cell in terms of cell centre. More...
 
label findNearestFace (const point &location, const label seedFaceI=-1, const bool useTreeSearch=true) const
 
label findCell (const point &location, const label seedCellI=-1, const bool useTreeSearch=true) const
 Find cell containing location. More...
 
label findNearestBoundaryFace (const point &location, const label seedFaceI=-1, const bool useTreeSearch=true) const
 Find nearest boundary face. More...
 
pointIndexHit intersection (const point &pStart, const point &pEnd) const
 Find first intersection of boundary in segment [pStart, pEnd]. More...
 
List< pointIndexHitintersections (const point &pStart, const point &pEnd) const
 Find all intersections of boundary within segment pStart .. pEnd. More...
 
bool isInside (const point &) const
 Determine inside/outside status. More...
 
void clearOut ()
 Delete all storage. More...
 
void correct ()
 Correct for mesh geom/topo changes. More...
 

Static Public Attributes

static scalar tol_ = 1e-3
 Tolerance on linear dimensions. More...
 

Private Member Functions

label findNearestCellTree (const point &) const
 Nearest cell centre using octree. More...
 
label findNearestCellLinear (const point &) const
 Nearest cell centre going through all cells. More...
 
label findNearestCellWalk (const point &, const label) const
 Walk from seed. Does not 'go around' boundary, just returns. More...
 
label findCellLinear (const point &) const
 Cell containing location. Linear search. More...
 
label findCellWalk (const point &, const label) const
 Walk from seed. Does not 'go around' boundary, just returns. More...
 
label findNearestFaceTree (const point &) const
 
label findNearestFaceLinear (const point &) const
 
label findNearestFaceWalk (const point &, const label) const
 
label findNearestBoundaryFaceWalk (const point &location, const label seedFaceI) const
 Walk from seed to find nearest boundary face. Gets stuck in. More...
 
vector offset (const point &bPoint, const label bFaceI, const vector &dir) const
 Calculate offset vector in direction dir with as length a. More...
 
 meshSearch (const meshSearch &)
 Disallow default bitwise copy construct. More...
 
void operator= (const meshSearch &)
 Disallow default bitwise assignment. More...
 

Static Private Member Functions

static bool findNearer (const point &sample, const pointField &points, label &nearestI, scalar &nearestDistSqr)
 Updates nearestI, nearestDistSqr from any closer ones. More...
 
static bool findNearer (const point &sample, const pointField &points, const labelList &indices, label &nearestI, scalar &nearestDistSqr)
 Updates nearestI, nearestDistSqr from any selected closer ones. More...
 

Private Attributes

const polyMeshmesh_
 Reference to mesh. More...
 
const polyMesh::cellDecomposition cellDecompMode_
 Whether to use cell decomposition for all geometric tests. More...
 
autoPtr< treeBoundBoxoverallBbPtr_
 Data bounding box. More...
 
autoPtr< indexedOctree< treeDataFace > > boundaryTreePtr_
 Demand driven octrees. More...
 
autoPtr< indexedOctree< treeDataCell > > cellTreePtr_
 

Detailed Description

Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.

Source files

Definition at line 57 of file meshSearch.H.

Constructor & Destructor Documentation

◆ meshSearch() [1/3]

meshSearch ( const meshSearch )
private

Disallow default bitwise copy construct.

◆ meshSearch() [2/3]

meshSearch ( const polyMesh mesh,
const polyMesh::cellDecomposition  cellDecompMode = polyMesh::CELL_TETS 
)

Construct from components. Constructs bb slightly bigger than.

mesh points bb.

Definition at line 497 of file meshSearch.C.

References polyMesh::CELL_TETS, polyMesh::FACE_DIAG_TRIS, mesh, and polyMesh::tetBasePtIs().

Here is the call graph for this function:

◆ meshSearch() [3/3]

meshSearch ( const polyMesh mesh,
const treeBoundBox bb,
const polyMesh::cellDecomposition  cellDecompMode = polyMesh::CELL_TETS 
)

Construct with a custom bounding box. Any mesh element outside.

bb will not be found. Up to user to make sure bb extends slightly beyond wanted elements.

Definition at line 519 of file meshSearch.C.

References polyMesh::CELL_TETS, polyMesh::FACE_DIAG_TRIS, mesh, and polyMesh::tetBasePtIs().

Here is the call graph for this function:

◆ ~meshSearch()

~meshSearch ( )

Destructor.

Definition at line 544 of file meshSearch.C.

Member Function Documentation

◆ findNearer() [1/2]

bool findNearer ( const point sample,
const pointField points,
label nearestI,
scalar &  nearestDistSqr 
)
staticprivate

Updates nearestI, nearestDistSqr from any closer ones.

Definition at line 47 of file meshSearch.C.

References forAll, Foam::magSqr(), and points.

Here is the call graph for this function:

◆ findNearer() [2/2]

bool findNearer ( const point sample,
const pointField points,
const labelList indices,
label nearestI,
scalar &  nearestDistSqr 
)
staticprivate

Updates nearestI, nearestDistSqr from any selected closer ones.

Definition at line 73 of file meshSearch.C.

References forAll, Foam::magSqr(), and points.

Here is the call graph for this function:

◆ findNearestCellTree()

Foam::label findNearestCellTree ( const point location) const
private

Nearest cell centre using octree.

Definition at line 102 of file meshSearch.C.

References indexedOctree::bb(), meshSearch::cellTree(), indexedOctree::findNearest(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), Foam::magSqr(), boundBox::max(), boundBox::min(), and Foam::sqr().

Here is the call graph for this function:

◆ findNearestCellLinear()

Foam::label findNearestCellLinear ( const point location) const
private

Nearest cell centre going through all cells.

Definition at line 121 of file meshSearch.C.

References Foam::magSqr().

Here is the call graph for this function:

◆ findNearestCellWalk()

Foam::label findNearestCellWalk ( const point location,
const label  seedCellI 
) const
private

Walk from seed. Does not 'go around' boundary, just returns.

last cell before boundary.

Definition at line 142 of file meshSearch.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::magSqr().

Here is the call graph for this function:

◆ findCellLinear()

Foam::label findCellLinear ( const point location) const
private

Cell containing location. Linear search.

Definition at line 295 of file meshSearch.C.

References n.

◆ findCellWalk()

Foam::label findCellWalk ( const point location,
const label  seedCellI 
) const
private

Walk from seed. Does not 'go around' boundary, just returns.

last cell before boundary.

Definition at line 327 of file meshSearch.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::magSqr().

Here is the call graph for this function:

◆ findNearestFaceTree()

Foam::label findNearestFaceTree ( const point location) const
private

◆ findNearestFaceLinear()

Foam::label findNearestFaceLinear ( const point location) const
private

Definition at line 218 of file meshSearch.C.

References Foam::magSqr().

Here is the call graph for this function:

◆ findNearestFaceWalk()

Foam::label findNearestFaceWalk ( const point location,
const label  seedFaceI 
) const
private

Definition at line 239 of file meshSearch.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::magSqr().

Here is the call graph for this function:

◆ findNearestBoundaryFaceWalk()

Foam::label findNearestBoundaryFaceWalk ( const point location,
const label  seedFaceI 
) const
private

Walk from seed to find nearest boundary face. Gets stuck in.

local minimum.

Definition at line 398 of file meshSearch.C.

References PointHit::distance(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, and forAll.

Here is the call graph for this function:

◆ offset()

Foam::vector offset ( const point bPoint,
const label  bFaceI,
const vector dir 
) const
private

Calculate offset vector in direction dir with as length a.

fraction of the cell size (of the cell straddling boundary face)

Definition at line 476 of file meshSearch.C.

References Foam::constant::universal::c, and Foam::mag().

Here is the call graph for this function:

◆ operator=()

void operator= ( const meshSearch )
private

Disallow default bitwise assignment.

◆ ClassName()

ClassName ( "meshSearch"  )

◆ mesh()

const polyMesh& mesh ( ) const
inline

Definition at line 194 of file meshSearch.H.

References meshSearch::mesh_.

◆ decompMode()

polyMesh::cellDecomposition decompMode ( ) const
inline

Definition at line 199 of file meshSearch.H.

References meshSearch::cellDecompMode_.

Referenced by sampledTriSurfaceMesh::update().

Here is the caller graph for this function:

◆ boundaryTree()

const Foam::indexedOctree< Foam::treeDataFace > & boundaryTree ( ) const

Get (demand driven) reference to octree holding all.

boundary faces

Definition at line 552 of file meshSearch.C.

References Foam::e, treeBoundBox::extend(), forAll, boundBox::max(), boundBox::min(), and rndGen().

Here is the call graph for this function:

◆ cellTree()

const Foam::indexedOctree< Foam::treeDataCell > & cellTree ( ) const

Get (demand driven) reference to octree holding all cells.

Definition at line 605 of file meshSearch.C.

References Foam::e, treeBoundBox::extend(), boundBox::max(), boundBox::min(), and rndGen().

Referenced by meshSearch::findNearestCellTree(), and sampledTriSurfaceMesh::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findNearestCell()

Foam::label findNearestCell ( const point location,
const label  seedCellI = -1,
const bool  useTreeSearch = true 
) const

Find nearest cell in terms of cell centre.

Options:

  • use octree
  • use linear search
  • if seed is provided walk. (uses findNearestCellWalk; does not handle holes in domain)

Definition at line 738 of file meshSearch.C.

◆ findNearestFace()

Foam::label findNearestFace ( const point location,
const label  seedFaceI = -1,
const bool  useTreeSearch = true 
) const

Definition at line 763 of file meshSearch.C.

Referenced by mappedPatchBase::findSamples().

Here is the caller graph for this function:

◆ findCell()

Foam::label findCell ( const point location,
const label  seedCellI = -1,
const bool  useTreeSearch = true 
) const

Find cell containing location.

If seed provided walks and falls back to linear/tree search. (so handles holes correctly)s Returns -1 if not in domain.

Definition at line 788 of file meshSearch.C.

Referenced by cloudSet::calcSamples(), arraySet::calcSamples(), surfaceToCell::combine(), and cellClassification::markCells().

Here is the caller graph for this function:

◆ findNearestBoundaryFace()

Foam::label findNearestBoundaryFace ( const point location,
const label  seedFaceI = -1,
const bool  useTreeSearch = true 
) const

Find nearest boundary face.

If seed provided walks but then does not pass local minima in distance. Also does not jump from one connected region to the next.

Definition at line 814 of file meshSearch.C.

References indexedOctree::bb(), PointHit::distance(), f(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), Foam::magSqr(), boundBox::max(), boundBox::min(), indexedOctree::shapes(), and Foam::sqr().

Here is the call graph for this function:

◆ intersection()

Foam::pointIndexHit intersection ( const point pStart,
const point pEnd 
) const

Find first intersection of boundary in segment [pStart, pEnd].

(so inclusive of endpoints). Always octree for now

Definition at line 882 of file meshSearch.C.

References PointIndexHit< Point >::hit(), PointIndexHit< Point >::index(), and PointIndexHit< Point >::setIndex().

Here is the call graph for this function:

◆ intersections()

Foam::List< Foam::pointIndexHit > intersections ( const point pStart,
const point pEnd 
) const

Find all intersections of boundary within segment pStart .. pEnd.

Always octree for now

Definition at line 899 of file meshSearch.C.

References DynamicList::append(), PointIndexHit< Point >::hit(), PointIndexHit< Point >::hitPoint(), PointIndexHit< Point >::index(), Foam::mag(), DynamicList::shrink(), and Foam::sqrt().

Here is the call graph for this function:

◆ isInside()

bool isInside ( const point p) const

Determine inside/outside status.

Definition at line 946 of file meshSearch.C.

References volumeType::INSIDE, and p.

◆ clearOut()

void clearOut ( )

Delete all storage.

Definition at line 953 of file meshSearch.C.

◆ correct()

void correct ( )

Correct for mesh geom/topo changes.

Definition at line 961 of file meshSearch.C.

Field Documentation

◆ mesh_

const polyMesh& mesh_
private

Reference to mesh.

Definition at line 62 of file meshSearch.H.

Referenced by meshSearch::mesh().

◆ cellDecompMode_

const polyMesh::cellDecomposition cellDecompMode_
private

Whether to use cell decomposition for all geometric tests.

Definition at line 65 of file meshSearch.H.

Referenced by meshSearch::decompMode().

◆ overallBbPtr_

autoPtr<treeBoundBox> overallBbPtr_
mutableprivate

Data bounding box.

Definition at line 68 of file meshSearch.H.

◆ boundaryTreePtr_

autoPtr<indexedOctree<treeDataFace> > boundaryTreePtr_
mutableprivate

Demand driven octrees.

Definition at line 71 of file meshSearch.H.

◆ cellTreePtr_

autoPtr<indexedOctree<treeDataCell> > cellTreePtr_
mutableprivate

Definition at line 72 of file meshSearch.H.

◆ tol_

scalar tol_ = 1e-3
static

Tolerance on linear dimensions.

Definition at line 163 of file meshSearch.H.


The documentation for this class was generated from the following files: