43 namespace coordSetWriters
96 void Foam::coordSetWriters::ensightWriter::writeGeometry
99 elemOutputType elemOutput
110 const auto& coords =
coords_[tracki];
114 if (
coords_.size() == 1 && elemOutputType::WRITE_LINES != elemOutput)
116 partName =
"sampled";
125 static_cast<const pointField&>(coords),
129 if (elemOutputType::WRITE_POINTS == elemOutput)
133 os.writeKeyword(
"point");
136 for (label pointi = 0; pointi <
nPoints; ++pointi)
143 if (elemOutputType::WRITE_LINES == elemOutput)
145 const label nLines = (
nPoints-1);
148 os.writeKeyword(
"point");
151 for (label pointi = 0; pointi <
nPoints; ++pointi)
159 os.writeKeyword(
"bar2");
162 for (label pointi = 0; pointi < nLines; ++pointi)
181 caching_(
"fieldsDict")
189 collateTimes_(options.getOrDefault(
"collateTimes", true)),
190 caching_(
"fieldsDict")
192 caseOpts_.timeFormat(
"timeFormat", options);
193 caseOpts_.timePrecision(
"timePrecision", options);
206 open(coords, outputPath);
219 open(tracks, outputPath);
243 if (!outputPath_.empty())
266 Foam::fileName Foam::coordSetWriters::ensightWriter::writeTemplate
268 const word& fieldName,
277 if (coords_.size() != 1)
280 <<
"Attempted to write field: " << fieldName
281 <<
" (" << 1 <<
" entries) for " 282 << coords_.size() <<
" sets" <<
nl 288 elemOutputType elemOutput =
291 ? elemOutputType::WRITE_LINES
292 : elemOutputType::NO_ELEMENTS
297 return writeCollated(fieldName, fieldPtrs, elemOutput);
301 return writeUncollated(fieldName, fieldPtrs, elemOutput);
307 Foam::fileName Foam::coordSetWriters::ensightWriter::writeTemplate
309 const word& fieldName,
318 if (coords_.size() != fieldValues.size())
321 <<
"Attempted to write field: " << fieldName
322 <<
" (" << fieldValues.size() <<
" entries) for " 323 << coords_.size() <<
" sets" <<
nl 327 UPtrList<const Field<Type>> fieldPtrs(repackageFields(fieldValues));
335 elemOutputType::WRITE_LINES
340 return writeUncollated
344 elemOutputType::WRITE_LINES
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
addToRunTimeSelectionTable(coordSetWriter, abaqusWriter, word)
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual Ostream & write(const char c) override
Write character.
Ensight names and component order for base types.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#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...
Specification of a valid Ensight file-name.
constexpr char nl
The newline '\n' character (0x0a)
static const fileName null
An empty fileName.
defineTypeName(abaqusWriter)
A simple container for options an IOstream can normally have.
static const char *const coordinates
The keyword "coordinates".
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Convenience macros for instantiating coordSetWriter methods.
Holds list of sampling positions.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void writeFieldComponents(ensightOutput::floatBufferType &scratch, ensightFile &os, const char *key, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise) for the given ensight element type.
Generic templated field type.
A class for handling words, derived from Foam::string.
Base class for writing coordSet(s) and tracks with fields.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Istream and Ostream manipulators taking arguments.
OBJstream os(runTime.globalPath()/outputName)
UPtrList< const coordSet > coords_
Reference to coordinate set(s)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
defineCoordSetWriterWriteFields(Foam::coordSetWriters::ensightWriter)
virtual void close(bool force=false)
Finish output, clears output times.
static void writeTrackField(ensightFile &os, const UPtrList< const Field< Type >> &fieldPtrs)
ensightWriter()
Default construct.
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
virtual fileName path() const
Expected (characteristic) output file name - information only.
virtual ~ensightWriter()
Destructor. Calls close()
bool writeCoordinates(ensightGeoFile &os, const label partId, const word &partName, const label nPoints, const FieldContainer< Foam::point > &fld, bool parallel)
Write coordinates (component-wise) for the given part.