Go to the documentation of this file.
45 const Foam::scalar Foam::geomCellLooper::pointEqualTol_ = 1
e-3;
49 Foam::scalar Foam::geomCellLooper::snapTol_ = 0.1;
65 Foam::scalar Foam::geomCellLooper::minEdgeLen(
const label vertI)
const
67 scalar minLen = GREAT;
73 const edge&
e =
mesh().
edges()[pEdges[pEdgeI]];
83 bool Foam::geomCellLooper::cutEdge
85 const plane& cutPlane,
94 scalar
s = cutPlane.normalIntersect(pts[
e.start()],
e.vec(pts));
96 if ((
s > -pointEqualTol_) && (
s < 1 + pointEqualTol_))
126 else if (weight > (1-tol))
141 scalar nComp =
n & base;
143 if (
mag(nComp) > 0.8)
152 if (
mag(nComp) > 0.8)
177 bool Foam::geomCellLooper::edgeEndsCut
183 label edgeI = getEdge(loop[index]);
187 const label prevCut = loop[loop.rcIndex(index)];
188 const label nextCut = loop[loop.fcIndex(index)];
190 if (!isEdge(prevCut) && !isEdge(nextCut))
194 label v0 = getVertex(prevCut);
195 label v1 = getVertex(nextCut);
199 (v0 ==
e[0] && v1 ==
e[1])
200 || (v0 ==
e[1] && v1 ==
e[0])
242 plane(
mesh().cellCentres()[celli], refDir),
255 const plane& cutPlane,
292 label edgeI = cellEdges[i];
294 const edge&
e = edges[edgeI];
296 bool useStart =
false;
304 if (!checkedPoints.
found(
e.start()))
306 checkedPoints.
insert(
e.start());
308 scalar typStartLen = pointEqualTol_ * minEdgeLen(
e.start());
314 localLoop.
append(vertToEVert(
e.start()));
315 localLoopWeights.
append(-GREAT);
320 if (!checkedPoints.
found(
e.end()))
324 scalar typEndLen = pointEqualTol_ * minEdgeLen(
e.end());
330 localLoop.
append(vertToEVert(
e.end()));
331 localLoopWeights.
append(-GREAT);
341 if (!useEnd && !useStart)
347 if (cutEdge(cutPlane, edgeI, cutWeight))
350 label cutVertI = snapToVert(snapTol_, edgeI, cutWeight);
355 localLoop.
append(edgeToEVert(edgeI));
356 localLoopWeights.
append(cutWeight);
365 if (!localLoop.found(
cut))
367 localLoop.
append(vertToEVert(cutVertI));
368 localLoopWeights.
append(-GREAT);
375 if (localLoop.size() <= 2)
381 localLoopWeights.
shrink();
390 loopPoints[i] = coord(localLoop[i], localLoopWeights[i]);
391 ctr += loopPoints[i];
393 ctr /= localLoop.size();
398 getBase(cutPlane.
normal(), e0, e1);
412 loop.
setSize(localLoop.size());
413 loopWeights.setSize(loop.size());
418 const labelList& indices = sortedAngles.indices();
422 loop[i] = localLoop[indices[i]];
423 loopWeights[i] = localLoopWeights[indices[i]];
428 bool filterLoop =
false;
434 if (isEdge(
cut) && edgeEndsCut(loop, i))
446 scalarField filteredLoopWeights(loopWeights.size());
453 if (isEdge(
cut) && edgeEndsCut(loop, i))
459 filteredLoop[filterI] = loop[i];
460 filteredLoopWeights[filterI] = loopWeights[i];
464 filteredLoop.setSize(filterI);
465 filteredLoopWeights.setSize(filterI);
468 loopWeights.transfer(filteredLoopWeights);
476 Pout<<
"At angle:" << sortedAngles[i] <<
endl
479 writeCut(
Pout, loop[i], loopWeights[i]);
481 Pout<<
" coord:" << coord(loop[i], loopWeights[i]);
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
scalar distance(const point &p) const
Return distance (magnitude) from the given point to the plane.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
const vector & normal() const
The plane unit normal.
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))
static constexpr const zero Zero
Global zero.
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
const cellList & cells() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
const labelListList & pointEdges() const
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const labelListList & cellEdges() const
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void transfer(List< T > &list)
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
A list that is sorted upon construction or when explicitly requested with the sort() method.
Macros for easy insertion into run-time selection tables.
scalar pseudoAngle(const vector &e0, const vector &e1, const vector &vec)
Estimate angle of vec in coordinate system (e0, e1, e0^e1).
Vector< scalar > vector
A scalar version of the templated Vector.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
virtual ~geomCellLooper()
Destructor.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Various functions to operate on Lists.
bool found(const Key &key) const
Return true if hashed entry is found in table.
void setSize(const label newSize)
Alias for resize(const label)
defineTypeNameAndDebug(combustionModel, 0)
const polyMesh & mesh() const