41 void Foam::vtkSurfaceWriter::writeGeometry
50 <<
"# vtk DataFile Version 2.0" << nl
51 <<
"sampleSurface" << nl
53 <<
"DATASET POLYDATA" <<
nl;
56 os <<
"POINTS " << points.size() <<
" double" <<
nl;
59 const point& pt = points[pointi];
60 os << float(pt.x()) <<
' ' 61 <<
float(pt.y()) <<
' ' 62 <<
float(pt.z()) << nl;
71 nNodes += faces[facei].size();
74 os <<
"POLYGONS " << faces.size() <<
' ' 75 << faces.size() + nNodes <<
nl;
79 const face&
f = faces[facei];
95 void Foam::vtkSurfaceWriter::writeData
101 os <<
"1 " << values.
size() <<
" float" <<
nl;
117 os << float(values[elemI]);
124 void Foam::vtkSurfaceWriter::writeData
130 os <<
"3 " << values.
size() <<
" float" <<
nl;
134 const vector& v = values[elemI];
135 os << float(v[0]) <<
' ' << float(v[1]) <<
' ' << float(v[2])
142 void Foam::vtkSurfaceWriter::writeData
148 os <<
"1 " << values.
size() <<
" float" <<
nl;
153 os << float(v[0]) <<
nl;
159 void Foam::vtkSurfaceWriter::writeData
165 os <<
"6 " << values.
size() <<
" float" <<
nl;
170 os << float(v[0]) <<
' ' << float(v[1]) <<
' ' << float(v[2])
172 << float(v[3]) <<
' ' << float(v[4]) <<
' ' << float(v[5])
180 void Foam::vtkSurfaceWriter::writeData
186 os <<
"9 " << values.
size() <<
" float" <<
nl;
190 const tensor& v = values[elemI];
191 os << float(v[0]) <<
' ' << float(v[1]) <<
' ' << float(v[2])
193 << float(v[3]) <<
' ' << float(v[4]) <<
' ' << float(v[5])
195 << float(v[6]) <<
' ' << float(v[7]) <<
' ' << float(v[8])
205 void Foam::vtkSurfaceWriter::writeData
211 os <<
"1 " << values.
size() <<
" float" <<
nl;
215 os << float(0) <<
nl;
221 void Foam::vtkSurfaceWriter::writeTemplate
227 const word& fieldName,
229 const bool isNodeValues,
233 if (!
isDir(outputDir))
238 OFstream os(outputDir/fieldName +
'_' + surfaceName +
".vtk");
242 Info<<
"Writing field " << fieldName <<
" to " << os.
name() <<
endl;
245 writeGeometry(os, points, faces);
257 os << values.
size() << nl
258 <<
"FIELD attributes 1" << nl
291 if (!
isDir(outputDir))
296 OFstream os(outputDir/surfaceName +
".vtk");
303 writeGeometry(os, points, faces);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~vtkSurfaceWriter()
Destructor.
const fileName & name() const
Return the name of the stream.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component, element access using th ii() member function and the inner-product (dot-product) and outer-product operators.
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?
A class for handling words, derived from string.
Convenience macros for instantiating writer methods for surfaceWriter classes.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
const bool writeData(readBool(pdfDictionary.lookup("writeData")))
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
vtkSurfaceWriter()
Construct null.
vector point
Point is a vector.
A surfaceWriter for VTK legacy format.
makeSurfaceWriterType(ensightSurfaceWriter)
Base class for surface writers.