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);
136 normal_(normal/
mag(normal)),
151 bounds().
min() = origin_ - span;
152 bounds().
max() = origin_ + span;
163 origin_(dict.
lookup(
"origin")),
164 normal_(dict.
lookup(
"normal")),
165 radius_(dict.
lookup<scalar>(
"radius"))
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." 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)
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
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.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
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 ~searchableDisk()
Destructor.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
void clear()
Clear the list, i.e. set size to zero.
bool hit() const
Is there a hit.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
searchableDisk(const IOobject &io, const point &origin, const point &normal, const scalar radius)
Construct from components.
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.
void setSize(const label)
Reset size of List.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
vector point
Point is a vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
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.