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;
174 Foam::searchableSurfaceWithGaps::searchableSurfaceWithGaps
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();
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
vector point
Point is a vector.
An ordered pair of two objects of type <T> with first() and second() elements.
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 ))
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual ~searchableSurfaceWithGaps()
Destructor.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
const boundBox & bounds() const
Return const reference to boundBox.
Various functions to operate on Lists.
A list of keyword definitions, which are a keyword followed by any number of values (e...
vectorField pointField
pointField is a vectorField.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Number of components in this vector space.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
void clear()
Clear the list, i.e. set size to zero.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
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.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
List< label > labelList
A List of labels.
Vector< scalar > vector
A scalar version of the templated Vector.
const objectRegistry & db() const
Return the local objectRegistry.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)