52const Foam::scalar Foam::geomCellLooper::pointEqualTol_ = 1
e-3;
56Foam::scalar Foam::geomCellLooper::snapTol_ = 0.1;
63 scalar minLen = GREAT;
69 const edge&
e =
mesh().
edges()[pEdges[pEdgeI]];
79bool Foam::geomCellLooper::cutEdge
81 const plane& cutPlane,
90 scalar
s = cutPlane.normalIntersect(pts[
e.start()],
e.vec(pts));
92 if ((
s > -pointEqualTol_) && (
s < 1 + pointEqualTol_))
109Foam::label Foam::geomCellLooper::snapToVert
122 else if (weight > (1-tol))
137 scalar nComp =
n & base;
139 if (
mag(nComp) > 0.8)
148 if (
mag(nComp) > 0.8)
173bool Foam::geomCellLooper::edgeEndsCut
179 label edgeI = getEdge(loop[index]);
183 const label prevCut = loop[loop.rcIndex(index)];
184 const label nextCut = loop[loop.fcIndex(index)];
186 if (!isEdge(prevCut) && !isEdge(nextCut))
190 label v0 = getVertex(prevCut);
191 label v1 = getVertex(nextCut);
195 (v0 ==
e[0] && v1 ==
e[1])
196 || (v0 ==
e[1] && v1 ==
e[0])
231 plane(
mesh().cellCentres()[celli], refDir),
244 const plane& cutPlane,
281 label edgeI = cellEdges[i];
283 const edge&
e = edges[edgeI];
285 bool useStart =
false;
293 if (checkedPoints.
insert(
e.start()))
295 const scalar typLen = pointEqualTol_ * minEdgeLen(
e.start());
301 localLoop.
append(vertToEVert(
e.start()));
302 localLoopWeights.
append(-GREAT);
310 const scalar typLen = pointEqualTol_ * minEdgeLen(
e.
end());
317 localLoopWeights.
append(-GREAT);
327 if (!useEnd && !useStart)
333 if (cutEdge(cutPlane, edgeI, cutWeight))
336 label cutVertI = snapToVert(snapTol_, edgeI, cutWeight);
341 localLoop.
append(edgeToEVert(edgeI));
342 localLoopWeights.
append(cutWeight);
349 label
cut = vertToEVert(cutVertI);
353 localLoop.
append(vertToEVert(cutVertI));
354 localLoopWeights.
append(-GREAT);
361 if (localLoop.
size() <= 2)
367 localLoopWeights.
shrink();
376 loopPoints[i] = coord(localLoop[i], localLoopWeights[i]);
377 ctr += loopPoints[i];
379 ctr /= localLoop.
size();
384 getBase(cutPlane.
normal(), e0, e1);
408 loop[i] = localLoop[indices[i]];
409 loopWeights[i] = localLoopWeights[indices[i]];
414 bool filterLoop =
false;
420 if (isEdge(
cut) && edgeEndsCut(loop, i))
439 if (isEdge(
cut) && edgeEndsCut(loop, i))
445 filteredLoop[filterI] = loop[i];
446 filteredLoopWeights[filterI] = loopWeights[i];
451 filteredLoopWeights.
setSize(filterI);
454 loopWeights.
transfer(filteredLoopWeights);
462 Pout<<
"At angle:" << sortedAngles[i] <<
endl
465 writeCut(
Pout, loop[i], loopWeights[i]);
467 Pout<<
" coord:" << coord(loop[i], loopWeights[i]);
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void append(const T &val)
Copy append an element to the end of this list.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
void transfer(List< T > &list)
void setSize(const label n)
Alias for resize()
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const noexcept
Return the list of sorted indices. Updated every sort.
void sort()
Forward (stable) sort the list (if changed after construction).
bool found(const T &val, label pos=0) const
True if the value if found in the list.
iterator end() noexcept
Return an iterator to end traversing the UList.
void size(const label n)
Older name for setAddressableSize.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
scalar minEdgeLen() const
Return the minEdgeLen.
const polyMesh & mesh() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Implementation of cellLooper. Does pure geometric cut through cell.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
scalar distance(const point &p) const
Return distance (magnitude) from the given point to the plane.
const vector & normal() const noexcept
The plane unit normal.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & cellEdges() const
const cellList & cells() const
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
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))
scalar pseudoAngle(const vector &e0, const vector &e1, const vector &vec)
Estimate angle of vec in coordinate system (e0, e1, e0^e1).
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.