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_
228 bounds() =
boundBox(origin_, origin_ + span_);
232 Foam::searchablePlate::searchablePlate
239 origin_(dict.
lookup(
"origin")),
240 span_(dict.
lookup(
"span")),
241 normalDir_(calcNormal(span_))
246 <<
" origin:" << origin_
247 <<
" origin+span:" << origin_+span_
252 bounds() =
boundBox(origin_, 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);
396 if (nearestInfo[pointi].hit())
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T & ref() const
Return non-const reference or generate a fatal error.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
static const char *const componentNames[]
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
A bounding box defined in terms of the points at its extremities.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
PointIndexHit< point > pointIndexHit
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
Vector< scalar > vector
A scalar version of the templated Vector.
Macros for easy insertion into run-time selection tables.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
static const direction nComponents
Number of components in this vector space.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
vectorField pointField
pointField is a vectorField.
void clear()
Clear the list, i.e. set size to zero.
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual ~searchablePlate()
Destructor.
errorManip< error > abort(error &err)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
defineTypeNameAndDebug(combustionModel, 0)
virtual const wordList & regions() const
Names of regions.
void setSize(const label)
Reset size of List.
const point & max() const
Maximum point defining the bounding box.
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.
vector point
Point is a vector.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
dimensioned< scalar > mag(const dimensioned< Type > &)
const doubleScalar e
Elementary charge.
const point & min() const
Minimum point defining the bounding box.
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
#define InfoInFunction
Report an information message using Foam::Info.