Go to the documentation of this file.
34 template<
class PatchType>
43 for (
label fp = 1; fp <
f.size(); fp++)
54 template<
class PatchType>
59 bbs_.setSize(patch_.size());
63 bbs_[i] = calcBb(patch_.points(), patch_[i]);
72 template<
class PatchType>
76 const PatchType& patch,
77 const scalar planarTol
88 template<
class PatchType>
98 template<
class PatchType>
108 template<
class PatchType>
116 shapeMask_(shapeMask)
120 template<
class PatchType>
135 template<
class PatchType>
142 cc[i] = patch_[i].centre(patch_.points());
151 template<
class PatchType>
172 if (info.
index() == -1)
175 <<
"Could not find " << sample <<
" in octree."
184 Pout<<
"getSampleType : sample:" << sample
185 <<
" nearest face:" << faceI;
188 const typename PatchType::FaceType& localF = patch_.localFaces()[faceI];
189 const typename PatchType::FaceType&
f = patch_[faceI];
210 Pout<<
" -> face hit:" << curPt
211 <<
" comparing to face normal " << area <<
endl;
222 Pout<<
" -> face miss:" << curPt;
230 const scalar typDimSqr =
mag(area) + VSMALL;
244 patch_.pointNormals()[localF[fp]],
252 if ((
magSqr(fc - curPt)/typDimSqr) < planarTol_)
259 Pout<<
" -> centre hit:" << fc
260 <<
" distance:" <<
magSqr(fc - curPt)/typDimSqr <<
endl;
276 const labelList& fEdges = patch_.faceEdges()[faceI];
280 label edgeI = fEdges[fEdgeI];
281 const edge&
e = patch_.edges()[edgeI];
291 const labelList& eFaces = patch_.edgeFaces()[edgeI];
293 vector edgeNormal(vector::zero);
297 edgeNormal += patch_.faceNormals()[eFaces[i]];
303 <<
" comparing to edge normal:" << edgeNormal
336 nLeft /=
mag(nLeft) + VSMALL;
339 nRight /=
mag(nRight) + VSMALL;
343 Pout<<
" -> internal edge hit point:" << edgeHit.
rawPoint()
344 <<
" comparing to edge normal "
345 << 0.5*(nLeft + nRight)
353 0.5*(nLeft + nRight),
361 Pout<<
"Did not find sample " << sample
362 <<
" anywhere related to nearest face " << faceI <<
endl
367 Pout<<
" vertex:" <<
f[fp]
378 return volumeType::UNKNOWN;
383 template<
class PatchType>
400 if (!cubeBb.
overlaps(calcBb(patch_.points(), patch_[index])))
410 const typename PatchType::FaceType&
f = patch_[index];
423 return triangleFuncs::intersectBb
435 bool triIntersects = triangleFuncs::intersectBb
455 template<
class PatchType>
460 const scalar radiusSqr
466 if (!bbs_[index].overlaps(centre, radiusSqr))
473 if (!calcBb(patch_.points(), patch_[index]).overlaps(centre, radiusSqr))
480 const face&
f = patch_[index];
495 template<
class PatchType>
501 scalar& nearestDistSqr,
507 const PatchType& patch = shape.
patch();
513 const label index = indices[i];
514 const typename PatchType::FaceType&
f = patch[index];
519 if (distSqr < nearestDistSqr)
521 nearestDistSqr = distSqr;
529 template<
class PatchType>
545 template<
class PatchType>
551 point& intersectionPoint
554 return findIntersection(tree_, index, start, end, intersectionPoint);
558 template<
class PatchType>
564 point& intersectionPoint
567 if (!shapeMask_.empty() &&
findIndex(shapeMask_, index) != -1)
572 return findIntersection(tree_, index, start, end, intersectionPoint);
576 template<
class PatchType>
582 point& intersectionPoint
588 <<
"EdgeID not set. Please set edgeID to the index of"
589 <<
" the edge you are testing"
594 const PatchType& patch = shape.
patch();
596 const typename PatchType::FaceType&
f = patch.localFaces()[index];
597 const edge&
e = patch.edges()[edgeID_];
601 return findIntersection(tree_, index, start, end, intersectionPoint);
610 template<
class PatchType>
617 point& intersectionPoint
621 const PatchType& patch = shape.
patch();
624 const typename PatchType::FaceType&
f = patch[index];
638 const vector dir(end - start);
648 ).intersection(start, dir, intersection::HALF_RAY, shape.
planarTol_);
652 const pointField& faceCentres = patch.faceCentres();
654 inter =
f.intersection
660 intersection::HALF_RAY,
669 intersectionPoint = inter.
hitPoint();
static treeBoundBox calcBb(const pointField &, const face &)
Calculate face bounding box.
const dimensionedScalar mp
Proton mass.
label index() const
Return index.
findIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree)
bool hit() const
Is there a hit.
const point & max() const
Maximum describing the bounding box.
const PatchType & patch() const
Return access to the underlying patch.
#define forAll(list, i)
Loop across all elements in list.
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
const Point & rawPoint() const
Return point with no checking.
Standard boundBox + extra functionality for use in octree.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool overlaps(const label index, const treeBoundBox &sampleBb) const
Does shape at index overlap bb.
direction posBits(const point &) const
Position of point relative to bounding box.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
void update()
Initialise all member data.
volumeType getVolumeType(const indexedOctree< treeDataPrimitivePatch< PatchType > > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const bool cacheBb_
Whether to precalculate and store face bounding box.
findAllIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, DynamicList< label > &shapeMask)
scalar distance() const
Return distance to hit.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Non-pointer based hierarchical recursive searching.
bool containsAny(const UList< point > &) const
Contains any of the points? (inside or on edge)
pointField shapePoints() const
Get representative point cloud for all shapes inside.
const point & min() const
Minimum describing the bounding box.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
treeDataPrimitivePatch(const bool cacheBb, const PatchType &, const scalar planarTol)
Construct from patch.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
findNearestOp(const indexedOctree< treeDataPrimitivePatch > &tree)
line< point, const point & > linePointRef
Line using referred points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
prefixOSstream Pout(cout, "Pout")
static bool findIntersection(const indexedOctree< treeDataPrimitivePatch< PatchType > > &tree, const label index, const point &start, const point &end, point &intersectionPoint)
Helper: find intersection of line with shapes.
Encapsulation of data needed to search on PrimitivePatches.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
treeBoundBoxList bbs_
Face bounding boxes (valid only if cacheBb_)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
Elementary charge.
findSelfIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, const label edgeID)
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
const scalar planarTol_
Tolerance to use for intersection tests.
A face is a list of labels corresponding to mesh vertices.
bool overlaps(const boundBox &) const
Overlaps other bounding box?
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const Point & hitPoint() const
Return hit point.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
triangle< point, const point & > triPointRef