62int main(
int argc,
char *argv[])
66 "Plot3d mesh (ascii/formatted format) converter"
68 argList::noParallel();
69 argList::addArgument(
"PLOT3D geom file");
74 "Geometry scaling factor - default is 1"
76 argList::addBoolOption
81 argList::addBoolOption
84 "Input is a single block"
90 "Use when converting a 2-D mesh (applied before scale)"
102 const bool readBlank = !
args.
found(
"noBlank");
103 const bool singleBlock =
args.
found(
"singleBlock");
104 scalar twoDThickness = -1;
107 Info<<
"Reading 2D case by extruding points by " << twoDThickness
108 <<
" in z direction." <<
nl <<
endl;
127 plot3dFile >> nblock;
130 Info<<
"Reading " << nblock <<
" blocks" <<
endl;
139 if (twoDThickness > 0)
142 plot3dFile >> nx >> ny;
147 plot3dFile >> nx >> ny >> nz;
150 Info<<
"block " << blockI <<
" nx:" << nx
151 <<
" ny:" << ny <<
" nz:" << nz <<
endl;
153 blocks.set(blockI,
new hexBlock(nx, ny, nz));
157 Info<<
"Reading block points" <<
endl;
163 Info<<
"block " << blockI <<
":" <<
nl;
164 blocks[blockI].readPoints(readBlank, twoDThickness, plot3dFile);
165 sumPoints += blocks[blockI].nBlockPoints();
166 nMeshCells += blocks[blockI].nBlockCells();
175 const pointField& blockPoints = blocks[blockI].points();
176 blockOffsets[blockI] = sumPoints;
179 points[sumPoints++] = blockPoints[i];
197 Info<<
"Merged points within " << SMALL <<
" distance. Merged from "
198 << oldToNew.
size() <<
" down to " << newPoints.
size()
199 <<
" points." <<
endl;
202 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
204 newPoints *= scaleFactor;
213 label nCreatedCells = 0;
219 forAll(curBlockCells, blockCelli)
221 labelList cellPoints(curBlockCells[blockCelli].size());
223 forAll(cellPoints, pointi)
228 curBlockCells[blockCelli][pointi]
229 + blockOffsets[blockI]
240 Info<<
"Creating boundary patches" <<
endl;
253 polyMesh::defaultRegion,
257 std::move(newPoints),
268 IOstream::defaultPrecision(
max(10u, IOstream::defaultPrecision()));
Input from file stream, using an ISstream.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void size(const label n)
Older name for setAddressableSize.
Extract command arguments and options from the supplied argc and argv parameters.
T get(const label index) const
Get a value from the argument at index.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Maps a geometry to a set of cell primitives.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
A class for handling file names.
Hex block definition used in the cfx converter.
Mesh consisting of general polyhedral cells.
A class for handling words, derived from Foam::string.
Geometric merging of points. See below.
label mergePoints(const PointList &points, const IndexerOp &indexer, const label nSubPoints, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol, const bool verbose)
Implementation detail for Foam::mergePoints.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char nl
The newline '\n' character (0x0a)
wordList patchTypes(nPatches)
wordList patchNames(nPatches)
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), std::move(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.