Go to the documentation of this file.
37 Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeValue
45 case fieldFormat::SHORT :
51 case fieldFormat::LONG :
57 case fieldFormat::FREE :
69 Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
91 const label setId = 1;
94 writeKeyword(
os, fileFormats::NASCore::loadFormatNames[
format])
98 os.setf(std::ios_base::right);
100 writeValue(
os, setId) << separator_;
104 case loadFormat::PLOAD2 :
108 writeValue(
os, value);
112 writeValue(
os,
mag(value));
116 writeValue(
os, elemId);
120 case loadFormat::PLOAD4 :
122 writeValue(
os, elemId);
124 for (
direction d = 0; d < pTraits<Type>::nComponents; ++d)
133 os.unsetf(std::ios_base::right);
144 const word& fieldName,
152 if (!wroteGeom_ && commonGeometry_)
175 !std::is_integral<Type>::value
176 && !fieldMap_.empty()
177 && !fieldMap_.found(fieldName)
181 <<
"No mapping found between field " << fieldName
182 <<
" and corresponding Nastran field. Available types:"
190 << fileFormats::NASCore::loadFormatNames[
format]
191 <<
" cannot be used for higher rank values"
192 <<
" - reverting to mag()" <<
endl;
203 if (useTimeDir() && !
timeName().empty())
213 geomFileName = outputPath_.
name().ext(
"nas");
216 outputFile /= fieldName +
'_' + outputPath_.name();
222 outputFile /= fieldName / outputPath_.name();
224 outputFile.
ext(
"bdf");
230 const scalar varScale =
232 std::is_integral<Type>::value
234 : fieldScale_.getOrDefault<scalar>(fieldName, 1)
239 Info<<
"Writing field " << fieldName;
240 if (!
equal(varScale, 1))
242 Info<<
" (scaling " << varScale <<
')';
244 Info<<
" to " << outputFile <<
endl;
253 if (Pstream::master() || !parallel_)
255 const auto&
values = tfield();
262 const scalar timeValue(0);
270 fileFormats::NASCore::setPrecision(
os, writeFormat_);
272 os <<
"TITLE=OpenFOAM " << outputFile.
name()
273 << token::SPACE << fieldName <<
" data" <<
nl;
275 if (useTimeDir() && !
timeName().empty())
281 os <<
"TIME " << timeValue <<
nl
283 <<
"BEGIN BULK" <<
nl;
287 os <<
"INCLUDE '" << geomFileName.c_str() <<
"'" <<
nl;
291 fileFormats::NASCore::faceDecomposition
307 <<
"$ Field data" <<
nl
316 const bool useOrigFaceIds =
318 elemIds.
size() == faces.size()
320 && decompFaces.empty()
326 if (this->isPointData())
332 elemId = elemIds[facei];
335 const label beginElemId = elemId;
340 label decompi = decompOffsets[facei];
341 decompi < decompOffsets[facei+1];
345 const face&
f = decompFaces[decompi];
348 for (
const label verti :
f)
354 writeFaceValue(
os,
format, v, ++elemId);
359 if (beginElemId == elemId)
361 const face&
f = faces[facei];
364 for (
const label verti :
f)
370 writeFaceValue(
os,
format, v, ++elemId);
376 auto valIter =
values.cbegin();
382 elemId = elemIds[facei];
385 const Type v(*valIter);
392 (decompOffsets[facei+1] - decompOffsets[facei])
397 writeFaceValue(
os,
format, v, ++elemId);
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.
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 (0)
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.
virtual const faceList & faces() const =0
The faces used for the surface.
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"))
Generic templated field type.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Istream and Ostream manipulators taking arguments.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual const pointField & points() const =0
The points used for the surface.
OBJstream os(runTime.globalPath()/outputName)
word ext() const
Return file name extension (part after last .)
Omanip< int > setw(const int i)
Output to file stream, using an OSstream.
virtual const labelList & faceIds() const
Per-face identifier (eg, element Id)
A traits class, which is primarily used for primitives.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
void size(const label n)
Older name for setAddressableSize.
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?