46template<
class ElementIds>
51 const ElementIds& elemIds
63 return treeBoundBox(edges[edgei].box(points));
72template<
class ElementIds>
77 const ElementIds& elemIds
82 for (
const label edgei : elemIds)
84 const edge&
e = edges[edgei];
111 [&](
const edge&
e) { return treeBoundBox(e.box(points)); }
151 for (
const edge&
e : edges)
165 const labelRange&
range
186void Foam::treeDataEdge::update()
249 edgeLabels_(edgeLabels),
267 edgeLabels_(std::move(edgeLabels)),
283 for (
const label index : indices)
285 const edge&
e = edges_[edgeLabels_[index]];
287 bb.
add(points_[
e.first()], points_[
e.second()]);
299 tmp<pointField> tpts;
307 edgeLabels_.cbegin(),
310 [&](label edgei) { return edges_[edgei].centre(points_); }
322 [&](
const edge&
e) { return e.centre(points_); }
332 const indexedOctree<treeDataEdge>& oc,
347 return searchBox.intersects(this->
line(index), intersect);
355 const scalar radiusSqr
387 scalar& nearestDistSqr,
392 for (
const label index : indices)
398 if (distSqr < nearestDistSqr)
400 nearestDistSqr = distSqr;
402 nearestPoint = nearHit.
point();
408void Foam::treeDataEdge::findNearestOp::operator()
413 scalar& nearestDistSqr,
418 tree_.shapes().findNearest
429void Foam::treeDataEdge::findNearestOp::operator()
445 scalar nearestDistSqr = linePoint.distSqr(nearestPoint);
447 for (
const label index : indices)
455 const scalar distSqr =
sqr(dist);
457 if (distSqr < nearestDistSqr)
459 nearestDistSqr = distSqr;
462 nearestPoint = ePoint;
471bool Foam::treeDataEdge::findIntersectOp::operator()
Minimal example by using system/controlDict.functions:
scalar distance() const noexcept
Return distance to hit.
const point_type & point() const noexcept
Return the point, no checks.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
void size(const label n)
Older name for setAddressableSize.
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
void add(const boundBox &bb)
Extend to include the second box.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Non-pointer based hierarchical recursive searching.
A range or interval of labels defined by a start and a size.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Standard boundBox with extra functionality for use in octree.
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,.
findIntersectOp(const indexedOctree< treeDataEdge > &tree)
findNearestOp(const indexedOctree< treeDataEdge > &tree)
Holds data for octree to work on an edges subset.
point centre(const label index) const
Representative point (edge centre) at shape index.
static treeBoundBoxList boxes(const edgeList &edges, const pointField &points)
Calculate and return bounding boxes for all edges.
tmp< pointField > centres() const
Representative point cloud for contained shapes. One point per shape, corresponding to the edge centr...
treeDataEdge(const bool cacheBb, const edgeList &edges, const pointField &points)
Construct from all edges.
static treeBoundBox bounds(const edgeList &edges, const pointField &points)
Return bounding box of all edges.
void findNearest(const labelUList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const
Calculates nearest (to sample) point in shape.
const labelList & edgeLabels() const noexcept
The subset of edge ids to use.
const edgeList & edges() const noexcept
The original list of edges.
const linePointRef line(const label index) const
Geometric line for edge at specified shape index. Frequently used.
const pointField & points() const noexcept
The reference point field.
volumeType getVolumeType(const indexedOctree< treeDataEdge > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
bool overlaps(const label index, const treeBoundBox &searchBox) const
Does (bb of) shape at index searchBox.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
#define defineTypeName(Type)
Define the typeName.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
List< edge > edgeList
List of edge.
PointHit< point > pointHit
A PointHit with a 3D point.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static treeBoundBox boundsImpl(const primitiveMesh &mesh, const ElementIds &elemIds)
List< treeBoundBox > treeBoundBoxList
A List of treeBoundBox.
static treeBoundBoxList boxesImpl(const primitiveMesh &mesh, const ElementIds &elemIds)
line< point, const point & > linePointRef
A line using referred points.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
vector point
Point is a vector.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Tree tree(triangles.begin(), triangles.end())