33 namespace searchableSurfaces
61 const scalar nearestDistSqr
66 vector v(sample - origin_);
69 scalar parallel = (v & normal_);
72 v -= parallel*normal_;
75 if (magV < rootVSmall)
85 info.setPoint(origin_ +
min(magV, radius_)*v);
87 if (
magSqr(sample -
info.rawPoint()) < nearestDistSqr)
97 void Foam::searchableSurfaces::disk::findLine
106 vector v(start - origin_);
109 scalar parallel = (v & normal_);
111 if (
sign(parallel) ==
sign((end - origin_) & normal_))
117 v -= parallel*normal_;
118 scalar magV =
mag(v);
120 if (magV < rootVSmall)
130 info.setPoint(origin_ + magV*v);
152 normal_(normal/
mag(normal)),
183 normal_ /=
mag(normal_);
212 if (regions_.empty())
215 regions_[0] =
"region0";
228 centres[0] = origin_;
231 radiusSqr[0] =
sqr(radius_);
238 void Foam::searchableSurfaces::disk::findNearest
249 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
254 void Foam::searchableSurfaces::disk::findLine
265 findLine(start[i], end[i], info[i]);
277 findLine(start, end, info);
288 info.setSize(start.
size());
293 findLine(start[i], end[i], inter);
337 <<
"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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
const boundBox & bounds() const
Return const reference to boundBox.
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.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
disk(const IOobject &io, const point &origin, const point &normal, const scalar radius)
Construct from components.
virtual ~disk()
Destructor.
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
addToRunTimeSelectionTable(searchableSurface, box, dictionary)
defineTypeNameAndDebug(box, 0)
addBackwardCompatibleToRunTimeSelectionTable(searchableSurface, box, dictionary, searchableBox, "searchableBox")
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar sign(const dimensionedScalar &ds)
PointIndexHit< point > pointIndexHit
const dimensionSet dimless
const dimensionSet dimLength
vector point
Point is a vector.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
scalarField samples(nIntervals, 0)