writer< Type > Class Template Referenceabstract

Base class for graphics format writing. Entry points are. More...

Inheritance diagram for writer< Type >:
[legend]

Public Member Functions

 TypeName ("writer")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, writer, word,(),())
 
 declareRunTimeSelectionTable (autoPtr, writer, dict,(const dictionary &formatOptions),(formatOptions))
 
 writer ()
 Default construct. More...
 
 writer (const dictionary &dict)
 Construct with dictionary. More...
 
virtual ~writer ()=default
 Destructor. More...
 
virtual fileName getFileName (const coordSet &, const wordList &) const =0
 Generate file name with correct extension. More...
 
virtual void write (const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
 General entry point for writing. More...
 
virtual void write (const coordSet &, const wordList &, const List< Field< Type >> &, Ostream &) const
 General entry point for writing. More...
 
virtual void write (const bool writeTracks, const List< scalarField > &times, const PtrList< coordSet > &tracks, const wordList &valueSetNames, const List< List< Field< Type >>> &valueSets, Ostream &) const =0
 General entry point for writing of multiple coordSets. More...
 
virtual Ostreamwrite (const scalar, Ostream &) const
 Write scalar as ascii. More...
 
template<class VSType >
OstreamwriteVS (const VSType &, Ostream &) const
 
virtual Ostreamwrite (const vector &, Ostream &) const
 Write vector. Tab separated ascii. More...
 
virtual Ostreamwrite (const sphericalTensor &, Ostream &) const
 Write sphericalTensor. Tab separated ascii. More...
 
virtual Ostreamwrite (const symmTensor &, Ostream &) const
 Write symmTensor. Tab separated ascii. More...
 
virtual Ostreamwrite (const tensor &, Ostream &) const
 Write tensor. Tab separated ascii. More...
 
template<class VSType >
Foam::OstreamwriteVS (const VSType &value, Ostream &os) const
 

Static Public Member Functions

static autoPtr< writerNew (const word &writeFormat)
 Return a reference to the selected writer. More...
 
static autoPtr< writerNew (const word &writeFormat, const dictionary &formatOptions)
 Return a reference to the selected writer. More...
 

Protected Member Functions

fileName getBaseName (const coordSet &, const wordList &) const
 Generates filename from coordSet and sampled fields. More...
 
void writeCoord (const coordSet &, const label sampleI, Ostream &) const
 
void writeTable (const coordSet &, const List< Type > &, Ostream &) const
 Writes single-column ascii write. Column 1 is coordSet coordinate,. More...
 
void writeTable (const coordSet &, const List< const List< Type > * > &, Ostream &os) const
 Writes multi-column ascii write. Column 1 is coordSet coordinate,. More...
 
virtual void writeSeparator (Ostream &os) const
 Writes a separator. Used by write functions. More...
 

Detailed Description

template<class Type>
class Foam::writer< Type >

Base class for graphics format writing. Entry points are.

- write(..).
Write to an Ostream a table of points with corresponding values.

  • write(scalar/vector/sphericalTensor/symmTensor/tensor).
    Write single scalar/vector/sphericalTensor/symmTensor/tensor. Default is to write space separated components.

Example:

    // Construct writer of xmgr type
    autoPtr<writer<scalar>> scalarFormatter(writer<scalar>::New("xmgr"));

    // Output list of points and corresponding values
    scalarFormatter().write
    (
        coordSet(...)
        "U.component(0)",   // name of values
        vals                // values
    );
Source files

Definition at line 81 of file writer.H.

Constructor & Destructor Documentation

◆ writer() [1/2]

writer ( )

Default construct.

Definition at line 165 of file writer.C.

◆ writer() [2/2]

writer ( const dictionary dict)
explicit

Construct with dictionary.

Definition at line 170 of file writer.C.

◆ ~writer()

virtual ~writer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ getBaseName()

Foam::fileName getBaseName ( const coordSet points,
const wordList valueSets 
) const
protected

Generates filename from coordSet and sampled fields.

Definition at line 85 of file writer.C.

◆ writeCoord()

void writeCoord ( const coordSet points,
const label  sampleI,
Ostream os 
) const
protected

Definition at line 103 of file writer.C.

◆ writeTable() [1/2]

void writeTable ( const coordSet points,
const List< Type > &  values,
Ostream os 
) const
protected

Writes single-column ascii write. Column 1 is coordSet coordinate,.

columns 2 is the value. Uses write() function to write coordinate in correct format.

Definition at line 122 of file writer.C.

◆ writeTable() [2/2]

void writeTable ( const coordSet points,
const List< const List< Type > * > &  valuesPtrList,
Ostream os 
) const
protected

Writes multi-column ascii write. Column 1 is coordSet coordinate,.

columns 2..n are the values. Uses write() function to write coordinate in correct format.

Definition at line 140 of file writer.C.

◆ writeSeparator()

void writeSeparator ( Ostream os) const
protectedvirtual

Writes a separator. Used by write functions.

Reimplemented in csvSetWriter< Type >.

Definition at line 228 of file writer.C.

◆ TypeName()

TypeName ( "writer< Type >"  )

Runtime type information.

◆ declareRunTimeSelectionTable() [1/2]

declareRunTimeSelectionTable ( autoPtr  ,
writer< Type >  ,
word  ,
()  ,
()   
)

◆ declareRunTimeSelectionTable() [2/2]

declareRunTimeSelectionTable ( autoPtr  ,
writer< Type >  ,
dict  ,
(const dictionary &formatOptions ,
(formatOptions  
)

◆ New() [1/2]

Foam::autoPtr< Foam::writer< Type > > New ( const word writeFormat)
static

Return a reference to the selected writer.

Definition at line 38 of file writer.C.

Referenced by histogram::read(), streamLineBase::read(), particleDistribution::read(), regionSizeDistribution::read(), and graph::write().

Here is the caller graph for this function:

◆ New() [2/2]

Foam::autoPtr< Foam::writer< Type > > New ( const word writeFormat,
const dictionary formatOptions 
)
static

Return a reference to the selected writer.

Definition at line 60 of file writer.C.

◆ getFileName()

virtual fileName getFileName ( const coordSet ,
const wordList  
) const
pure virtual

Generate file name with correct extension.

Implemented in gltfSetWriter< Type >, nastranSetWriter< Type >, csvSetWriter< Type >, jplotSetWriter< Type >, vtkSetWriter< Type >, ensightSetWriter< Type >, gnuplotSetWriter< Type >, rawSetWriter< Type >, and xmgraceSetWriter< Type >.

Referenced by meshRefinement::findRegions(), and sampledSets::writeSampleFile().

Here is the caller graph for this function:

◆ write() [1/8]

◆ write() [2/8]

void write ( const coordSet points,
const wordList valueSetNames,
const List< Field< Type >> &  valueSets,
Ostream os 
) const
virtual

General entry point for writing.

The data is organized in a set of point with one or more values per point

Definition at line 178 of file writer.C.

◆ write() [3/8]

virtual void write ( const bool  writeTracks,
const List< scalarField > &  times,
const PtrList< coordSet > &  tracks,
const wordList valueSetNames,
const List< List< Field< Type >>> &  valueSets,
Ostream  
) const
pure virtual

General entry point for writing of multiple coordSets.

Each coordSet (track) has same data variables. The data is per variable, per track, per point of track. If writeTracks adds connecting lines (wherever applicable)

Implemented in nastranSetWriter< Type >, csvSetWriter< Type >, jplotSetWriter< Type >, vtkSetWriter< Type >, ensightSetWriter< Type >, gnuplotSetWriter< Type >, rawSetWriter< Type >, xmgraceSetWriter< Type >, and gltfSetWriter< Type >.

◆ write() [4/8]

Foam::Ostream & write ( const scalar  value,
Ostream os 
) const
virtual

Write scalar as ascii.

Definition at line 196 of file writer.C.

◆ writeVS() [1/2]

Ostream& writeVS ( const VSType &  ,
Ostream  
) const

◆ write() [5/8]

Foam::Ostream & write ( const vector value,
Ostream os 
) const
virtual

Write vector. Tab separated ascii.

Definition at line 238 of file writer.C.

◆ write() [6/8]

Foam::Ostream & write ( const sphericalTensor value,
Ostream os 
) const
virtual

Write sphericalTensor. Tab separated ascii.

Definition at line 249 of file writer.C.

◆ write() [7/8]

Foam::Ostream & write ( const symmTensor value,
Ostream os 
) const
virtual

Write symmTensor. Tab separated ascii.

Definition at line 260 of file writer.C.

◆ write() [8/8]

Foam::Ostream & write ( const tensor value,
Ostream os 
) const
virtual

Write tensor. Tab separated ascii.

Definition at line 271 of file writer.C.

◆ writeVS() [2/2]

Foam::Ostream& writeVS ( const VSType &  value,
Ostream os 
) const

Definition at line 208 of file writer.C.


The documentation for this class was generated from the following files: