Go to the documentation of this file.
56 wordConstructorTablePtr_->found(writeType)
57 || wordDictConstructorTablePtr_->found(writeType)
67 auto* ctorPtr = wordConstructorTable(writeType);
81 <<
"Unknown write type \"" << writeType <<
"\"\n\n"
82 <<
"Valid write types : "
83 <<
flatOutput(wordConstructorTablePtr_->sortedToc()) <<
nl
84 <<
"Valid proxy types : "
96 const word& writeType,
102 auto* ctorPtr = wordDictConstructorTable(writeType);
112 auto* ctorPtr = wordConstructorTable(writeType);
126 <<
"Unknown write type \"" << writeType <<
"\"\n\n"
127 <<
"Valid write types : "
128 << wordConstructorTablePtr_->sortedToc() <<
nl
129 <<
"Valid proxy types : "
144 useComponents_(false),
152 mergeDim_(defaultMergeDim),
178 setSurface(surf, parallel);
192 setSurface(
points, faces, parallel);
214 currTime_ =
instant(timeValue);
220 currTime_.value() = timeValue;
227 currTime_.value() = 0;
228 currTime_.name().clear();
252 outputPath_ = outputPath;
265 setSurface(surf, parallel);
279 setSurface(
points, faces, parallel);
291 setSurface(surf, parallel_);
304 setSurface(
points, faces, parallel_);
320 useComponents_ =
false;
321 surf_ = std::cref<meshedSurf>(emptySurface_);
333 useComponents_ =
false;
334 surf_ = std::cref<meshedSurf>(surf);
348 useComponents_ =
true;
349 surf_ = std::cref<meshedSurf>(emptySurface_);
350 surfComp_.reset(
points, faces);
360 setSurface(surf, parallel_);
370 setSurface(
points, faces, parallel_);
388 const bool changed = upToDate_;
403 return (useComponents_ || (&emptySurface_ != &(surf_.get())));
412 ? surfComp_.faces().empty()
413 : surf_.get().faces().empty()
425 ? surfComp_.faces().size()
426 : surf_.get().faces().size()
435 if (outputPath_.empty())
438 <<
type() <<
" : Attempted to write without a path" <<
nl
442 return !outputPath_.empty();
448 bool changed =
false;
454 changed = merged_.merge(surfComp_, mergeDim_);
458 changed = merged_.merge(surf_.get(), mergeDim_);
507 auto& allFld = tfield.ref();
515 && this->isPointData()
516 && merged_.pointsMap().size()
520 allFld.resize(merged_.points().size());
533 #define defineSurfaceWriterMergeMethod(ThisClass, Type) \
534 Foam::tmp<Foam::Field<Type>> \
535 ThisClass::mergeField(const Field<Type>& fld) const \
537 return mergeFieldTemplate(fld); \
547 #undef defineSurfaceWriterMergeMethod
560 os <<
"surfaceWriter:"
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A helper class for outputting values to Ostream.
Base class for surface writers.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A class for managing temporary objects.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
static scalar defaultMergeDim
The default merge dimension (1e-8)
void unsetTime()
Clear the current time.
virtual bool merge() const
virtual void setSurface(const meshedSurf &surf, bool parallel)
void setTime(const instant &inst)
Set the current time.
static word timeName(const scalar t, const int precision=precision_)
const meshedSurf & surface() const
Abstract definition of a meshed surface defined by faces and points.
static bool master(const label communicator=worldComm)
Am I the master process.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
The global number of faces for the associated surface.
const Type & value() const
Return const reference to value.
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
static const meshedSurf::emptySurface emptySurface_
Placeholder.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
bool empty() const
The surface to write is empty if the global number of faces is zero.
A surfaceWriter that writes the geometry via the MeshedSurfaceProxy, but which does not support any f...
virtual void endTime()
End a time-step.
bool upToDate_
The topology/surface is up-to-date?
virtual void beginTime(const Time &t)
Begin a time-step.
label nFields_
The number of fields.
bool checkOpen() const
Verify that the outputPath_ has been set or FatalError.
surfaceWriter()
Default construct.
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind surface changes)
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))
fileName outputPath_
The full output directory and file (surface) name.
virtual bool wroteData() const
Geometry or fields written since the last open?
static void gatherOp(const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
bool isPointData_
Is point vs cell data.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
A concrete meshedSurf class without faces, points, etc.
static wordHashSet writeTypes()
The file format types that can be written via MeshedSurfaceProxy.
instant currTime_
The current time value/name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
static bool & parRun() noexcept
Test if this a parallel run.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionedScalar e
Elementary charge.
virtual ~surfaceWriter()
Destructor. Calls close()
bool hasSurface() const
Writer is associated with a surface.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
#define defineSurfaceWriterMergeMethod(ThisClass, Type)
An instant of time. Contains the time value and name.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
tmp< Field< Type > > mergeFieldTemplate(const Field< Type > &fld) const
Gather (merge) fields with renumbering and shrinking for point data.
bool verbose_
Additional output verbosity.
virtual void close()
Finish output, performing any necessary cleanup.
defineTypeNameAndDebug(combustionModel, 0)
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
static bool canWriteType(const word &fileType, bool verbose=false)
Can this file format type be written via MeshedSurfaceProxy?
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const