Go to the documentation of this file.
81 packedLst[packedI++] = i;
84 packedLst.setSize(packedI);
99 packedElems[packedI++] = elems[i];
102 packedElems.setSize(packedI);
113 const scalar cosAngle,
114 const scalar sinAngle,
126 bool sameFaceOrder = !((own[f0] == celli) ^ (own[f1] == celli));
130 scalar normalCosAngle = n0 & n1;
134 normalCosAngle = -normalCosAngle;
147 scalar fcCosAngle = n0 & c1c0;
149 if (own[f0] != celli)
151 fcCosAngle = -fcCosAngle;
164 if (normalCosAngle < cosAngle)
185 if (normalCosAngle > cosAngle)
216 const edge&
e = edges[edgeI];
228 for (
const label facei : cFaces)
230 const face&
f = faces[facei];
232 label fp0 =
f.find(
e[0]);
233 label fp1 =
f.find(
e[1]);
269 if (leftI == -1 || rightI == -1)
277 const face& leftF = faces[leftI];
279 label leftV = leftF[(leftFp + 2) % leftF.size()];
281 const face& rightF = faces[rightI];
283 label rightV = rightF[(rightFp + 2) % rightF.size()];
286 loop[0] = ev.vertToEVert(
e[0]);
287 loop[1] = ev.vertToEVert(leftV);
288 loop[2] = ev.vertToEVert(rightV);
289 loop[3] = ev.vertToEVert(
e[1]);
292 loopWeights[0] = -GREAT;
293 loopWeights[1] = -GREAT;
294 loopWeights[2] = -GREAT;
295 loopWeights[3] = -GREAT;
299 cellEdgeWeights.
append(loopWeights);
328 vector planeN = eVec ^ halfNorm;
333 planeN += 0.01*halfNorm;
359 cellEdgeWeights.
append(loopWeights);
401 for (
const label celli : cellsToCut)
403 const labelList& cEdges = cellEdges[celli];
405 for (
const label edgeI : cEdges)
429 bool splitOk =
false;
449 if ((own[f0] == celli) ^ (own[f1] == celli))
452 halfNorm = 0.5*(n0 - n1);
458 halfNorm = 0.5*(n0 + n1);
484 label index = cellLoops.size() - 1;
485 const labelList& loop = cellLoops[index];
486 const scalarField& loopWeights = cellEdgeWeights[index];
494 edgeIsCut[ev.getEdge(
cut)] =
true;
495 edgeWeight[ev.getEdge(
cut)] = loopWeights[i];
499 vertIsCut[ev.getVertex(
cut)] =
true;
517 int main(
int argc,
char *argv[])
521 "Split cells with flat faces"
535 "Split cells from specified cellSet only"
540 "Use geometric cut for hexes as well"
546 "Edge snap tolerance (default 0.2)"
557 const scalar featureAngle =
args.
get<scalar>(1);
562 const bool geometry =
args.
found(
"geometry");
563 const bool overwrite =
args.
found(
"overwrite");
567 Info<<
"Trying to split cells with internal angles > feature angle\n" <<
nl
568 <<
"featureAngle : " << featureAngle <<
nl
569 <<
"edge snapping tol : " << edgeTol <<
nl;
572 Info<<
"candidate cells : cellSet " <<
args[
"set"] <<
nl;
576 Info<<
"candidate cells : all cells" <<
nl;
580 Info<<
"hex cuts : geometric; using edge tolerance" <<
nl;
584 Info<<
"hex cuts : topological; cut to opposite edge" <<
nl;
610 for (label celli = 0; celli <
mesh.
nCells(); celli++)
612 cellsToCut.insert(celli);
637 cutSet.insert(cutCells);
640 Info<<
"Writing " << cutSet.size() <<
" cells to cut to cellSet "
641 << cutSet.instance()/cutSet.local()/cutSet.name()
654 Info<<
"Actually cut cells:" << cuts.nLoops() <<
nl <<
endl;
656 if (cuts.nLoops() == 0)
662 forAll(cuts.cellLoops(), celli)
664 if (cuts.cellLoops()[celli].size())
668 cellsToCut.erase(celli);
679 cutter.setRefinement(cuts, meshMod);
691 if (morphMap().hasMotionPoints())
697 cutter.updateMesh(morphMap());
700 cellsToCut.updateMesh(morphMap());
702 Info<<
"Remaining:" << cellsToCut.size() <<
endl;
virtual const pointField & points() const
A class for handling words, derived from Foam::string.
virtual bool write(const bool valid=true) const
T getOrDefault(const word &optName, const T &deflt) const
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
dimensionedScalar sin(const dimensionedScalar &ds)
static word timeName(const scalar t, const int precision=precision_)
const cellList & cells() const
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static void addNote(const string ¬e)
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Unit conversion functions.
virtual tmp< scalarField > movePoints(const pointField &)
Ostream & endl(Ostream &os)
const edgeList & edges() const
Vector< Cmpt > & normalise()
DynamicList< T, SizeMin > & shrink()
T get(const label index) const
Mesh consisting of general polyhedral cells.
label nPoints() const noexcept
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
static void addArgument(const string &argName, const string &usage="")
const fileName & pointsInstance() const
static void noFunctionObjects(bool addWithOption=false)
label nCells() const noexcept
Generic templated field type.
const labelListList & cellEdges() const
DynamicList< T, SizeMin > & append(const T &val)
virtual const labelList & faceOwner() const
Implementation of cellLooper. Does pure geometric cut through cell.
static const cellModel & ref(const modelType model)
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
virtual bool write(const token &tok)=0
errorManip< error > abort(error &err)
A collection of cell labels.
const cellShapeList & cellShapes() const
static void setSnapTol(const scalar tol)
constexpr scalar degToRad(const scalar deg) noexcept
IOstream & hex(IOstream &io)
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual const faceList & faces() const
#define FatalErrorInFunction
Description of cell after splitting. Contains cellLabel and pointers to cells it it split in....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const vectorField & faceCentres() const
const dimensionedScalar e
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
Maps a geometry to a set of cell primitives.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
A cell is defined as a list of faces with extra functionality.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
bool found(const word &optName) const
Description of cuts across cells.
dimensionedScalar cos(const dimensionedScalar &ds)
const vectorField & faceAreas() const
Cell-face mesh analysis engine.