61bool Foam::fileFormats::FIREMeshWriter::writeGeometry(OSstream&
os)
const
90 Info<<
"faces: " << faces.size() <<
endl;
119bool Foam::fileFormats::FIREMeshWriter::writeSelections(OSstream&
os)
const
133 forAll(mesh_.boundaryMesh(), patchI)
135 const polyPatch&
patch = mesh_.boundaryMesh()[patchI];
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];
222 Info<<
"patch " << patchI
223 <<
" (start: " <<
patch.start() <<
" size: " <<
patch.size()
244Foam::fileFormats::FIREMeshWriter::FIREMeshWriter
247 const scalar scaleFactor
250 meshWriter(
mesh, 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());
294 streamOpt = IOstreamOption
302 streamOpt = IOstreamOption
310 streamOpt = IOstreamOption
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;
A simple container for options an IOstream can normally have.
compressionType compression() const noexcept
Get the stream compression.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
@ UNCOMPRESSED
compression = false
@ COMPRESSED
compression = true
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Generic output stream using a standard (STL) stream.
const word & constant() const noexcept
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr).
A class for handling file names.
bool remove_ext()
Remove extension, returning true if string changed.
word ext() const
Return file name extension (part after last .).
scalar scaleFactor_
Scaling factor for points (eg, [m] -> [mm]).
static string defaultMeshName
Specify a default mesh name.
const polyMesh & mesh_
Mesh reference.
Mesh consisting of general polyhedral cells.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
const std::string patch
OpenFOAM patch number as a std::string.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
wordList patchNames(nPatches)
#define forAll(list, i)
Loop across all elements in list.