Go to the documentation of this file.
58 const scalar nearestDistSqr
63 const vector n(sample - origin_);
66 if (nearestDistSqr >=
sqr(magN - radius_))
68 if (magN < ROOTVSMALL)
70 info.rawPoint() = origin_ +
vector(1,0,0)*radius_;
74 info.rawPoint() = origin_ +
n/magN*radius_;
85 void Foam::searchableSphere::findLineAll
97 scalar magSqrDir =
magSqr(dir);
99 if (magSqrDir > ROOTVSMALL)
101 const vector toCentre(origin_ - start);
102 scalar magSqrToCentre =
magSqr(toCentre);
106 scalar v = (toCentre & dir);
108 scalar disc =
sqr(radius_) - (magSqrToCentre -
sqr(v));
114 scalar nearParam = v-d;
116 if (nearParam >= 0 &&
sqr(nearParam) <= magSqrDir)
119 near.setPoint(start + nearParam*dir);
123 scalar farParam = v+d;
125 if (farParam >= 0 &&
sqr(farParam) <= magSqrDir)
128 far.setPoint(start + farParam*dir);
138 Foam::searchableSphere::searchableSphere
157 Foam::searchableSphere::searchableSphere
182 if (regions_.empty())
185 regions_.first() =
"region0";
199 centres[0] = origin_;
209 void Foam::searchableSphere::findNearest
220 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
239 findLineAll(start[i],
end[i], info[i],
b);
240 if (!info[i].hit() &&
b.hit())
262 findLineAll(start[i],
end[i], info[i],
b);
263 if (!info[i].hit() &&
b.hit())
271 void Foam::searchableSphere::findLineAll
283 findLineAll(start[i],
end[i], near, far);
332 normal.setSize(info.size());
339 normal[i] =
normalised(info[i].hitPoint() - origin_);
357 const scalar rad2 =
sqr(radius_);
365 (
magSqr(pt - origin_) <= rad2)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static const Vector< scalar > one
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
static constexpr const zero Zero
Global zero (0)
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 const wordList & regions() const
Names of regions.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
T getCompat(const word &keyword, std::initializer_list< std::pair< const char *, int >> compat, enum keyType::option=keyType::REGEX) const
InfoProxy< IOobject > info() const
Return info proxy.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
Specialization of rigidBody to construct a sphere given the mass and radius.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
scalarField samples(nIntervals, Zero)
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
void resize(const label newSize)
Adjust allocated size of list.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Vector< scalar > vector
A scalar version of the templated Vector.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void clear()
Clear the list, i.e. set size to zero.
A location inside the volume.
A bounding box defined in terms of min/max extrema points.
vector point
Point is a vector.
void setSize(const label newSize)
Alias for resize(const label)
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
defineTypeNameAndDebug(combustionModel, 0)
A location outside the volume.