43 searchableExtrudedCircle,
74 radius_(dict.
lookup<scalar>(
"radius"))
82 vector halfSpan(0.5*bounds().span());
83 point ctr(bounds().midpoint());
85 bounds().min() = ctr -
mag(halfSpan)*
vector(1, 1, 1);
86 bounds().max() = ctr +
mag(halfSpan)*
vector(1, 1, 1);
93 bb.
min() -=
point(rootVSmall, rootVSmall, rootVSmall);
94 bb.
max() +=
point(rootVSmall, rootVSmall, rootVSmall);
126 if (regions_.empty())
129 regions_[0] =
"region0";
137 return eMeshPtr_().points().size();
143 return eMeshPtr_().points();
153 centres = eMeshPtr_().points();
174 info[i] = tree.findNearest(samples[i], nearestDistSqr[i]);
178 vector d(samples[i]-info[i].hitPoint());
179 info[i].setPoint(info[i].hitPoint() + d/
mag(d)*radius_);
205 (rawLambdas-rawLambdas[0])
206 /(rawLambdas.
last()-rawLambdas[0])
214 const pointIndexHit startInfo = tree.findNearest(start, maxDistSqr);
215 curvePoints[0] = startInfo.hitPoint();
216 axialVecs[0] = edges[startInfo.index()].vec(points);
218 const pointIndexHit endInfo = tree.findNearest(end, maxDistSqr);
219 curvePoints.last() = endInfo.
hitPoint();
220 axialVecs.last() = edges[endInfo.
index()].vec(points);
227 scalar endDistance = -1.0;
231 const point& start = curvePoints[0];
232 const point& end = curvePoints.last();
234 label edgei = startInfo.index();
235 const edge& startE = edges[edgei];
237 label pointi = startE[0];
238 if ((startE.
vec(points)&(end-start)) > 0)
243 curveLambdas[pointi] =
mag(points[pointi]-curvePoints[0]);
245 curveLambdas[otherPointi] = -
mag(points[otherPointi]-curvePoints[0]);
253 const labelList& pEdges = pointEdges[pointi];
254 if (pEdges.
size() == 1)
258 else if (pEdges.
size() != 2)
261 <<
" is not a single path. This is not supported" 266 label oldEdgei = edgei;
267 if (pEdges[0] == oldEdgei)
276 if (edgei == endInfo.
index())
278 endDistance = curveLambdas[pointi] +
mag(end-points[pointi]);
287 label oldPointi = pointi;
288 pointi = edges[edgei].otherVertex(oldPointi);
290 if (curveLambdas[pointi] >= 0)
295 curveLambdas[pointi] =
296 curveLambdas[oldPointi] + edges[edgei].mag(points);
302 if (curveLambdas[i] >= 0)
304 curveLambdas[i] /= endDistance;
317 for (
label i = 1; i < curvePoints.size()-1; i++)
319 interpolator.
valueWeights(lambdas[i], indices, weights);
321 if (indices.
size() == 1)
324 label pointi = indices[0];
325 const point& p0 = points[pointi];
326 label edge0 = pointEdges[pointi][0];
327 const edge& e0 = edges[edge0];
328 axialVecs[i] = e0.
vec(points);
329 curvePoints[i] = weights[0]*p0;
331 else if (indices.
size() == 2)
333 const point& p0 = points[indices[0]];
334 const point& p1 = points[indices[1]];
335 axialVecs[i] = p1-p0;
336 curvePoints[i] = weights[0]*p0+weights[1]*p1;
339 axialVecs /=
mag(axialVecs);
354 radialStart = start-curvePoints[0];
355 radialStart -= (radialStart&axialVecs[0])*axialVecs[0];
356 radialStart /=
mag(radialStart);
364 vector radialEnd(end-curvePoints.last());
365 radialEnd -= (radialEnd&axialVecs.last())*axialVecs.last();
366 radialEnd /=
mag(radialEnd);
368 vector projectedEnd = radialEnd;
369 projectedEnd -= (projectedEnd&axialVecs[0])*axialVecs[0];
370 projectedEnd /=
mag(projectedEnd);
371 qProjectedEnd =
quaternion(projectedEnd, 0.0);
376 for (
label i = 1; i < lambdas.
size()-1; i++)
381 radialDir -= (radialDir&axialVecs[i])*axialVecs.last();
382 radialDir /=
mag(radialDir);
384 info[i] =
pointIndexHit(
true, curvePoints[i]+radius_*radialDir, 0);
425 normal[i] = info[i].hitPoint()-curvePt.
hitPoint();
428 vector axialVec = edges[curvePt.
index()].vec(points);
429 axialVec /=
mag(axialVec);
430 normal[i] -= (normal[i]&axialVec)*axialVec;
431 normal[i] /=
mag(normal[i]);
#define forAll(list, i)
Loop across all elements in list.
virtual ~searchableExtrudedCircle()
Destructor.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual label size() const
Range of local indices that can be returned.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static autoPtr< edgeMesh > New(const fileName &, const word &ext)
Select constructed from filename (explicit extension)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
Holds data for octree to work on an edges subset.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
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.
label otherVertex(const label a) const
Given one vertex, return the other.
Macros for easy insertion into run-time selection tables.
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 getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
const Point & hitPoint() const
Return hit point.
const labelListList & pointEdges() const
Return edges.
virtual bool valueWeights(const scalar t, labelList &indices, scalarField &weights) const
Calculate weights and indices to calculate t from samples.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
const edgeList & edges() const
Return edges.
const word & constant() const
Return constant name.
Quaternion class used to perform rotations in 3D space.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
vector vec(const pointField &) const
Return the vector (end - start)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual const wordList & regions() const
Names of regions.
const pointField & points() const
Return points.
defineTypeNameAndDebug(combustionModel, 0)
Points connected by edges.
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
const point & max() const
Maximum describing the bounding box.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
const Time & time() const
Return time.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
Standard boundBox + extra functionality for use in octree.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
searchableExtrudedCircle(const IOobject &io, const dictionary &dict)
Construct from dictionary (used by searchableSurface)
const point & min() const
Minimum describing the bounding box.
A class for managing temporary objects.
T & last()
Return the last element of the list.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label index() const
Return index.
vector transform(const vector &v) const
Rotate the given vector.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.