Go to the documentation of this file.
43 os <<
setw(8) << value;
48 os <<
setw(16) << value;
85 Type scaledValue = scale_*value;
88 writeKeyword(dataFormatNames_[
format], os);
93 os.
setf(ios_base::right);
104 writeValue(scaledValue, os);
109 << dataFormatNames_[
format] <<
" requires scalar values "
110 <<
"and cannot be used for higher rank values"
113 writeValue(scalar(0), os);
125 for (
direction dirI = 0; dirI < pTraits<Type>::nComponents; dirI++)
128 writeValue(
component(scaledValue, dirI), os);
135 <<
"Unhandled enumeration " << dataFormatNames_[
format]
140 os.
unsetf(ios_base::right);
153 const word& fieldName,
155 const bool isNodeValues,
159 if (!fieldMap_.found(fieldName))
162 <<
"No mapping found between field " << fieldName
163 <<
" and corresponding Nastran field. Available types are:"
167 return fileName::null;
172 if (!
isDir(outputDir/fieldName))
174 mkDir(outputDir/fieldName);
178 const scalar timeValue = 0.0;
180 OFstream os(outputDir/fieldName/surfaceName +
".nas");
188 os <<
"TITLE=OpenFOAM " << surfaceName.c_str() <<
" " << fieldName
191 <<
"TIME " << timeValue <<
nl
193 <<
"BEGIN BULK" <<
nl;
197 writeGeometry(
points, faces, decomposedFaces, os);
201 <<
"$ Field data" <<
nl
208 forAll(decomposedFaces, i)
214 const face&
f = dFaces[faceI];
218 v += values[
f[fptI]];
222 writeFaceValue(
format, v, ++
n, os);
230 forAll(decomposedFaces, i)
236 writeFaceValue(
format, values[faceI], ++
n, os);
243 os <<
"ENDDATA" <<
endl;
word format(conversionProperties.lookup("format"))
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
fileName writeTemplate(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const word &fieldName, const Field< Type > &values, const bool isNodeValues, const bool verbose) const
Templated write operation.
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 string.
A class for handling file names.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Ostream & endl(Ostream &os)
Add newline and flush stream.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Istream and Ostream manipulators taking arguments.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
Omanip< int > setw(const int i)
void unsetf(const ios_base::fmtflags uf)
Unset flags of stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set 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.
const fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void writeValue(const Type &value, Ostream &os) const
Write a formatted value to the output stream.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
#define WarningInFunction
Report a warning using Foam::Warning.
void writeFaceValue(const dataFormat &format, const Type &value, const label EID, Ostream &os) const
Write a face-based value.