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;
212 if (tetFacei == -1 || tetPtI == -1)
214 newPosition = facePt;
234 }
while (tetFacei < 0 && iterNo <= trap);
240 <<
"After pushing " << facePt <<
" to " << newPosition
241 <<
" it is still outside face " << facei
243 <<
" of cell " << celli
244 <<
" at " << cC <<
endl 245 <<
"Please change your starting point" 255 const point& samplePt,
258 const scalar smallDist,
265 bool isGoodSample =
false;
270 trackCelli =
mesh().
findCell(samplePt, searchEngine_.decompMode());
279 searchEngine_.decompMode()
289 isGoodSample =
false;
301 else if (
mag(samplePt - bPoint) < smallDist)
304 trackPt = pushIn(bPoint, bFacei);
306 trackCelli = getBoundaryCell(trackFacei);
312 scalar
sign = calcSign(bFacei, samplePt);
319 trackCelli =
mesh().
findCell(trackPt, searchEngine_.decompMode());
326 trackPt = pushIn(bPoint, bFacei);
328 trackCelli = getBoundaryCell(trackFacei);
330 isGoodSample =
false;
337 <<
" samplePt:" << samplePt
338 <<
" bPoint:" << bPoint
339 <<
" bFacei:" << bFacei
340 <<
endl <<
" Calculated first tracking point :" 341 <<
" trackPt:" << trackPt
342 <<
" trackCelli:" << trackCelli
343 <<
" trackFacei:" << trackFacei
344 <<
" isGoodSample:" << isGoodSample
362 cells_.setSize(samplingCells.
size());
363 faces_.setSize(samplingFaces.
size());
364 segments_.setSize(samplingSegments.
size());
365 curveDist_.setSize(samplingCurveDist.
size());
369 (cells_.size() != size())
370 || (faces_.size() != size())
371 || (segments_.size() != size())
372 || (curveDist_.size() != size())
376 <<
"sizes not equal : " 377 <<
" points:" << size()
378 <<
" cells:" << cells_.size()
379 <<
" faces:" << faces_.size()
380 <<
" segments:" << segments_.size()
381 <<
" curveDist:" << curveDist_.size()
385 forAll(samplingPts, sampleI)
387 operator[](sampleI) = samplingPts[sampleI];
389 curveDist_ = samplingCurveDist;
391 cells_ = samplingCells;
392 faces_ = samplingFaces;
393 segments_ = samplingSegments;
409 searchEngine_(searchEngine),
426 searchEngine_(searchEngine),
451 wordConstructorTable::iterator cstrIter =
452 wordConstructorTablePtr_->find(sampleType);
454 if (cstrIter == wordConstructorTablePtr_->end())
457 <<
"Unknown sample type " 458 << sampleType <<
nl <<
nl 459 <<
"Valid sample types : " <<
endl 460 << wordConstructorTablePtr_->sortedToc()
481 os <<
endl <<
"\t(celli)\t(facei)" <<
endl;
485 os <<
'\t' << cells_[sampleI]
486 <<
'\t' << faces_[sampleI]
label getBoundaryCell(const label) const
Returns cell next to boundary face.
dimensionedScalar sign(const dimensionedScalar &ds)
label findNearFace(const label celli, const point &sample, const scalar smallDist) const
Returns face label (or -1) of face which is close to sample.
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.
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
const Point & missPoint() const
Return miss point.
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const vectorField & faceAreas() const
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~sampledSet()
Destructor.
Ostream & write(Ostream &) const
Output for debugging.
const vectorField & faceCentres() const
const cellList & cells() const
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingCurveDist)
Sets sample data.
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.
label pointInCell(const point &p, const label samplei) const
Return the cell in which the point on the sample line.
points setSize(newPointi)
Holds list of sampling positions.
Ostream & write(Ostream &os) const
A class for handling words, derived from string.
point pushIn(const point &sample, const label facei) const
Moves sample in direction of -n to it is 'inside' of facei.
const vectorField & cellCentres() const
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
pointHit nearestPoint(const point &p, const pointField &) const
Return nearest point to face.
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.
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.
virtual const labelList & faceNeighbour() const
Return face neighbour.
#define WarningInFunction
Report a warning using Foam::Warning.
const Point & hitPoint() const
Return hit point.
A cell is defined as a list of faces with extra functionality.
label getNeighbourCell(const label) const
Returns the neigbour cell or the owner if face in on the boundary.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
dimensioned< scalar > mag(const dimensioned< Type > &)
bool hit() const
Is there a hit.
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
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.