45 const scalar nearestDistSqr
50 const vector n(sample - centre_);
53 if (nearestDistSqr >=
sqr(magN - radius_))
55 if (magN < rootVSmall)
57 info.rawPoint() = centre_ +
vector(1,0,0)*radius_;
61 info.rawPoint() = centre_ +
n/magN*radius_;
72 void Foam::searchableSphere::findLineAll
84 scalar magSqrDir =
magSqr(dir);
86 if (magSqrDir > rootVSmall)
88 const vector toCentre(centre_-start);
89 scalar magSqrToCentre =
magSqr(toCentre);
93 scalar v = (toCentre & dir);
95 scalar disc =
sqr(radius_) - (magSqrToCentre -
sqr(v));
101 scalar nearParam = v-d;
103 if (nearParam >= 0 &&
sqr(nearParam) <= magSqrDir)
106 near.setPoint(start + nearParam*dir);
110 scalar farParam = v+d;
112 if (farParam >= 0 &&
sqr(farParam) <= magSqrDir)
115 far.setPoint(start + farParam*dir);
139 centre_ + radius_*vector::one
151 centre_(dict.
lookup(
"centre")),
152 radius_(dict.
lookup<scalar>(
"radius"))
157 centre_ + radius_*vector::one
178 if (regions_.empty())
181 regions_[0] =
"region0";
195 centres[0] = centre_;
205 void Foam::searchableSphere::findNearest
216 info[i] = findNearest(samples[i], nearestDistSqr[i]);
235 findLineAll(start[i], end[i], info[i], b);
236 if (!info[i].hit() && b.
hit())
258 findLineAll(start[i], end[i], info[i], b);
259 if (!info[i].hit() && b.
hit())
267 void Foam::searchableSphere::findLineAll
279 findLineAll(start[i], end[i], near, far);
335 normal[i] = info[i].hitPoint() - centre_;
337 normal[i] /=
mag(normal[i])+vSmall;
358 const point& pt = points[pointi];
360 if (
magSqr(pt - centre_) <=
sqr(radius_))
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
#define forAll(list, i)
Loop across all elements in list.
A list of keyword definitions, which are a keyword followed by any number of values (e...
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)
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
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.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Macros for easy insertion into run-time selection tables.
searchableSphere(const IOobject &io, const point &, const scalar radius)
Construct from components.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
const dimensionedScalar & b
Wien displacement law constant: default SI units: [m K].
void clear()
Clear the list, i.e. set size to zero.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
bool hit() const
Is there a hit.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual ~searchableSphere()
Destructor.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
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 const wordList & regions() const
Names of regions.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
static const Vector< scalar > one
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.