62 scalar minMag = great;
67 if (
mag(
n[cmpt]) < minMag)
69 minMag =
mag(
n[cmpt]);
74 offsets[0][minCmpt] = 1.0;
76 offsets[0] -=
n[minCmpt]*
n;
77 offsets[0] /=
mag(offsets[0]);
79 offsets[1] =
n ^ offsets[0];
90 void Foam::searchableSurfaceWithGaps::offsetVecs
98 offset0.setSize(start.size());
99 offset1.setSize(start.size());
103 const Pair<vector> offsets(offsetVecs(start[i], end[i]));
104 offset0[i] = offsets[0];
105 offset1[i] = offsets[1];
110 Foam::label Foam::searchableSurfaceWithGaps::countMisses
112 const List<pointIndexHit>& info,
125 missMap.setSize(nMiss);
132 missMap[nMiss++] = i;
141 Foam::label Foam::searchableSurfaceWithGaps::countMisses
143 const List<pointIndexHit>& plusInfo,
144 const List<pointIndexHit>& minInfo,
151 if (!plusInfo[i].hit() || !minInfo[i].hit())
157 missMap.setSize(nMiss);
162 if (!plusInfo[i].hit() || !minInfo[i].hit())
164 missMap[nMiss++] = i;
184 const word subGeomName(
dict.lookup(
"surface"));
191 bounds() = subGeom_[0].bounds();
214 surface().findLine(start, end, info);
218 label nMiss = countMisses(info, compactMap);
245 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
250 compactStart+offset0-smallVec,
251 compactEnd+offset0+smallVec,
257 compactStart-offset0-smallVec,
258 compactEnd-offset0+smallVec,
265 if (plusInfo[i].hit() && minInfo[i].hit())
267 info[compactMap[i]] = plusInfo[i];
268 info[compactMap[i]].rawPoint() -= offset0[i];
273 nMiss = countMisses(plusInfo, minInfo, plusMissMap);
286 label mapI = plusMissMap[i];
287 compactStart[i] = compactStart[mapI];
288 compactEnd[i] = compactEnd[mapI];
289 compactMap[i] = compactMap[mapI];
290 offset0[i] = offset0[mapI];
291 offset1[i] = offset1[mapI];
299 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
303 compactStart+offset1-smallVec,
304 compactEnd+offset1+smallVec,
309 compactStart-offset1-smallVec,
310 compactEnd-offset1+smallVec,
317 if (plusInfo[i].hit() && minInfo[i].hit())
319 info[compactMap[i]] = plusInfo[i];
320 info[compactMap[i]].rawPoint() -= offset1[i];
336 findLine(start, end, info);
349 findLine(start, end, nearestInfo);
351 info.setSize(start.
size());
354 if (nearestInfo[pointi].hit())
356 info[pointi].setSize(1);
357 info[pointi][0] = nearestInfo[pointi];
361 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 <T> with first() and second() elements.
static const direction nComponents
Number of components in this vector space.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
searchableSurface using multiple slightly shifted underlying surfaces to make sure pierces don't go t...
virtual ~searchableSurfaceWithGaps()
Destructor.
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.
searchableSurfaceWithGaps(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.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
const boundBox & bounds() const
Return const reference to boundBox.
A class for handling words, derived from string.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
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)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)