Go to the documentation of this file.
64 <<
"Span should have two positive and one zero entry. Now:"
67 else if (span[dir] < VSMALL)
85 <<
"Span should have two positive and one zero entry. Now:"
97 const scalar nearestDistSqr
110 info.rawPoint()[normalDir_] = origin_[normalDir_];
115 if (dir != normalDir_)
117 if (info.rawPoint()[dir] < origin_[dir])
119 info.rawPoint()[dir] = origin_[dir];
121 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
123 info.rawPoint()[dir] = origin_[dir]+span_[dir];
130 if (
magSqr(info.rawPoint() - sample) > nearestDistSqr)
155 if (
mag(dir[normalDir_]) < VSMALL)
162 scalar t = (origin_[normalDir_]-
start[normalDir_]) / dir[normalDir_];
171 info.rawPoint() =
start+t*dir;
172 info.rawPoint()[normalDir_] = origin_[normalDir_];
177 if (dir != normalDir_)
179 if (info.rawPoint()[dir] < origin_[dir])
185 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
199 treeBoundBox bb(origin_, origin_+span_);
200 bb.min()[normalDir_] -= 1
e-6;
201 bb.max()[normalDir_] += 1
e-6;
203 if (!bb.contains(info.hitPoint()))
206 <<
"bb:" << bb <<
endl
207 <<
"origin_:" << origin_ <<
endl
208 <<
"span_:" << span_ <<
endl
209 <<
"normalDir_:" << normalDir_ <<
endl
210 <<
"hitPoint:" << info.hitPoint()
221 Foam::searchablePlate::searchablePlate
231 normalDir_(calcNormal(span_))
236 <<
" origin:" << origin_
237 <<
" origin+span:" << origin_+span_
242 bounds() =
boundBox(origin_, origin_ + span_);
246 Foam::searchablePlate::searchablePlate
255 normalDir_(calcNormal(span_))
260 <<
" origin:" << origin_
261 <<
" origin+span:" << origin_+span_
266 bounds() =
boundBox(origin_, origin_ + span_);
274 if (regions_.empty())
277 regions_[0] =
"region0";
296 centres[0] = origin_ + 0.5*span_;
298 radiusSqr.setSize(1);
309 auto& pts = tpts.ref();
312 pts[2] = origin_ + span_;
314 if (span_.x() < span_.y() && span_.x() < span_.z())
316 pts[1] = origin_ +
point(0, span_.y(), 0);
317 pts[3] = origin_ +
point(0, 0, span_.z());
319 else if (span_.y() < span_.z())
321 pts[1] = origin_ +
point(span_.x(), 0, 0);
322 pts[3] = origin_ +
point(0, 0, span_.z());
326 pts[1] = origin_ +
point(span_.x(), 0, 0);
327 pts[3] = origin_ +
point(0, span_.y(), 0);
338 (origin_.x() + span_.x()) >= bb.
min().
x()
339 && origin_.x() <= bb.
max().
x()
340 && (origin_.y() + span_.y()) >= bb.
min().
y()
341 && origin_.y() <= bb.
max().
y()
342 && (origin_.z() + span_.z()) >= bb.
min().
z()
343 && origin_.z() <= bb.
max().
z()
348 void Foam::searchablePlate::findNearest
359 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
364 void Foam::searchablePlate::findLine
375 info[i] = findLine(
start[i],
end[i]);
404 if (nearestInfo[pointi].hit())
407 info[pointi][0] = nearestInfo[pointi];
411 info[pointi].
clear();
434 normal.setSize(info.size());
438 normal[i][normalDir_] = 1.0;
450 <<
"Volume type not supported for plate."
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Cmpt & x() const
Access to the vector x component.
#define InfoInFunction
Report an information message using Foam::Info.
static const char *const componentNames[]
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const point & max() const
Maximum describing the bounding box.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
const Cmpt & z() const
Access to the vector z component.
const point & min() const
Minimum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
virtual tmp< pointField > points() const
Get the points that define the surface.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
scalarField samples(nIntervals, Zero)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label ListType::const_reference const label start
const dimensionedScalar e
Elementary charge.
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 bounding box defined in terms of min/max extrema points.
virtual const wordList & regions() const
Names of regions.
vector point
Point is a vector.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
void setSize(const label newSize)
Alias for resize(const label)
defineTypeNameAndDebug(combustionModel, 0)
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
static constexpr direction nComponents
Number of components in this vector space.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.