OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

writer< Type > Class Template Reference

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.
More...

Inheritance diagram for writer< Type >:

List of all members.


Public Member Functions

 TypeName ("writer")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, writer, word,(),())
 writer ()
 Construct null.
virtual ~writer ()=0
 Destructor.
virtual fileName getFileName (const coordSet &, const wordList &) const =0
 Generate file name with correct extension.
virtual void write (const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
 General entry point for writing.
virtual Ostream & write (const scalar, Ostream &) const
 Write scalar as ascii.
template<class VSType >
Ostream & writeVS (const VSType &, Ostream &) const
virtual Ostream & write (const vector &, Ostream &) const
 Write vector. Tab separated ascii.
virtual Ostream & write (const sphericalTensor &, Ostream &) const
 Write sphericalTensor. Tab separated ascii.
virtual Ostream & write (const symmTensor &, Ostream &) const
 Write symmTensor. Tab separated ascii.
virtual Ostream & write (const tensor &, Ostream &) const
 Write tensor. Tab separated ascii.

Static Public Member Functions

static autoPtr< writer > New (const word &writeFormat)
 Return a reference to the selected writer.

Protected Member Functions

fileName getBaseName (const coordSet &, const wordList &) const
 Generates filename from coordSet and sampled fields.
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,.
void writeTable (const coordSet &, const List< const List< Type > * > &, Ostream &os) const
 Writes multi-column ascii write. Column 1 is coordSet coordinate,.

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
        (
            points,         // sample coordinates
            "someLine",     // name of coordSet
            "distance",     // write coordinates as distance to refPoint
            points[0]       // reference point
        ),
        "U.component(0)",   // name of values
        vals                // values
    );

Source files

Definition at line 80 of file writer.H.


Constructor & Destructor Documentation

writer (  )  [inline]

Construct null.

Definition at line 135 of file writer.C.

~writer (  )  [inline, pure virtual]

Destructor.

Definition at line 142 of file writer.C.


Member Function Documentation

Foam::fileName getBaseName ( const coordSet &  points,
const wordList &  valueSets 
) const [inline, protected]

Generates filename from coordSet and sampled fields.

Definition at line 55 of file writer.C.

void writeCoord ( const coordSet &  points,
const label  sampleI,
Ostream &  os 
) const [inline, protected]

Definition at line 73 of file writer.C.

void writeTable ( const coordSet &  points,
const List< Type > &  values,
Ostream &  os 
) const [inline, 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 92 of file writer.C.

void writeTable ( const coordSet &  points,
const List< const List< Type > * > &  valuesPtrList,
Ostream &  os 
) const [inline, 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 111 of file writer.C.

TypeName ( "writer< Type >"   ) 

Runtime type information.

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

Foam::autoPtr< Foam::writer< Type > > New ( const word &  writeFormat  )  [inline, static]

Return a reference to the selected writer.

Definition at line 27 of file writer.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorIn.

Here is the call graph for this function:

virtual fileName getFileName ( const coordSet &  ,
const wordList &   
) const [pure virtual]

Generate file name with correct extension.

Implemented in gnuplotSetWriter< Type >, jplotSetWriter< Type >, rawSetWriter< Type >, and xmgraceSetWriter< Type >.

virtual void write ( const coordSet &  ,
const wordList &  ,
const List< const Field< Type > * > &  ,
Ostream &   
) const [pure virtual]

General entry point for writing.

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

Implemented in gnuplotSetWriter< Type >, jplotSetWriter< Type >, rawSetWriter< Type >, and xmgraceSetWriter< Type >.

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

Write scalar as ascii.

Definition at line 150 of file writer.C.

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

Definition at line 162 of file writer.C.

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

Write vector. Tab separated ascii.

Definition at line 182 of file writer.C.

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

Write sphericalTensor. Tab separated ascii.

Definition at line 193 of file writer.C.

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

Write symmTensor. Tab separated ascii.

Definition at line 204 of file writer.C.

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

Write tensor. Tab separated ascii.

Definition at line 215 of file writer.C.


The documentation for this class was generated from the following files:
  • src/sampling/sampledSet/writers/writer.H
  • src/sampling/sampledSet/writers/writer.C
Copyright © 2000-2009 OpenCFD Ltd