46 searchableExtrudedCircle,
52 searchableExtrudedCircle,
61 Foam::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_);
216 List<pointIndexHit>& info
219 const edgeMesh&
mesh = eMeshPtr_();
220 const indexedOctree<treeDataEdge>&
tree = edgeTree_();
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;
338 linearInterpolationWeights interpolator(curveLambdas);
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];
354 axialVecs[i] = e0.vec(
points);
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];
384 qStart = quaternion(radialStart, 0.0);
389 quaternion qProjectedEnd;
391 vector radialEnd(
end-curvePoints.last());
395 vector projectedEnd = radialEnd;
399 qProjectedEnd = quaternion(projectedEnd, 0.0);
404 for (label i = 1; i < lambdas.size()-1; i++)
406 quaternion q(
slerp(qStart, qProjectedEnd, lambdas[i]));
407 vector radialDir(q.transform(radialStart));
412 info[i] =
pointIndexHit(
true, curvePoints[i]+radius_*radialDir, 0);
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);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
virtual ~searchableExtrudedCircle()
Destructor.
const pointField & points() const noexcept
Return points.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual label size() const
Range of local indices that can be returned.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< edge > edgeList
List of edge.
const labelListList & pointEdges() const
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
scalarField samples(nIntervals, Zero)
dimensionedScalar sqrt(const dimensionedScalar &ds)
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
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.
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.
A bounding box defined in terms of min/max extrema points.
This class describes the interaction of an object (often a face) and a point. It carries the info of ...
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
virtual const boundBox & bounds() const
Return const reference to boundBox.
List< labelList > labelListList
List of labelList.
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
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 const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
Tree tree(triangles.begin(), triangles.end())
label index() const noexcept
Return the hit index.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
virtual const wordList & regions() const
Names of regions.
defineTypeNameAndDebug(combustionModel, 0)
Mesh data needed to do the Finite Area discretisation.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
const edgeList & edges() const noexcept
Return edges.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
Standard boundBox with extra functionality for use in octree.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
Field< vector > vectorField
Specialisation of Field<T> for vector.
void reset()
Reset to an inverted box.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
void normalise()
Inplace normalise this field. Generally a no-op except for vector fields.
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))
virtual tmp< pointField > points() const
Get the points that define the surface.
Vector< Cmpt > & removeCollinear(const Vector< Cmpt > &unitVec)
Inplace removal of components that are collinear to the given unit vector.
Defines the attributes of an object for which implicit objectRegistry management is supported...
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
const volScalarField & p0
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)