35 namespace searchableSurfaces
51 searchableSurfaceWithGaps,
52 "searchableSurfaceWithGaps"
78 scalar minMag = great;
83 if (
mag(
n[cmpt]) < minMag)
85 minMag =
mag(
n[cmpt]);
90 offsets[0][minCmpt] = 1.0;
92 offsets[0] -=
n[minCmpt]*
n;
93 offsets[0] /=
mag(offsets[0]);
95 offsets[1] =
n ^ offsets[0];
106 void Foam::searchableSurfaces::withGaps::offsetVecs
114 offset0.setSize(start.size());
115 offset1.setSize(start.size());
119 const Pair<vector> offsets(offsetVecs(start[i], end[i]));
120 offset0[i] = offsets[0];
121 offset1[i] = offsets[1];
126 Foam::label Foam::searchableSurfaces::withGaps::countMisses
128 const List<pointIndexHit>& info,
141 missMap.setSize(nMiss);
148 missMap[nMiss++] = i;
157 Foam::label Foam::searchableSurfaces::withGaps::countMisses
159 const List<pointIndexHit>& plusInfo,
160 const List<pointIndexHit>& minInfo,
167 if (!plusInfo[i].hit() || !minInfo[i].hit())
173 missMap.setSize(nMiss);
178 if (!plusInfo[i].hit() || !minInfo[i].hit())
180 missMap[nMiss++] = i;
200 const word subGeomName(
dict.lookup(
"surface"));
207 bounds() = subGeom_[0].bounds();
230 surface().findLine(start, end, info);
234 label nMiss = countMisses(info, compactMap);
261 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
266 compactStart+offset0-smallVec,
267 compactEnd+offset0+smallVec,
273 compactStart-offset0-smallVec,
274 compactEnd-offset0+smallVec,
281 if (plusInfo[i].hit() && minInfo[i].hit())
283 info[compactMap[i]] = plusInfo[i];
284 info[compactMap[i]].rawPoint() -= offset0[i];
289 nMiss = countMisses(plusInfo, minInfo, plusMissMap);
302 label mapI = plusMissMap[i];
303 compactStart[i] = compactStart[mapI];
304 compactEnd[i] = compactEnd[mapI];
305 compactMap[i] = compactMap[mapI];
306 offset0[i] = offset0[mapI];
307 offset1[i] = offset1[mapI];
315 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
319 compactStart+offset1-smallVec,
320 compactEnd+offset1+smallVec,
325 compactStart-offset1-smallVec,
326 compactEnd-offset1+smallVec,
333 if (plusInfo[i].hit() && minInfo[i].hit())
335 info[compactMap[i]] = plusInfo[i];
336 info[compactMap[i]].rawPoint() -= offset1[i];
352 findLine(start, end, info);
365 findLine(start, end, nearestInfo);
367 info.setSize(start.
size());
370 if (nearestInfo[pointi].hit())
372 info[pointi].setSize(1);
373 info[pointi][0] = nearestInfo[pointi];
377 info[pointi].
clear();
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const objectRegistry & db() const
Return the local objectRegistry.
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.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
An ordered pair of two objects of type <Type> with first() and second() elements.
static const direction nComponents
Number of components in this vector space.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
const boundBox & bounds() const
Return const reference to boundBox.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual ~withGaps()
Destructor.
withGaps(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
A class for handling words, derived from string.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
addToRunTimeSelectionTable(searchableSurface, box, dictionary)
defineTypeNameAndDebug(box, 0)
addBackwardCompatibleToRunTimeSelectionTable(searchableSurface, box, dictionary, searchableBox, "searchableBox")
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.
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Vector< scalar > vector
A scalar version of the templated Vector.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)