46 void Foam::sampledSets::lineFace::calcSamples
51 const label storeFaces,
52 const bool storeCells,
87 for (
label bHitj = bHiti + 1; bHitj < bHits.
size(); ++ bHitj)
90 (bHits[bHiti].hitPoint() + bHits[bHitj].hitPoint())/2;
93 const scalar midT =
mag(midP - start)/
mag(end - start);
126 label nLocateBoundaryHits = 0;
127 forAll(procCandidateCells, proci)
129 forAll(procCandidateCells[proci], candidatei)
131 const label celli = procCandidateCells[proci][candidatei];
133 if (celli == -1)
continue;
135 const scalar t = procCandidateTs[proci][candidatei];
136 const point p = (1 - t)*start + t*end;
146 i == 0 ? endStart : startEnd,
150 halfSegmentPositions,
151 halfSegmentDistances,
174 particles.
move(particles, tdBwd);
182 : i == 0 ? vGreat : -vGreat,
183 [i](
const scalar a,
const scalar
b)
185 return (i == 0) == (a <
b) ? a :
b;
199 samplingPositions.
append(halfSegmentPositions);
201 samplingCells.
append(halfSegmentCells);
202 samplingFaces.
append(halfSegmentFaces);
204 halfSegmentPositions.
clear();
205 halfSegmentDistances.
clear();
206 halfSegmentCells.
clear();
207 halfSegmentFaces.
clear();
232 samplingSegments.
append(segmenti);
233 samplingCells.
append(celli);
241 forAll(procCandidateCells, procj)
243 forAll(procCandidateCells[procj], candidatej)
245 const label cellj = procCandidateCells[procj][candidatej];
247 if (cellj == -1)
continue;
249 const scalar t = procCandidateTs[procj][candidatej];
253 t > segmentT.
first() - rootSmall
254 && t < segmentT.
second() + rootSmall
257 procCandidateCells[procj][candidatej] = -1;
258 procCandidateTs[procj][candidatej] = NaN;
269 samplingDistances.
resize(samplingPositions.
size());
270 forAll(samplingPositions, i)
272 samplingDistances[i] =
mag(samplingPositions[i] - start);
279 bool Foam::sampledSets::lineFace::calcSamples
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
static meshBoundarySearch & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
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.
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
Mesh object that implements searches within the local boundary faces.
List< pointIndexHit > intersections(const point &pStart, const point &pEnd) const
Find all intersections of the boundary with the line.
Mesh object that implements searches within the local cells and faces.
label findCell(const point &p, const pointInCellShapes=pointInCellShapes::tets) const
Find the cell containing the given point.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
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 polyMesh & mesh() const
Access the mesh.
Face-intersections along a line.
lineFace(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
virtual ~lineFace()
Destructor.
Set of sets to sample. Call sampledSets.write() to sample&write files.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
defineTypeNameAndDebug(arcUniform, 0)
addToRunTimeSelectionTable(sampledSet, arcUniform, word)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)