Go to the documentation of this file.
52 const Foam::scalar Foam::geomCellLooper::pointEqualTol_ = 1
e-3;
56 Foam::scalar Foam::geomCellLooper::snapTol_ = 0.1;
61 Foam::scalar Foam::geomCellLooper::minEdgeLen(
const label vertI)
const
63 scalar minLen = GREAT;
69 const edge&
e =
mesh().
edges()[pEdges[pEdgeI]];
79 bool 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_))
109 Foam::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)
173 bool 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,
268 label nEstCuts = 2*
mesh().
cells()[celli].size();
281 label edgeI = cellEdges[i];
283 const edge&
e = edges[edgeI];
285 bool useStart =
false;
293 if (!checkedPoints.
found(
e.start()))
295 checkedPoints.
insert(
e.start());
297 scalar typStartLen = pointEqualTol_ * minEdgeLen(
e.start());
303 localLoop.
append(vertToEVert(
e.start()));
304 localLoopWeights.
append(-GREAT);
309 if (!checkedPoints.
found(
e.end()))
313 scalar typEndLen = pointEqualTol_ * minEdgeLen(
e.end());
319 localLoop.
append(vertToEVert(
e.end()));
320 localLoopWeights.
append(-GREAT);
330 if (!useEnd && !useStart)
336 if (cutEdge(cutPlane, edgeI, cutWeight))
339 label cutVertI = snapToVert(snapTol_, edgeI, cutWeight);
344 localLoop.
append(edgeToEVert(edgeI));
345 localLoopWeights.
append(cutWeight);
352 label
cut = vertToEVert(cutVertI);
354 if (!localLoop.found(
cut))
356 localLoop.
append(vertToEVert(cutVertI));
357 localLoopWeights.
append(-GREAT);
364 if (localLoop.size() <= 2)
370 localLoopWeights.
shrink();
379 loopPoints[i] = coord(localLoop[i], localLoopWeights[i]);
380 ctr += loopPoints[i];
382 ctr /= localLoop.size();
387 getBase(cutPlane.
normal(), e0, e1);
401 loop.
setSize(localLoop.size());
402 loopWeights.setSize(loop.size());
407 const labelList& indices = sortedAngles.indices();
411 loop[i] = localLoop[indices[i]];
412 loopWeights[i] = localLoopWeights[indices[i]];
417 bool filterLoop =
false;
423 if (isEdge(
cut) && edgeEndsCut(loop, i))
435 scalarField filteredLoopWeights(loopWeights.size());
442 if (isEdge(
cut) && edgeEndsCut(loop, i))
448 filteredLoop[filterI] = loop[i];
449 filteredLoopWeights[filterI] = loopWeights[i];
453 filteredLoop.setSize(filterI);
454 filteredLoopWeights.setSize(filterI);
457 loopWeights.transfer(filteredLoopWeights);
465 Pout<<
"At angle:" << sortedAngles[i] <<
endl
468 writeCut(
Pout, loop[i], loopWeights[i]);
470 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 (0)
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 ...
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)
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