39 namespace searchableSurfaces
55 searchableExtrudedCircle,
56 "searchableExtrudedCircle"
106 bb.
min() -=
point(rootVSmall, rootVSmall, rootVSmall);
107 bb.
max() +=
point(rootVSmall, rootVSmall, rootVSmall);
139 if (regions_.empty())
142 regions_[0] =
"region0";
150 return eMeshPtr_().points().size();
157 return eMeshPtr_().points();
167 centres = eMeshPtr_().points();
188 info[i] = tree.findNearest(
samples[i], nearestDistSqr[i]);
193 info[i].setPoint(info[i].hitPoint() + d/
mag(d)*radius_);
219 (rawLambdas-rawLambdas[0])
220 /(rawLambdas.
last()-rawLambdas[0])
228 const pointIndexHit startInfo = tree.findNearest(start, maxDistSqr);
229 curvePoints[0] = startInfo.
hitPoint();
230 axialVecs[0] = edges[startInfo.
index()].vec(
points);
232 const pointIndexHit endInfo = tree.findNearest(end, maxDistSqr);
241 scalar endDistance = -1.0;
245 const point& start = curvePoints[0];
249 const edge& startE = edges[edgei];
251 label pointi = startE[0];
252 if ((startE.
vec(
points)&(end-start)) > 0)
257 curveLambdas[pointi] =
mag(
points[pointi]-curvePoints[0]);
259 curveLambdas[otherPointi] = -
mag(
points[otherPointi]-curvePoints[0]);
267 const labelList& pEdges = pointEdges[pointi];
268 if (pEdges.
size() == 1)
272 else if (pEdges.
size() != 2)
275 <<
" is not a single path. This is not supported"
280 label oldEdgei = edgei;
281 if (pEdges[0] == oldEdgei)
290 if (edgei == endInfo.
index())
292 endDistance = curveLambdas[pointi] +
mag(end-
points[pointi]);
301 label oldPointi = pointi;
302 pointi = edges[edgei].otherVertex(oldPointi);
304 if (curveLambdas[pointi] >= 0)
309 curveLambdas[pointi] =
310 curveLambdas[oldPointi] + edges[edgei].mag(
points);
316 if (curveLambdas[i] >= 0)
318 curveLambdas[i] /= endDistance;
331 for (
label i = 1; i < curvePoints.
size()-1; i++)
333 interpolator.
valueWeights(lambdas[i], indices, weights);
335 if (indices.
size() == 1)
338 label pointi = indices[0];
340 label edge0 = pointEdges[pointi][0];
341 const edge& e0 = edges[edge0];
343 curvePoints[i] = weights[0]*p0;
345 else if (indices.
size() == 2)
349 axialVecs[i] = p1-p0;
350 curvePoints[i] = weights[0]*p0+weights[1]*p1;
353 axialVecs /=
mag(axialVecs);
368 radialStart = start-curvePoints[0];
369 radialStart -= (radialStart&axialVecs[0])*axialVecs[0];
370 radialStart /=
mag(radialStart);
379 radialEnd -= (radialEnd&axialVecs.
last())*axialVecs.
last();
380 radialEnd /=
mag(radialEnd);
382 vector projectedEnd = radialEnd;
383 projectedEnd -= (projectedEnd&axialVecs[0])*axialVecs[0];
384 projectedEnd /=
mag(projectedEnd);
385 qProjectedEnd =
quaternion(projectedEnd, 0.0);
390 for (
label i = 1; i < lambdas.
size()-1; i++)
395 radialDir -= (radialDir&axialVecs[i])*axialVecs.
last();
396 radialDir /=
mag(radialDir);
398 info[i] =
pointIndexHit(
true, curvePoints[i]+radius_*radialDir, 0);
439 normal[i] = info[i].hitPoint()-curvePt.
hitPoint();
443 axialVec /=
mag(axialVec);
444 normal[i] -= (normal[i]&axialVec)*axialVec;
445 normal[i] /=
mag(normal[i]);
#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...
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...
const Point & hitPoint() const
Return hit point.
label index() const
Return index.
T & last()
Return the last element of the list.
A bounding box defined in terms of the points at its extremities.
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.
Points connected by edges.
const edgeList & edges() const
Return edges.
const pointField & points() const
Return points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
vector vec(const pointField &) const
Return the vector (end - start)
label otherVertex(const label a) const
Given one vertex, return the other.
Non-pointer based hierarchical recursive searching.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
virtual const pointField & points() const
Return raw points.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Quaternion class used to perform rotations in 3D space.
vector transform(const vector &v) const
Rotate the given vector.
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 tube shape, which can be used with snappyHexMesh. The geometry is formed from...
virtual label size() const
Range of local indices that can be returned.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
virtual ~extrudedCircle()
Destructor.
virtual tmp< pointField > points() const
Get the points that define the surface.
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 findParametricNearest(const point &start, const point &end, const scalarField &lambdas, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Unique to parametric geometry: given points find.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
extrudedCircle(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
A class for managing temporary objects.
Standard boundBox + extra functionality for use in octree.
Holds data for octree to work on an edges subset.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
addToRunTimeSelectionTable(searchableSurface, box, dictionary)
defineTypeNameAndDebug(box, 0)
addBackwardCompatibleToRunTimeSelectionTable(searchableSurface, box, dictionary, searchableBox, "searchableBox")
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
PointIndexHit< point > pointIndexHit
const dimensionSet dimLength
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Vector< scalar > vector
A scalar version of the templated Vector.
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
scalarField samples(nIntervals, 0)