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);
165 void Foam::nastranSurfaceWriter::writeFace
167 const word& faceType,
187 switch (writeFormat_)
191 os.
setf(ios_base::left);
192 os <<
setw(8) << faceType;
193 os.
unsetf(ios_base::left);
194 os.
setf(ios_base::right);
195 os <<
setw(8) << nFace++
200 os <<
setw(8) << facePts[i] + 1;
204 os.
unsetf(ios_base::right);
210 os.
setf(ios_base::left);
211 os <<
setw(8) <<
word(faceType +
"*");
212 os.
unsetf(ios_base::left);
213 os.
setf(ios_base::right);
214 os <<
setw(16) << nFace++
219 os <<
setw(16) << facePts[i] + 1;
223 os.
unsetf(ios_base::right);
224 os.
setf(ios_base::left);
225 os <<
setw(8) <<
"*";
226 os.
unsetf(ios_base::left);
227 os.
setf(ios_base::right);
232 os.
unsetf(ios_base::right);
238 os << faceType <<
',' 243 os <<
',' << facePts[i] + 1;
260 void Foam::nastranSurfaceWriter::writeGeometry
276 writeCoord(points[pointi], pointi, os);
290 const face&
f = faces[facei];
294 writeFace(
"CTRIA3", faces[facei], nFace, os);
295 decomposedFaces[facei].append(faces[facei]);
297 else if (f.
size() == 4)
299 writeFace(
"CQUAD4", faces[facei], nFace, os);
300 decomposedFaces[facei].append(faces[facei]);
311 writeFace(
"CTRIA3", triFaces[triI], nFace, os);
312 decomposedFaces[facei].append(triFaces[triI]);
324 writeFormat_(wfShort),
335 scale_(options.lookupOrDefault(
"scale", 1.0))
337 if (options.
found(
"format"))
346 fieldMap_.insert(fieldSet[i].first(), fieldSet[i].second());
368 if (!
isDir(outputDir))
373 OFstream os(outputDir/surfaceName +
".dat");
381 os <<
"TITLE=OpenFOAM " << surfaceName.c_str() <<
" mesh" <<
nl 383 <<
"BEGIN BULK" <<
nl;
387 writeGeometry(points, faces, decomposedFaces, os);
389 if (!
isDir(outputDir))
394 os <<
"ENDDATA" <<
endl;
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#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 unsetf(const ios_base::fmtflags uf)
Unset flags of stream.
A face is a list of labels corresponding to mesh vertices.
virtual int precision() const
Get precision of output field.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
nastranSurfaceWriter()
Construct null.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~nastranSurfaceWriter()
Destructor.
const fileName & name() const
Return the name of the stream.
Initialise the NamedEnum HashTable from the static list of names.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
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)
errorManip< error > abort(error &err)
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.
makeSurfaceWriterType(ensightSurfaceWriter)
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
static const NamedEnum< writeFormat, 3 > writeFormatNames_
Base class for surface writers.
Omanip< int > setw(const int i)
IOstream & scientific(IOstream &io)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.