96void Foam::coordSetWriters::ensightWriter::writeGeometry
99 elemOutputType elemOutput
110 const auto& coords =
coords_[tracki];
111 const label
nPoints = coords.size();
114 if (
coords_.size() == 1 && elemOutputType::WRITE_LINES != elemOutput)
116 partName =
"sampled";
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())
268 const word& fieldName,
280 <<
"Attempted to write field: " << fieldName
281 <<
" (" << 1 <<
" entries) for "
288 elemOutputType elemOutput =
291 ? elemOutputType::WRITE_LINES
292 : elemOutputType::NO_ELEMENTS
297 return writeCollated(fieldName, fieldPtrs, elemOutput);
301 return writeUncollated(fieldName, fieldPtrs, elemOutput);
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
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A simple container for options an IOstream can normally have.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Base class for writing coordSet(s) and tracks with fields.
virtual void open(const fileName &outputPath)
Write separate geometry to file.
static UPtrList< const Field< Type > > repackageFields(const Field< Type > &field)
Repackage field into a UPtrList.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
bool useTracks_
Prefer tracks to points during single set writing.
UPtrList< const coordSet > coords_
Reference to coordinate set(s).
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
fileName outputPath_
The full output directory and file (coords) name.
virtual ~ensightWriter()
Destructor. Calls close().
ensightWriter()
Default construct.
virtual fileName path() const
Expected (characteristic) output file name - information only.
virtual void close(bool force=false)
Finish output, clears output times.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
static const char *const coordinates
The keyword "coordinates".
Specification of a valid Ensight file-name.
A class for handling file names.
static const fileName null
An empty fileName.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
Convenience macros for instantiating coordSetWriter methods.
#define defineCoordSetWriterWriteFields(ThisClass)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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.
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.
static void writeTrackField(ensightFile &os, const UPtrList< const Field< Type > > &fieldPtrs)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
static const char *const typeName
The type name used in ensight case files.