52 if (facei >=
mesh().nInternalFaces())
74 getNeighbourCell(faces_[samplei]),
76 getNeighbourCell(faces_[samplei+1])
82 (cells[0] == cells[2] || cells[0] == cells[3]) ? cells[0]
83 : (cells[1] == cells[2] || cells[1] == cells[3]) ? cells[1]
97 <<
"Could not find mid-point " << p
98 <<
" cell " << cellm <<
endl;
106 for (
label i=0; i<4; i++)
117 <<
"Could not find cell for mid-point" <<
nl 118 <<
" samplei: " << samplei
119 <<
" pts[samplei]: " << operator[](samplei)
120 <<
" face[samplei]: " << faces_[samplei]
121 <<
" pts[samplei+1]: " << operator[](samplei+1)
122 <<
" face[samplei+1]: " << faces_[samplei+1]
123 <<
" cellio: " << cells[0]
124 <<
" cellin: " << cells[1]
125 <<
" celljo: " << cells[2]
126 <<
" celljn: " << cells[3]
143 scalar magVec =
mag(vec);
155 n /=
mag(n) + VSMALL;
165 const scalar smallDist
187 if (dist < smallDist)
189 return myFaces[myFacei];
205 point newPosition = facePt;
218 const scalar trackingCorrectionTol = 1
e-5;
220 if (tetFacei == -1 || tetPtI == -1)
222 newPosition = facePt;
224 label trap(1.0/trackingCorrectionTol + 1);
230 newPosition += trackingCorrectionTol*(cC - facePt);
242 }
while (tetFacei < 0 && iterNo <= trap);
248 <<
"After pushing " << facePt <<
" to " << newPosition
249 <<
" it is still outside face " << facei
251 <<
" of cell " << celli
252 <<
" at " << cC <<
endl 253 <<
"Please change your starting point" 263 const point& samplePt,
266 const scalar smallDist,
273 bool isGoodSample =
false;
278 trackCelli =
mesh().
findCell(samplePt, searchEngine_.decompMode());
287 searchEngine_.decompMode()
297 isGoodSample =
false;
309 else if (
mag(samplePt - bPoint) < smallDist)
312 trackPt = pushIn(bPoint, bFacei);
314 trackCelli = getBoundaryCell(trackFacei);
320 scalar
sign = calcSign(bFacei, samplePt);
327 trackCelli =
mesh().
findCell(trackPt, searchEngine_.decompMode());
334 trackPt = pushIn(bPoint, bFacei);
336 trackCelli = getBoundaryCell(trackFacei);
338 isGoodSample =
false;
345 <<
" samplePt:" << samplePt
346 <<
" bPoint:" << bPoint
347 <<
" bFacei:" << bFacei
348 <<
endl <<
" Calculated first tracking point :" 349 <<
" trackPt:" << trackPt
350 <<
" trackCelli:" << trackCelli
351 <<
" trackFacei:" << trackFacei
352 <<
" isGoodSample:" << isGoodSample
370 cells_.setSize(samplingCells.
size());
371 faces_.setSize(samplingFaces.
size());
372 segments_.setSize(samplingSegments.
size());
373 curveDist_.setSize(samplingCurveDist.
size());
377 (cells_.size() != size())
378 || (faces_.size() != size())
379 || (segments_.size() != size())
380 || (curveDist_.size() != size())
384 <<
"sizes not equal : " 385 <<
" points:" << size()
386 <<
" cells:" << cells_.size()
387 <<
" faces:" << faces_.size()
388 <<
" segments:" << segments_.size()
389 <<
" curveDist:" << curveDist_.size()
393 forAll(samplingPts, sampleI)
395 operator[](sampleI) = samplingPts[sampleI];
397 curveDist_ = samplingCurveDist;
399 cells_ = samplingCells;
400 faces_ = samplingFaces;
401 segments_ = samplingSegments;
417 searchEngine_(searchEngine),
434 searchEngine_(searchEngine),
459 wordConstructorTable::iterator cstrIter =
460 wordConstructorTablePtr_->find(sampleType);
462 if (cstrIter == wordConstructorTablePtr_->end())
465 <<
"Unknown sample type " 466 << sampleType <<
nl <<
nl 467 <<
"Valid sample types : " <<
endl 468 << wordConstructorTablePtr_->sortedToc()
489 os <<
endl <<
"\t(celli)\t(facei)" <<
endl;
493 os <<
'\t' << cells_[sampleI]
494 <<
'\t' << faces_[sampleI]
dimensionedScalar sign(const dimensionedScalar &ds)
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
label findNearFace(const label celli, const point &sample, const scalar smallDist) const
Returns face label (or -1) of face which is close to sample.
const double e
Elementary charge.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label getNeighbourCell(const label) const
Returns the neigbour cell or the owner if face in on the boundary.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~sampledSet()
Destructor.
const cellList & cells() const
bool pointInCell(const point &p, label celli, const cellDecomposition=CELL_TETS) const
Test if point p is in the celli.
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingCurveDist)
Sets sample data.
const Point & missPoint() const
Return miss point.
point pushIn(const point &sample, const label facei) const
Moves sample in direction of -n to it is 'inside' of facei.
points setSize(newPointi)
Ostream & write(Ostream &) const
Output for debugging.
Holds list of sampling positions.
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
A class for handling words, derived from string.
Ostream & write(Ostream &os) const
const Point & hitPoint() const
Return hit point.
virtual const labelList & faceOwner() const
Return face owner.
bool hit() const
Is there a hit.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
label getBoundaryCell(const label) const
Returns cell next to boundary face.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis)
Construct from components.
const vectorField & faceCentres() const
label pointInCell(const point &p, const label samplei) const
Return the cell in which the point on the sample line.
#define WarningInFunction
Report a warning using Foam::Warning.
pointHit nearestPoint(const point &p, const pointField &) const
Return nearest point to face.
A cell is defined as a list of faces with extra functionality.
scalar calcSign(const label facei, const point &sample) const
Calculates inproduct of face normal and vector sample-face centre.
const vectorField & faceAreas() const
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
bool getTrackingPoint(const point &samplePt, const point &bPoint, const label bFacei, const scalar smallDist, point &trackPt, label &trackCelli, label &trackFacei) const
Calculates start of tracking given samplePt and first boundary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
#define InfoInFunction
Report an information message using Foam::Info.