55 void Foam::nastranSurfaceWriter::formatOS(
OFstream& os)
const 60 os.
setf(ios_base::uppercase);
86 void Foam::nastranSurfaceWriter::writeCoord
108 os.
setf(ios_base::left);
109 os <<
setw(8) <<
"GRID";
110 os.
unsetf(ios_base::left);
111 os.
setf(ios_base::right);
112 os <<
setw(8) << pointi + 1
118 os.
unsetf(ios_base::right);
124 os.
setf(ios_base::left);
125 os <<
setw(8) <<
"GRID*";
126 os.
unsetf(ios_base::left);
127 os.
setf(ios_base::right);
128 os <<
setw(16) << pointi + 1
133 os.
unsetf(ios_base::right);
134 os.
setf(ios_base::left);
135 os <<
setw(8) <<
"*";
136 os.
unsetf(ios_base::left);
137 os.
setf(ios_base::right);
138 os <<
setw(16) << p.
z()
140 os.
unsetf(ios_base::right);
164 void Foam::nastranSurfaceWriter::writeFace
166 const word& faceType,
190 os.
setf(ios_base::left);
191 os <<
setw(8) << faceType;
192 os.
unsetf(ios_base::left);
193 os.
setf(ios_base::right);
194 os <<
setw(8) << nFace++
199 os <<
setw(8) << facePts[i] + 1;
203 os.
unsetf(ios_base::right);
209 os.
setf(ios_base::left);
210 os <<
setw(8) <<
word(faceType +
"*");
211 os.
unsetf(ios_base::left);
212 os.
setf(ios_base::right);
213 os <<
setw(16) << nFace++
218 os <<
setw(16) << facePts[i] + 1;
222 os.
unsetf(ios_base::right);
223 os.
setf(ios_base::left);
224 os <<
setw(8) <<
"*";
225 os.
unsetf(ios_base::left);
226 os.
setf(ios_base::right);
231 os.
unsetf(ios_base::right);
237 os << faceType <<
',' 242 os <<
',' << facePts[i] + 1;
259 void Foam::nastranSurfaceWriter::writeGeometry
275 writeCoord(points[pointi], pointi, os);
291 const face&
f = faces[facei];
295 writeFace(
"CTRIA3", faces[facei], nFace, os);
296 decomposedFaces[facei].append(faces[facei]);
298 else if (f.
size() == 4)
300 writeFace(
"CQUAD4", faces[facei], nFace, os);
301 decomposedFaces[facei].append(faces[facei]);
310 writeFace(
"CTRIA3", f, nFace, os);
311 decomposedFaces[facei].append(f);
341 if (nastranDict.found(
"format"))
350 fieldMap_.insert(fieldSet[i].first(), fieldSet[i].second());
353 if (nastranDict.found(
"scale"))
355 nastranDict.lookup(
"scale") >> scale_;
376 if (!
isDir(outputDir))
381 OFstream os(outputDir/surfaceName +
".dat");
389 os <<
"TITLE=OpenFOAM " << surfaceName.c_str() <<
" mesh" <<
nl 391 <<
"BEGIN BULK" <<
nl;
395 writeGeometry(points, faces, decomposedFaces, os);
397 if (!
isDir(outputDir))
402 os <<
"ENDDATA" <<
endl;
#define forAll(list, i)
Loop across all elements in list.
nastranSurfaceWriter(const IOstream::streamFormat writeFormat)
Construct given write format.
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.
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.
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.
streamFormat
Enumeration for the format of data in the stream.
defineSurfaceWriterWriteFields(nastranSurfaceWriter)
errorManip< error > abort(error &err)
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)
Triangulation of three-dimensional polygons.
A List with indirect addressing.
static const NamedEnum< format, 3 > formatNames_
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
Base class for surface writers.
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces) const
Write single surface geometry to file.
Omanip< int > setw(const int i)
const UList< triFace > & triPoints() const
Get the triangles' points.
IOstream & scientific(IOstream &io)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.