60 static const scalar edgeTol = 1e-3;
82 scalar minOther = GREAT;
83 scalar maxOther = -GREAT;
89 const edge& e = edges[edgeI];
93 scalar eMag =
mag(eVec);
97 if (
mag(eVec & x) > 1-edgeTol)
99 minX =
min(minX, eMag);
100 maxX =
max(maxX, eMag);
103 else if (
mag(eVec & y) > 1-edgeTol)
105 minY =
min(minY, eMag);
106 maxY =
max(maxY, eMag);
109 else if (
mag(eVec & z) > 1-edgeTol)
111 minZ =
min(minZ, eMag);
112 maxZ =
max(maxZ, eMag);
117 minOther =
min(minOther, eMag);
118 maxOther =
max(maxOther, eMag);
122 Pout<<
"Mesh edge statistics:" << endl
123 <<
" x aligned : number:" << nX <<
"\tminLen:" << minX
124 <<
"\tmaxLen:" << maxX << endl
125 <<
" y aligned : number:" << nY <<
"\tminLen:" << minY
126 <<
"\tmaxLen:" << maxY << endl
127 <<
" z aligned : number:" << nZ <<
"\tminLen:" << minZ
128 <<
"\tmaxLen:" << maxZ << endl
129 <<
" other : number:" << mesh.
nEdges() - nX - nY - nZ
130 <<
"\tminLen:" << minOther
131 <<
"\tmaxLen:" << maxOther << endl <<
endl;
135 int main(
int argc,
char *argv[])
139 "refine cells in multiple directions" 154 runTime.functionObjects().off();
156 const word oldInstance = mesh.pointsInstance();
158 printEdgeStats(mesh);
193 <<
"Cannot open specified refinement dictionary " 198 Info<<
"Refining according to " << dictPath <<
nl <<
endl;
202 else if (!refineAllCells)
224 if (refineDict.
size())
234 refCells =
cells.toc();
245 refCells[celli] = celli;
248 if (mesh.nGeometricD() == 3)
250 Info<<
"3D case; refining all directions" <<
nl <<
endl;
259 refineDict.
add(
"useHexTopology",
"true");
269 Info<<
"2D case; refining in directions y,z\n" <<
endl;
273 else if (dirs.y() == -1)
275 Info<<
"2D case; refining in directions x,z\n" <<
endl;
281 Info<<
"2D case; refining in directions x,y\n" <<
endl;
289 refineDict.
add(
"useHexTopology",
"false");
292 refineDict.
add(
"coordinateSystem",
"global");
297 refineDict.
add(
"globalCoeffs", coeffsDict);
299 refineDict.
add(
"geometricCut",
"false");
300 refineDict.
add(
"writeMesh",
"false");
304 string oldTimeName(runTime.timeName());
319 mesh.setInstance(oldInstance);
330 cellSet newCells(mesh,
"refinedCells", refCells.
size());
332 forAll(oldToNew, oldCelli)
334 const labelList& added = oldToNew[oldCelli];
338 newCells.insert(added[i]);
342 Pout<<
"Writing refined cells (" << newCells.size() <<
") to cellSet " 343 << newCells.instance()/newCells.local()/newCells.
name()
369 "From cells in mesh at " 371 +
" to cells in mesh at " 375 forAll(oldToNew, oldCelli)
377 const labelList& added = oldToNew[oldCelli];
383 newToOld[added[i]] = oldCelli;
389 newToOld[oldCelli] = oldCelli;
393 Info<<
"Writing map from new to old cell to " 394 << newToOld.objectPath() <<
nl <<
endl;
398 printEdgeStats(mesh);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Cell-face mesh analysis engine.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Does multiple pass refinement to refine cells in multiple directions.
void size(const label)
Override size to be inconsistent with allocated storage.
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual const pointField & points() const =0
Return mesh points.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
Vector< scalar > vector
A scalar version of the templated Vector.
label size() const
Return number of elements in list.
const cellList & cells() const
bool add(entry *, bool mergeEntry=false)
Add a new entry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
string & note()
Return non-constant access to the optional note.
bool optionFound(const word &opt) const
Return true if the named option is found.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
virtual const fileName & name() const
Return the name of the stream.
prefixOSstream Pout(cout,"Pout")
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
void setSize(const label)
Reset size of List.
word dictName("noiseDict")
A collection of cell labels.
vector vec(const pointField &) const
Return the vector (end - start)
dimensioned< scalar > mag(const dimensioned< Type > &)
bool headerOk()
Read and check header info.
virtual Ostream & write(const token &)=0
Write next token to stream.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.