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;
181 gap_(dict.
lookup<scalar>(
"gap")),
184 const word subGeomName(dict.
lookup(
"surface"));
189 subGeom_.set(0, &const_cast<searchableSurface&>(s));
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);
354 if (nearestInfo[pointi].hit())
357 info[pointi][0] = nearestInfo[pointi];
361 info[pointi].
clear();
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
searchableSurfaceWithGaps(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
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.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
Vector< scalar > vector
A scalar version of the templated Vector.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
Various functions to operate on Lists.
static const direction nComponents
Number of components in this vector space.
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.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
An ordered pair of two objects of type <T> with first() and second() elements.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
List< label > labelList
A List of labels.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
virtual ~searchableSurfaceWithGaps()
Destructor.
void setSize(const label)
Reset size of List.
vector point
Point is a vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const boundBox & bounds() const
Return const reference to boundBox.
const doubleScalar e
Elementary charge.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
const objectRegistry & db() const
Return the local objectRegistry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.