62 "sampledSet::getCell(const label, const point&)" 63 ) <<
"Illegal face label " << faceI
67 if (faceI >=
mesh().nInternalFaces())
69 label cellI = getBoundaryCell(faceI);
71 if (!
mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
75 "sampledSet::getCell(const label, const point&)" 76 ) <<
"Found cell " << cellI <<
" using face " << faceI
77 <<
". But cell does not contain point " << sample
88 if (
mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
96 if (
mesh().pointInCell(sample, cellI, searchEngine_.decompMode()))
104 "sampledSet::getCell(const label, const point&)" 105 ) <<
"None of the neighbours of face " 106 << faceI <<
" contains point " << sample
124 scalar magVec =
mag(vec);
136 n /=
mag(n) + VSMALL;
147 const scalar smallDist
169 if (dist < smallDist)
171 return myFaces[myFaceI];
189 point newPosition = facePt;
196 if (tetFaceI == -1 || tetPtI == -1)
198 newPosition = facePt;
218 }
while (tetFaceI < 0 && iterNo <= trap);
225 "sampledSet::pushIn(const point&, const label)" 226 ) <<
"After pushing " << facePt <<
" to " << newPosition
227 <<
" it is still outside face " << faceI
229 <<
" of cell " << cellI
230 <<
" at " << cC <<
endl 231 <<
"Please change your starting point" 248 const point& samplePt,
257 const scalar smallDist =
mag(tol*offset);
259 bool isGoodSample =
false;
264 trackCellI =
mesh().
findCell(samplePt, searchEngine_.decompMode());
273 searchEngine_.decompMode()
286 isGoodSample =
false;
302 else if (
mag(samplePt - bPoint) < smallDist)
309 trackPt = pushIn(bPoint, bFaceI);
311 trackCellI = getBoundaryCell(trackFaceI);
317 scalar
sign = calcSign(bFaceI, samplePt);
324 trackCellI =
mesh().
findCell(trackPt, searchEngine_.decompMode());
331 trackPt = pushIn(bPoint, bFaceI);
333 trackCellI = getBoundaryCell(trackFaceI);
335 isGoodSample =
false;
341 Info<<
"sampledSet::getTrackingPoint :" 342 <<
" offset:" << offset
343 <<
" samplePt:" << samplePt
344 <<
" bPoint:" << bPoint
345 <<
" bFaceI:" << bFaceI
346 <<
endl <<
" Calculated first tracking point :" 347 <<
" trackPt:" << trackPt
348 <<
" trackCellI:" << trackCellI
349 <<
" trackFaceI:" << trackFaceI
350 <<
" isGoodSample:" << isGoodSample
368 cells_.setSize(samplingCells.
size());
369 faces_.setSize(samplingFaces.
size());
370 segments_.setSize(samplingSegments.
size());
371 curveDist_.setSize(samplingCurveDist.
size());
375 (cells_.size() != size())
376 || (faces_.size() != size())
377 || (segments_.size() != size())
378 || (curveDist_.size() != size())
382 <<
"sizes not equal : " 383 <<
" points:" << size()
384 <<
" cells:" << cells_.size()
385 <<
" faces:" << faces_.size()
386 <<
" segments:" << segments_.size()
387 <<
" curveDist:" << curveDist_.size()
391 forAll(samplingPts, sampleI)
393 operator[](sampleI) = samplingPts[sampleI];
395 curveDist_ = samplingCurveDist;
397 cells_ = samplingCells;
398 faces_ = samplingFaces;
399 segments_ = samplingSegments;
415 searchEngine_(searchEngine),
432 searchEngine_(searchEngine),
457 wordConstructorTable::iterator cstrIter =
458 wordConstructorTablePtr_->find(sampleType);
460 if (cstrIter == wordConstructorTablePtr_->end())
465 "(const word&, const polyMesh&, const meshSearch&" 466 ", const dictionary&)" 467 ) <<
"Unknown sample type " 468 << sampleType <<
nl <<
nl 469 <<
"Valid sample types : " <<
endl 470 << wordConstructorTablePtr_->sortedToc()
491 os <<
endl <<
"\t(cellI)\t(faceI)" <<
endl;
495 os <<
'\t' << cells_[sampleI]
496 <<
'\t' << faces_[sampleI]
const vectorField & faceAreas() const
virtual ~sampledSet()
Destructor.
const pointField & points
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
dimensioned< scalar > mag(const dimensioned< Type > &)
label getCell(const label faceI, const point &sample) const
Returns cell using face and containing sample.
Holds list of sampling positions.
word name(const complex &)
Return a string representation of a complex.
A cell is defined as a list of faces with extra functionality.
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
const Point & missPoint() const
Return miss point.
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 Point & hitPoint() const
Return hit point.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const scalar tol
Tolerance when comparing points. Usually relative to difference.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const cellList & cells() const
dimensionedScalar sign(const dimensionedScalar &ds)
const vectorField & cellCentres() const
point pushIn(const point &sample, const label faceI) const
Moves sample in direction of -n to it is 'inside' of faceI.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
label getBoundaryCell(const label) const
Returns cell next to boundary face.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
errorManip< error > abort(error &err)
virtual const labelList & faceOwner() const
Return face owner.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
points setSize(newPointi)
Ostream & write(Ostream &os) const
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
pointHit nearestPoint(const point &p, const pointField &) const
Return nearest point to face.
bool hit() const
Is there a hit.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual const faceList & faces() const
Return raw faces.
Ostream & write(Ostream &) const
Output for debugging.
virtual const labelList & faceNeighbour() const
Return face neighbour.
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis)
Construct from components.
bool pointInCell(const point &p, label celli, const cellDecomposition=CELL_TETS) const
Test if point p is in the celli.
scalar calcSign(const label faceI, const point &sample) const
Calculates inproduct of face normal and vector sample-face centre.
bool getTrackingPoint(const vector &offset, const point &samplePt, const point &bPoint, const label bFaceI, point &trackPt, label &trackCellI, label &trackFaceI) const
Calculates start of tracking given samplePt and first boundary.
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingCurveDist)
Sets sample data.
defineTypeNameAndDebug(combustionModel, 0)
const vectorField & faceCentres() const