52 <<
"Span should have two positive and one zero entry. Now:" 55 else if (span[dir] < VSMALL)
73 <<
"Span should have two positive and one zero entry. Now:" 85 const scalar nearestDistSqr
98 info.rawPoint()[normalDir_] = origin_[normalDir_];
103 if (dir != normalDir_)
105 if (info.rawPoint()[dir] < origin_[dir])
107 info.rawPoint()[dir] = origin_[dir];
109 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
111 info.rawPoint()[dir] = origin_[dir]+span_[dir];
118 if (
magSqr(info.rawPoint() - sample) > nearestDistSqr)
141 const vector dir(end-start);
143 if (
mag(dir[normalDir_]) < VSMALL)
150 scalar t = (origin_[normalDir_]-start[normalDir_]) / dir[normalDir_];
159 info.rawPoint() = start+t*dir;
160 info.rawPoint()[normalDir_] = origin_[normalDir_];
165 if (dir != normalDir_)
167 if (info.rawPoint()[dir] < origin_[dir])
173 else if (info.rawPoint()[dir] > origin_[dir]+span_[dir])
187 treeBoundBox bb(origin_, origin_+span_);
188 bb.min()[normalDir_] -= 1
e-6;
189 bb.max()[normalDir_] += 1
e-6;
191 if (!bb.contains(info.hitPoint()))
194 <<
"bb:" << bb <<
endl 195 <<
"origin_:" << origin_ <<
endl 196 <<
"span_:" << span_ <<
endl 197 <<
"normalDir_:" << normalDir_ <<
endl 198 <<
"hitPoint:" << info.hitPoint()
209 Foam::searchablePlate::searchablePlate
219 normalDir_(calcNormal(span_))
223 Info<<
"searchablePlate::searchablePlate :" 224 <<
" origin:" << origin_
225 <<
" origin+span:" << origin_+span_
230 bounds() =
boundBox(origin_, origin_ + span_);
234 Foam::searchablePlate::searchablePlate
241 origin_(dict.
lookup(
"origin")),
242 span_(dict.
lookup(
"span")),
243 normalDir_(calcNormal(span_))
247 Info<<
"searchablePlate::searchablePlate :" 248 <<
" origin:" << origin_
249 <<
" origin+span:" << origin_+span_
254 bounds() =
boundBox(origin_, origin_ + span_);
268 if (regions_.empty())
271 regions_[0] =
"region0";
290 centres[0] = origin_ + 0.5*span_;
306 pts[2] = origin_ + span_;
308 if (span_.x() < span_.y() && span_.x() < span_.z())
310 pts[1] = origin_ +
point(0, span_.y(), 0);
311 pts[3] = origin_ +
point(0, 0, span_.z());
313 else if (span_.y() < span_.z())
315 pts[1] = origin_ +
point(span_.x(), 0, 0);
316 pts[3] = origin_ +
point(0, 0, span_.z());
320 pts[1] = origin_ +
point(span_.x(), 0, 0);
321 pts[3] = origin_ +
point(0, span_.y(), 0);
332 (origin_.x() + span_.x()) >= bb.
min().
x()
333 && origin_.x() <= bb.
max().
x()
334 && (origin_.y() + span_.y()) >= bb.
min().
y()
335 && origin_.y() <= bb.
max().
y()
336 && (origin_.z() + span_.z()) >= bb.
min().
z()
337 && origin_.z() <= bb.
max().
z()
342 void Foam::searchablePlate::findNearest
353 info[i] = findNearest(samples[i], nearestDistSqr[i]);
358 void Foam::searchablePlate::findLine
369 info[i] = findLine(start[i], end[i]);
381 findLine(start, end, info);
393 findLine(start, end, nearestInfo);
398 if (nearestInfo[pointI].hit())
401 info[pointI][0] = nearestInfo[pointI];
405 info[pointI].
clear();
432 normal[i][normalDir_] = 1.0;
445 "searchableCollection::getVolumeType(const pointField&" 446 ", List<volumeType>&) const" 447 ) <<
"Volume type not supported for plate."
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
const point & min() const
Minimum describing the bounding box.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
vector point
Point is a vector.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
static const char * componentNames[]
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
PointIndexHit< point > pointIndexHit
A list of keyword definitions, which are a keyword followed by any number of values (e...
vectorField pointField
pointField is a vectorField.
virtual const wordList & regions() const
Names of regions.
Number of components in this vector space.
void clear()
Clear the list, i.e. set size to zero.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual tmp< pointField > points() const
Get the points that define the surface.
virtual ~searchablePlate()
Destructor.
Macros for easy insertion into run-time selection tables.
const point & max() const
Maximum describing the bounding box.
errorManip< error > abort(error &err)
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A bounding box defined in terms of the points at its extremities.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Vector< scalar > vector
A scalar version of the templated Vector.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
A class for managing temporary objects.
defineTypeNameAndDebug(combustionModel, 0)