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 label nLocateBoundaryHits = 0;
125 forAll(procCandidateCells, proci)
127 forAll(procCandidateCells[proci], candidatei)
129 const label celli = procCandidateCells[proci][candidatei];
131 if (celli == -1)
continue;
133 const scalar t = procCandidateTs[proci][candidatei];
134 const point p = (1 - t)*start + t*end;
144 i == 0 ? endStart : startEnd,
148 halfSegmentPositions,
149 halfSegmentDistances,
172 particles.
move(particles, tdBwd);
180 : i == 0 ? vGreat : -vGreat,
181 [i](
const scalar a,
const scalar
b)
183 return (i == 0) == (a <
b) ? a :
b;
197 samplingPositions.
append(halfSegmentPositions);
199 samplingCells.
append(halfSegmentCells);
200 samplingFaces.
append(halfSegmentFaces);
202 halfSegmentPositions.
clear();
203 halfSegmentDistances.
clear();
204 halfSegmentCells.
clear();
205 halfSegmentFaces.
clear();
224 samplingSegments.
append(segmenti);
225 samplingCells.
append(celli);
233 forAll(procCandidateCells, procj)
235 forAll(procCandidateCells[procj], candidatej)
237 const label cellj = procCandidateCells[procj][candidatej];
239 if (cellj == -1)
continue;
241 const scalar t = procCandidateTs[procj][candidatej];
245 t > segmentT.
first() - rootSmall
246 && t < segmentT.
second() + rootSmall
249 procCandidateCells[procj][candidatej] = -1;
250 procCandidateTs[procj][candidatej] = NaN;
261 samplingDistances.
resize(samplingPositions.
size());
262 forAll(samplingPositions, i)
264 samplingDistances[i] =
mag(samplingPositions[i] - start);
271 void Foam::sampledSets::lineFace::calcSamples
297 void Foam::sampledSets::lineFace::genSamples()
314 samplingPositions.
shrink();
315 samplingDistances.
shrink();
316 samplingSegments.
shrink();
342 start_(
dict.lookup(
"start")),
343 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.
word name(const bool)
Return a word representation of a bool.
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 > &)