Go to the documentation of this file.
75 packedLst[packedI++] = i;
78 packedLst.setSize(packedI);
93 packedElems[packedI++] = elems[i];
96 packedElems.setSize(packedI);
107 const scalar cosAngle,
108 const scalar sinAngle,
120 bool sameFaceOrder = !((own[f0] == cellI) ^ (own[
f1] == cellI));
124 scalar normalCosAngle = n0 & n1;
128 normalCosAngle = -normalCosAngle;
136 c1c0 /=
mag(c1c0) + VSMALL;
138 scalar fcCosAngle = n0 & c1c0;
140 if (own[f0] != cellI)
142 fcCosAngle = -fcCosAngle;
155 if (normalCosAngle < cosAngle)
176 if (normalCosAngle > cosAngle)
207 const edge&
e = edges[edgeI];
221 label faceI = cFaces[i];
223 const face&
f = faces[faceI];
262 if (leftI == -1 || rightI == -1)
270 const face& leftF = faces[leftI];
272 label leftV = leftF[(leftFp + 2) % leftF.
size()];
274 const face& rightF = faces[rightI];
276 label rightV = rightF[(rightFp + 2) % rightF.
size()];
279 loop[0] = ev.vertToEVert(
e[0]);
280 loop[1] = ev.vertToEVert(leftV);
281 loop[2] = ev.vertToEVert(rightV);
282 loop[3] = ev.vertToEVert(
e[1]);
285 loopWeights[0] = -GREAT;
286 loopWeights[1] = -GREAT;
287 loopWeights[2] = -GREAT;
288 loopWeights[3] = -GREAT;
292 cellEdgeWeights.
append(loopWeights);
322 vector planeN = eVec ^ halfNorm;
327 planeN += 0.01*halfNorm;
329 planeN /=
mag(planeN);
354 cellEdgeWeights.
append(loopWeights);
400 const label cellI = iter.key();
401 const labelList& cEdges = cellEdges[cellI];
405 label edgeI = cEdges[i];
410 vector n0 = faceAreas[f0];
432 bool splitOk =
false;
452 if ((own[f0] == cellI) ^ (own[
f1] == cellI))
455 halfNorm = 0.5*(n0 - n1);
461 halfNorm = 0.5*(n0 + n1);
487 label index = cellLoops.size() - 1;
488 const labelList& loop = cellLoops[index];
489 const scalarField& loopWeights = cellEdgeWeights[index];
497 edgeIsCut[ev.getEdge(
cut)] =
true;
498 edgeWeight[ev.getEdge(
cut)] = loopWeights[i];
502 vertIsCut[ev.getVertex(
cut)] =
true;
520 int main(
int argc,
char *argv[])
524 "split cells with flat faces"
534 "split cells from specified cellSet only"
539 "use geometric cut for hexes as well"
544 "scalar",
"edge snap tolerance (default 0.2)"
549 runTime.functionObjects().off();
553 const scalar featureAngle =
args.
argRead<scalar>(1);
563 Info<<
"Trying to split cells with internal angles > feature angle\n" <<
nl
564 <<
"featureAngle : " << featureAngle <<
nl
565 <<
"edge snapping tol : " << edgeTol <<
nl;
568 Info<<
"candidate cells : cellSet " <<
args[
"set"] <<
nl;
572 Info<<
"candidate cells : all cells" <<
nl;
576 Info<<
"hex cuts : geometric; using edge tolerance" <<
nl;
580 Info<<
"hex cuts : topological; cut to opposite edge" <<
nl;
635 cutSet.insert(cutCells[i]);
639 Info<<
"Writing " << cutSet.size() <<
" cells to cut to cellSet "
640 << cutSet.instance()/cutSet.local()/cutSet.name()
653 Info<<
"Actually cut cells:" << cuts.nLoops() <<
nl <<
endl;
655 if (cuts.nLoops() == 0)
661 forAll(cuts.cellLoops(), cellI)
663 if (cuts.cellLoops()[cellI].size())
667 cellsToCut.
erase(cellI);
678 cutter.setRefinement(cuts, meshMod);
690 if (morphMap().hasMotionPoints())
696 cutter.updateMesh(morphMap());
709 Info<<
"Writing refined morphMesh to time " << runTime.timeName()
static SLList< string > validArgs
A list of valid (mandatory) arguments.
const cellShapeList & cellShapes
virtual const pointField & points() const
Return raw points.
A class for handling words, derived from string.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
dimensionedScalar sin(const dimensionedScalar &ds)
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 addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Unit conversion functions.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
virtual bool write() const
Write mesh using IO settings from time.
const fileName & pointsInstance() const
Return the current instance directory for points.
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.
const labelListList & cellEdges() const
virtual Ostream & write(const token &)=0
Write next token to stream.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or NULL.
virtual const labelList & faceOwner() const
Return face owner.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Implementation of cellLooper. Does pure geometric cut through cell.
int main(int argc, char *argv[])
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
A collection of cell labels.
const double e
Elementary charge.
const cellShapeList & cellShapes() const
Return cell shapes.
static void setSnapTol(const scalar tol)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
IOstream & hex(IOstream &io)
void setInstance(const fileName &)
Set the instance for mesh files.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Description of cell after splitting. Contains cellLabel and pointers to cells it it split in....
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels.
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
bool insert(const Key &key)
Insert a new entry.
bool optionFound(const word &opt) const
Return true if the named option is found.
T argRead(const label index) const
Read a value from the argument at index.
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, which enables geometric cell data to be calculated witho...
void size(const label)
Override size to be inconsistent with allocated storage.
static void noParallel()
Remove the parallel options.
Foam::argList args(argc, argv)
A cell is defined as a list of faces with extra functionality.
Description of cuts across cells.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)
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 vectorField & faceAreas() const
Cell-face mesh analysis engine.