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);
125 Foam::searchableSphere::searchableSphere
139 centre_ + radius_*vector::one
144 Foam::searchableSphere::searchableSphere
151 centre_(dict.
lookup(
"centre")),
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_))
dimensionedScalar sqrt(const dimensionedScalar &ds)
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.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
void size(const label)
Override size to be inconsistent with allocated storage.
PointIndexHit< point > pointIndexHit
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
bool hit() const
Is there a hit.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual ~searchableSphere()
Destructor.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
virtual const wordList & regions() const
Names of regions.
Macros for easy insertion into run-time selection tables.
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 void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)