41namespace surfaceWriters
60Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeKeyword
70void Foam::surfaceWriters::nastranWriter::writeCoord
81void Foam::surfaceWriters::nastranWriter::writeFace
104 writeKeyword(
os, faceType) << separator_;
106 os.setf(std::ios_base::right);
108 writeValue(
os, elemId) << separator_;
109 writeValue(
os, propId);
111 switch (writeFormat_)
113 case fieldFormat::SHORT :
115 for (
const label pointi : facePts)
117 writeValue(
os, pointi + 1);
123 case fieldFormat::LONG :
127 writeValue(
os, facePts[i] + 1);
131 os.unsetf(std::ios_base::right);
132 writeKeyword(
os,
"");
133 os.setf(std::ios_base::right);
140 case fieldFormat::FREE :
142 for (
const label pointi : facePts)
145 writeValue(
os, pointi + 1);
153 os.unsetf(std::ios_base::right);
160 const meshedSurf& surf,
162 DynamicList<face>& decompFaces
166 const faceList& faces = surf.faces();
168 const labelList& elemIds = surf.faceIds();
171 bool useOrigFaceIds =
173 elemIds.size() == faces.size()
180 for (
const auto&
f : faces)
184 useOrigFaceIds =
false;
199 writeCoord(
os,
points[pointi], pointi);
203 decompOffsets.resize(faces.size()+1);
206 decompOffsets[0] = 0;
215 const face&
f = faces[facei];
219 elemId = elemIds[facei];
223 const label propId = 1 + (facei < zones.size() ? zones[facei] : 0);
227 writeFace(
os,
"CTRIA3",
f, ++elemId, propId);
229 else if (
f.size() == 4)
231 writeFace(
os,
"CQUAD4",
f, ++elemId, propId);
236 f.triangles(
points, decompFaces);
240 label decompi = decompOffsets[facei];
241 decompi < decompFaces.size();
249 decompFaces[decompi],
257 decompOffsets[facei+1] = decompFaces.size();
268 if (pidsUsed.empty())
270 pidsUsed.resize(1,
Zero);
273 for (
auto pid : pidsUsed)
275 writeKeyword(
os,
"PSHELL") << separator_;
276 writeValue(
os,
pid+1);
278 for (label i = 0; i < 7; ++i)
292 writeKeyword(
os,
"MAT1") << separator_;
295 for (label i = 0; i < 7; ++i)
312 commonGeometry_(false),
330 fileFormats::NASCore::fieldFormatNames.getOrDefault
338 commonGeometry_(options.getOrDefault(
"commonGeometry", false)),
341 if (writeFormat_ == fieldFormat::FREE)
371 open(surf, outputPath, parallel);
399 if (useTimeDir() && !
timeName().empty())
402 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
404 outputFile.
ext(
"nas");
408 Info<<
"Writing nastran geometry to " << outputFile <<
endl;
425 os <<
"TITLE=OpenFOAM " << outputPath_.name() <<
" geometry" <<
nl
426 <<
"BEGIN BULK" <<
nl;
433 os <<
"ENDDATA" <<
nl;
Istream and Ostream manipulators taking arguments.
Various functions to operate on Lists.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream, using an OSstream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An ordered pair of two objects of type <T> with first() and second() elements.
void writeGeometry()
Write the mesh.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A class for handling file names.
word ext() const
Return file name extension (part after last .)
static std::string path(const std::string &str)
Return directory path name (part before last /)
Implements a meshed surface by referencing another meshed surface or faces/points components.
Abstract definition of a meshed surface defined by faces and points.
splitCell * master() const
Base class for surface writers.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
A surface writer for the Nastran file format - both surface mesh and fields.
nastranWriter()
Default construct. Default SHORT format.
virtual fileName write()
Write surface geometry to file.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
OBJstream os(runTime.globalPath()/outputName)
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
List< label > labelList
A List of labels.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Ostream & endl(Ostream &os)
Add newline and flush stream.
pid_t pid()
Return the PID of this process.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
A List of faces.
UList< label > labelUList
A UList of labels.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Convenience macros for instantiating surfaceWriter methods.
#define defineSurfaceWriterWriteFields(ThisClass)