46 void Foam::ensightSurfaceWriter::Write
48 const fileName& outputDir,
49 const fileName& surfaceName,
52 const word& fieldName,
53 const Field<Type>& values,
54 const bool isNodeValues
57 if (!
isDir(outputDir/fieldName))
59 mkDir(outputDir/fieldName);
63 const scalar timeValue = 0.0;
65 OFstream osCase(outputDir/fieldName/surfaceName +
".case");
68 outputDir/fieldName/surfaceName +
".000.mesh",
73 outputDir/fieldName/surfaceName +
".000." + fieldName,
79 Info<<
"Writing case file to " << osCase.name() <<
endl;
84 <<
"type: ensight gold" << nl
87 <<
"model: 1 " << osGeom.
name().
name() << nl
91 << word(isNodeValues ?
"node:" :
"element:") <<
setw(10) << 1
93 <<
" " << surfaceName.c_str() <<
".***." << fieldName << nl
96 <<
"time set: 1" << nl
97 <<
"number of steps: 1" << nl
98 <<
"filename start number: 0" << nl
99 <<
"filename increment: 1" << nl
100 <<
"time values:" << nl
104 ensightPartFaces ensPart(0, osGeom.name().name(),
points, faces,
true);
109 ensPart.writeField(osField, values, isNodeValues);
146 if (!
isDir(outputDir))
152 const scalar timeValue = 0.0;
154 OFstream osCase(outputDir/surfaceName +
".case");
157 outputDir/surfaceName +
".000.mesh",
163 Info<<
"Writing case file to " << osCase.
name() <<
endl;
168 <<
"type: ensight gold" << nl
171 <<
"model: 1 " << osGeom.
name().
name() << nl
174 <<
"time set: 1" << nl
175 <<
"number of steps: 1" << nl
176 <<
"filename start number: 0" << nl
177 <<
"filename increment: 1" << nl
178 <<
"time values:" << nl
A class for handling file names.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Specialized Ensight output with extra geometry file header.
const fileName & name() const
Return the name of the stream.
virtual ~ensightSurfaceWriter()
Destructor.
IOstream::streamFormat writeFormat_
Write format.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
vectorField pointField
pointField is a vectorField.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
virtual const fileName & name() const
Return the name of the stream.
Convenience macros for instantiating writer methods for surfaceWriter classes.
word name() const
Return file name (part beyond last /)
streamFormat
Enumeration for the format of data in the stream.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
Istream and Ostream manipulators taking arguments.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
A surfaceWriter for Ensight format.
makeSurfaceWriterType(ensightSurfaceWriter)
An implementation of ensightPart to hold volume mesh faces.
Base class for surface writers.
static const char *const typeName
Omanip< int > setw(const int i)
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces) const
Write single surface geometry to file.
ensightSurfaceWriter(const IOstream::streamFormat writeFormat)
Construct given write format.