Go to the documentation of this file.
27 #include "primitiveMesh.H"
36 const Foam::scalar zeroish = Foam::SMALL;
37 const Foam::scalar positive = Foam::SMALL * 1E3;
55 listSize = cellIdLabels.
size();
58 cutCells_.setSize(listSize);
63 for (
label listI = 0; listI < listSize; ++listI)
69 cellI = cellIdLabels[listI];
72 const labelList& cEdges = cellEdges[cellI];
78 const edge&
e = edges[cEdges[i]];
82 (dotProducts[
e[0]] < zeroish && dotProducts[
e[1]] > positive)
83 || (dotProducts[
e[1]] < zeroish && dotProducts[
e[0]] > positive)
90 cutCells_[cutcellI++] = cellI;
121 const edge&
e = edges[edgeI];
125 (dotProducts[
e[0]] < zeroish && dotProducts[
e[1]] > positive)
126 || (dotProducts[
e[1]] < zeroish && dotProducts[
e[0]] > positive)
130 edgePoint[edgeI] = dynCuttingPoints.size();
139 dynCuttingPoints.
append(p0);
141 else if (
alpha >= 1.0)
143 dynCuttingPoints.
append(p1);
152 edgePoint[edgeI] = -1;
156 this->storedPoints().
transfer(dynCuttingPoints);
165 const label startEdgeI,
170 label edgeI = startEdgeI;
177 faceVerts.
append(edgePoint[edgeI]);
185 label nextEdgeI = -1;
194 label edge2I = fEdges[i];
196 if (edge2I != edgeI && edgePoint[edge2I] != -1)
207 <<
"Did not find closed walk along surface of cell " << cellI
208 <<
" starting from edge " << startEdgeI
209 <<
" in " << nIter <<
" iterations." <<
nl
210 <<
"Collected cutPoints so far:" << faceVerts
223 <<
"Did not find closed walk along surface of cell " << cellI
224 <<
" starting from edge " << startEdgeI
225 <<
" in " << nIter <<
" iterations." <<
nl
226 <<
"Collected cutPoints so far:" << faceVerts
231 }
while (edgeI != startEdgeI);
234 if (faceVerts.size() >= 3)
241 <<
"Did not find closed walk along surface of cell " << cellI
242 <<
" starting from edge " << startEdgeI <<
nl
243 <<
"Collected cutPoints so far:" << faceVerts
254 const bool triangulate,
269 label cellI = cutCells_[i];
274 label startEdgeI = -1;
278 label edgeI = cEdges[cEdgeI];
280 if (edgePoint[edgeI] != -1)
288 if (startEdgeI == -1)
291 <<
"Cannot find cut edge for cut cell " << cellI
296 bool okCut = walkCell
310 if ((
f.normal(cutPoints) &
normal()) < 0)
318 label nTri =
f.triangles(cutPoints, dynCutFaces);
321 dynCutCells.
append(cellI);
327 dynCutCells.
append(cellI);
332 this->storedFaces().transfer(dynCutFaces);
333 cutCells_.transfer(dynCutCells);
351 const bool triangulate,
357 reCut(
mesh, triangulate, cellIdLabels);
367 const bool triangulate,
377 calcCutCells(
mesh, dotProducts, cellIdLabels);
382 intersectEdges(
mesh, dotProducts, edgePoint);
385 walkCellCuts(
mesh, triangulate, edgePoint);
397 MeshStorage::remapFaces(
faceMap);
402 newCutCells[faceI] = cutCells_[
faceMap[faceI]];
417 <<
"Attempted assignment to self"
422 static_cast<plane&
>(*this) = rhs;
virtual const pointField & points() const
Return raw points.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const labelList & cutCells() const
Return List of cells cut by the plane.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
Constructs plane through mesh.
void operator=(const cuttingPlane &)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
static bool walkCell(const primitiveMesh &, const labelUList &edgePoint, const label cellI, const label startEdgeI, DynamicList< label > &faceVerts)
Walk circumference of cell, starting from startEdgeI crossing.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
void clear()
Clear the addressed list, i.e. set the size to zero.
errorManip< error > abort(error &err)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void setSize(const label)
Reset size of List.
line< point, const point & > linePointRef
Line using referred points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void reCut(const primitiveMesh &, const bool triangulate, const labelUList &cellIdLabels=labelUList::null())
Recut mesh with existing planeDesc, restricted to a list of cells.
virtual void remapFaces(const labelUList &faceMap)
Remap action on triangulation or cleanup.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
Elementary charge.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
label size() const
Return the number of elements in the UList.
void calcCutCells(const primitiveMesh &, const scalarField &dotProducts, const labelUList &cellIdLabels=labelUList::null())
Determine cut cells, possibly restricted to a list of cells.
#define WarningInFunction
Report a warning using Foam::Warning.
void intersectEdges(const primitiveMesh &, const scalarField &dotProducts, List< label > &edgePoint)
Determine intersection points (cutPoints).
void walkCellCuts(const primitiveMesh &mesh, const bool triangulate, const labelUList &edgePoint)
Determine cuts for all cut cells.
A normal distribution model.
cuttingPlane(const plane &)
Construct plane description without cutting.
Cell-face mesh analysis engine.