47 template<
class ElementIds>
51 const ElementIds& elemIds
121 for (
const label celli : cellIds)
128 for (
const label celli : cellIds)
141 Foam::treeDataCell::getBounds(
const label index)
const 143 return treeBoundBox(mesh_.cellBb(objectIndex(index)));
147 void Foam::treeDataCell::update()
168 const polyMesh&
mesh,
176 decompMode_(decompMode)
191 cellLabels_(cellLabels),
194 decompMode_(decompMode)
209 cellLabels_(
std::move(cellLabels)),
212 decompMode_(decompMode)
227 if (mesh_.hasCellPoints())
229 for (
const label index : indices)
231 const label celli = cellLabels_[index];
233 bb.
add(mesh_.points(), mesh_.cellPoints(celli));
238 for (
const label index : indices)
240 const label celli = cellLabels_[index];
242 bb.
add(mesh_.cells()[celli].box(mesh_));
260 return mesh_.cellCentres();
267 const treeBoundBox& searchBox
273 ? searchBox.overlaps(bbs_[index])
274 : searchBox.overlaps(getBounds(index))
285 return mesh_.pointInCell(sample, objectIndex(index), decompMode_);
314 scalar& nearestDistSqr,
319 for (
const label index : indices)
321 const point& pt = centre(index);
323 const scalar distSqr = sample.distSqr(pt);
325 if (distSqr < nearestDistSqr)
327 nearestDistSqr = distSqr;
335 void Foam::treeDataCell::findNearestOp::operator()
340 scalar& nearestDistSqr,
345 tree_.shapes().findNearest
356 void Foam::treeDataCell::findNearestOp::operator()
371 bool Foam::treeDataCell::findIntersectOp::operator()
376 point& intersectionPoint
394 const treeBoundBox cellBb = shape.getBounds(index);
396 if ((cellBb.posBits(start) & cellBb.posBits(
end)) != 0)
411 scalar minDistSqr =
magSqr(dir);
416 for (
const label facei : shape.
mesh().
cells()[celli])
428 if (inter.hit() &&
sqr(inter.distance()) <= minDistSqr)
433 minDistSqr =
sqr(inter.distance());
434 intersectionPoint = inter.point();
tmp< pointField > centres() const
Representative point cloud for contained shapes. One point per shape, corresponding to the cell centr...
Cell-face mesh analysis engine.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A range or interval of labels defined by a start and a size.
const polyMesh & mesh() const noexcept
Reference to the supporting mesh.
const cellList & cells() const
bool overlaps(const label index, const treeBoundBox &searchBox) const
Does (bb of) shape at index overlap searchBox.
static treeBoundBoxList boxes(const primitiveMesh &mesh)
Calculate and return bounding boxes for all mesh cells.
cellDecomposition
Enumeration defining the decomposition of the cell for.
static treeBoundBoxList boxesImpl(const primitiveMesh &mesh, const ElementIds &elemIds)
UList< label > labelUList
A UList of labels.
virtual const pointField & points() const
Return raw points.
direction posBits(const point &pt) const
Position of point relative to bounding box.
static scalar setPlanarTol(const scalar t)
Set the planar tolerance, returning the previous value.
defineTypeName(manifoldCellsMeshObject)
void add(const boundBox &bb)
Extend to include the second box.
findIntersectOp(const indexedOctree< treeDataCell > &tree)
Tree tree(triangles.begin(), triangles.end())
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
static treeBoundBox bounds(const primitiveMesh &mesh, const labelUList &cellIds)
Return bounding box of specified mesh cells.
virtual const faceList & faces() const
Return raw faces.
void findNearest(const labelUList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const
Calculates nearest (to sample) point in shape.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
bool hasCellPoints() const noexcept
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Encapsulation of data needed to search in/for cells. Used to find the cell containing a point (e...
treeDataCell(const bool cacheBb, const polyMesh &mesh, polyMesh::cellDecomposition decompMode)
Construct from mesh, using all cells in mesh.
findNearestOp(const indexedOctree< treeDataCell > &tree)
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
label objectIndex(const label index) const
Map from shape index to original (non-subset) cell label.
label nCells() const noexcept
Number of mesh cells.
Standard boundBox with extra functionality for use in octree.
Mesh consisting of general polyhedral cells.
A class for managing temporary objects.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
const labelListList & cellPoints() const
bool contains(const label index, const point &sample) const
Does shape at index contain sample.
PointHit< point > pointHit
A PointHit with a 3D point.