61 bool Foam::fileFormats::FIREMeshWriter::writeGeometry(OSstream&
os)
const 90 Info<<
"faces: " << faces.size() <<
endl;
119 bool Foam::fileFormats::FIREMeshWriter::writeSelections(OSstream&
os)
const 133 forAll(mesh_.boundaryMesh(), patchI)
135 const polyPatch&
patch = mesh_.boundaryMesh()[patchI];
136 if (
patch.size() && !isA<processorPolyPatch>(
patch))
140 const word oldName =
patch.name();
144 newName =
"BND_" + oldName;
146 if (usedPatchNames.found(newName))
155 if (usedPatchNames.found(newName))
161 usedPatchNames.set(newName);
168 forAll(mesh_.cellZones(), zoneI)
170 const cellZone& cZone = mesh_.cellZones()[zoneI];
175 const word oldName = cZone.name();
176 word newName = oldName;
178 if (usedPatchNames.found(newName) || usedZoneNames.found(newName))
183 usedZoneNames.set(newName);
184 zoneNames.set(zoneI, newName);
197 forAll(mesh_.cellZones(), zoneI)
199 const cellZone& cZone = mesh_.cellZones()[zoneI];
203 Info<<
"cellZone " << zoneI
204 <<
" (size: " << cZone.size()
205 <<
") name: " << zoneNames[zoneI] <<
nl;
207 putFireString(
os, zoneNames[zoneI]);
211 putFireLabels(
os, cZone);
217 forAll(mesh_.boundaryMesh(), patchI)
219 const polyPatch&
patch = mesh_.boundaryMesh()[patchI];
220 if (
patch.size() && !isA<processorPolyPatch>(
patch))
222 Info<<
"patch " << patchI
223 <<
" (start: " <<
patch.start() <<
" size: " <<
patch.size()
244 Foam::fileFormats::FIREMeshWriter::FIREMeshWriter
247 const scalar scaleFactor
268 fileName baseName(meshName);
269 if (baseName.empty())
273 const Time& t = mesh_.time();
278 && t.timeName() != t.constant()
281 baseName +=
"_" + t.timeName();
286 const word ext(baseName.ext());
292 if (fireFileType == FIRECore::fileExt3d::POLY_ASCII)
294 streamOpt = IOstreamOption
300 else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY)
302 streamOpt = IOstreamOption
308 else if (fireFileType == FIRECore::fileExt3d::POLY_ASCII_Z)
310 streamOpt = IOstreamOption
316 else if (fireFileType == FIRECore::fileExt3d::POLY_BINARY_Z)
318 streamOpt = IOstreamOption
326 baseName.remove_ext();
342 autoPtr<OFstream> osPtr(
new OFstream(filename, streamOpt));
346 Info<<
"Writing output to ";
350 Info<<
'"' << osPtr().name().c_str() <<
"z\"" <<
endl;
358 writeSelections(osPtr());
366 Foam::mv(filename +
".gz", filename +
"z");
371 Info<<
"could not open file for writing " << filename <<
endl;
Write OpenFOAM meshes and/or results to another CFD format.
Generic output stream using a standard (STL) stream.
static string defaultMeshName
Specify a default mesh name.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
A class for handling file names.
List< cell > cellList
List of cell.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
A simple container for options an IOstream can normally have.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
wordList patchNames(nPatches)
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
virtual const faceList & faces() const
Return raw faces.
scalar scaleFactor_
Scaling factor for points (eg, [m] -> [mm])
OBJstream os(runTime.globalPath()/outputName)
compressionType compression() const noexcept
Get the stream compression.
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
streamFormat format() const noexcept
Get the current stream format.
const polyMesh & mesh_
Mesh reference.