48 void Foam::sampledSets::lineFace::calcSamples
54 const label storeFaces,
55 const bool storeCells,
85 for (
label bHitj = bHiti + 1; bHitj < bHits.
size(); ++ bHitj)
88 (bHits[bHiti].hitPoint() + bHits[bHitj].hitPoint())/2;
91 const scalar midT =
mag(midP - start)/
mag(end - start);
124 forAll(procCandidateCells, proci)
126 forAll(procCandidateCells[proci], candidatei)
128 const label celli = procCandidateCells[proci][candidatei];
130 if (celli == -1)
continue;
132 const scalar t = procCandidateTs[proci][candidatei];
133 const point p = (1 - t)*start + t*end;
143 i == 0 ? endStart : startEnd,
147 halfSegmentPositions,
148 halfSegmentDistances,
170 particles.
move(particles, tdBwd);
178 : i == 0 ? vGreat : -vGreat,
179 [i](
const scalar a,
const scalar
b)
181 return (i == 0) == (a <
b) ? a :
b;
195 samplingPositions.
append(halfSegmentPositions);
197 samplingCells.
append(halfSegmentCells);
198 samplingFaces.
append(halfSegmentFaces);
200 halfSegmentPositions.
clear();
201 halfSegmentDistances.
clear();
202 halfSegmentCells.
clear();
203 halfSegmentFaces.
clear();
210 trackBwd.trackToFace(
mesh, start -
p, 0);
212 if (trackBwd.onFace() && trackFwd.
onFace())
217 trackBwd.position(
mesh)
221 samplingSegments.
append(segmenti);
222 samplingCells.
append(celli);
230 forAll(procCandidateCells, procj)
232 forAll(procCandidateCells[procj], candidatej)
234 const label cellj = procCandidateCells[procj][candidatej];
236 if (cellj == -1)
continue;
238 const scalar t = procCandidateTs[procj][candidatej];
242 t > segmentT.
first() - rootSmall
243 && t < segmentT.
second() + rootSmall
246 procCandidateCells[procj][candidatej] = -1;
247 procCandidateTs[procj][candidatej] =
NaN;
258 samplingDistances.
resize(samplingPositions.
size());
259 forAll(samplingPositions, i)
261 samplingDistances[i] =
mag(samplingPositions[i] - start);
268 void Foam::sampledSets::lineFace::calcSamples
294 void Foam::sampledSets::lineFace::genSamples()
311 samplingPositions.
shrink();
312 samplingDistances.
shrink();
313 samplingSegments.
shrink();
339 start_(
dict.lookup(
"start")),
340 end_(
dict.lookup(
"end"))
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
label size() const
Return the number of particles in the cloud.
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
void move(TrackCloudType &cloud, typename ParticleType::trackingData &td)
Move the particles.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void resize(const label)
Alter the addressed list size.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
void clear()
Clear the addressed list, i.e. set the size to zero.
Template class for intrusive linked lists.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
const Type & second() const
Return second.
const Type & first() const
Return first.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
T * first()
Return the first entry.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A list of keyword definitions, which are a keyword followed by any number of values (e....
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of boundary within segment pStart .. pEnd.
label findCell(const point &location, const label seedCelli=-1, const bool useTreeSearch=true) const
Find cell containing location.
scalar trackToFace(const polyMesh &mesh, const vector &displacement, const scalar fraction)
As particle::track, but stops when a face is hit.
bool onFace() const
Is the particle on a face?
vector position(const polyMesh &mesh) const
Return current particle position.
Mesh consisting of general polyhedral cells.
A Cloud of sampledSet particles.
Particle for generating line-type sampled sets.
Holds list of sampling points which is filled at construction time. Various implementations of this b...
const meshSearch & searchEngine() const
Access the search engine.
const polyMesh & mesh() const
Access the mesh.
Face-intersections along a line.
virtual ~lineFace()
Destructor.
lineFace(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Construct from dictionary.
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
defineTypeNameAndDebug(arcUniform, 0)
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void reverse(UList< T > &, const label n)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.