Go to the documentation of this file.
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),
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.
static word defaultRegion
T getOrDefault(const word &optName, const T &deflt) const
Input from file stream, using an ISstream.
static void addNote(const string ¬e)
Extract command arguments and options from the supplied argc and argv parameters.
Ostream & endl(Ostream &os)
T get(const label index) const
bool readIfPresent(const word &optName, T &val) const
Mesh consisting of general polyhedral cells.
wordList patchTypes(nPatches)
static void addArgument(const string &argName, const string &usage="")
Generic templated field type.
virtual bool write(const bool valid=true) const
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), std::move(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
void removeFiles(const fileName &instanceDir) const
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
wordList patchNames(nPatches)
static const cellModel & ref(const modelType model)
label max(const labelHashSet &set, label maxValue=labelMin)
void exit(const int errNo=1)
label mergePoints(const PointList &points, const scalar mergeTol, const bool verbose, labelList &pointMap, typename PointList::const_reference origin=PointList::value_type::zero)
IOstream & hex(IOstream &io)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
static unsigned int defaultPrecision() noexcept
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Maps a geometry to a set of cell primitives.
Hex block definition used in the cfx converter.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
const word & constant() const
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
bool found(const word &optName) const