67 else if (span[dir] < VSMALL)
83 <<
"Span should have two positive and one zero entry: " 96 const scalar nearestDistSqr
109 info.point()[normalDir_] = origin_[normalDir_];
114 if (dir != normalDir_)
116 if (info.point()[dir] < origin_[dir])
118 info.point()[dir] = origin_[dir];
120 else if (info.point()[dir] > origin_[dir]+span_[dir])
122 info.point()[dir] = origin_[dir]+span_[dir];
129 if (info.point().distSqr(sample) > nearestDistSqr)
154 if (
mag(dir[normalDir_]) < VSMALL)
161 scalar t = (origin_[normalDir_]-start[normalDir_]) / dir[normalDir_];
170 info.point() = start+t*dir;
171 info.point()[normalDir_] = origin_[normalDir_];
176 if (dir != normalDir_)
178 if (info.point()[dir] < origin_[dir])
184 else if (info.point()[dir] > origin_[dir]+span_[dir])
198 treeBoundBox bb(origin_, origin_+span_);
199 bb.min()[normalDir_] -= 1
e-6;
200 bb.max()[normalDir_] += 1
e-6;
202 if (!bb.contains(info.point()))
205 <<
"bb:" << bb <<
endl 206 <<
"origin_:" << origin_ <<
endl 207 <<
"span_:" << span_ <<
endl 208 <<
"normalDir_:" << normalDir_ <<
endl 209 <<
"hitPoint:" << info.point()
220 Foam::searchablePlate::searchablePlate
230 normalDir_(calcNormal(span_))
233 <<
" origin:" << origin_
234 <<
" origin+span:" << origin_+span_
235 <<
" normal:" << vector::componentNames[normalDir_] <<
nl;
241 Foam::searchablePlate::searchablePlate
255 if (regions_.empty())
258 regions_.first() =
"region0";
279 centres[0] = origin_ + 0.5*span_;
290 auto&
pts = tpts.ref();
294 if (span_.x() < span_.y() && span_.x() < span_.z())
296 pts[1].y() += span_.y();
297 pts[3].z() += span_.z();
299 else if (span_.y() < span_.z())
301 pts[1].x() += span_.x();
302 pts[3].z() += span_.z();
306 pts[1].x() += span_.x();
320 void Foam::searchablePlate::findNearest
331 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
336 void Foam::searchablePlate::findLine
340 List<pointIndexHit>& info
343 info.setSize(start.size());
347 info[i] = findLine(start[i],
end[i]);
356 List<pointIndexHit>& info
359 findLine(start,
end, info);
371 findLine(start,
end, nearestInfo);
373 info.setSize(start.
size());
376 if (nearestInfo[pointi].hit())
378 info[pointi].setSize(1);
379 info[pointi][0] = nearestInfo[pointi];
391 const List<pointIndexHit>& info,
395 region.setSize(info.size());
410 normal[i][normalDir_] = 1.0;
418 List<volumeType>& volType
422 <<
"Volume type not supported for plate." 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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void resize(const label len)
Adjust allocated size of list.
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
scalarField samples(nIntervals, Zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
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 ...
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
virtual const boundBox & bounds() const
Return const reference to boundBox.
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(topoSetCellSource, badQualityToCell, word, badQuality)
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit >> &) const
Get all intersections in order from start to end.
#define forAll(list, i)
Loop across all elements in list.
virtual bool overlaps(const boundBox &bb) const
Does any part of the surface overlap the supplied bound box?
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
void clear()
Clear the list, i.e. set size to zero.
#define DebugInFunction
Report an information message using Foam::Info.
virtual tmp< pointField > points() const
Get the points that define the surface.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
errorManip< error > abort(error &err)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
defineTypeNameAndDebug(combustionModel, 0)
virtual const wordList & regions() const
Names of regions.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
vector point
Point is a vector.
Searching on finite plate. Plate has to be aligned with coordinate axes. Plate defined as origin and ...
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
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.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)