Go to the documentation of this file.
72 os.
setf(ios_base::uppercase);
104 os.
setf(ios_base::left);
106 switch (writeFormat_)
110 os <<
setw(8) << keyword;
115 os <<
setw(8) <<
word(keyword +
'*');
125 os.
unsetf(ios_base::left);
148 writeKeyword(
"GRID", os);
152 os.
setf(ios_base::right);
154 writeValue(pointI + 1, os);
158 writeValue(
p.x(), os);
160 writeValue(
p.y(), os);
163 switch (writeFormat_)
167 os <<
setw(8) <<
p.z()
169 os.
unsetf(ios_base::right);
176 os.
unsetf(ios_base::right);
177 writeKeyword(
"", os);
178 os.
setf(ios_base::right);
179 writeValue(
p.z(), os);
186 writeValue(
p.z(), os);
198 os.
unsetf(ios_base::right);
204 const word& faceType,
226 writeKeyword(faceType, os);
230 os.
setf(ios_base::right);
232 writeValue(nFace++, os);
238 switch (writeFormat_)
244 writeValue(facePts[i] + 1, os);
253 writeValue(facePts[i] + 1, os);
257 os.
unsetf(ios_base::right);
258 writeKeyword(
"", os);
259 os.
setf(ios_base::right);
270 writeValue(facePts[i] + 1, os);
283 os.
unsetf(ios_base::right);
303 writeCoord(
points[pointI], pointI, os);
317 const face&
f = faces[faceI];
321 writeFace(
"CTRIA3", faces[faceI], nFace, os);
322 decomposedFaces[faceI].append(faces[faceI]);
324 else if (
f.
size() == 4)
326 writeFace(
"CQUAD4", faces[faceI], nFace, os);
327 decomposedFaces[faceI].append(faces[faceI]);
334 f.triangles(
points, nTri, triFaces);
338 writeFace(
"CTRIA3", triFaces[triI], nFace, os);
339 decomposedFaces[faceI].append(triFaces[triI]);
350 writeKeyword(
"PSHELL", os);
356 for (
label i = 0; i < 7; i++)
364 writeKeyword(
"MAT1", os);
371 for (
label i = 0; i < 7; i++)
387 writeFormat_(wfShort),
396 writeFormat_(wfLong),
398 scale_(options.lookupOrDefault(
"scale", 1.0)),
401 if (options.
found(
"format"))
439 if (!
isDir(outputDir))
444 OFstream os(outputDir/surfaceName +
".nas");
452 os <<
"TITLE=OpenFOAM " << surfaceName.c_str() <<
" mesh" <<
nl
454 <<
"BEGIN BULK" <<
nl;
458 writeGeometry(
points, faces, decomposedFaces, os);
460 if (!
isDir(outputDir))
467 os <<
"ENDDATA" <<
endl;
nastranSurfaceWriter()
Construct null.
word format(conversionProperties.lookup("format"))
A class for handling words, derived from string.
Base class for surface writers.
A class for handling file names.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual ~nastranSurfaceWriter()
Destructor.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
void writeFace(const word &faceType, const labelList &facePts, label &nFace, OFstream &os) const
Write a face element (CTRIA3 or CQUAD4)
void writeCoord(const point &p, const label pointI, OFstream &os) const
Write a co-ordinate.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const NamedEnum< dataFormat, 2 > dataFormatNames_
word separator_
Separator used for free format.
Convenience macros for instantiating writer methods for surfaceWriter classes.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Pre-declare SubField and related Field type.
void writeFooter(Ostream &os) const
Write the footer information.
writeFormat writeFormat_
Write option.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
Istream and Ostream manipulators taking arguments.
A list of keyword definitions, which are a keyword followed by any number of values (e....
errorManip< error > abort(error &err)
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
Omanip< int > setw(const int i)
IOstream & scientific(IOstream &io)
void unsetf(const ios_base::fmtflags uf)
Unset flags of stream.
void formatOS(OFstream &os) const
Initialise the output stream format params.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
virtual int precision() const
Get precision of output field.
void writeKeyword(const word &keyword, Ostream &os) const
Write the formatted keyword to the output stream.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A face is a list of labels corresponding to mesh vertices.
virtual fileName 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 fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
makeSurfaceWriterType(boundaryDataSurfaceWriter)
static const NamedEnum< writeFormat, 3 > writeFormatNames_
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
void writeGeometry(const pointField &points, const faceList &faces, List< DynamicList< face > > &decomposedFaces, OFstream &os) const
Main driver to write the surface mesh geometry.
Initialise the NamedEnum HashTable from the static list of names.
HashTable< dataFormat, word > fieldMap_
Mapping from field name to data format enumeration.