42 const Foam::scalar Foam::geomCellLooper::pointEqualTol_ = 1e-3;
46 Foam::scalar Foam::geomCellLooper::snapTol_ = 0.1;
62 Foam::scalar Foam::geomCellLooper::minEdgeLen(
const label vertI)
const 64 scalar minLen = GREAT;
70 const edge& e =
mesh().
edges()[pEdges[pEdgeI]];
80 bool Foam::geomCellLooper::cutEdge
82 const plane& cutPlane,
91 scalar s = cutPlane.normalIntersect(pts[e.start()], e.vec(pts));
93 if ((s > -pointEqualTol_) && (s < 1 + pointEqualTol_))
123 else if (weight > (1-tol))
140 scalar nComp = n & base;
142 if (
mag(nComp) > 0.8)
151 if (
mag(nComp) > 0.8)
164 e0 /=
mag(e0) + VSMALL;
178 bool Foam::geomCellLooper::edgeEndsCut
184 label edgeI = getEdge(loop[index]);
188 const label prevCut = loop[loop.rcIndex(index)];
189 const label nextCut = loop[loop.fcIndex(index)];
191 if (!isEdge(prevCut) && !isEdge(nextCut))
195 label v0 = getVertex(prevCut);
196 label v1 = getVertex(nextCut);
200 (v0 == e[0] && v1 == e[1])
201 || (v0 == e[1] && v1 == e[0])
243 plane(
mesh().cellCentres()[celli], refDir),
256 const plane& cutPlane,
293 label edgeI = cellEdges[i];
295 const edge& e = edges[edgeI];
297 bool useStart =
false;
309 scalar typStartLen = pointEqualTol_ * minEdgeLen(e.
start());
316 localLoopWeights.
append(-GREAT);
325 scalar typEndLen = pointEqualTol_ * minEdgeLen(e.
end());
328 if (cutPlane.
distance(points[e.
end()]) < typEndLen)
332 localLoopWeights.
append(-GREAT);
342 if (!useEnd && !useStart)
348 if (cutEdge(cutPlane, edgeI, cutWeight))
351 label cutVertI = snapToVert(snapTol_, edgeI, cutWeight);
357 localLoopWeights.
append(cutWeight);
369 localLoopWeights.
append(-GREAT);
376 if (localLoop.
size() <= 2)
382 localLoopWeights.
shrink();
391 loopPoints[i] =
coord(localLoop[i], localLoopWeights[i]);
392 ctr += loopPoints[i];
394 ctr /= localLoop.
size();
399 getBase(cutPlane.
normal(), e0, e1);
407 vector toCtr(loopPoints[i] - ctr);
420 const labelList& indices = sortedAngles.indices();
424 loop[i] = localLoop[indices[i]];
425 loopWeights[i] = localLoopWeights[indices[i]];
430 bool filterLoop =
false;
436 if (
isEdge(cut) && edgeEndsCut(loop, i))
455 if (
isEdge(cut) && edgeEndsCut(loop, i))
461 filteredLoop[filterI] = loop[i];
462 filteredLoopWeights[filterI] = loopWeights[i];
467 filteredLoopWeights.setSize(filterI);
470 loopWeights.
transfer(filteredLoopWeights);
478 Pout<<
"At angle:" << sortedAngles[i] << endl
483 Pout<<
" coord:" <<
coord(loop[i], loopWeights[i]);
label end() const
Return end vertex label.
#define forAll(list, i)
Loop across all elements in list.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
scalar pseudoAngle(const vector &e0, const vector &e1, const vector &vec)
Estimate angle of vec in coordinate system (e0, e1, e0^e1).
A list that is sorted upon construction or when explicitly requested with the sort() method...
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
virtual ~geomCellLooper()
Destructor.
Vector< scalar > vector
A scalar version of the templated Vector.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
bool insert(const Key &key)
Insert a new entry.
iterator end()
Return an iterator to end traversing the UList.
const cellList & cells() const
Macros for easy insertion into run-time selection tables.
const vector & normal() const
Return plane normal.
virtual const pointField & points() const
Return raw points.
Various functions to operate on Lists.
static label edgeToEVert(const primitiveMesh &mesh, const label edgeI)
Convert edgeI to eVert.
Ostream & writeCut(Ostream &os, const label cut, const scalar) const
Write cut description to Ostream.
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))
const polyMesh & mesh() const
vectorField pointField
pointField is a vectorField.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
scalar distance(const point &p) const
Return distance from the given point to the plane.
static label vertToEVert(const primitiveMesh &mesh, const label vertI)
Convert pointi to eVert.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
const labelListList & pointEdges() const
bool found(const Key &) const
Return true if hashedEntry is found in table.
prefixOSstream Pout(cout,"Pout")
label start() const
Return start vertex label.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const labelListList & cellEdges() const
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
static bool isEdge(const primitiveMesh &mesh, const label eVert)
Is eVert an edge?
void setSize(const label)
Reset size of List.
dimensioned< scalar > mag(const dimensioned< Type > &)
static point coord(const primitiveMesh &, const label cut, const scalar weight)
Return coordinate of cut (uses weight if edgeCut)
Mesh consisting of general polyhedral cells.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.