Go to the documentation of this file.
37 template<
class PatchType>
42 bbs_.setSize(patch_.size());
46 bbs_[i] = treeBoundBox(patch_.points(), patch_[i]);
54 template<
class PatchType>
58 const PatchType&
patch,
59 const scalar planarTol
70 template<
class PatchType>
80 template<
class PatchType>
90 template<
class PatchType>
102 template<
class PatchType>
117 template<
class PatchType>
124 cc[i] = patch_[i].centre(patch_.points());
131 template<
class PatchType>
152 if (info.
index() == -1)
155 <<
"Could not find " << sample <<
" in octree."
160 label facei = info.
index();
164 Pout<<
"getSampleType : sample:" << sample
165 <<
" nearest face:" << facei;
168 const typename PatchType::face_type& localF = patch_.localFaces()[facei];
169 const typename PatchType::face_type&
f = patch_[facei];
190 Pout<<
" -> face hit:" << curPt
191 <<
" comparing to face normal " <<
area <<
endl;
202 Pout<<
" -> face miss:" << curPt;
210 const scalar typDimSqr =
mag(
area) + VSMALL;
224 patch_.pointNormals()[localF[fp]],
232 if ((
magSqr(fc - curPt)/typDimSqr) < planarTol_)
239 Pout<<
" -> centre hit:" << fc
240 <<
" distance:" <<
magSqr(fc - curPt)/typDimSqr <<
endl;
256 const labelList& fEdges = patch_.faceEdges()[facei];
260 label edgeI = fEdges[fEdgeI];
261 const edge&
e = patch_.edges()[edgeI];
265 if ((
magSqr(edgeHit.rawPoint() - curPt)/typDimSqr) < planarTol_)
271 const labelList& eFaces = patch_.edgeFaces()[edgeI];
277 edgeNormal += patch_.faceNormals()[eFaces[i]];
282 Pout<<
" -> real edge hit point:" << edgeHit.rawPoint()
283 <<
" comparing to edge normal:" << edgeNormal
320 Pout<<
" -> internal edge hit point:" << edgeHit.
rawPoint()
321 <<
" comparing to edge normal "
322 << 0.5*(nLeft + nRight)
330 0.5*(nLeft + nRight),
338 Pout<<
"Did not find sample " << sample
339 <<
" anywhere related to nearest face " << facei <<
endl
344 Pout<<
" vertex:" <<
f[fp]
355 return volumeType::UNKNOWN;
360 template<
class PatchType>
382 const typename PatchType::face_type&
f = patch_[index];
395 return triangleFuncs::intersectBb
407 bool triIntersects = triangleFuncs::intersectBb
427 template<
class PatchType>
432 const scalar radiusSqr
439 ? !bbs_[index].overlaps(centre, radiusSqr)
440 : !
treeBoundBox(patch_.points(),patch_[index]).overlaps(centre, radiusSqr)
447 const face&
f = patch_[index];
462 template<
class PatchType>
468 scalar& nearestDistSqr,
478 for (
const label index : indices)
480 const typename PatchType::face_type&
f =
patch[index];
485 if (distSqr < nearestDistSqr)
487 nearestDistSqr = distSqr;
495 template<
class PatchType>
511 template<
class PatchType>
517 point& intersectionPoint
520 return findIntersection(tree_, index, start,
end, intersectionPoint);
524 template<
class PatchType>
530 point& intersectionPoint
533 if (shapeMask_.found(index))
538 return findIntersection(tree_, index, start,
end, intersectionPoint);
542 template<
class PatchType>
548 point& intersectionPoint
554 <<
"EdgeID not set. Please set edgeID to the index of"
555 <<
" the edge you are testing"
562 const typename PatchType::face_type&
f =
patch.localFaces()[index];
565 if (!
f.found(
e[0]) && !
f.found(
e[1]))
567 return findIntersection(tree_, index, start,
end, intersectionPoint);
574 template<
class PatchType>
581 point& intersectionPoint
588 const typename PatchType::face_type&
f =
patch[index];
612 ).intersection(start, dir, intersection::HALF_RAY, shape.planarTol_);
618 inter =
f.intersection
624 intersection::HALF_RAY,
633 intersectionPoint = inter.
hitPoint();
int debug
Static debugging option.
volumeType getVolumeType(const indexedOctree< treeDataPrimitivePatch< PatchType >> &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
bool overlaps(const boundBox &bb) const
Overlaps other 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 PatchType & patch() const
Return access to the underlying patch.
static constexpr const zero Zero
Global zero (0)
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.
bool containsAny(const UList< point > &points) const
Contains any of the points? (inside or on edge)
const Point & rawPoint() const
Return point with no checking.
Standard boundBox with 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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
direction posBits(const point &pt) const
Position of point relative to bounding box.
#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...
findAllIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, DynamicList< label > &shapeMask)
scalar distance() const
Return distance to hit.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
Non-pointer based hierarchical recursive searching.
pointField shapePoints() const
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
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.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
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)
const std::string patch
OpenFOAM patch number as a std::string.
Encapsulation of data needed to search on PrimitivePatches.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
findSelfIntersectOp(const indexedOctree< treeDataPrimitivePatch > &tree, const label edgeID)
const wordList area
Standard area field types (scalar, vector, tensor, etc)
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
A face is a list of labels corresponding to mesh vertices.
const Point & hitPoint() const
Return hit point.
triangle< point, const point & > triPointRef