Go to the documentation of this file.
60 static const scalar edgeTol = 1
e-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();
158 printEdgeStats(
mesh);
193 <<
"Cannot open specified refinement dictionary "
202 else if (!refineAllCells)
224 if (refineDict.size())
234 refCells =
cells.toc();
245 refCells[cellI] = cellI;
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());
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);
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A class for handling words, derived from string.
A class for handling file names.
static void addNote(const string &)
Add extra notes for the usage information.
#define forAll(list, i)
Loop across all elements in list.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const cellList & cells() const
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
dimensioned< scalar > mag(const dimensioned< Type > &)
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
virtual bool write() const
Write mesh using IO settings from time.
bool headerOk()
Read and check header info.
const word dictName("particleTrackDict")
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.
virtual Ostream & write(const token &)=0
Write next token to stream.
virtual const fileName & name() const
Return the name of the stream.
int main(int argc, char *argv[])
Does multiple pass refinement to refine cells in multiple directions.
A list of keyword definitions, which are a keyword followed by any number of values (e....
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
A collection of cell labels.
const double e
Elementary charge.
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setInstance(const fileName &)
Set the instance for mesh files.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool optionFound(const word &opt) const
Return true if the named option is found.
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::argList args(argc, argv)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Cell-face mesh analysis engine.