68 scalar minMag = GREAT;
73 if (
mag(
n[cmpt]) < minMag)
75 minMag =
mag(
n[cmpt]);
80 offsets[0][minCmpt] = 1.0;
82 offsets[0] -=
n[minCmpt]*
n;
83 offsets[0] /=
mag(offsets[0]);
85 offsets[1] =
n ^ offsets[0];
96void Foam::searchableSurfaceWithGaps::offsetVecs
104 offset0.setSize(start.size());
105 offset1.setSize(start.size());
109 const Pair<vector> offsets(offsetVecs(start[i], end[i]));
110 offset0[i] = offsets[0];
111 offset1[i] = offsets[1];
116Foam::label Foam::searchableSurfaceWithGaps::countMisses
131 missMap.setSize(nMiss);
138 missMap[nMiss++] = i;
147Foam::label Foam::searchableSurfaceWithGaps::countMisses
157 if (!plusInfo[i].hit() || !minInfo[i].hit())
163 missMap.setSize(nMiss);
168 if (!plusInfo[i].hit() || !minInfo[i].hit())
170 missMap[nMiss++] = i;
180Foam::searchableSurfaceWithGaps::searchableSurfaceWithGaps
187 gap_(
dict.get<scalar>(
"gap")),
198 bounds() = subGeom_[0].bounds();
215 surface().findLine(start, end, info);
219 label nMiss = countMisses(info, compactMap);
246 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
251 compactStart+offset0-smallVec,
252 compactEnd+offset0+smallVec,
258 compactStart-offset0-smallVec,
259 compactEnd-offset0+smallVec,
266 if (plusInfo[i].hit() && minInfo[i].hit())
268 info[compactMap[i]] = plusInfo[i];
269 info[compactMap[i]].point() -= offset0[i];
274 nMiss = countMisses(plusInfo, minInfo, plusMissMap);
287 label mapI = plusMissMap[i];
288 compactStart[i] = compactStart[mapI];
289 compactEnd[i] = compactEnd[mapI];
290 compactMap[i] = compactMap[mapI];
291 offset0[i] = offset0[mapI];
292 offset1[i] = offset1[mapI];
300 const vectorField smallVec(1
e-6*(compactEnd-compactStart));
304 compactStart+offset1-smallVec,
305 compactEnd+offset1+smallVec,
310 compactStart-offset1-smallVec,
311 compactEnd-offset1+smallVec,
318 if (plusInfo[i].hit() && minInfo[i].hit())
320 info[compactMap[i]] = plusInfo[i];
321 info[compactMap[i]].point() -= offset1[i];
350 findLine(start, end, nearestInfo);
352 info.setSize(start.
size());
355 if (nearestInfo[pointi].hit())
357 info[pointi].setSize(1);
358 info[pointi][0] = nearestInfo[pointi];
362 info[pointi].clear();
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
An ordered pair of two objects of type <T> with first() and second() elements.
void size(const label n)
Older name for setAddressableSize.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
static constexpr direction nComponents
Number of components in this vector space.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
searchableSurface using multiple slightly shifted underlying surfaces to make sure pierces don't go t...
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order 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.
const searchableSurface & surface() const
The underlying searchableSurface.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual const boundBox & bounds() const
Return const reference to boundBox.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
vectorField pointField
pointField is a vectorField.
#define forAll(list, i)
Loop across all elements in list.