Go to the documentation of this file.
36 Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeValue
44 case fieldFormat::SHORT :
46 os <<
setw(8) << value;
50 case fieldFormat::LONG :
52 os <<
setw(16) << value;
56 case fieldFormat::FREE :
68 Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
92 Type scaledValue = scale_*value;
95 writeKeyword(os, fileFormats::NASCore::loadFormatNames[
format])
99 os.
setf(std::ios_base::right);
101 writeValue(os, SID) << separator_;
105 case loadFormat::PLOAD2 :
109 writeValue(os, scaledValue) << separator_;
114 << fileFormats::NASCore::loadFormatNames[
format]
115 <<
" requires scalar values"
116 <<
" - it cannot be used for higher rank values"
119 writeValue(os, scalar(0)) << separator_;
126 case loadFormat::PLOAD4 :
130 for (
direction d = 0; d < pTraits<Type>::nComponents; ++d)
133 writeValue(os,
component(scaledValue, d));
139 os.
unsetf(std::ios_base::right);
150 const word& fieldName,
156 if (!fieldMap_.found(fieldName))
159 <<
"No mapping found between field " << fieldName
160 <<
" and corresponding Nastran field. Available types are:"
164 return fileName::null;
172 if (useTimeDir() && !
timeName().empty())
177 outputFile /= fieldName / outputPath_.
name();
178 outputFile.
ext(
"nas");
182 Info<<
"Writing field " << fieldName <<
" to " << outputFile <<
endl;
191 if (Pstream::master() || !parallel_)
193 const auto&
values = tfield();
200 const scalar timeValue = 0.0;
203 fileFormats::NASCore::setPrecision(os, writeFormat_);
210 os <<
"TITLE=OpenFOAM " << outputFile.
name()
211 <<
" " << fieldName <<
" data" <<
nl
213 <<
"TIME " << timeValue <<
nl
215 <<
"BEGIN BULK" <<
nl;
218 writeGeometry(os, surf, decomposedFaces);
221 <<
"$ Field data" <<
nl
226 if (this->isPointData())
230 for (
const face&
f : dFaces)
234 for (
const label verti :
f)
240 writeFaceValue(os,
format, v, ++elemId);
255 writeFooter(os, surf)
256 <<
"ENDDATA" <<
endl;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual const fileName & name() const
Read/write access to the name of the stream.
static std::string path(const std::string &str)
Return directory path name (part before last /)
A class for managing temporary objects.
static constexpr const zero Zero
Global zero.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Abstract definition of a meshed surface defined by faces and points.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
word format(conversionProperties.get< word >("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.
Generic templated field type.
messageStream Info
Information stream (uses stdout - output is on the master only)
Istream and Ostream manipulators taking arguments.
word ext() const
Return file name extension (part after last .)
Omanip< int > setw(const int i)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
void unsetf(const ios_base::fmtflags f)
Unset flags of stream.
#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...
Traits class for primitives.
A face is a list of labels corresponding to mesh vertices.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
#define WarningInFunction
Report a warning using Foam::Warning.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?