Go to the documentation of this file.
50 for (
label fp = 1; fp <
f.size(); fp++)
65 isTreeFace_.set(faceLabels_[i], 1);
70 bbs_.setSize(faceLabels_.size());
74 bbs_[i] = calcBb(faceLabels_[i]);
90 faceLabels_(faceLabels),
106 faceLabels_(faceLabels),
121 faceLabels_(
identity(mesh_.nFaces())),
141 isTreeFace_(mesh_.nFaces(), 0),
174 cc[i] = mesh_.faceCentres()[faceLabels_[i]];
203 if (info.
index() == -1)
206 <<
"Could not find " << sample <<
" in octree."
216 Pout<<
"getSampleType : sample:" << sample
217 <<
" nearest face:" << faceI;
225 const face&
f = mesh_.faces()[faceI];
226 const vector& area = mesh_.faceAreas()[faceI];
227 const point& fc = mesh_.faceCentres()[faceI];
242 Pout<<
" -> face hit:" << curPt
243 <<
" comparing to face normal " << area <<
endl;
250 Pout<<
" -> face miss:" << curPt;
258 const scalar typDimSqr =
mag(area) + VSMALL;
274 if (isTreeFace_.get(
pFaces[i]) == 1)
277 n /=
mag(
n) + VSMALL;
286 <<
" point normal:" << pointNormal
297 if ((
magSqr(fc - curPt)/typDimSqr) < tolSqr)
304 Pout<<
" -> centre hit:" << fc
305 <<
" distance:" <<
magSqr(fc - curPt)/typDimSqr <<
endl;
317 const labelList& myEdges = mesh_.faceEdges()[faceI];
321 const edge&
e = mesh_.edges()[myEdges[myEdgeI]];
337 const labelList& eFaces = mesh_.edgeFaces()[myEdges[myEdgeI]];
343 if (isTreeFace_.get(eFaces[i]) == 1)
345 vector n = mesh_.faceAreas()[eFaces[i]];
346 n /=
mag(
n) + VSMALL;
355 <<
" comparing to edge normal:" << edgeNormal
392 nLeft /=
mag(nLeft) + VSMALL;
395 nRight /=
mag(nRight) + VSMALL;
399 Pout<<
" -> internal edge hit point:" << edgeHit.
rawPoint()
400 <<
" comparing to edge normal "
401 << 0.5*(nLeft + nRight)
409 0.5*(nLeft + nRight),
417 Pout<<
"Did not find sample " << sample
418 <<
" anywhere related to nearest face " << faceI <<
endl
423 Pout<<
" vertex:" <<
f[fp] <<
" coord:" <<
points[
f[fp]]
454 if (!cubeBb.
overlaps(calcBb(faceLabels_[index])))
464 label faceI = faceLabels_[index];
466 const face&
f = mesh_.faces()[faceI];
474 const point& fc = mesh_.faceCentres()[faceI];
495 void Foam::treeDataFace::findNearestOp::operator()
500 scalar& nearestDistSqr,
509 const label index = indices[i];
516 if (distSqr < nearestDistSqr)
518 nearestDistSqr = distSqr;
526 void Foam::treeDataFace::findNearestOp::operator()
541 bool Foam::treeDataFace::findIntersectOp::operator()
546 point& intersectionPoint
565 const vector dir(end - start);
580 intersectionPoint = inter.
hitPoint();
void update()
Initialise all member data.
label index() const
Return index.
bool hit() const
Is there a hit.
const point & max() const
Maximum describing the bounding box.
virtual const pointField & points() const =0
Return mesh points.
#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...
virtual const faceList & faces() const =0
Return faces.
const bool cacheBb_
Whether to precalculate and store face bounding box.
const Point & rawPoint() const
Return point with no checking.
Standard boundBox + extra functionality for use in octree.
volumeType getVolumeType(const indexedOctree< treeDataFace > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
direction posBits(const point &) const
Position of point relative to bounding box.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static scalar tolSqr
Tolerance on linear dimensions.
const labelList & faceLabels() const
dimensioned< scalar > mag(const dimensioned< Type > &)
treeBoundBoxList bbs_
Face bounding boxes (valid only if cacheBb_)
const primitiveMesh & mesh() const
A simple container for copying or transferring objects of type <T>.
treeBoundBox calcBb(const label cellI) const
Calculate face bounding box.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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]=cellShape(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]
static bool intersectBb(const point &p0, const point &p1, const point &p2, const treeBoundBox &cubeBb)
Does triangle intersect 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...
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.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
A patch is a list of labels that address the faces in the global face list.
Non-pointer based hierarchical recursive searching.
bool containsAny(const UList< point > &) const
Contains any of the points? (inside or on edge)
const polyMesh & mesh() const
Return the mesh reference.
const point & min() const
Minimum describing the bounding box.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const labelList faceLabels_
Subset of faces to work on.
errorManip< error > abort(error &err)
const double e
Elementary charge.
label start() const
Return start label of this patch in the polyMesh face list.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
treeDataFace(const bool cacheBb, const primitiveMesh &, const labelUList &)
Construct from mesh and subset of faces.
pointField shapePoints() const
Get representative point cloud for all shapes inside.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
prefixOSstream Pout(cout, "Pout")
bool overlaps(const label index, const treeBoundBox &sampleBb) const
Does (bb of) shape at index overlap bb.
static volumeType getSide(const vector &outsideNormal, const vector &vec)
Helper function to return the side. Returns outside if.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Encapsulation of data needed to search for faces.
const vectorField & faceCentres() const
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
void findNearest(const label nodeI, const linePointRef &ln, treeBoundBox &tightest, label &nearestShapeI, point &linePoint, point &nearestPoint, const FindNearestOp &fnOp) const
Find nearest point to line.
A face is a list of labels corresponding to mesh vertices.
bool overlaps(const boundBox &) const
Overlaps other bounding box?
const primitiveMesh & mesh_
findNearestOp(const indexedOctree< treeDataFace > &tree)
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const Point & hitPoint() const
Return hit point.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
findIntersectOp(const indexedOctree< treeDataFace > &tree)
Cell-face mesh analysis engine.