Go to the documentation of this file.
56 wordConstructorTablePtr_->found(writeType)
57 || wordDictConstructorTablePtr_->found(writeType)
67 auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
69 if (!cstrIter.found())
81 <<
"Unknown write type \"" << writeType <<
"\"\n\n"
82 <<
"Valid write types : "
83 <<
flatOutput(wordConstructorTablePtr_->sortedToc()) <<
nl
84 <<
"Valid proxy types : "
96 const word& writeType,
101 auto cstrIter2 = wordDictConstructorTablePtr_->cfind(writeType);
103 if (cstrIter2.found())
109 auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
111 if (!cstrIter.found())
123 <<
"Unknown write type \"" << writeType <<
"\"\n\n"
124 <<
"Valid write types : "
125 << wordConstructorTablePtr_->sortedToc() <<
nl
126 <<
"Valid proxy types : "
141 useComponents_(false),
149 mergeDim_(defaultMergeDim),
175 setSurface(surf, parallel);
189 setSurface(
points, faces, parallel);
211 currTime_ =
instant(timeValue);
217 currTime_.value() = timeValue;
224 currTime_.value() = 0;
225 currTime_.name().clear();
249 outputPath_ = outputPath;
262 setSurface(surf, parallel);
276 setSurface(
points, faces, parallel);
288 setSurface(surf, parallel_);
301 setSurface(
points, faces, parallel_);
317 useComponents_ =
false;
318 surf_ = std::cref<meshedSurf>(emptySurface_);
330 useComponents_ =
false;
331 surf_ = std::cref<meshedSurf>(surf);
345 useComponents_ =
true;
346 surf_ = std::cref<meshedSurf>(emptySurface_);
347 surfComp_.reset(
points, faces);
357 setSurface(surf, parallel_);
367 setSurface(
points, faces, parallel_);
385 const bool changed = upToDate_;
400 return (useComponents_ || (&emptySurface_ != &(surf_.get())));
409 ? surfComp_.faces().empty()
410 : surf_.get().faces().empty()
422 ? surfComp_.faces().empty()
423 : surf_.get().faces().empty()
432 if (outputPath_.empty())
435 <<
type() <<
" : Attempted to write without a path" <<
nl
439 return !outputPath_.empty();
445 bool changed =
false;
451 changed = merged_.merge(surfComp_, mergeDim_);
455 changed = merged_.merge(surf_.get(), mergeDim_);
504 auto& allFld = tfield.ref();
512 && this->isPointData()
513 && merged_.pointsMap().size()
517 allFld.resize(merged_.points().size());
530 #define defineSurfaceWriterMergeMethod(ThisClass, Type) \
531 Foam::tmp<Foam::Field<Type>> \
532 ThisClass::mergeField(const Field<Type>& fld) const \
534 return mergeFieldTemplate(fld); \
544 #undef defineSurfaceWriterMergeMethod
557 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)
static bool & parRun()
Is this a parallel run?
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.
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()
Construct null.
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind surface changes)
static void gatherOp(const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master.
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?
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
bool isPointData_
Is point vs cell data.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
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.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
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