61Foam::searchableExtrudedCircle::searchableExtrudedCircle
84 radius_(
dict.get<scalar>(
"radius"))
93 const scalar halfWidth =
mag(0.5*
bounds().span());
128 if (regions_.empty())
131 regions_[0] =
"region0";
139 return eMeshPtr_().points().
size();
145 return eMeshPtr_().points();
155 centres = eMeshPtr_().points();
176 const scalar nearestDist =
Foam::sqrt(nearestDistSqr[i]);
177 const scalar searchDistSqr =
Foam::sqr(nearestDist+radius_);
180 info[i] =
tree.findNearest(
samples[i], searchDistSqr);
186 const scalar
s(
mag(d));
195 const scalar distToSurface = radius_-
s;
196 if (
mag(distToSurface) > nearestDist)
202 info[i].setPoint(info[i].
point() + d/
s*radius_);
221 const auto& treeData =
tree.shapes();
226 const scalar maxDistSqr =
bounds().magSqr();
231 (rawLambdas-rawLambdas[0])
232 /(rawLambdas.last()-rawLambdas[0])
241 curvePoints[0] = startInfo.hitPoint();
242 axialVecs[0] = treeData.line(startInfo.index()).vec();
245 curvePoints.last() = endInfo.hitPoint();
246 axialVecs.last() = treeData.line(endInfo.index()).vec();
253 scalar endDistance = -1.0;
257 const point& start = curvePoints[0];
258 const point&
end = curvePoints.last();
260 label edgei = startInfo.index();
261 const edge& startE = edges[edgei];
263 label pointi = startE[0];
264 if ((startE.vec(
points)&(
end-start)) > 0)
269 curveLambdas[pointi] =
mag(
points[pointi]-curvePoints[0]);
270 label otherPointi = startE.otherVertex(pointi);
271 curveLambdas[otherPointi] = -
mag(
points[otherPointi]-curvePoints[0]);
279 const labelList& pEdges = pointEdges[pointi];
280 if (pEdges.size() == 1)
284 else if (pEdges.size() != 2)
287 <<
" is not a single path. This is not supported"
292 label oldEdgei = edgei;
293 if (pEdges[0] == oldEdgei)
302 if (edgei == endInfo.index())
304 endDistance = curveLambdas[pointi] +
mag(end-
points[pointi]);
313 label oldPointi = pointi;
314 pointi = edges[edgei].otherVertex(oldPointi);
316 if (curveLambdas[pointi] >= 0)
321 curveLambdas[pointi] =
322 curveLambdas[oldPointi] + edges[edgei].mag(
points);
328 if (curveLambdas[i] >= 0)
330 curveLambdas[i] /= endDistance;
343 for (label i = 1; i < curvePoints.size()-1; i++)
345 interpolator.valueWeights(lambdas[i], indices, weights);
347 if (indices.size() == 1)
350 label pointi = indices[0];
352 label edge0 = pointEdges[pointi][0];
353 const edge& e0 = edges[edge0];
355 curvePoints[i] = weights[0]*
p0;
357 else if (indices.size() == 2)
361 axialVecs[i] = p1-
p0;
362 curvePoints[i] = weights[0]*
p0+weights[1]*p1;
365 axialVecs /=
mag(axialVecs);
372 info.setSize(lambdas.size());
380 radialStart = start-curvePoints[0];
381 radialStart.removeCollinear(axialVecs[0]);
382 radialStart.normalise();
391 vector radialEnd(end-curvePoints.last());
392 radialEnd.removeCollinear(axialVecs.last());
393 radialEnd.normalise();
395 vector projectedEnd = radialEnd;
396 projectedEnd.removeCollinear(axialVecs[0]);
397 projectedEnd.normalise();
399 qProjectedEnd =
quaternion(projectedEnd, 0.0);
404 for (label i = 1; i < lambdas.size()-1; i++)
407 vector radialDir(q.transform(radialStart));
409 radialDir.removeCollinear(axialVecs[i]);
410 radialDir.normalise();
419 const List<pointIndexHit>& info,
423 region.setSize(
info.size());
442 const scalar distSqr =
bounds().magSqr();
451 normal[i] = info[i].hitPoint()-curvePt.
hitPoint();
456 normal[i].removeCollinear(axialVec);
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void normalise()
Inplace normalise this field. Generally a no-op except for vector fields.
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const Time & time() const noexcept
Return Time associated with the objectRegistry.
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
fileName objectPath() const
The complete path + object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
label index() const noexcept
Return the hit index.
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
void size(const label n)
Older name for setAddressableSize.
T & last()
Access last element of the list, position [size()-1].
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
Vector< Cmpt > & removeCollinear(const Vector< Cmpt > &unitVec)
Inplace removal of components that are collinear to the given unit vector.
A bounding box defined in terms of min/max extrema points.
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
void reset()
Reset to an inverted box.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Area discretisation.
const pointField & points() const noexcept
Return points.
const edgeList & edges() const noexcept
Return edges.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
vector vec(const UList< point > &pts) const
Return the vector (from first to second).
label otherVertex(const label vertex) const
Given one vertex label, return the other one.
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.
Searching on edgeMesh with constant radius.
virtual ~searchableExtrudedCircle()
Destructor.
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 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
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
virtual const boundBox & bounds() const
Return const reference to boundBox.
A class for managing temporary objects.
Standard boundBox with extra functionality for use in octree.
Holds data for octree to work on an edges subset.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & p0
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for bounding specifications. At the moment, mostly for tables.
Different types of constants.
List< edge > edgeList
List of edge.
List< word > wordList
List of word.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Tree tree(triangles.begin(), triangles.end())
#define forAll(list, i)
Loop across all elements in list.
scalarField samples(nIntervals, Zero)