Go to the documentation of this file.
56 void Foam::searchableBox::projectOntoCoordPlane
64 info.rawPoint()[dir] = planePt[dir];
67 if (planePt[dir] ==
min()[dir])
71 else if (planePt[dir] ==
max()[dir])
73 info.setIndex(dir*2+1);
78 <<
"Point on plane " << planePt
79 <<
" is not on coordinate " <<
min()[dir]
90 const scalar nearestDistSqr
106 bool outside =
false;
113 if (info.rawPoint()[dir] <
min()[dir])
115 projectOntoCoordPlane(dir,
min(), info);
118 else if (info.rawPoint()[dir] >
max()[dir])
120 projectOntoCoordPlane(dir,
max(), info);
123 else if (info.rawPoint()[dir] > bbMid[dir])
125 near[dir] =
max()[dir];
129 near[dir] =
min()[dir];
140 if (dist.x() < dist.y())
142 if (dist.x() < dist.z())
145 projectOntoCoordPlane(
vector::X, near, info);
149 projectOntoCoordPlane(
vector::Z, near, info);
154 if (dist.y() < dist.z())
156 projectOntoCoordPlane(
vector::Y, near, info);
160 projectOntoCoordPlane(
vector::Z, near, info);
168 if (
magSqr(info.rawPoint() - sample) > nearestDistSqr)
180 Foam::searchableBox::searchableBox
192 <<
"Illegal bounding box specification : "
197 bounds() =
static_cast<boundBox>(*this);
201 Foam::searchableBox::searchableBox
213 <<
"Illegal bounding box specification : "
218 bounds() =
static_cast<boundBox>(*this);
226 if (regions_.empty())
229 regions_[0] =
"region0";
238 auto& ctrs = tctrs.ref();
245 ctrs[i] = fcs[i].centre(pts);
258 centres.setSize(size());
259 radiusSqr.setSize(size());
267 const face&
f = fcs[i];
269 centres[i] =
f.centre(pts);
270 for (
const label pointi :
f)
272 const point& pt = pts[pointi];
296 const scalar nearestDistSqr
299 return findNearest(centre(), sample, nearestDistSqr);
306 const scalar nearestDistSqr
309 const point bbMid(centre());
313 bool outside =
false;
322 projectOntoCoordPlane(dir,
min(), info);
327 projectOntoCoordPlane(dir,
max(), info);
330 else if (info.
rawPoint()[dir] > bbMid[dir])
332 near[dir] =
max()[dir];
336 near[dir] =
min()[dir];
349 sortedDist[0] = dist[0];
350 sortedDist[1] = dist[1];
351 sortedDist[2] = dist[2];
355 projectOntoCoordPlane(sortedDist.
indices()[0], near, info);
357 projectOntoCoordPlane(sortedDist.
indices()[1], near, info);
395 if (posBits(start) == 0)
397 if (posBits(
end) == 0)
405 foundInter = intersects(
end, start, info.
rawPoint());
411 foundInter = intersects(start,
end, info.
rawPoint());
434 if (info.
index() == -1)
438 <<
" on segment " << start <<
end
439 <<
" should be on face of " << *
this
454 return findLine(start,
end);
458 void Foam::searchableBox::findNearest
467 const point bbMid(centre());
471 info[i] = findNearest(bbMid,
samples[i], nearestDistSqr[i]);
487 info[i] = findLine(start[i],
end[i]);
503 info[i] = findLineAny(start[i],
end[i]);
531 +
vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
546 while (((pt-start[pointi])&dirVec[pointi]) <= magSqrDirVec[pointi])
556 || (inter.
index() == hits.last().index())
563 pt = inter.
hitPoint() + smallVec[pointi];
570 info[pointi].
clear();
593 normal.setSize(info.size());
626 if (pt[dir] <
min()[dir] || pt[dir] >
max()[dir])
633 volType[pointi] = vt;
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
label index() const
Return index.
pointIndexHit findLine(const point &start, const point &end) const
Find nearest intersection of line between start and end.
void setIndex(const label index)
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.
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.
bool hit() const
Is there a 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.
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...
const Point & rawPoint() const
Return point with no checking.
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.
const Point & hitPoint() const
Return hit point.
static const faceList faces
Face to point addressing.
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 clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(List< T > &list)
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
scalarField samples(nIntervals, Zero)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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,...
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
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.
A bounding box defined in terms of min/max extrema points.
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.
void setSize(const label newSize)
Alias for resize(const label)
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.