76void 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);
208 <<
"Illegal bounding box specification : "
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);
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);
476void 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]);
533 info.setSize(start.
size());
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();
643 if (pt[dir] <
min()[dir] || pt[dir] >
max()[dir])
650 volType[pointi] = vt;
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
Minimal example by using system/controlDict.functions:
Defines the attributes of an object for which implicit objectRegistry management is supported,...
InfoProxy< IOobject > info() const
Return info proxy, for printing information to a stream.
void transfer(List< T > &list)
void setSize(const label n)
Alias for resize()
void resize(const label len)
Adjust allocated size of list.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
void setHit() noexcept
Set the hit status on.
const point_type & rawPoint() const noexcept
The point, no checks. Same as point()
void setIndex(const label index) noexcept
Set the index.
label index() const noexcept
Return the hit index.
void setMiss() noexcept
Set the hit status off.
bool hit() const noexcept
Is there a hit?
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const noexcept
Return the list of sorted indices. Updated every sort.
void sort()
Forward (stable) sort the list (if changed after construction).
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
T & last()
Return the last element of the list.
const point & min() const
Minimum describing the bounding box.
const point & max() const
Maximum describing the bounding box.
static const FixedList< vector, 6 > faceNormals
The unit normal per face.
bool valid() const
True if all internal ids are non-negative.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A face is a list of labels corresponding to mesh vertices.
@ REGEX
Regular expression.
static constexpr direction nComponents
Number of components in bool is 1.
Searching on bounding box.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside) for points.
pointIndexHit findNearestOnEdge(const point &sample, const scalar nearestDistSqr) const
Calculate nearest point on edge.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
pointIndexHit findLine(const point &start, const point &end) const
Find nearest intersection of line between start and end.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
virtual tmp< pointField > points() const
Get the points that define the surface.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual const boundBox & bounds() const
Return const reference to boundBox.
A class for managing temporary objects.
Standard boundBox with extra functionality for use in octree.
static const faceList faces
Face to point addressing.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
An enumeration wrapper for classification of a location as being inside/outside of a volume.
@ OUTSIDE
A location outside the volume.
@ INSIDE
A location inside the volume.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
static void readBoxDim(const dictionary &dict, treeBoundBox &bb)
vector point
Point is a vector.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
scalarField samples(nIntervals, Zero)