58 <<
"Sizes not equal : "
59 <<
" points:" <<
size()
77 if (facei <
mesh().nInternalFaces())
94 const label
cells[4] =
97 getNeighbourCell(faces_[samplei]),
99 getNeighbourCell(faces_[samplei+1])
113 if (!
mesh().pointInCell(
p, cellm, searchEngine_.decompMode()))
120 <<
"Could not find mid-point " <<
p
121 <<
" cell " << cellm <<
endl;
129 for (label i=0; i<4; ++i)
131 if (
mesh().pointInCell(
p,
cells[i], searchEngine_.decompMode()))
140 <<
"Could not find cell for mid-point" <<
nl
141 <<
" samplei: " << samplei
142 <<
" pts[samplei]: " << operator[](samplei)
143 <<
" face[samplei]: " << faces_[samplei]
144 <<
" pts[samplei+1]: " << operator[](samplei+1)
145 <<
" face[samplei+1]: " << faces_[samplei+1]
146 <<
" cellio: " <<
cells[0]
147 <<
" cellin: " <<
cells[1]
148 <<
" celljo: " <<
cells[2]
149 <<
" celljn: " <<
cells[3]
166 scalar magVec =
mag(vec);
186 const scalar smallDist
199 if (dist < smallDist)
201 return myFaces[myFacei];
217 point newPosition = facePt;
230 const scalar trackingCorrectionTol = 1
e-5;
232 if (tetFacei == -1 || tetPtI == -1)
234 newPosition = facePt;
236 label trap(1.0/trackingCorrectionTol + 1);
242 newPosition += trackingCorrectionTol*(cC - facePt);
254 }
while (tetFacei < 0 && iterNo <= trap);
260 <<
"After pushing " << facePt <<
" to " << newPosition
261 <<
" it is still outside face " << facei
263 <<
" of cell " << celli
264 <<
" at " << cC <<
endl
265 <<
"Please change your starting point"
275 const point& samplePt,
278 const scalar smallDist,
285 bool isGoodSample =
false;
290 trackCelli =
mesh().
findCell(samplePt, searchEngine_.decompMode());
295 || !
mesh().pointInCell
299 searchEngine_.decompMode()
309 isGoodSample =
false;
321 else if (
mag(samplePt - bPoint) < smallDist)
324 trackPt = pushIn(bPoint, bFacei);
326 trackCelli = getBoundaryCell(trackFacei);
332 scalar
sign = calcSign(bFacei, samplePt);
339 trackCelli =
mesh().
findCell(trackPt, searchEngine_.decompMode());
346 trackPt = pushIn(bPoint, bFacei);
348 trackCelli = getBoundaryCell(trackFacei);
350 isGoodSample =
false;
355 <<
" samplePt:" << samplePt
356 <<
" bPoint:" << bPoint
357 <<
" bFacei:" << bFacei <<
nl
358 <<
" Calculated first tracking point :"
359 <<
" trackPt:" << trackPt
360 <<
" trackCelli:" << trackCelli
361 <<
" trackFacei:" << trackFacei
362 <<
" isGoodSample:" << isGoodSample
378 setPoints(samplingPts);
379 setDistance(samplingDistance,
false);
381 segments_ = samplingSegments;
398 setPoints(std::move(samplingPts));
399 setDistance(std::move(samplingDistance),
false);
401 segments_ = std::move(samplingSegments);
402 cells_ = std::move(samplingCells);
403 faces_ = std::move(samplingFaces);
455 searchEngine_(searchEngine),
493 auto* ctorPtr = wordConstructorTable(sampleType);
502 *wordConstructorTablePtr_
513 dict.optionalSubDict(sampleType +
"Coeffs")
523 os <<
nl <<
"\t(celli)\t(facei)" <<
nl;
527 os <<
'\t' << cells_[samplei]
528 <<
'\t' << faces_[samplei]
Minimal example by using system/controlDict.functions:
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const point_type & point() const noexcept
Return the point, no checks.
bool get(const label i) const
label size() const noexcept
vector & operator[](const label i)
scalar dist(const Vector< Cmpt > &v2) const
The L2-norm distance from another vector. The mag() of the difference.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A cell is defined as a list of faces with extra functionality.
Holds list of sampling positions.
scalarList distance_
Cumulative distance for "distance" write specifier.
const word & axis() const
The sort axis name.
Ostream & write(Ostream &os) const
Write to stream.
coordSet(const word &name, const coordFormat axisType)
Default construct with name and axis type.
void setPoints(const List< point > &newPoints)
Copy assign new points.
const word & name() const noexcept
The coord-set name.
void setDistance(const scalarList &dist, const bool check=true)
Copy assign the cumulative distance.
coordFormat
Enumeration defining the output format for coordinates.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
virtual const labelList & faceOwner() const
Return face owner.
void findTetFacePt(const label celli, const point &p, label &tetFacei, label &tetPti) const
Find the tetFacei and tetPti for point p in celli.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
const cellList & cells() const
Holds list of sampling points which is filled at construction time. Various implementations of this b...
labelList faces_
Face numbers (-1 if not known).
const meshSearch & searchEngine() const noexcept
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingDistance)
Set sample data. Copy list contents.
label pointInCell(const point &p, const label samplei) const
Return the cell in which the point on the sample line.
label getNeighbourCell(const label) const
Returns the neighbour cell or the owner if face in on the boundary.
scalar calcSign(const label facei, const point &sample) const
Calculates inproduct of face normal and vector sample-face centre.
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.
labelList segments_
Segment numbers.
labelList cells_
Cell numbers.
Ostream & write(Ostream &) const
Output for debugging.
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const coordSet::coordFormat axisType)
Construct from components.
label getBoundaryCell(const label) const
Returns cell next to boundary face.
void checkDimensions() const
Check for consistent sizing.
point pushIn(const point &sample, const label facei) const
Moves sample in direction of -n to it is 'inside' of facei.
const polyMesh & mesh() const noexcept
const labelList & cells() const noexcept
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
label findNearFace(const label celli, const point &sample, const scalar smallDist) const
Returns face label (or -1) of face which is close to sample.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugInFunction
Report an information message using Foam::Info.
Namespace for handling debugging switches.
PointHit< point > pointHit
A PointHit with a 3D point.
dimensionedScalar sign(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
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)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< scalar > scalarList
List of scalar.
constexpr char nl
The newline '\n' character (0x0a).
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.