56 static const scalar edgeTol = 1
e-3;
75 static const vector z(0, 0, 1);
77 scalar minOther = great;
78 scalar maxOther = -great;
86 if (isMasterEdge[edgeI])
88 const edge&
e = edges[edgeI];
92 scalar eMag =
mag(eVec);
96 if (
mag(eVec &
x) > 1-edgeTol)
98 minX =
min(minX, eMag);
99 maxX =
max(maxX, eMag);
102 else if (
mag(eVec &
y) > 1-edgeTol)
104 minY =
min(minY, eMag);
105 maxY =
max(maxY, eMag);
108 else if (
mag(eVec & z) > 1-edgeTol)
110 minZ =
min(minZ, eMag);
111 maxZ =
max(maxZ, eMag);
116 minOther =
min(minOther, eMag);
117 maxOther =
max(maxOther, eMag);
140 Info<<
"Mesh edge statistics:" <<
nl;
141 if (minX > great || maxX > -great)
143 Info<<
" x aligned : number:" << nX <<
"\tminLen:" << minX
144 <<
"\tmaxLen:" << maxX <<
nl;
146 if (minY > great || maxY > -great)
148 Info<<
" y aligned : number:" << nY <<
"\tminLen:" << minY
149 <<
"\tmayLen:" << maxY <<
nl;
151 if (minZ > great || maxZ > -great)
153 Info<<
" z aligned : number:" << nZ <<
"\tminLen:" << minZ
154 <<
"\tmazLen:" << maxZ <<
nl;
156 if (minOther > great || maxOther > -great)
158 Info<<
" other : number:" << nEdges - nX - nY - nZ
159 <<
"\tminLen:" << minOther
160 <<
"\tmaxLen:" << maxOther <<
nl;
178 if (meshCutterPtr.
valid())
214 zoneDict.
isDict(
"coordinates")
215 ? zoneDict.
subDict(
"coordinates")
216 : refineDict.
subDict(
"coordinates")
220 Info<<
" total number of cell increased from " << nCells0
226 int main(
int argc,
char *argv[])
251 printEdgeStats(
mesh);
269 Info<<
"3D case; refining all directions" <<
nl <<
endl;
278 refineDict.
add(
"useHexTopology",
"true");
288 Info<<
"2D case; refining in directions y,z\n" <<
endl;
292 else if (dirs.y() == -1)
294 Info<<
"2D case; refining in directions x,z\n" <<
endl;
300 Info<<
"2D case; refining in directions x,y\n" <<
endl;
308 refineDict.
add(
"useHexTopology",
"false");
311 refineDict.
add(
"coordinateSystem",
"global");
316 refineDict.
add(
"globalCoeffs", coeffDict);
318 refineDict.
add(
"geometricCut",
"false");
319 refineDict.
add(
"writeMesh",
"false");
330 const bool hexRef8Refine(refineDict.
lookupOrDefault(
"hexRef8",
false));
339 Info<<
"Refining using hexRef8" <<
nl
349 if (refineDict.
found(
"set"))
369 else if (refineDict.
found(
"zone"))
373 if (refineDict.
isDict(
"zone"))
386 refCells = zg->generate().cZone();
390 <<
" cells in zone " << zg->zoneName()
391 <<
" of type " << zg->type() <<
endl;
395 const word cellZoneName(refineDict.
lookup(
"zone"));
400 <<
" cells in zone " << cellZoneName <<
endl;
414 else if (refineDict.
found(
"zones"))
420 const word&
name = iter().keyword();
434 const labelList refCells(zg->generate().cZone());
438 <<
" cells in zone " << zg->zoneName()
439 <<
" of type " << zg->type() <<
endl;
453 printEdgeStats(
mesh);
459 if (meshCutterPtr.
valid())
461 meshCutterPtr->setInstance(oldInstance);
469 Info<<
"Writing mesh to ";
473 if (meshCutterPtr.
valid())
475 Info<<
"Writing hexRef8 refinement level files to "
477 meshCutterPtr->write();
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
static void addNote(const string &)
Add extra notes for the usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
A collection of cell labels.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) const
Find and return a T, if not found return the given default.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
virtual void topoChange(const polyTopoChangeMap &map)
Update mesh corresponding to the given map.
label nTotalFaces() const
Return total number of faces in decomposed mesh. Not.
label nTotalPoints() const
Return total number of points in decomposed mesh. Not.
label nTotalCells() const
Return total number of cells in decomposed mesh.
Refinement of (split) hexes using polyTopoChange.
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
void setRefinement(const cellCuts &cuts, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
Does multiple pass refinement to refine cells in multiple directions.
Mesh consisting of general polyhedral cells.
const fileName & facesInstance() const
Return the current instance directory for faces.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
const cellZoneList & cellZones() const
Return cell zones.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
const globalMeshData & globalData() const
Return parallel info.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual const pointField & points() const
Return raw points.
void setInstance(const fileName &)
Set the instance for mesh files.
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
A class for handling words, derived from string.
static autoPtr< zoneGenerator > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Select constructed from name, mesh and dictionary.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
int main(int argc, char *argv[])
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Type gMin(const FieldField< Field, Type > &f)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion, const fileName &path=fileName::null)
Type gMax(const FieldField< Field, Type > &f)
Foam::argList args(argc, argv)