65 int main(
int argc,
char *argv[])
73 "write block edges and centres as .obj files"
78 "keep the existing files in the polyMesh"
85 " For a given block, the correspondence between the ordering of\n"
86 " vertex labels and face labels is shown below.\n"
87 " For vertex numbering in the sequence 0 to 7 (block, centre):\n"
88 " faces 0 (f0) and 1 are left and right, respectively;\n"
89 " faces 2 and 3 are front and back; \n"
90 " and faces 4 and 5 are bottom and top::\n"
111 const word dictName(
"blockMeshDict");
134 runTime.path()/runTime.constant()
140 if (
exists(polyMeshPath/dictName))
142 Info<<
"Not deleting polyMesh directory " <<
nl
143 <<
" " << polyMeshPath <<
nl
144 <<
" because it contains " << dictName <<
endl;
148 Info<<
"Deleting polyMesh directory" <<
nl
149 <<
" " << polyMeshPath <<
endl;
160 if (!meshDictIO.headerOk())
163 <<
"Cannot find file " << meshDictIO.relativeObjectPath()
168 Info<<
"Creating block mesh from\n "
169 << meshDictIO.relativeObjectPath() <<
endl;
179 fileName objMeshFile(
"blockTopology.obj");
181 OFstream str(runTime.path()/objMeshFile);
183 Info<<
nl <<
"Dumping block structure as Lightwave obj format"
184 <<
" to " << objMeshFile <<
endl;
186 blocks.writeTopology(str);
191 fileName objCcFile(
"blockCentres.obj");
193 OFstream str(runTime.path()/objCcFile);
195 Info<<
nl <<
"Dumping block centres as Lightwave obj format"
196 <<
" to " << objCcFile <<
endl;
198 const polyMesh& topo = blocks.topology();
202 forAll(cellCentres, celli)
205 const point& cc = cellCentres[celli];
207 str <<
"v " << cc.
x() <<
' ' << cc.
y() <<
' ' << cc.
z() <<
nl;
217 Info<<
nl <<
"Creating polyMesh from blockMesh" <<
endl;
230 clone(blocks.points()),
241 if (meshDict.found(
"mergePatchPairs"))
245 meshDict.lookup(
"mergePatchPairs")
248 if (patchPairNames.size())
257 Info<<
nl <<
"No patch pairs to merge" <<
endl;
260 label nZones = blocks.numZonedBlocks();
280 const block&
b = blocks[blockI];
282 const word& zoneName =
b.zoneName();
290 if (iter == zoneMap.end())
294 Info<<
" " << zoneI <<
'\t' << zoneName <<
endl;
296 zoneMap.insert(zoneName, zoneI);
305 zoneCells[zoneI].append(celli++);
310 celli += blockCells.
size();
319 label zoneI = iter();
324 zoneCells[zoneI].
shrink(),
339 bool hasCyclic =
false;
351 Info<<
nl <<
"Detected cyclic patches; ordering boundary faces"
355 meshMod.changeMesh(
mesh);
369 <<
"Failed writing polyMesh."
378 Info<<
"----------------" <<
nl
379 <<
"Mesh Information" <<
nl
380 <<
"----------------" <<
nl
387 Info<<
"----------------" <<
nl
389 <<
"----------------" <<
nl;
396 <<
" (start: " <<
p.start()
397 <<
" size: " <<
p.size()
398 <<
") 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.
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.
static void removeOption(const word &opt)
Remove option from validOptions and from optionUsage.
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.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
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.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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
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
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.
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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Foam::argList args(argc, argv)