50 <<
"Span should have two positive and one zero entry. Now:"
53 else if (span[dir] < vSmall)
71 <<
"Span should have two positive and one zero entry. Now:"
83 const scalar nearestDistSqr
96 info.rawPoint()[normalDir_] = origin_[normalDir_];
101 if (dir != normalDir_)
103 if (info.rawPoint()[dir] < origin_[dir])
105 info.rawPoint()[dir] = origin_[dir];
107 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
109 info.rawPoint()[dir] = origin_[dir]+span_[dir];
116 if (
magSqr(info.rawPoint() - sample) > nearestDistSqr)
139 const vector dir(end-start);
141 if (
mag(dir[normalDir_]) < vSmall)
148 scalar t = (origin_[normalDir_]-start[normalDir_]) / dir[normalDir_];
157 info.rawPoint() = start+t*dir;
158 info.rawPoint()[normalDir_] = origin_[normalDir_];
163 if (dir != normalDir_)
165 if (info.rawPoint()[dir] < origin_[dir])
171 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
185 treeBoundBox bb(origin_, origin_+span_);
186 bb.min()[normalDir_] -= 1
e-6;
187 bb.max()[normalDir_] += 1
e-6;
189 if (!bb.contains(info.hitPoint()))
192 <<
"bb:" << bb <<
endl
193 <<
"origin_:" << origin_ <<
endl
194 <<
"span_:" << span_ <<
endl
195 <<
"normalDir_:" << normalDir_ <<
endl
196 <<
"hitPoint:" << info.hitPoint()
207 Foam::searchablePlate::searchablePlate
217 normalDir_(calcNormal(span_))
222 <<
" origin:" << origin_
223 <<
" origin+span:" << origin_+span_
232 Foam::searchablePlate::searchablePlate
241 normalDir_(calcNormal(span_))
246 <<
" origin:" << origin_
247 <<
" origin+span:" << origin_+span_
266 if (regions_.empty())
269 regions_[0] =
"region0";
288 centres[0] = origin_ + 0.5*span_;
304 pts[2] = origin_ + span_;
306 if (span_.x() < span_.y() && span_.x() < span_.z())
308 pts[1] = origin_ +
point(0, span_.y(), 0);
309 pts[3] = origin_ +
point(0, 0, span_.z());
311 else if (span_.y() < span_.z())
313 pts[1] = origin_ +
point(span_.x(), 0, 0);
314 pts[3] = origin_ +
point(0, 0, span_.z());
318 pts[1] = origin_ +
point(span_.x(), 0, 0);
319 pts[3] = origin_ +
point(0, span_.y(), 0);
330 (origin_.x() + span_.x()) >= bb.
min().
x()
331 && origin_.x() <= bb.
max().
x()
332 && (origin_.y() + span_.y()) >= bb.
min().
y()
333 && origin_.y() <= bb.
max().
y()
334 && (origin_.z() + span_.z()) >= bb.
min().
z()
335 && origin_.z() <= bb.
max().
z()
340 void Foam::searchablePlate::findNearest
351 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
356 void Foam::searchablePlate::findLine
367 info[i] = findLine(start[i], end[i]);
379 findLine(start, end, info);
391 findLine(start, end, nearestInfo);
393 info.setSize(start.
size());
396 if (nearestInfo[pointi].hit())
398 info[pointi].setSize(1);
399 info[pointi][0] = nearestInfo[pointi];
403 info[pointi].
clear();
430 normal[i][normalDir_] = 1.0;
442 <<
"Volume type not supported for plate."
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
static const char *const componentNames[]
static const direction nComponents
Number of components in this vector space.
A bounding box defined in terms of the points at its extremities.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Surface geometry of a finite plane, aligned with the coordinate axes, which can be used with snappyHe...
virtual ~searchablePlate()
Destructor.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
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.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to 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....
const boundBox & bounds() const
Return const reference to boundBox.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define InfoInFunction
Report an information message using Foam::Info.
errorManipArg< error, int > exit(error &err, const int errNo=1)
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
const dimensionSet dimLength
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
scalarField samples(nIntervals, 0)