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 : "
145 mergeDim_(defaultMergeDim),
147 geometryTransform_(),
206 currTime_ =
instant(timeValue);
212 currTime_.value() = timeValue;
219 currTime_.value() = 0;
220 currTime_.name().clear();
244 outputPath_ = outputPath;
257 setSurface(surf, parallel);
271 setSurface(
points, faces, parallel);
283 setSurface(surf, parallel_);
296 setSurface(
points, faces, parallel_);
336 surf_.reset(
points, faces);
346 setSurface(surf, parallel_);
356 setSurface(
points, faces, parallel_);
374 const bool changed = upToDate_;
378 adjustedSurf_.clear();
390 return surf_.valid();
396 const bool value = surf_.faces().empty();
404 const label value = surf_.faces().size();
415 <<
type() <<
" : Attempted to write without a path" <<
nl
423 bool changed =
false;
427 adjustedSurf_.clear();
431 changed = mergedSurf_.merge(surf_, mergeDim_);
467 adjustedSurf_.
clear();
470 if (!adjustedSurf_.valid())
472 adjustedSurf_.reset(surface());
476 geometryTransform_.valid()
479 (
magSqr(geometryTransform_.origin()) > ROOTVSMALL)
480 || !geometryTransform_.R().is_identity()
485 adjustedSurf_.movePoints
487 geometryTransform_.globalPosition(adjustedSurf_.points0())
491 adjustedSurf_.scalePoints(geometryScale_);
494 return adjustedSurf_;
513 auto& allFld = tfield.ref();
521 && this->isPointData()
522 && mergedSurf_.pointsMap().size()
526 allFld.resize(mergedSurf_.points().size());
542 const word& fieldName,
548 Info<<
"Writing field " << fieldName;
555 if (!std::is_integral<Type>::value)
570 for (
direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
577 Info<<
" [level " << refLevel <<
']';
583 tadjusted.
reset(tfield.ptr());
587 tadjusted.
ref() -= refLevel;
599 Info<<
" [scaling " << value <<
']';
605 tadjusted.
reset(tfield.ptr());
609 tadjusted.
ref() *= value;
616 && geometryTransform_.valid()
617 && !geometryTransform_.R().is_identity()
623 tadjusted.
reset(tfield.ptr());
629 geometryTransform_.R(),
635 return (tadjusted ? tadjusted : tfield);
639#define defineSurfaceFieldMethods(ThisClass, Type) \
640 Foam::tmp<Foam::Field<Type>> \
641 ThisClass::mergeField(const Field<Type>& fld) const \
643 return mergeFieldTemplate(fld); \
646 Foam::tmp<Foam::Field<Type>> \
647 ThisClass::adjustField \
649 const word& fieldName, \
650 const tmp<Field<Type>>& tfield \
653 return adjustFieldTemplate(fieldName, tfield); \
663#undef defineSurfaceFieldMethod
676 os <<
"surfaceWriter:"
Macros for easy insertion into run-time selection tables.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A helper class for outputting values to Ostream.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
static wordHashSet writeTypes()
The file format types that can be written via MeshedSurfaceProxy.
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.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A Cartesian coordinate system.
virtual void clear()
Reset origin and rotation to an identity coordinateSystem.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
const Type & value() const
Return const reference to value.
A class for handling file names.
static void gatherOp(const UList< Type > &sendData, List< Type > &allData, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking, const label comm=UPstream::worldComm)
Collect data in processor order on master (in serial: performs a simple copy).
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
@ REGEX
Regular expression.
Implements a meshed surface by referencing another meshed surface or faces/points components.
void clear()
Invalid by redirecting to null objects.
Abstract definition of a meshed surface defined by faces and points.
A traits class, which is primarily used for primitives.
splitCell * master() const
Base class for surface writers.
surfaceWriter()
Default construct.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
virtual void endTime()
End a time-step.
scalar geometryScale_
Output geometry scaling after rotate/translate.
bool isPointData_
Is point vs cell data.
const meshedSurf & surface() const
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
void unsetTime()
Clear the current time.
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)
virtual void close()
Finish output, performing any necessary cleanup.
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?
dictionary fieldLevel_
Field level to remove (on output)
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
void setTime(const instant &inst)
Set the current time.
virtual bool merge() const
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 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.
bool hasSurface() const
Writer is associated with a surface.
const meshedSurfRef & adjustSurface() const
virtual bool wroteData() const
Geometry or fields written since the last open?
fileName outputPath_
The full output directory and file (surface) name.
A surfaceWriter that writes the geometry via the MeshedSurfaceProxy, but which does not support any f...
A class for managing temporary objects.
void reset(tmp< T > &&other) noexcept
Clear existing and transfer ownership.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components)
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
static constexpr char open
#define defineSurfaceFieldMethods(ThisClass, Type)