56 void Foam::nastranSurfaceWriter::formatOS(
OFstream& os)
const 61 os.
setf(ios_base::uppercase);
87 void Foam::nastranSurfaceWriter::writeCoord
105 switch (writeFormat_)
109 os.
setf(ios_base::left);
110 os <<
setw(8) <<
"GRID";
111 os.
unsetf(ios_base::left);
112 os.
setf(ios_base::right);
113 os <<
setw(8) << pointI + 1
119 os.
unsetf(ios_base::right);
125 os.
setf(ios_base::left);
126 os <<
setw(8) <<
"GRID*";
127 os.
unsetf(ios_base::left);
128 os.
setf(ios_base::right);
129 os <<
setw(16) << pointI + 1
134 os.
unsetf(ios_base::right);
135 os.
setf(ios_base::left);
136 os <<
setw(8) <<
"*";
137 os.
unsetf(ios_base::left);
138 os.
setf(ios_base::right);
139 os <<
setw(16) << p.
z()
141 os.
unsetf(ios_base::right);
161 "void Foam::nastranSurfaceWriter::writeCoord" 171 void Foam::nastranSurfaceWriter::writeFace
173 const word& faceType,
193 switch (writeFormat_)
197 os.
setf(ios_base::left);
198 os <<
setw(8) << faceType;
199 os.
unsetf(ios_base::left);
200 os.
setf(ios_base::right);
201 os <<
setw(8) << nFace++
206 os <<
setw(8) << facePts[i] + 1;
210 os.
unsetf(ios_base::right);
216 os.
setf(ios_base::left);
217 os <<
setw(8) <<
word(faceType +
"*");
218 os.
unsetf(ios_base::left);
219 os.
setf(ios_base::right);
220 os <<
setw(16) << nFace++
225 os <<
setw(16) << facePts[i] + 1;
229 os.
unsetf(ios_base::right);
230 os.
setf(ios_base::left);
231 os <<
setw(8) <<
"*";
232 os.
unsetf(ios_base::left);
233 os.
setf(ios_base::right);
238 os.
unsetf(ios_base::right);
244 os << faceType <<
',' 249 os <<
',' << facePts[i] + 1;
260 "void Foam::nastranSurfaceWriter::writeFace" 274 void Foam::nastranSurfaceWriter::writeGeometry
290 writeCoord(points[pointI], pointI, os);
304 const face&
f = faces[faceI];
308 writeFace(
"CTRIA3", faces[faceI], nFace, os);
309 decomposedFaces[faceI].append(faces[faceI]);
311 else if (f.
size() == 4)
313 writeFace(
"CQUAD4", faces[faceI], nFace, os);
314 decomposedFaces[faceI].append(faces[faceI]);
325 writeFace(
"CTRIA3", triFaces[triI], nFace, os);
326 decomposedFaces[faceI].append(triFaces[triI]);
338 writeFormat_(wfShort),
349 scale_(options.lookupOrDefault(
"scale", 1.0))
351 if (options.
found(
"format"))
360 fieldMap_.insert(fieldSet[i].first(), fieldSet[i].second());
382 if (!
isDir(outputDir))
387 OFstream os(outputDir/surfaceName +
".dat");
395 os <<
"TITLE=OpenFOAM " << surfaceName.c_str() <<
" mesh" <<
nl 397 <<
"BEGIN BULK" <<
nl;
401 writeGeometry(points, faces, decomposedFaces, os);
403 if (!
isDir(outputDir))
408 os <<
"ENDDATA" <<
endl;
nastranSurfaceWriter()
Construct null.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
void unsetf(const ios_base::fmtflags uf)
Unset flags of stream.
Convenience macros for instantiating writer methods for surfaceWriter classes.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
void size(const label)
Override size to be inconsistent with allocated storage.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A face is a list of labels corresponding to mesh vertices.
virtual ~nastranSurfaceWriter()
Destructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual int precision() const
Get precision of output field.
const fileName & name() const
Return the name of the stream.
Base class for surface writers.
Omanip< int > setw(const int i)
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.
errorManip< error > abort(error &err)
Istream and Ostream manipulators taking arguments.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A class for handling file names.
makeSurfaceWriterType(dxSurfaceWriter)
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
IOstream & scientific(IOstream &io)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
static const NamedEnum< writeFormat, 3 > writeFormatNames_