110#ifndef Foam_surfaceWriter_H
111#define Foam_surfaceWriter_H
224 virtual bool merge()
const;
243 const word& fieldName,
247#undef declareSurfaceFieldMethods
248#define declareSurfaceFieldMethods(Type) \
250 tmp<Field<Type>> mergeField(const Field<Type>& fld) const; \
252 tmp<Field<Type>> adjustField \
254 const word& fieldName, \
255 const tmp<Field<Type>>& tfield \
265 #undef declareSurfaceFieldMethods
271 const word& fieldName,
277 return this->
write();
322 const word& formatName,
323 const word& entryName =
"formatOptions"
331 const word& formatName,
332 const word& entryName =
"formatOptions"
343 static autoPtr<surfaceWriter>
TryNew(
const word& writeType);
349 const word& writeType,
420 virtual void clear();
593 virtual
void close();
602#undef declareSurfaceWriterWriteMethod
603#define declareSurfaceWriterWriteMethod(Type) \
605 virtual fileName write \
607 const word& fieldName, \
608 const Field<Type>& values \
619#undef declareSurfaceWriterWriteMethod
620#define declareSurfaceWriterWriteMethod(Type) \
623 virtual fileName write \
625 const word& fieldName, \
626 const Field<Type>& values \
649 #ifdef Foam_surfaceWriter_directAccess
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 helper class for outputting values to Ostream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
commsTypes
Communications types.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A Cartesian coordinate system.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
static const fileName null
An empty fileName.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Simple class to manage surface merging information.
Implements a meshed surface by referencing another meshed surface or faces/points components.
Abstract definition of a meshed surface defined by faces and points.
Base class for surface writers.
surfaceWriter()
Default construct.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
meshedSurfRef surf_
Reference to surface or surface components.
virtual void endTime()
End a time-step.
virtual bool enabled() const
The writer is enabled. If the writer is not enabled, it may be possible for the caller to skip variou...
scalar geometryScale_
Output geometry scaling after rotate/translate.
virtual fileName write()=0
Write separate surface geometry to file.
bool useTimeDir_
Insert additional time sub-directory in the output path.
bool gatherv_
Prefer MPI gatherv intrinsic (for field merging) [experimental].
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
bool wroteGeom_
Track if geometry has been written since the last open.
virtual InfoProxy< surfaceWriter > info() const noexcept
Return info proxy, used to print information to a stream.
bool isPointData_
Is point vs cell data.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
meshedSurfRef adjustedSurf_
The surface after point coordinate transforms and scaling.
const meshedSurf & surface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel).
bool isPointData() const noexcept
Are the field data to be treated as point data?
const word & timeName() const
The current time value/name.
fileName writeTemplate(const word &fieldName, const Field< Type > &localValues)
Dummy templated write operation.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
void unsetTime()
Clear the current time.
scalar scale() const noexcept
The current value of the geometry scaling.
virtual void beginTime(const Time &t)
Begin a time-step.
label size() const
The global number of faces for the associated surface.
label nFields_
The number of fields.
static scalar defaultMergeDim
The default merge dimension (1e-8).
virtual ~surfaceWriter()
Destructor. Calls close().
virtual void setSurface(const meshedSurf &surf, bool parallel)
Change association with a surface, expire the writer with defined parallel/serial treatment.
static autoPtr< surfaceWriter > TryNew(const word &writeType)
Optional select construct surfaceWriter.
virtual void close()
Finish output, performing any necessary cleanup.
bool parallel_
Writing in parallel (via master).
bool empty() const
The surface to write is empty if the global number of faces is zero.
bool upToDate_
The topology/surface is up-to-date?
UPstream::commsTypes commType_
Communication type (for field merging).
dictionary fieldLevel_
Field level to remove (on output).
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
bool is_open() const noexcept
Test if outputPath has been set.
void setTime(const instant &inst)
Set the current time.
declareRunTimeSelectionTable(autoPtr, surfaceWriter, wordDict,(const dictionary &writeOpts),(writeOpts))
virtual bool merge() const
Merge surfaces if they are not already upToDate (parallel) or simply mark the surface as being up-to-...
mergedSurf mergedSurf_
Surface after merging (parallel).
bool verbose_
Additional output verbosity.
tmp< Field< Type > > adjustFieldTemplate(const word &fieldName, const tmp< Field< Type > > &tfield) const
Apply refLevel and fieldScaling.
dictionary fieldScale_
Field scaling (on output).
virtual bool expire()
Mark that surface changed and the writer will need an update, and set nFields = 0.
virtual bool usesFaceIds() const
True if the writer format uses faceIds as part of its output.
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind surface changes).
tmp< Field< Type > > mergeFieldTemplate(const Field< Type > &fld) const
Gather (merge) fields with renumbering and shrinking for point data.
instant currTime_
The current time value/name.
virtual bool separateGeometry() const
True if the surface format requires geometry in a separate file.
bool verbose() const noexcept
Get output verbosity.
bool hasSurface() const
Writer is associated with a surface.
const meshedSurfRef & adjustSurface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel) and a...
declareRunTimeSelectionTable(autoPtr, surfaceWriter, word,(),())
virtual void clear()
Close any open output, remove association with a surface and expire the writer. The parallel flag rem...
point geometryCentre_
The centre of rotation (untranslate, translate).
scalar timeValue() const
The current time value/name.
virtual bool wroteData() const
Geometry or fields written since the last open?
scalar mergeDim() const noexcept
The current value of the point merge dimension (metre).
bool hasTime() const
True if there is a known time.
fileName outputPath_
The full output directory and file (surface) name.
const coordSystem::cartesian & transform() const noexcept
The current (cartesian) coordinate system transformation.
label nFields() const noexcept
The number of expected output fields.
scalar mergeDim_
Dimension for merging.
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
TypeName("surfaceWriter")
Runtime type information.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
Namespace for coordinate systems.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
List< face > faceList
List of faces.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
vector point
Point is a vector.
vectorField pointField
pointField is a vectorField.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
#define declareSurfaceFieldMethods(Type)
#define declareSurfaceWriterWriteMethod(Type)
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.