Go to the documentation of this file.
57 centres[0] = 0.5*(point1_ + point2_);
82 const scalar nearestDistSqr
87 vector v(sample - point1_);
90 scalar parallel = (v & unitDir_);
93 v -= parallel*unitDir_;
96 if (magV < ROOTVSMALL)
110 else if (parallel >= magDir_)
124 if (magV < ROOTVSMALL)
128 scalar magE1 =
mag(e1);
131 e1 =
point(0,1,0) ^ unitDir_;
135 cylPt = sample + radius_*e1;
139 cylPt = sample + (radius_-magV)*v;
142 if (parallel < 0.5*magDir_)
145 point end1Pt = point1_ +
min(magV, radius_)*v;
159 point end2Pt = point2_ +
min(magV, radius_)*v;
184 const vector x = (pt-point1_) ^ unitDir_;
202 vector point1Start(start-point1_);
203 vector point2Start(start-point2_);
204 vector point1End(end-point1_);
207 scalar s1 = point1Start&unitDir_;
208 scalar s2 = point1End&unitDir_;
210 if ((s1 < 0 && s2 < 0) || (s1 > magDir_ && s2 > magDir_))
217 scalar magV =
mag(V);
218 if (magV < ROOTVSMALL)
234 scalar tNear = VGREAT;
235 scalar tFar = VGREAT;
238 scalar
s = (V&unitDir_);
242 tPoint2 = -(point2Start&unitDir_)/
s;
243 if (tPoint2 < tPoint1)
245 Swap(tPoint1, tPoint2);
247 if (tPoint1 > magV || tPoint2 < 0)
253 if (tPoint1 >= 0 && tPoint1 <= magV)
255 if (radius2(start+tPoint1*V) <=
sqr(radius_))
260 if (tPoint2 >= 0 && tPoint2 <= magV)
262 if (radius2(start+tPoint2*V) <=
sqr(radius_))
286 const vector x = point1Start ^ unitDir_;
288 const scalar d =
sqr(radius_);
291 const scalar a = (
y&
y);
292 const scalar
b = 2*(
x&
y);
293 const scalar
c = (
x&
x)-d;
295 const scalar disc =
b*
b-4*a*
c;
305 else if (disc < ROOTVSMALL)
308 if (
mag(a) > ROOTVSMALL)
316 if (t1 >= 0 && t1 <= magV && t1 >= tPoint1 && t1 <= tPoint2)
349 if (
mag(a) > ROOTVSMALL)
351 scalar sqrtDisc =
sqrt(disc);
353 t1 = (-
b - sqrtDisc)/(2*a);
354 t2 = (-
b + sqrtDisc)/(2*a);
360 if (t1 >= 0 && t1 <= magV && t1 >= tPoint1 && t1 <= tPoint2)
373 if (t2 >= 0 && t2 <= magV && t2 >= tPoint1 && t2 <= tPoint2)
407 if (tNear >= 0 && tNear <= magV)
420 else if (tFar >= 0 && tFar <= magV)
490 magDir_(
mag(point2_-point1_)),
491 unitDir_((point2_-point1_)/magDir_),
494 bounds() = calcBounds();
507 magDir_(
mag(point2_-point1_)),
508 unitDir_((point2_-point1_)/magDir_),
511 bounds() = calcBounds();
525 if (regions_.empty())
528 regions_[0] =
"region0";
545 info[i] = findNearest(
samples[i], nearestDistSqr[i]);
563 findLineAll(start[i], end[i], info[i],
b);
564 if (!info[i].hit() &&
b.hit())
585 findLineAll(start[i], end[i], info[i],
b);
586 if (!info[i].hit() &&
b.hit())
606 findLineAll(start[i], end[i], near, far);
662 vector v(info[i].hitPoint() - point1_);
665 scalar parallel = (v & unitDir_);
668 v -= parallel*unitDir_;
669 scalar magV =
mag(v);
673 if ((magV-radius_) <
mag(parallel))
683 else if (parallel <= 0.5*magDir_)
686 if (magV >= radius_ || (radius_-magV) < parallel)
696 else if (parallel <= magDir_)
699 if (magV >= radius_ || (radius_-magV) < (magDir_-parallel))
711 if ((magV-radius_) < (parallel-magDir_))
742 scalar parallel = v & unitDir_;
749 else if (parallel > magDir_)
757 v -= parallel*unitDir_;
759 if (
mag(v) > radius_)
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared), one per element.
vectorField pointField
pointField is a vectorField.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual const wordList & regions() const
Names of regions.
void setIndex(const label index)
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
searchableCylinder(const searchableCylinder &)
Disallow default bitwise copy construct.
scalar radius2(const point &pt) const
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool hit() const
Is there a hit.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual void getVolumeType(const pointField &, List< volumeType > &) const
Determine type (inside/outside/mixed) for point. unknown if.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
scalarField samples(nIntervals, 0)
virtual ~searchableCylinder()
Destructor.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const Point & rawPoint() const
Return point with no checking.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Pre-declare SubField and related Field type.
const point point1_
'left' point
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr) const
Find nearest point on cylinder.
void setPoint(const Point &p)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
virtual tmp< pointField > points() const
Get the points that define the surface.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
void findLineAll(const point &start, const point &end, pointIndexHit &near, pointIndexHit &far) const
Find intersection with cylinder.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
boundBox calcBounds() const
Return the boundBox of the cylinder.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
void clear()
Clear the list, i.e. set size to zero.
A bounding box defined in terms of the points at its extremities.
const dimensionedScalar c
Speed of light in a vacuum.
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
const point point2_
'right' point
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
A normal distribution model.