Go to the documentation of this file.
76 void Foam::searchableBox::projectOntoCoordPlane
84 info.rawPoint()[dir] = planePt[dir];
87 if (planePt[dir] ==
min()[dir])
91 else if (planePt[dir] ==
max()[dir])
93 info.setIndex(dir*2+1);
98 <<
"Point on plane " << planePt
99 <<
" is not on coordinate " <<
min()[dir]
100 <<
" nor " <<
max()[dir] <<
nl
111 const scalar nearestDistSqr
127 bool outside =
false;
134 if (info.rawPoint()[dir] <
min()[dir])
136 projectOntoCoordPlane(dir,
min(), info);
139 else if (info.rawPoint()[dir] >
max()[dir])
141 projectOntoCoordPlane(dir,
max(), info);
144 else if (info.rawPoint()[dir] > bbMid[dir])
146 near[dir] =
max()[dir];
150 near[dir] =
min()[dir];
163 if (dist.x() < dist.y())
165 if (dist.x() < dist.z())
172 if (dist.y() < dist.z())
178 projectOntoCoordPlane(projNorm, near, info);
196 Foam::searchableBox::searchableBox
208 <<
"Illegal bounding box specification : "
217 Foam::searchableBox::searchableBox
231 <<
"Illegal bounding box specification : "
244 if (regions_.empty())
247 regions_[0] =
"region0";
256 auto& ctrs = tctrs.ref();
263 ctrs[i] = fcs[i].centre(pts);
276 centres.setSize(size());
277 radiusSqr.setSize(size());
285 const face&
f = fcs[i];
287 centres[i] =
f.centre(pts);
288 for (
const label pointi :
f)
290 const point& pt = pts[pointi];
314 const scalar nearestDistSqr
317 return findNearest(centre(),
sample, nearestDistSqr);
324 const scalar nearestDistSqr
327 const point bbMid(centre());
331 bool outside =
false;
340 projectOntoCoordPlane(dir,
min(), info);
345 projectOntoCoordPlane(dir,
max(), info);
348 else if (info.
rawPoint()[dir] > bbMid[dir])
350 near[dir] =
max()[dir];
354 near[dir] =
min()[dir];
367 sortedDist[0] = dist[0];
368 sortedDist[1] = dist[1];
369 sortedDist[2] = dist[2];
373 projectOntoCoordPlane(sortedDist.
indices()[0], near, info);
375 projectOntoCoordPlane(sortedDist.
indices()[1], near, info);
413 if (posBits(start) == 0)
415 if (posBits(
end) == 0)
423 foundInter = intersects(
end, start, info.
rawPoint());
429 foundInter = intersects(start,
end, info.
rawPoint());
452 if (info.
index() == -1)
456 <<
" on segment " << start <<
end
457 <<
" should be on face of " << *
this
472 return findLine(start,
end);
476 void Foam::searchableBox::findNearest
485 const point bbMid(centre());
489 info[i] = findNearest(bbMid,
samples[i], nearestDistSqr[i]);
505 info[i] = findLine(start[i],
end[i]);
521 info[i] = findLineAny(start[i],
end[i]);
563 while (((pt-start[pointi])&dirVec[pointi]) <= magSqrDirVec[pointi])
573 || (inter.
index() == hits.last().index())
580 pt = inter.
hitPoint() + smallVec[pointi];
587 info[pointi].
clear();
610 normal.setSize(info.size());
643 if (pt[dir] <
min()[dir] || pt[dir] >
max()[dir])
650 volType[pointi] = vt;
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
pointIndexHit findLine(const point &start, const point &end) const
Find nearest intersection of line between start and end.
static Vector< scalar > uniform(const scalar &s)
Return a VectorSpace with all elements = s.
void setIndex(const label index) noexcept
Set the index.
void resize(const label len)
Adjust allocated size of list.
void sort()
Forward (stable) sort the list (if changed after construction).
tmp< pointField > points() const
Vertex coordinates. In octant coding.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
Standard boundBox with extra functionality for use in octree.
void setMiss() noexcept
Set the hit status off.
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
const point & max() const
Maximum describing the bounding box.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
InfoProxy< IOobject > info() const
Return info proxy.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const point & min() const
Minimum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool hit() const noexcept
Is there a hit?
pointIndexHit findNearestOnEdge(const point &sample, const scalar nearestDistSqr) const
Calculate nearest point on edge.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
static const faceList faces
Face to point addressing.
void setSize(const label n)
Alias for resize()
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
void transfer(List< T > &list)
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
scalarField samples(nIntervals, Zero)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static void readBoxDim(const dictionary &dict, treeBoundBox &bb)
virtual tmp< pointField > points() const
Get the points that define the surface.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const point_type & rawPoint() const noexcept
The point, no checks. Same as point()
A list that is sorted upon construction or when explicitly requested with the sort() method.
Macros for easy insertion into run-time selection tables.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside) for points.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
label index() const noexcept
Return the hit index.
void setHit() noexcept
Set the hit status on.
virtual const wordList & regions() const
Names of regions.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
void clear()
Clear the list, i.e. set size to zero.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
A location inside the volume.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
static const FixedList< vector, 6 > faceNormals
The unit normal per face.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
A face is a list of labels corresponding to mesh vertices.
vector point
Point is a vector.
bool valid() const
Bounding box is non-inverted.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
defineTypeNameAndDebug(combustionModel, 0)
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
static constexpr direction nComponents
Number of components in this vector space.
A location outside the volume.
Minimal example by using system/controlDict.functions: