39 scalar treeDataFace::tolSqr =
sqr(1
e-6);
47 return treeBoundBox(mesh_.
points(), mesh_.
faces()[facei]);
51void Foam::treeDataFace::update()
53 isTreeFace_.set(faceLabels_);
57 bbs_.setSize(faceLabels_.size());
61 bbs_[i] = calcBb(faceLabels_[i]);
77 faceLabels_(faceLabels),
93 faceLabels_(std::move(faceLabels)),
124 isTreeFace_(mesh_.
nFaces(), false),
184 if (info.
index() == -1)
187 <<
"Could not find " <<
sample <<
" in octree."
193 label facei = faceLabels_[info.
index()];
198 <<
" nearest face:" << facei;
223 Pout<<
" -> face hit:" << curPt
224 <<
" comparing to face normal " << area <<
endl;
231 Pout<<
" -> face miss:" << curPt;
239 const scalar typDimSqr =
mag(area) + VSMALL;
253 for (
const label facei :
pFaces)
255 if (isTreeFace_.
test(facei))
264 <<
" point normal:" << pointNormal
275 if ((
magSqr(fc - curPt)/typDimSqr) < tolSqr)
282 Pout<<
" -> centre hit:" << fc
283 <<
" distance:" <<
magSqr(fc - curPt)/typDimSqr <<
endl;
299 const edge&
e = mesh_.
edges()[myEdges[myEdgeI]];
319 for (
const label facei : eFaces)
321 if (isTreeFace_.
test(facei))
330 <<
" comparing to edge normal:" << edgeNormal
371 Pout<<
" -> internal edge hit point:" << edgeHit.
rawPoint()
372 <<
" comparing to edge normal "
373 << 0.5*(nLeft + nRight)
381 0.5*(nLeft + nRight),
390 <<
" anywhere related to nearest face " << facei <<
endl
395 Pout<<
" vertex:" <<
f[fp] <<
" coord:" <<
points[
f[fp]]
426 if (!cubeBb.
overlaps(calcBb(faceLabels_[index])))
436 label facei = faceLabels_[index];
473 scalar& nearestDistSqr,
480 for (
const label index : indices)
487 if (distSqr < nearestDistSqr)
489 nearestDistSqr = distSqr;
517 point& intersectionPoint
534 const label facei = shape.faceLabels_[index];
536 const vector dir(end - start);
551 intersectionPoint = inter.
hitPoint();
Minimal example by using system/controlDict.functions:
int overlaps
Flag to control which overlap calculations are performed.
Describes the interaction of a face and a point. It carries the info of a successful hit and (if succ...
const point_type & rawPoint() const noexcept
The point, no checks.
scalar distance() const noexcept
Return distance to hit.
bool hit() const noexcept
Is there a hit.
const point_type & hitPoint() const
Return the hit point. Fatal if not hit.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const noexcept
Return the hit index.
iterator end() noexcept
Return an iterator to end traversing the UList.
label rcIndex(const label i) const noexcept
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
bool containsAny(const UList< point > &points) const
Contains any of the points? (inside or on edge)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
A face is a list of labels corresponding to mesh vertices.
Non-pointer based hierarchical recursive searching.
static volumeType getSide(const vector &outsideNormal, const vector &vec)
Helper function to return the side. Returns outside if.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
A patch is a list of labels that address the faces in the global face list.
Cell-face mesh analysis engine.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
virtual const faceList & faces() const =0
Return faces.
const labelListList & pointFaces() const
const labelListList & edgeFaces() const
const labelListList & faceEdges() const
const vectorField & faceAreas() const
virtual const pointField & points() const =0
Return mesh points.
Standard boundBox with extra functionality for use in octree.
bool overlaps(const boundBox &bb) const
Overlaps other bounding box?
direction posBits(const point &pt) const
Position of point relative to bounding box.
Encapsulation of data needed to search for faces.
const labelList & faceLabels() const
volumeType getVolumeType(const indexedOctree< treeDataFace > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
const primitiveMesh & mesh() const
pointField shapePoints() const
static bool intersectBb(const point &p0, const point &p1, const point &p2, const treeBoundBox &cubeBb)
Intersect triangle with bounding box.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.