93int main(
int argc,
char *argv[])
97 "Reads CCM files as written by PROSTAR/STARCCM and writes an OPENFOAM "
98 " polyMesh. Multi-region support for PROSTAR meshes should be stable."
99 " Multi-region merging for STARCCM meshes will not always be"
103 argList::noParallel();
104 argList::addArgument(
"ccm-file",
"The input .ccm or .ccmg file");
105 argList::addBoolOption
108 "Write in ASCII format instead of binary"
110 argList::addBoolOption
113 "Re-export mesh in CCM format for post-processing"
115 argList::addBoolOption
118 "List some information about the geometry"
124 "Use specified remapping dictionary instead of <constant/remapping>"
130 "Provide alternative base name when re-exporting (implies -export). "
131 "Default is <meshExport>."
133 argList::addBoolOption
136 "Remove any baffles by merging the faces"
138 argList::addBoolOption
141 "Merge in-place interfaces"
143 argList::addBoolOption
146 "Use numbered names (eg, patch_0, zone_0) only"
152 "Geometry scaling factor - default is 1 (ie, no scaling)"
154 argList::addBoolOption
157 "Treat any solid cells present just like fluid cells. "
158 "The default is to remove them."
161 argList::noFunctionObjects();
166 runTime.functionObjects().off();
174 const word ext(exportName.
ext());
176 if (ext ==
"ccm" || ext ==
"ccmg" || ext ==
"ccmp")
178 exportName = exportName.
lessExt();
183 exportName = ccm::writer::defaultMeshName;
197 ? IOstreamOption::ASCII
198 : IOstreamOption::BINARY
202 IOstream::defaultPrecision(
max(10u, IOstream::defaultPrecision()));
219 Info<<
"treating solids like fluids" <<
endl;
233 Info<<
"mesh geometry information:" <<
endl;
234 if (reader.hasGeometry())
236 Info<<
nl <<
"cellTable:" << reader.cellTableInfo()
237 <<
nl <<
"boundaryRegion:" << reader.boundaryTableInfo()
238 <<
nl <<
"interfaces:" << reader.interfaceDefinitionsInfo()
245 : reader.remapMeshInfo(
runTime)
249 <<
"Remapped cellTable:" << reader.cellTableInfo() <<
nl
250 <<
"Remapped boundaryRegion:" << reader.boundaryTableInfo()
261 else if (reader.readGeometry(scaleFactor))
271 Info<<
nl <<
"Bounding box size: " <<
mesh().bounds().span() <<
nl;
276 Info<<
"Number of regions: " << rs.nRegions();
277 if (rs.nRegions() == 1)
284 <<
"**************************************************" <<
nl
285 <<
"** WARNING: the mesh has disconnected regions **" <<
nl
286 <<
"**************************************************" <<
nl;
292 if (exportName.size())
294 const fileName geomName = exportName +
".ccmg";
295 Info<<
nl <<
"Re-exporting geometry as " << geomName <<
nl;
302 <<
"could not read geometry"
Reader/writer for handling ccm files.
streamFormat
Data format (ascii | binary)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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.
const fileName & rootPath() const noexcept
Return root path.
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.
const fileName & globalCaseName() const noexcept
Return global case name.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
bool mergeInterfaces() const
Merge in-place interfaces (default true)
bool useNumberedNames() const
Use numbered names (eg, patch_0, zone_0) instead of human-readable.
bool removeBaffles() const
Remove baffles by merging their respective faces (default false)
bool keepSolid() const
Keep solid regions (default true)
Reads CCM files as written by PROSTAR/STARCCM.
Write OpenFOAM meshes and/or results to CCM format.
void writeGeometry()
Write the mesh.
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .)
word ext() const
Return file name extension (part after last .)
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
word format(conversionProperties.get< word >("format"))
Foam::argList args(argc, argv)