62 int main(
int argc,
char *argv[])
66 "Plot3d mesh (ascii/formatted format) converter" 74 "Geometry scaling factor - default is 1" 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;
257 std::move(newPoints),
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
IOstream & hex(IOstream &io)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
wordList patchTypes(nPatches)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), std::move(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
#define forAll(list, i)
Loop across all elements in list.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
label mergePoints(const PointList &points, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol=SMALL, const bool verbose=false)
Calculate merge mapping, preserving the original point order. All points closer/equal mergeTol are to...
void removeFiles(const fileName &instanceDir) const
Remove all files from mesh instance.
A class for handling words, derived from Foam::string.
static word defaultRegion
Return the default region name.
Extract command arguments and options from the supplied argc and argv parameters. ...
wordList patchNames(nPatches)
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
const word & constant() const noexcept
Return constant name.
Input from file stream, using an ISstream.
Geometric merging of points. See below.
T get(const label index) const
Get a value from the argument at index.
Hex block definition used in the cfx converter.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Maps a geometry to a set of cell primitives.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
Check the parsed command-line for mandatory arguments and that all the options are correct...
bool found(const word &optName) const
Return true if the named option is found.