Base class for surface writers. More...
Public Member Functions | |
TypeName ("surfaceWriter") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, surfaceWriter, word,(),()) | |
declareRunTimeSelectionTable (autoPtr, surfaceWriter, wordDict,(const dictionary &writeOpts),(writeOpts)) | |
surfaceWriter () | |
Default construct. More... | |
surfaceWriter (const dictionary &options) | |
Default construct with specified options. More... | |
surfaceWriter (const meshedSurf &surf, bool parallel=Pstream::parRun(), const dictionary &options=dictionary()) | |
Construct from components. More... | |
surfaceWriter (const pointField &points, const faceList &faces, bool parallel=Pstream::parRun(), const dictionary &options=dictionary()) | |
Construct from components. More... | |
virtual | ~surfaceWriter () |
Destructor. Calls close() More... | |
virtual bool | enabled () const |
virtual bool | separateGeometry () const |
True if the surface format requires geometry in a separate file. More... | |
virtual bool | usesFaceIds () const |
True if the writer format uses faceIds as part of its output. More... | |
virtual bool | needsUpdate () const |
Does the writer need an update (eg, lagging behind surface changes) More... | |
virtual bool | wroteData () const |
Geometry or fields written since the last open? More... | |
virtual bool | expire () |
virtual void | clear () |
virtual void | setSurface (const meshedSurf &surf, bool parallel) |
virtual void | setSurface (const pointField &points, const faceList &faces, bool parallel) |
virtual void | setSurface (const meshedSurf &surf) |
virtual void | setSurface (const pointField &points, const faceList &faces) |
bool | hasSurface () const |
Writer is associated with a surface. More... | |
bool | empty () const |
The surface to write is empty if the global number of faces is zero. More... | |
label | size () const |
The global number of faces for the associated surface. More... | |
label | nFields () const |
The number of expected output fields. More... | |
label | nFields (const label n) |
Set the number of expected output fields. More... | |
bool | isPointData () const |
Are the field data to be treated as point data? More... | |
bool | isPointData (const bool on) |
Set handling of field data to face/point data. More... | |
bool | useTimeDir () const |
Should a time directory be spliced into the output path? More... | |
bool | useTimeDir (const bool on) |
Enable/disable use of spliced output path. More... | |
bool | verbose () const |
Get output verbosity. More... | |
bool | verbose (const bool on) |
Enable/disable verbose output. More... | |
scalar | mergeDim () const |
The current value of the point merge dimension (metre) More... | |
scalar | mergeDim (const scalar dist) |
Change the point merge dimension (metre) More... | |
bool | hasTime () const |
True if there is a known time. More... | |
const word & | timeName () const |
The current time value/name. More... | |
scalar | timeValue () const |
The current time value/name. More... | |
void | setTime (const instant &inst) |
Set the current time. More... | |
void | setTime (scalar timeValue) |
Set current time from timeValue, auto generating the name. More... | |
void | setTime (scalar timeValue, const word &timeName) |
Set current time from timeValue and timeName. More... | |
void | unsetTime () |
Clear the current time. More... | |
virtual void | beginTime (const Time &t) |
Begin a time-step. More... | |
virtual void | beginTime (const instant &inst) |
Begin a time-step. More... | |
virtual void | endTime () |
End a time-step. More... | |
virtual void | open (const fileName &outputPath) |
Open for output on specified path, using existing surface. More... | |
virtual void | open (const pointField &points, const faceList &faces, const fileName &outputPath, bool parallel) |
Open from components. More... | |
virtual void | open (const meshedSurf &surf, const fileName &outputPath, bool parallel) |
Open from components. More... | |
virtual void | open (const pointField &points, const faceList &faces, const fileName &outputPath) |
Open from components, with the current parallel/serial treatment. More... | |
virtual void | open (const meshedSurf &surf, const fileName &outputPath) |
Open from components, with the current parallel/serial treatment. More... | |
virtual void | close () |
Finish output, performing any necessary cleanup. More... | |
virtual fileName | write ()=0 |
Write separate surface geometry to file. More... | |
virtual fileName | write (const word &fieldName, const Field< label > &values)=0 |
Write field of label (per face or vertex) More... | |
virtual fileName | write (const word &fieldName, const Field< scalar > &values)=0 |
Write field of scalar (per face or vertex) More... | |
virtual fileName | write (const word &fieldName, const Field< vector > &values)=0 |
Write field of vector (per face or vertex) More... | |
virtual fileName | write (const word &fieldName, const Field< sphericalTensor > &values)=0 |
Write field of sphericalTensor (per face or vertex) More... | |
virtual fileName | write (const word &fieldName, const Field< symmTensor > &values)=0 |
Write field of symmTensor (per face or vertex) More... | |
virtual fileName | write (const word &fieldName, const Field< tensor > &values)=0 |
Write field of tensor (per face or vertex) More... | |
virtual InfoProxy< surfaceWriter > | info () const |
Return info proxy. More... | |
template<class Type > | |
Foam::tmp< Foam::Field< Type > > | mergeFieldTemplate (const Field< Type > &fld) const |
Static Public Member Functions | |
static bool | supportedType (const word &writeType) |
True if New is likely to succeed for this writeType. More... | |
static autoPtr< surfaceWriter > | New (const word &writeType) |
Return a reference to the selected surfaceWriter. More... | |
static autoPtr< surfaceWriter > | New (const word &writeType, const dictionary &writeOptions) |
Return a reference to the selected surfaceWriter. More... | |
Static Public Attributes | |
static scalar | defaultMergeDim = 1e-8 |
The default merge dimension (1e-8) More... | |
Protected Member Functions | |
bool | checkOpen () const |
Verify that the outputPath_ has been set or FatalError. More... | |
virtual bool | merge () const |
const meshedSurf & | surface () const |
template<class Type > | |
tmp< Field< Type > > | mergeFieldTemplate (const Field< Type > &fld) const |
Gather (merge) fields with renumbering and shrinking for point data. More... | |
tmp< Field< label > > | mergeField (const Field< label > &fld) const |
tmp< Field< scalar > > | mergeField (const Field< scalar > &fld) const |
tmp< Field< vector > > | mergeField (const Field< vector > &fld) const |
tmp< Field< sphericalTensor > > | mergeField (const Field< sphericalTensor > &fld) const |
tmp< Field< symmTensor > > | mergeField (const Field< symmTensor > &fld) const |
tmp< Field< tensor > > | mergeField (const Field< tensor > &fld) const |
template<class Type > | |
fileName | writeTemplate (const word &fieldName, const Field< Type > &localValues) |
Dummy templated write operation. More... | |
Protected Attributes | |
std::reference_wrapper< const meshedSurf > | surf_ |
Reference to a surface. More... | |
meshedSurfRef | surfComp_ |
Reference to raw surface components. More... | |
bool | useComponents_ |
Use raw surface components instead of surface reference. More... | |
bool | upToDate_ |
The topology/surface is up-to-date? More... | |
bool | wroteGeom_ |
Track if geometry has been written since the last open. More... | |
bool | parallel_ |
Writing in parallel (via master) More... | |
bool | useTimeDir_ |
Insert additional time sub-directory in the output path. More... | |
bool | isPointData_ |
Is point vs cell data. More... | |
bool | verbose_ |
Additional output verbosity. More... | |
label | nFields_ |
The number of fields. More... | |
scalar | mergeDim_ |
Dimension for merging. More... | |
mergedSurf | merged_ |
Merging information and the resulting merged surface (parallel) More... | |
instant | currTime_ |
The current time value/name. More... | |
fileName | outputPath_ |
The full output directory and file (surface) name. More... | |
Static Protected Attributes | |
static const meshedSurf::emptySurface | emptySurface_ |
Placeholder. More... | |
Friends | |
Ostream & | operator<< (Ostream &os, const InfoProxy< surfaceWriter > &ip) |
Output info proxy. More... | |
Base class for surface writers.
The surfaceWriter interface is rather large since we need a writer that can either be initially defined without a surface association and have that added at a later stage, or be defined with a surface association.
formatOptions { someFormat // Eg, ensight, vtk, etc { verbose true; } }
Format options:
Property | Description | Required | Default |
---|---|---|---|
verbose | Additional output verbosity | no | no |
Definition at line 114 of file surfaceWriter.H.
surfaceWriter | ( | ) |
Default construct.
Definition at line 140 of file surfaceWriter.C.
References surfaceWriter::close().
|
explicit |
Default construct with specified options.
Definition at line 161 of file surfaceWriter.C.
References dictionary::readIfPresent(), and surfaceWriter::verbose_.
|
explicit |
Construct from components.
Definition at line 170 of file surfaceWriter.C.
surfaceWriter | ( | const pointField & | points, |
const faceList & | faces, | ||
bool | parallel = Pstream::parRun() , |
||
const dictionary & | options = dictionary() |
||
) |
|
virtual |
Destructor. Calls close()
Definition at line 198 of file surfaceWriter.C.
|
protected |
Verify that the outputPath_ has been set or FatalError.
Definition at line 433 of file surfaceWriter.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and Foam::type().
|
protectedvirtual |
Merge surfaces if they are not already upToDate (parallel) or simply mark the surface as being up-to-date
Definition at line 446 of file surfaceWriter.C.
References UPstream::parRun().
|
protected |
Merge surfaces (if not upToDate) and return merged or the regular surface
Definition at line 472 of file surfaceWriter.C.
References UPstream::parRun().
Gather (merge) fields with renumbering and shrinking for point data.
|
protected |
Definition at line 542 of file surfaceWriter.C.
|
protected |
Definition at line 543 of file surfaceWriter.C.
|
protected |
Definition at line 544 of file surfaceWriter.C.
|
protected |
Definition at line 545 of file surfaceWriter.C.
|
inlineprotected |
Dummy templated write operation.
fieldName | Name of field |
localValues | Local field values to write |
Definition at line 203 of file surfaceWriter.H.
References fileName::null, surfaceWriter::write(), and surfaceWriter::wroteGeom_.
TypeName | ( | "surfaceWriter" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
surfaceWriter | , | ||
word | , | ||
() | , | ||
() | |||
) |
declareRunTimeSelectionTable | ( | autoPtr | , |
surfaceWriter | , | ||
wordDict | , | ||
(const dictionary &writeOpts) | , | ||
(writeOpts) | |||
) |
True if New is likely to succeed for this writeType.
Definition at line 52 of file surfaceWriter.C.
References MeshedSurfaceProxy< Face >::canWriteType().
|
static |
Return a reference to the selected surfaceWriter.
Definition at line 64 of file surfaceWriter.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::flatOutput(), and Foam::nl.
Referenced by averageNeighbourFvGeometryScheme::movePoints(), surfaceNoise::read(), areaWrite::read(), Curle::read(), surfaceFieldValue::read(), and propellerInfo::setSampleDiskSurface().
|
static |
Return a reference to the selected surfaceWriter.
Select with extra write option
Definition at line 95 of file surfaceWriter.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and MeshedSurfaceProxy< Face >::writeTypes().
|
inlinevirtual |
The writer is enabled. If the writer is not enabled, it may be possible for the caller to skip various preparatory operations.
This method is primarily useful for the null writer
Reimplemented in nullWriter.
Definition at line 304 of file surfaceWriter.H.
|
inlinevirtual |
True if the surface format requires geometry in a separate file.
Reimplemented in ensightWriter, foamWriter, starcdWriter, and proxyWriter.
Definition at line 310 of file surfaceWriter.H.
|
inlinevirtual |
True if the writer format uses faceIds as part of its output.
Element ids are used by various CAE formats (abaqus, nastran, starcd, ...)
Reimplemented in nastranWriter, abaqusWriter, and starcdWriter.
Definition at line 318 of file surfaceWriter.H.
|
virtual |
Does the writer need an update (eg, lagging behind surface changes)
Reimplemented in nullWriter.
Definition at line 374 of file surfaceWriter.C.
Referenced by areaWrite::write().
|
virtual |
Geometry or fields written since the last open?
Reimplemented in nullWriter.
Definition at line 380 of file surfaceWriter.C.
Referenced by areaWrite::write().
|
virtual |
Mark that surface changed and the writer will need an update, and set nFields = 0.
May also free up unneeded data. Return false if it was previously already expired.
Definition at line 386 of file surfaceWriter.C.
|
virtual |
Close any open output, remove association with a surface and expire the writer. The parallel flag remains untouched.
Definition at line 316 of file surfaceWriter.C.
|
virtual |
Change association with a surface, expire the writer with defined parallel/serial treatment
Reimplemented in nullWriter.
Definition at line 327 of file surfaceWriter.C.
References UPstream::parRun().
Referenced by areaWrite::write().
|
virtual |
Change association with a surface, expire the writer with defined parallel/serial treatment
Reimplemented in nullWriter.
Definition at line 341 of file surfaceWriter.C.
References UPstream::parRun(), and points.
|
virtual |
Change association with a surface, expire the writer with the current parallel/serial treatment
Definition at line 356 of file surfaceWriter.C.
|
virtual |
Change association with a surface, expire the writer with the current parallel/serial treatment
Definition at line 365 of file surfaceWriter.C.
References points.
bool hasSurface | ( | ) | const |
Writer is associated with a surface.
Definition at line 401 of file surfaceWriter.C.
bool empty | ( | ) | const |
The surface to write is empty if the global number of faces is zero.
Definition at line 407 of file surfaceWriter.C.
References Foam::returnReduce().
Foam::label size | ( | ) | const |
The global number of faces for the associated surface.
Definition at line 420 of file surfaceWriter.C.
References Foam::returnReduce().
|
inline |
The number of expected output fields.
Currently only used by the legacy VTK format.
Definition at line 30 of file surfaceWriterI.H.
References surfaceWriter::nFields_.
Referenced by areaWrite::write().
|
inline |
Set the number of expected output fields.
Currently only used by the legacy VTK format.
Definition at line 36 of file surfaceWriterI.H.
References n.
|
inline |
Are the field data to be treated as point data?
Definition at line 44 of file surfaceWriterI.H.
Set handling of field data to face/point data.
Definition at line 50 of file surfaceWriterI.H.
|
inline |
Should a time directory be spliced into the output path?
Definition at line 58 of file surfaceWriterI.H.
Enable/disable use of spliced output path.
Definition at line 64 of file surfaceWriterI.H.
|
inline |
Get output verbosity.
Definition at line 72 of file surfaceWriterI.H.
|
inline |
The current value of the point merge dimension (metre)
Definition at line 86 of file surfaceWriterI.H.
|
inline |
Change the point merge dimension (metre)
Definition at line 92 of file surfaceWriterI.H.
|
inline |
True if there is a known time.
Definition at line 100 of file surfaceWriterI.H.
|
inline |
The current time value/name.
Definition at line 106 of file surfaceWriterI.H.
|
inline |
The current time value/name.
Definition at line 112 of file surfaceWriterI.H.
void setTime | ( | const instant & | inst | ) |
Set the current time.
Definition at line 206 of file surfaceWriter.C.
void setTime | ( | scalar | timeValue | ) |
Set current time from timeValue, auto generating the name.
Definition at line 212 of file surfaceWriter.C.
void setTime | ( | scalar | timeValue, |
const word & | timeName | ||
) |
Set current time from timeValue and timeName.
Definition at line 218 of file surfaceWriter.C.
References timeName.
void unsetTime | ( | ) |
Clear the current time.
Definition at line 225 of file surfaceWriter.C.
|
virtual |
Begin a time-step.
Reimplemented in vtkWriter.
Definition at line 232 of file surfaceWriter.C.
References setTime(), Time::timeName(), and dimensioned< Type >::value().
Referenced by vtkWriter::beginTime(), and areaWrite::write().
|
virtual |
Begin a time-step.
Reimplemented in vtkWriter.
Definition at line 238 of file surfaceWriter.C.
References setTime().
|
virtual |
End a time-step.
Reimplemented in vtkWriter.
Definition at line 244 of file surfaceWriter.C.
Referenced by vtkWriter::endTime(), and areaWrite::write().
|
virtual |
Open for output on specified path, using existing surface.
Reimplemented in nullWriter.
Definition at line 250 of file surfaceWriter.C.
Referenced by proxyWriter::proxyWriter(), and areaWrite::write().
|
virtual |
|
virtual |
Open from components.
Definition at line 258 of file surfaceWriter.C.
|
virtual |
Open from components, with the current parallel/serial treatment.
Definition at line 297 of file surfaceWriter.C.
References points.
|
virtual |
Open from components, with the current parallel/serial treatment.
Definition at line 285 of file surfaceWriter.C.
|
virtual |
Finish output, performing any necessary cleanup.
Reimplemented in ensightWriter, and vtkWriter.
Definition at line 309 of file surfaceWriter.C.
Referenced by vtkWriter::close(), ensightWriter::close(), and surfaceWriter::surfaceWriter().
|
pure virtual |
Write separate surface geometry to file.
Implemented in nastranWriter, boundaryDataWriter, ensightWriter, abaqusWriter, vtkWriter, rawWriter, foamWriter, starcdWriter, x3dWriter, proxyWriter, and nullWriter.
Referenced by areaWrite::write(), and surfaceWriter::writeTemplate().
Write field of label (per face or vertex)
fieldName | Name of field |
values | Field values to write |
Write field of scalar (per face or vertex)
fieldName | Name of field |
values | Field values to write |
Write field of vector (per face or vertex)
fieldName | Name of field |
values | Field values to write |
|
pure virtual |
Write field of sphericalTensor (per face or vertex)
fieldName | Name of field |
values | Field values to write |
|
pure virtual |
Write field of symmTensor (per face or vertex)
fieldName | Name of field |
values | Field values to write |
Write field of tensor (per face or vertex)
fieldName | Name of field |
values | Field values to write |
|
inlinevirtual |
Return info proxy.
Definition at line 540 of file surfaceWriter.H.
Foam::tmp<Foam::Field<Type> > mergeFieldTemplate | ( | const Field< Type > & | fld | ) | const |
Definition at line 496 of file surfaceWriter.C.
References fld, globalIndex::gatherOp(), Foam::inplaceReorder(), UPstream::master(), Foam::New(), and UPstream::parRun().
|
friend |
Output info proxy.
|
staticprotected |
Placeholder.
Definition at line 121 of file surfaceWriter.H.
|
protected |
Reference to a surface.
Definition at line 127 of file surfaceWriter.H.
|
protected |
Reference to raw surface components.
Definition at line 130 of file surfaceWriter.H.
|
protected |
Use raw surface components instead of surface reference.
Definition at line 133 of file surfaceWriter.H.
|
mutableprotected |
The topology/surface is up-to-date?
Definition at line 136 of file surfaceWriter.H.
Referenced by Foam::operator<<().
|
mutableprotected |
Track if geometry has been written since the last open.
Definition at line 139 of file surfaceWriter.H.
Referenced by surfaceWriter::writeTemplate().
|
protected |
Writing in parallel (via master)
Definition at line 142 of file surfaceWriter.H.
|
protected |
Insert additional time sub-directory in the output path.
Definition at line 145 of file surfaceWriter.H.
|
protected |
Is point vs cell data.
Definition at line 148 of file surfaceWriter.H.
Referenced by Foam::operator<<().
|
protected |
Additional output verbosity.
Definition at line 151 of file surfaceWriter.H.
Referenced by surfaceWriter::surfaceWriter().
|
protected |
The number of fields.
Definition at line 154 of file surfaceWriter.H.
Referenced by surfaceWriter::nFields(), and Foam::operator<<().
|
protected |
Dimension for merging.
Definition at line 157 of file surfaceWriter.H.
|
mutableprotected |
Merging information and the resulting merged surface (parallel)
Definition at line 160 of file surfaceWriter.H.
|
protected |
The current time value/name.
Definition at line 163 of file surfaceWriter.H.
Referenced by Foam::operator<<().
|
protected |
The full output directory and file (surface) name.
Definition at line 166 of file surfaceWriter.H.
Referenced by Foam::operator<<().
|
static |
The default merge dimension (1e-8)
Definition at line 221 of file surfaceWriter.H.