97 cellTree().findNearest
105 info = cellTree().findNearest(
p,
Foam::sqr(great));
120 label nearestCelli = -1;
121 scalar nearestDistSqr = vGreat;
123 forAll(cellCentres, celli)
125 const scalar distSqr =
magSqr(cellCentres[celli] -
p);
127 if (distSqr < nearestDistSqr)
129 nearestCelli = celli;
130 nearestDistSqr = distSqr;
144 const label celli = findNearestCell(
p);
145 if (celli < 0)
return -1;
149 label nearestFacei = -1;
150 scalar nearestDistSqr = vGreat;
157 const label facei = cFaces[cFacei];
159 const scalar distSqr =
magSqr(faceCentres[facei] -
p);
161 if (distSqr < nearestDistSqr)
163 nearestFacei = facei;
164 nearestDistSqr = distSqr;
190 const label celli = findNearestCellNoTree(
mesh,
p);
191 if (celli < 0)
return -1;
#define forAll(list, i)
Loop across all elements in list.
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const
Return index.
bool hit() const
Is there a hit.
A cell is defined as a list of faces with extra functionality.
Mesh object to hold a bound box for use by mesh search engines.
Mesh object that implements searches within the local cells and faces.
label findNearestCell(const point &p) const
Find the cell with centre closest to the given point.
label findCell(const point &p, const pointInCellShapes=pointInCellShapes::tets) const
Find the cell containing the given point.
label findNearestFace(const point &p) const
Find the face with centre closest to the given point.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
meshSearch(const polyMesh &mesh)
Construct from mesh.
virtual ~meshSearch()
Destructor.
static label findNearestCellNoTree(const polyMesh &mesh, const point &p)
Find the cell with centre closest to the given point. Do a.
static label findCellNoTree(const polyMesh &mesh, const point &p, const pointInCellShapes=pointInCellShapes::tets)
Find the cell containing the given point. Do a.
Mesh consisting of general polyhedral cells.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
const cellList & cells() const
Encapsulation of data needed to search in/for cells. Used to find the cell containing a point (e....
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const cellShapeList & cellShapes
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
pointInCellShapes
Enumeration for the sub-shapes used to perform the inside calculation.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
bool pointInCell(const point &p, const polyMesh &mesh, const label celli, const pointInCellShapes=pointInCellShapes::tets)
Test if a point is in a given cell.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)