65 int main(
int argc,
char *argv[])
72 "write block edges and centres as .obj files"
77 "keep the existing files in the polyMesh"
84 " For a given block, the correspondence between the ordering of\n"
85 " vertex labels and face labels is shown below.\n"
86 " For vertex numbering in the sequence 0 to 7 (block, centre):\n"
87 " faces 0 (f0) and 1 are left and right, respectively;\n"
88 " faces 2 and 3 are front and back; \n"
89 " and faces 4 and 5 are bottom and top::\n"
110 const word dictName(
"blockMeshDict");
133 runTime.path()/runTime.constant()
139 if (
exists(polyMeshPath/dictName))
141 Info<<
"Not deleting polyMesh directory " <<
nl
142 <<
" " << polyMeshPath <<
nl
143 <<
" because it contains " << dictName <<
endl;
147 Info<<
"Deleting polyMesh directory" <<
nl
148 <<
" " << polyMeshPath <<
endl;
159 if (!meshDictIO.headerOk())
162 <<
"Cannot find file " << meshDictIO.relativeObjectPath()
167 Info<<
"Creating block mesh from\n "
168 << meshDictIO.relativeObjectPath() <<
endl;
178 fileName objMeshFile(
"blockTopology.obj");
180 OFstream str(runTime.path()/objMeshFile);
182 Info<<
nl <<
"Dumping block structure as Lightwave obj format"
183 <<
" to " << objMeshFile <<
endl;
185 blocks.writeTopology(str);
190 fileName objCcFile(
"blockCentres.obj");
192 OFstream str(runTime.path()/objCcFile);
194 Info<<
nl <<
"Dumping block centres as Lightwave obj format"
195 <<
" to " << objCcFile <<
endl;
197 const polyMesh& topo = blocks.topology();
201 forAll(cellCentres, celli)
204 const point& cc = cellCentres[celli];
206 str <<
"v " << cc.
x() <<
' ' << cc.
y() <<
' ' << cc.
z() <<
nl;
216 Info<<
nl <<
"Creating polyMesh from blockMesh" <<
endl;
231 clone(blocks.points()),
242 if (meshDict.found(
"mergePatchPairs"))
246 meshDict.lookup(
"mergePatchPairs")
249 const scalar mergeTolerance =
250 meshDict.lookupOrDefault<scalar>(
"mergeTolerance", 1
e-4);
252 if (patchPairNames.size())
261 Info<<
nl <<
"No patch pairs to merge" <<
endl;
264 label nZones = blocks.numZonedBlocks();
284 const block&
b = blocks[blockI];
286 const word& zoneName =
b.zoneName();
294 if (iter == zoneMap.end())
298 Info<<
" " << zoneI <<
'\t' << zoneName <<
endl;
300 zoneMap.insert(zoneName, zoneI);
309 zoneCells[zoneI].append(celli++);
314 celli += blockCells.
size();
323 label zoneI = iter();
328 zoneCells[zoneI].
shrink(),
343 bool hasCyclic =
false;
355 Info<<
nl <<
"Detected cyclic patches; ordering boundary faces"
359 meshMod.changeMesh(
mesh);
373 <<
"Failed writing polyMesh."
382 Info<<
"----------------" <<
nl
383 <<
"Mesh Information" <<
nl
384 <<
"----------------" <<
nl
391 Info<<
"----------------" <<
nl
393 <<
"----------------" <<
nl;
400 <<
" (start: " <<
p.start()
401 <<
" size: " <<
p.size()
402 <<
") name: " <<
p.
name()
#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 shrink()
Shrink the allocated table to approx. twice number of elements.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
const word & name() const
Return name.
static unsigned int defaultPrecision()
Return the default precision.
static unsigned int highPrecision()
Return a high precision for writing data that is.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
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.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
static void noParallel()
Remove the parallel options.
A multi-block mesh generator.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
A bounding box defined in terms of the points at its extremities.
Named list of cell indices representing a sub-set of the mesh.
A class for handling file names.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Class to stitch mesh by merging patch-pairs.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const cellZoneList & cellZones() const
Return cell zones.
static word defaultRegion
Return the default region name.
const fileName & pointsInstance() const
Return the current instance directory for points.
const faceZoneList & faceZones() const
Return face zones.
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
virtual const pointField & points() const
Return raw points.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void setInstance(const fileName &)
Set the instance for mesh files.
A patch is a list of labels that address the faces in the global face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label nInternalFaces() const
const vectorField & cellCentres() const
virtual bool write(const bool write=true) const
Write using setting from DB.
Templated form of IOobject providing type information for file reading and header type checking.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
void setLength(const unitSet &length)
Set the length scale to the given unit set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
const word & regionName(const solver ®ion)
IOobject systemDictIO(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion, const fileName &path=fileName::null)
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
bool rmDir(const fileName &)
Remove a directory and its contents.
Foam::argList args(argc, argv)