56 wordConstructorTablePtr_->found(writeType)
57 || wordDictConstructorTablePtr_->found(writeType)
66 const word& formatName,
78 const word& formatName,
91 auto* ctorPtr = wordConstructorTable(writeType);
107 const word& writeType,
113 auto* ctorPtr = wordDictConstructorTable(writeType);
123 auto* ctorPtr = wordConstructorTable(writeType);
127 return autoPtr<surfaceWriter>(ctorPtr());
147 <<
"Unknown write type \"" << writeType <<
"\"\n\n" 148 <<
"Valid write types : " 149 <<
flatOutput(wordConstructorTablePtr_->sortedToc()) <<
nl 150 <<
"Valid proxy types : " 162 const word& writeType,
174 <<
"Unknown write type \"" << writeType <<
"\"\n\n" 175 <<
"Valid write types : " 176 <<
flatOutput(wordConstructorTablePtr_->sortedToc()) <<
nl 177 <<
"Valid proxy types : " 193 mergeDim_(defaultMergeDim),
195 geometryCentre_(
Zero),
196 geometryTransform_(),
203 commType_(
UPstream::commsTypes::scheduled),
245 Info<<
"Create surfaceWriter (" 246 << (this->
isPointData() ?
"point" :
"face") <<
" data):" 270 currTime_ =
instant(timeValue);
276 currTime_.value() = timeValue;
283 currTime_.value() = 0;
284 currTime_.name().clear();
308 outputPath_ = outputPath;
321 setSurface(surf, parallel);
335 setSurface(
points, faces, parallel);
347 setSurface(surf, parallel_);
360 setSurface(
points, faces, parallel_);
400 surf_.reset(
points, faces);
410 setSurface(surf, parallel_);
420 setSurface(
points, faces, parallel_);
438 const bool changed = upToDate_;
442 adjustedSurf_.clear();
460 const bool value = surf_.faces().empty();
468 const label value = surf_.faces().size();
479 <<
type() <<
" : Attempted to write without a path" <<
nl 487 bool changed =
false;
492 adjustedSurf_.clear();
496 changed = mergedSurf_.merge(surf_, mergeDim_);
531 adjustedSurf_.
clear();
534 if (!adjustedSurf_.good())
536 adjustedSurf_.reset(
surface());
538 tmp<pointField> tpts;
540 if (geometryTransform_.good())
542 if (!geometryTransform_.R().is_identity())
544 if (
magSqr(geometryCentre_) > ROOTVSMALL)
549 geometryTransform_.globalPosition
551 adjustedSurf_.points0() - geometryCentre_
555 tpts.ref() += geometryCentre_;
561 geometryTransform_.globalPosition
563 adjustedSurf_.points0()
567 else if (
magSqr(geometryTransform_.origin()) > ROOTVSMALL)
570 tpts = (adjustedSurf_.points0() + geometryTransform_.origin());
574 adjustedSurf_.movePoints(tpts);
575 adjustedSurf_.scalePoints(geometryScale_);
578 return adjustedSurf_;
597 auto& allFld = tfield.ref();
604 ? mergedSurf_.pointGlobalIndex()
605 : mergedSurf_.faceGlobalIndex()
621 && this->isPointData()
622 && mergedSurf_.pointsMap().size()
626 allFld.resize(mergedSurf_.points().size());
642 const word& fieldName,
648 Info<<
"Writing field " << fieldName;
651 tmp<Field<Type>> tadjusted;
655 if (!std::is_integral<Type>::value)
677 Info<<
" [level " << refLevel <<
']';
683 tadjusted.reset(tfield.ptr());
687 tadjusted.ref() -= refLevel;
699 Info<<
" [scaling " << value <<
']';
705 tadjusted.reset(tfield.ptr());
709 tadjusted.ref() *= value;
716 && geometryTransform_.good()
717 && !geometryTransform_.R().is_identity()
723 tadjusted.reset(tfield.ptr());
729 geometryTransform_.R(),
735 return (tadjusted ? tadjusted : tfield);
739 #define defineSurfaceFieldMethods(ThisClass, Type) \ 740 Foam::tmp<Foam::Field<Type>> \ 741 ThisClass::mergeField(const Field<Type>& fld) const \ 743 return mergeFieldTemplate(fld); \ 746 Foam::tmp<Foam::Field<Type>> \ 747 ThisClass::adjustField \ 749 const word& fieldName, \ 750 const tmp<Field<Type>>& tfield \ 753 return adjustFieldTemplate(fieldName, tfield); \ 763 #undef defineSurfaceFieldMethod 774 const auto& w = *iproxy;
776 os <<
"surfaceWriter:" 777 <<
" upToDate: " << w.upToDate_
778 <<
" PointData: " << w.isPointData_
779 <<
" nFields: " << w.nFields_
780 <<
" time: " << w.currTime_
781 <<
" path: " << w.outputPath_ <<
endl;
const Type & value() const noexcept
Return const reference to value.
label size() const
The global number of faces for the associated surface.
virtual bool expire()
Mark that surface changed and the writer will need an update, and set nFields = 0.
A class for handling file names.
static const Enum< commsTypes > commsTypeNames
Enumerated names for the communication types.
surfaceWriter()
Default construct.
errorManipArg< error, int > exit(error &err, const int errNo=1)
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/"finiteArea-edgesCentres"))
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool equal(const T &a, const T &b)
Compare two values for equality.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
The surface to write is empty if the global number of faces is zero.
dictionary fieldLevel_
Field level to remove (on output)
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
#define defineSurfaceFieldMethods(ThisClass, Type)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const meshedSurf & surface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel) ...
static bool & parRun() noexcept
Test if this a parallel run.
const meshedSurfRef & adjustSurface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel) and a...
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
point geometryCentre_
The centre of rotation (untranslate, translate)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
static int & msgType() noexcept
Message tag of standard messages.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
static bool canWriteType(const word &fileType, bool verbose=false)
Can this file format type be written via MeshedSurfaceProxy?
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
UPstream::commsTypes commType_
Communication type (for field merging)
Macros for easy insertion into run-time selection tables.
virtual void clear()
Reset origin and rotation to an identity coordinateSystem.
virtual ~surfaceWriter()
Destructor. Calls close()
Abstract definition of a meshed surface defined by faces and points.
bool isPointData() const noexcept
Are the field data to be treated as point data?
A Cartesian coordinate system.
static scalar defaultMergeDim
The default merge dimension (1e-8)
virtual void clear()
Close any open output, remove association with a surface and expire the writer. The parallel flag rem...
virtual void setSurface(const meshedSurf &surf, bool parallel)
Change association with a surface, expire the writer with defined parallel/serial treatment...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
virtual void endTime()
End a time-step.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
const dimensionedScalar e
Elementary charge.
Implements a meshed surface by referencing another meshed surface or faces/points components...
A class for handling words, derived from Foam::string.
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind surface changes)
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
scalar geometryScale_
Output geometry scaling after rotate/translate.
bool hasSurface() const
Writer is associated with a surface.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
tmp< Field< Type > > mergeFieldTemplate(const Field< Type > &fld) const
Gather (merge) fields with renumbering and shrinking for point data.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary. ...
virtual void close()
Finish output, performing any necessary cleanup.
tmp< Field< Type > > adjustFieldTemplate(const word &fieldName, const tmp< Field< Type >> &tfield) const
Apply refLevel and fieldScaling.
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))
dictionary fieldScale_
Field scaling (on output)
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
A helper class for outputting values to Ostream.
virtual bool wroteData() const
Geometry or fields written since the last open?
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool merge() const
Merge surfaces if they are not already upToDate (parallel) or simply mark the surface as being up-to-...
Reading is optional [identical to READ_IF_PRESENT].
Base class for surface writers.
bool verbose_
Additional output verbosity.
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
A class for managing temporary objects.
static autoPtr< surfaceWriter > TryNew(const word &writeType)
Optional select construct proxy writer.
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)
Tensor of scalars, i.e. Tensor<scalar>.
static autoPtr< surfaceWriter > TryNew(const word &writeType)
Optional select construct surfaceWriter.
void unsetTime()
Clear the current time.
Inter-processor communications stream.
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
virtual void beginTime(const Time &t)
Begin a time-step.
void clear()
Invalid by redirecting to null objects.
void setTime(const instant &inst)
Set the current time.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
static constexpr const zero Zero
Global zero (0)