45 const scalar nearestDistSqr
50 vector v(sample - origin_);
53 scalar parallel = (v & normal_);
56 v -= parallel*normal_;
59 if (magV < ROOTVSMALL)
69 info.setPoint(origin_ +
min(magV, radius_)*v);
71 if (
magSqr(sample - info.rawPoint()) < nearestDistSqr)
81 void Foam::searchableDisk::findLine
93 scalar parallel = (v & normal_);
95 if (
sign(parallel) ==
sign((end - origin_) & normal_))
101 v -= parallel*normal_;
102 scalar magV =
mag(v);
104 if (magV < ROOTVSMALL)
114 info.setPoint(origin_ + magV*v);
126 Foam::searchableDisk::searchableDisk
136 normal_(normal/
mag(normal)),
151 bounds().
min() = origin_ - span;
152 bounds().
max() = origin_ + span;
156 Foam::searchableDisk::searchableDisk
163 origin_(dict.
lookup(
"origin")),
164 normal_(dict.
lookup(
"normal")),
167 normal_ /=
mag(normal_);
181 bounds().
min() = origin_ - span;
182 bounds().
max() = origin_ + span;
196 if (regions_.empty())
199 regions_[0] =
"region0";
212 centres[0] = origin_;
215 radiusSqr[0] =
sqr(radius_);
222 void Foam::searchableDisk::findNearest
233 info[i] = findNearest(samples[i], nearestDistSqr[i]);
238 void Foam::searchableDisk::findLine
249 findLine(start[i], end[i], info[i]);
261 findLine(start, end, info);
277 findLine(start[i], end[i], inter);
321 <<
"Volume type not supported for disk." virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
dimensionedScalar sign(const dimensionedScalar &ds)
#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.
bool hit() const
Is there a hit.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
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 getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual ~searchableDisk()
Destructor.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
void clear()
Clear the list, i.e. set size to zero.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const wordList & regions() const
Names of regions.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
void setSize(const label)
Reset size of List.
vector point
Point is a vector.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.