43 void Foam::dxSurfaceWriter::writeGeometry
52 os <<
"# The irregular positions" << nl
53 <<
"object 1 class array type float rank 1 shape 3 items " 54 << points.size() <<
" data follows" <<
nl;
58 const point& pt = points[pointi];
60 os << float(pt.x()) <<
' ' <<
float(pt.y()) <<
' ' <<
float(pt.z())
66 os <<
"# The irregular connections (triangles)" << nl
67 <<
"object 2 class array type int rank 1 shape 3 items " 68 << faces.size() <<
" data follows" <<
nl;
72 const face&
f = faces[facei];
77 <<
"Face " << facei <<
" vertices " << f
78 <<
" is not a triangle." 82 os << f[0] <<
' ' << f[1] <<
' ' << f[2] <<
nl;
84 os <<
"attribute \"element type\" string \"triangles\"" << nl
85 <<
"attribute \"ref\" string \"positions\"" << nl <<
nl;
89 void Foam::dxSurfaceWriter::writeTrailer(Ostream& os,
const bool isNodeValues)
93 os << nl <<
"attribute \"dep\" string \"positions\"" 98 os << nl <<
"attribute \"dep\" string \"connections\"" 102 os <<
"# the field, with three components: \"positions\"," 103 <<
" \"connections\", and \"data\"" << nl
104 <<
"object \"irregular positions irregular " 105 <<
"connections\" class field" 107 <<
"component \"positions\" value 1" << nl
108 <<
"component \"connections\" value 2" << nl
109 <<
"component \"data\" value 3" <<
nl;
118 void Foam::dxSurfaceWriter::writeData
124 os <<
"object 3 class array type float rank 0 items " 125 << values.
size() <<
" data follows" <<
nl;
129 os << float(values[elemI]) <<
nl;
135 void Foam::dxSurfaceWriter::writeData
141 os <<
"object 3 class array type float rank 1 shape 3 items " 142 << values.
size() <<
" data follows" <<
nl;
146 os << float(values[elemI].
x()) <<
' ' 147 << float(values[elemI].
y()) <<
' ' 148 << float(values[elemI].z()) <<
nl;
154 void Foam::dxSurfaceWriter::writeData
160 os <<
"object 3 class array type float rank 0 items " 161 << values.
size() <<
" data follows" <<
nl;
165 os << float(values[elemI][0]) <<
nl;
171 void Foam::dxSurfaceWriter::writeData
177 os <<
"object 3 class array type float rank 2 shape 3 items " 178 << values.
size() <<
" data follows" <<
nl;
184 os << float(t.
xx()) <<
' ' <<
float(t.
xy()) <<
' ' <<
float(t.
xz())
185 <<
float(t.
xy()) <<
' ' <<
float(t.
yy()) <<
' ' <<
float(t.
yz())
186 <<
float(t.
xz()) <<
' ' <<
float(t.
yz()) <<
' ' <<
float(t.
zz())
194 inline void Foam::dxSurfaceWriter::writeData
200 os <<
"object 3 class array type float rank 2 shape 3 items " 201 << values.
size() <<
" data follows" <<
nl;
205 const tensor& t = values[elemI];
207 os << float(t.
xx()) <<
' ' <<
float(t.
xy()) <<
' ' <<
float(t.
xz())
208 <<
float(t.
yx()) <<
' ' <<
float(t.
yy()) <<
' ' <<
float(t.
yz())
209 <<
float(t.
zx()) <<
' ' <<
float(t.
zy()) <<
' ' <<
float(t.
zz())
218 inline void Foam::dxSurfaceWriter::writeData
224 os <<
"object 3 class array type float rank 0 items " 225 << values.
size() <<
" data follows" <<
nl;
229 os << float(0.0) <<
nl;
235 void Foam::dxSurfaceWriter::writeTemplate
241 const word& fieldName,
243 const bool isNodeValues,
247 if (!
isDir(outputDir))
254 outputDir/fieldName +
'_' + surfaceName +
".dx" 259 Info<<
"Writing field " << fieldName <<
" to " << os.
name() <<
endl;
262 writeGeometry(os, points, faces);
264 writeTrailer(os, isNodeValues);
#define forAll(list, i)
Loop across all elements in list.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
A surfaceWriter for OpenDX format.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
vectorField pointField
pointField is a vectorField.
A class for handling words, derived from string.
Convenience macros for instantiating writer methods for surfaceWriter classes.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
dxSurfaceWriter()
Construct null.
virtual ~dxSurfaceWriter()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
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.
vector point
Point is a vector.
Base class for surface writers.
const fileName & name() const
Return the name of the stream.
makeSurfaceWriterType(dxSurfaceWriter)