46 const word& fieldName,
51 const bool geomChanged = (!upToDate_);
72 const int maskWidth = 8;
73 const char* mask =
"data/********/";
77 const fileName baseDir = outputPath_;
80 const scalar timeValue = currTime_.value();
82 const fileName outputFile = baseDir / surfName +
".case";
86 Info<<
"Writing case file to " << outputFile <<
nl;
90 tmp<Field<Type>> tfield = adjustField(fieldName, mergeField(localValues));
98 const meshedSurfRef& surf = adjustSurface();
107 const bool stateChanged =
120 const label
timeIndex = caching_.latestTimeIndex();
121 const label geomIndex = caching_.latestGeomIndex();
126 const fileName geometryName
135 const fileName dataDir
144 const fileName geomFile(baseDir/geometryName);
147 ensightOutputSurface part
158 Info<<
"Writing geometry to " << geomFile.name() <<
endl;
162 ensightGeoFile osGeom
169 osGeom.beginGeometry();
183 Info<<
"Writing field file to " << osField.name() <<
endl;
189 part.writeData(osField, tfield(), this->isPointData());
205 Info<<
"Writing case file to " << osCase.name() <<
endl;
213 const label tsGeom = caching_.geometryTimeset();
217 <<
"type: ensight gold" <<
nl
226 <<
"model: " << tsGeom <<
" "
227 << mask << geometryName.name() <<
nl;
234 << geometryName.c_str() <<
nl;
242 for (
const entry& dEntry : caching_.fieldsDict())
246 const string varType(subDict.get<
string>(
"type"));
249 subDict.getOrDefault<word>
264 <<
setw(15) << varName <<
' '
265 << mask << ensight::FileName(varName).c_str() <<
nl;
280 caching_.geometries()
284 osCase <<
"# end" <<
nl;
289 OFstream timeStamp(dataDir/
"time");
291 <<
"# timestep time" <<
nl
292 << dataDir.name() <<
' ' << timeValue <<
nl;
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
@ ASCII
"ascii" (normal default)
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
virtual const fileName & name() const override
Read/write access to the name of the stream.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
bool wroteGeom_
Track if geometry has been written since the last open.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
bool upToDate_
The content is up-to-date?
bool verbose_
Additional output verbosity.
instant currTime_
The current time value/name.
scalar timeValue() const
The current time value/name.
fileName outputPath_
The full output directory and file (coords) name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
static const char * geometryName
The name for geometry files: "geometry".
static void setTimeFormat(OSstream &os, IOstreamOption::floatFormat timeFmt, const int timePrec)
Set output time format for ensight case file.
static word padded(const int nwidth, const label index)
Stringified zero-padded integer value of specified width.
static void printTimeset(OSstream &os, const label ts, const scalar timeValue)
Print time-set for ensight case file with a single time.
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
virtual bool write(const token &) override
Writing token does not make sense.
void newline()
Add carriage return to ascii stream.
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information.
void beginGeometry()
Start of geometry information.
A variant of ensightFaces that holds references to contiguous points/faces with its own encapsulated ...
void write(ensightGeoFile &os) const
Write processor-local geometry (serial-only). No beginGeometry() marker.
void writeData(ensightFile &os, const Field< Type > &fld, const bool isPointData=false) const
Write a field of face or point values (serial-only).
Specification of a valid Ensight file-name.
Specification of a valid Ensight variable-name.
A keyword and a list of tokens is an 'entry'.
A class for handling file names.
static const fileName null
An empty fileName.
static std::string path(const std::string &str)
Return directory path name (part before last /).
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Implements a meshed surface by referencing another meshed surface or faces/points components.
virtual const pointField & points() const
The points used for the surface.
virtual const faceList & faces() const
The faces used for the surface.
bool wroteGeom_
Track if geometry has been written since the last open.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).
static const char *const typeName
The type name used in ensight case files.