45 case fieldFormat::SHORT :
51 case fieldFormat::LONG :
57 case fieldFormat::FREE :
69Foam::Ostream& Foam::surfaceWriters::nastranWriter::writeFaceValue
91 const label setId = 1;
98 os.setf(std::ios_base::right);
100 writeValue(
os, setId) << separator_;
104 case loadFormat::PLOAD2 :
112 writeValue(
os, value);
116 writeValue(
os, elemId);
120 case loadFormat::PLOAD4 :
122 writeValue(
os, elemId);
127 for (
direction d = 0; d < pTraits<Type>::nComponents; ++d)
136 os.unsetf(std::ios_base::right);
147 const word& fieldName,
155 if (!wroteGeom_ && commonGeometry_)
163 loadFormat
format = loadFormat::PLOAD2;
165 if constexpr (std::is_integral_v<Type>)
169 else if (!pload4_.empty())
171 const wordRes::filter matcher(pload4_, pload2_);
173 if (matcher(fieldName))
175 format = loadFormat::PLOAD4;
185 fileName outputFile = outputPath_.path();
186 if (useTimeDir() && !
timeName().empty())
192 fileName geomFileName;
196 geomFileName = outputPath_.name().ext(
"nas");
199 outputFile /= fieldName +
'_' + outputPath_.name();
205 outputFile /= fieldName / outputPath_.name();
207 outputFile.ext(
"bdf");
210 tmp<Field<Type>> tfield = adjustField(fieldName, mergeField(localValues));
214 Info<<
" to " << outputFile <<
endl;
219 const meshedSurfRef& surf = adjustSurface();
223 const auto&
values = tfield();
230 const scalar timeValue(0);
234 DynamicList<face> decompFaces;
240 os <<
"TITLE=OpenFOAM " << outputFile.name()
243 if (useTimeDir() && !
timeName().empty())
249 os <<
"TIME " << timeValue <<
nl
251 <<
"BEGIN BULK" <<
nl;
255 os <<
"INCLUDE '" << geomFileName.c_str() <<
"'" <<
nl;
275 <<
"$ Field data" <<
nl
280 const faceList& faces = surf.faces();
284 const bool useOrigFaceIds =
286 elemIds.size() == faces.size()
288 && decompFaces.empty()
294 if (this->isPointData())
300 elemId = elemIds[facei];
303 const label beginElemId = elemId;
308 label decompi = decompOffsets[facei];
309 decompi < decompOffsets[facei+1];
313 const face&
f = decompFaces[decompi];
316 for (
const label verti :
f)
322 writeFaceValue(
os,
format, v, ++elemId);
327 if (beginElemId == elemId)
329 const face&
f = faces[facei];
332 for (
const label verti :
f)
338 writeFaceValue(
os,
format, v, ++elemId);
344 auto valIter =
values.cbegin();
350 elemId = elemIds[facei];
353 const Type v(*valIter);
360 (decompOffsets[facei+1] - decompOffsets[facei])
365 writeFaceValue(
os,
format, v, ++elemId);
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...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
bool wroteGeom_
Track if geometry has been written since the last open.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
bool empty() const
Writer is not associated with content.
bool verbose_
Additional output verbosity.
scalar timeValue() const
The current time value/name.
fileName outputPath_
The full output directory and file (coords) name.
Foam::fileFormats::NASCore::loadFormat loadFormat
Output load format.
A face is a list of labels corresponding to mesh vertices.
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 /).
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Implements a meshed surface by referencing another meshed surface or faces/points components.
virtual const pointField & points() const
The points used for the surface.
virtual const labelList & faceIds() const
Per-face identifier (eg, element Id).
virtual const faceList & faces() const
The faces used for the surface.
Foam::fileFormats::NASCore::loadFormat loadFormat
Output load format.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
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).
word format(conversionProperties.get< word >("format"))
#define forAll(list, i)
Loop across all elements in list.
The vector-space number of components: default is 1.
Functor wrapper of allow/deny lists of wordRe for filtering.