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)),
167 normal_ /=
mag(normal_);
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);
272 info.setSize(start.
size());
277 findLine(start[i], end[i], inter);
321 <<
"Volume type not supported for disk."
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
InfoProxy< IOobject > info() const
Return info proxy.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool hit() const
Is there a hit.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Surface geometry with a circular disk shape, which can be used with snappyHexMesh.
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.
searchableDisk(const IOobject &io, const point &origin, const point &normal, const scalar radius)
Construct from components.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
virtual ~searchableDisk()
Destructor.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
const boundBox & bounds() const
Return const reference to boundBox.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar sign(const dimensionedScalar &ds)
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
const dimensionSet dimless
const dimensionSet dimLength
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
scalarField samples(nIntervals, 0)