46 void Foam::sampledSets::lineFace::calcSamples
70 initialPts.
append(bHits[bHiti].hitPoint());
71 const label facei = bHits[bHiti].index();
72 initialFaces.
append(facei);
74 initialDirections.
append((mesh.
faceAreas()[facei] & (end - start)) < 0);
83 initialCells.
append(startCelli);
84 initialDirections.
append(
true);
91 initialCells.
append(endCelli);
92 initialDirections.
append(
false);
96 label sampleSegmenti = 0;
98 forAll(initialPts, initiali)
101 const scalar
sign = initialDirections[initiali] ? +1 : -1;
108 initialPts[initiali],
109 initialCells[initiali]
111 if (initialFaces[initiali] != -1)
113 sampleParticle.
track(sign*(start - end), 0);
117 <<
"Failed to associate with the starting boundary face" 130 const scalar dist =
mag(pt - (sign > 0 ? start : end));
131 const bool first = segmentPts.
size() == 0;
133 if (sampleParticle.
onFace())
141 sign*(end - start)*(1 - dist/
mag(end - start));
166 forAll(segmentPts, segmentPti)
176 const scalar dot0 = (segmentPts[segmentPti] - l[0]) & dlHat;
177 const scalar dot1 = (l[1] - segmentPts[segmentPti]) & dlHat;
178 if (dot0 > 0 && dot1 > 0)
180 segmentKeep[segmentPti] =
false;
191 bool newSampleSegment =
false;
192 forAll(segmentPts, segmentPti)
194 if (segmentKeep[segmentPti])
196 samplingPts.
append(segmentPts[segmentPti]);
197 samplingCells.
append(segmentCells[segmentPti]);
198 samplingFaces.
append(segmentFaces[segmentPti]);
199 samplingSegments.
append(sampleSegmenti);
200 samplingCurveDist.
append(
mag(segmentPts[segmentPti] - start));
201 newSampleSegment =
true;
203 else if (newSampleSegment)
206 newSampleSegment =
false;
209 if (newSampleSegment)
212 newSampleSegment =
false;
220 void Foam::sampledSets::lineFace::calcSamples
244 void Foam::sampledSets::lineFace::genSamples()
264 samplingSegments.
shrink();
265 samplingCurveDist.
shrink();
289 start_(dict.
lookup(
"start")),
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)
bool onBoundaryFace() const
Is the particle on a boundary face?
A list of keyword definitions, which are a keyword followed by any number of values (e...
#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...
void size(const label)
Override size to be inconsistent with allocated storage.
virtual ~lineFace()
Destructor.
scalar trackToCell(const vector &displacement, const scalar fraction)
As particle::track, but stops when a new cell is reached.
Macros for easy insertion into run-time selection tables.
void inplaceReverseList(ListType &list)
Inplace reversal of a list using Swap.
label cell() const
Return current cell particle is in.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
An ordered pair of two objects of type <T> with first() and second() elements.
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Holds list of sampling points which is filled at construction time. Various implementations of this b...
label face() const
Return current face particle is on otherwise -1.
label findCell(const point &location, const label seedCelli=-1, const bool useTreeSearch=true) const
Find cell containing location.
A class for handling words, derived from string.
virtual const labelList & faceOwner() const
Return face owner.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void reverse(UList< T > &, const label n)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
bool onFace() const
Is the particle on a face?
virtual bool write()
Sample and write.
const vectorField & faceAreas() const
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.
defineTypeNameAndDebug(arcUniform, 0)
scalar track(const vector &displacement, const scalar fraction)
Track along the displacement for a given fraction of the overall.
lineFace(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
vector position() const
Return current particle position.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T & first()
Return reference to the first element of the list.