Go to the documentation of this file.
60 static const scalar edgeTol = 1
e-3;
80 static const vector z(0, 0, 1);
82 scalar minOther = GREAT;
83 scalar maxOther = -GREAT;
91 if (isMasterEdge.test(edgeI))
93 const edge&
e = edges[edgeI];
97 scalar eMag =
mag(eVec);
101 if (
mag(eVec &
x) > 1-edgeTol)
103 minX =
min(minX, eMag);
104 maxX =
max(maxX, eMag);
107 else if (
mag(eVec &
y) > 1-edgeTol)
109 minY =
min(minY, eMag);
110 maxY =
max(maxY, eMag);
113 else if (
mag(eVec & z) > 1-edgeTol)
115 minZ =
min(minZ, eMag);
116 maxZ =
max(maxZ, eMag);
121 minOther =
min(minOther, eMag);
122 maxOther =
max(maxOther, eMag);
146 Info<<
"Mesh edge statistics:" <<
nl
147 <<
" x aligned : number:" << nX <<
"\tminLen:" << minX
148 <<
"\tmaxLen:" << maxX <<
nl
149 <<
" y aligned : number:" << nY <<
"\tminLen:" << minY
150 <<
"\tmaxLen:" << maxY <<
nl
151 <<
" z aligned : number:" << nZ <<
"\tminLen:" << minZ
152 <<
"\tmaxLen:" << maxZ <<
nl
153 <<
" other : number:" << nEdges - nX - nY - nZ
154 <<
"\tminLen:" << minOther
155 <<
"\tmaxLen:" << maxOther <<
nl <<
endl;
159 int main(
int argc,
char *argv[])
163 "Refine cells in multiple directions"
185 printEdgeStats(
mesh);
191 const bool refineAllCells =
args.
found(
"all");
192 const bool overwrite =
args.
found(
"overwrite");
227 Info<<
"Refining according to ";
229 if (dictPath.empty())
239 else if (dictPath.empty())
241 Info<<
"Refinement dictionary " <<
dictName <<
" not found" <<
nl;
246 <<
"Cannot open specified refinement dictionary "
252 if (refineDict.size())
259 <<
" cells from cellSet "
263 refCells =
cells.toc();
274 Info<<
"3D case; refining all directions" <<
nl <<
endl;
283 refineDict.
add(
"useHexTopology",
"true");
293 Info<<
"2D case; refining in directions y,z\n" <<
endl;
297 else if (dirs.y() == -1)
299 Info<<
"2D case; refining in directions x,z\n" <<
endl;
305 Info<<
"2D case; refining in directions x,y\n" <<
endl;
313 refineDict.
add(
"useHexTopology",
"false");
316 refineDict.
add(
"coordinateSystem",
"global");
321 refineDict.
add(
"globalCoeffs", coeffsDict);
323 refineDict.
add(
"geometricCut",
"false");
324 refineDict.
add(
"writeMesh",
"false");
354 cellSet newCells(
mesh,
"refinedCells", refCells.size());
358 newCells.insert(added);
361 Info<<
"Writing refined cells ("
364 << newCells.instance()/newCells.local()/newCells.name()
388 "From cells in mesh at "
390 +
" to cells in mesh at "
394 forAll(oldToNew, oldCelli)
396 const labelList& added = oldToNew[oldCelli];
400 for (
const label celli : added)
402 newToOld[celli] = oldCelli;
408 newToOld[oldCelli] = oldCelli;
412 Info<<
"Writing map from new to old cell to "
413 << newToOld.objectPath() <<
nl <<
endl;
417 printEdgeStats(
mesh);
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual bool write(const bool valid=true) const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
T getOrDefault(const word &optName, const T &deflt) const
label nGeometricD() const
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
const word dictName("faMeshDefinition")
static word timeName(const scalar t, const int precision=precision_)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static void addNote(const string ¬e)
Ostream & endl(Ostream &os)
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
const edgeList & edges() const
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
label min(const labelHashSet &set, label minValue=labelMax)
Mesh consisting of general polyhedral cells.
const fileName & pointsInstance() const
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static void noFunctionObjects(bool addWithOption=false)
label nCells() const noexcept
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Does multiple pass refinement to refine cells in multiple directions.
label max(const labelHashSet &set, label maxValue=labelMin)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool write(const token &tok)=0
A collection of cell labels.
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
const word & system() const
#define FatalErrorInFunction
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
labelList identity(const label len, label start=0)
entry * add(entry *entryPtr, bool mergeEntry=false)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
bool found(const word &optName) const