setWriter Class Referenceabstract

Base class for writing coordinate sets with data. More...

Inheritance diagram for setWriter:
Collaboration diagram for setWriter:

Public Member Functions

 TypeName ("setWriter")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, setWriter, word,(const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression),(writeFormat, writeCompression))
 
 declareRunTimeSelectionTable (autoPtr, setWriter, dict,(const dictionary &dict),(dict))
 
 setWriter (const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression)
 Construct given write options. More...
 
 setWriter (const dictionary &dict)
 Construct from dictionary. More...
 
 setWriter (const setWriter &writer)
 Construct copy. More...
 
virtual autoPtr< setWriterclone () const =0
 Construct and return a clone. More...
 
virtual ~setWriter ()=0
 Destructor. More...
 
virtual void write (const fileName &outputDir, const fileName &setName, const coordSet &set, const wordList &valueSetNames #define TypeValueSetsConstArg(Type, nullArg)) const =0
 Write a coordSet and associated data. More...
 
virtual void write (const fileName &outputDir, const fileName &setName, const coordSet &set, const wordList &valueSetNames #define TypeValueSetsConstArg(Type, nullArg)) const
 Write a coordSet and associated data. More...
 
template<class ... Args>
void write (const fileName &outputDir, const fileName &setName, const coordSet &set, const Args &... args) const
 Write fields for a single surface to file. For use in code where. More...
 
template<class Type >
Foam::OstreamwriteValue (const Type &value, Ostream &os, const bool align) const
 

Static Public Member Functions

template<class Types , class Type >
static void appendTypeValueSet (UPtrList< const Field< Types >> &valueSets, const Field< Type > &valueSet)
 Helper for variadic write. More...
 
template<class Type >
static void appendTypeValueSet (UPtrList< const Field< Type >> &valueSets, const Field< Type > &valueSet)
 Helper for variadic write. More...
 
static void unpackTypeValueSets (wordList &valueSetNames #define TypeValueSetsNonConstArg(Type, nullArg))
 Helper for variadic write. More...
 
template<class Type , class ... Args>
static void unpackTypeValueSets (wordList &valueSetNames #define TypeValueSetsNonConstArg(Type, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg), const word &valueSetName, const Field< Type > &valueSet, Args &... args)
 Helper for variadic write. More...
 
template<class Type , class ... Args>
static void unpackTypeValueSets (wordList &valueSetNames #define TypeValueSetsNonConstArg(Type, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg), const wordList &valueSetNamesPart, const UPtrList< const Field< Type >> &valueSetsPart, Args &... args)
 Helper for variadic write. More...
 
template<class Type , class ... Args>
static void unpackTypeValueSets (wordList &valueSetNames #define TypeValueSetsNonConstArg(Type, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg), const wordList &valueSetNamesPart, const PtrList< Field< Type >> &valueSetsPart, Args &... args)
 Helper for variadic write. More...
 
static autoPtr< setWriterNew (const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
 Select given write options. More...
 
static autoPtr< setWriterNew (const word &writeType, const dictionary &dict)
 Select given a dictionary. More...
 

Protected Member Functions

virtual void writeValueSeparator (Ostream &os) const
 Write a value separator. More...
 
virtual void writeCoordSeparator (Ostream &os) const
 Write a coordinate separator. More...
 
virtual void writeSegmentSeparator (Ostream &os) const
 Write a segment separator. More...
 
const List< string > & delimiters () const
 Possible delimiters that need quoting. More...
 
OstreamwriteWord (const word &w, Ostream &os, const bool align=false, const unsigned long alignPad=0) const
 Write a word. More...
 
template<class Type >
OstreamwriteValue (const Type &value, Ostream &os, const bool align=false) const
 Write a value. More...
 
void writeTableHeader (const coordSet &set, const wordList &valueSetNames, #define TypeValueSetsConstArg(Type, nullArg) Ostream &os, const bool align=false, const unsigned long alignPad=0) const
 Write multi-column table header. More...
 
void writeTable (const coordSet &set, #define TypeValueSetsConstArg(Type, nullArg) Ostream &os, const bool align=false) const
 Write multi-column table of data. More...
 

Static Protected Member Functions

static unsigned long columnWidth (Ostream &os)
 Width of columns in tabulated output. More...
 

Protected Attributes

IOstream::streamFormat writeFormat_
 Write format. More...
 
IOstream::compressionType writeCompression_
 Write compression. More...
 
autoPtr< List< string > > delimiters_
 Possible delimiters that need quoting. Constructed on demand from. More...
 

Detailed Description

Base class for writing coordinate sets with data.

Example:

    setWriter::New("vtk")->write
    (
        "myDirectory",
        "mySet",
        coordSet(true, "position", points),
        "p", p,
        "U", U
    );
Source files

Definition at line 63 of file setWriter.H.

Constructor & Destructor Documentation

◆ setWriter() [1/3]

setWriter ( const IOstream::streamFormat  writeFormat,
const IOstream::compressionType  writeCompression 
)

Construct given write options.

Definition at line 248 of file setWriter.C.

◆ setWriter() [2/3]

setWriter ( const dictionary dict)

Construct from dictionary.

Definition at line 259 of file setWriter.C.

◆ setWriter() [3/3]

setWriter ( const setWriter writer)

Construct copy.

Definition at line 276 of file setWriter.C.

◆ ~setWriter()

~setWriter ( )
pure virtual

Destructor.

Definition at line 347 of file setWriter.C.

Member Function Documentation

◆ appendTypeValueSet() [1/2]

static void appendTypeValueSet ( UPtrList< const Field< Types >> &  valueSets,
const Field< Type > &  valueSet 
)
inlinestatic

Helper for variadic write.

Definition at line 71 of file setWriter.H.

◆ appendTypeValueSet() [2/2]

static void appendTypeValueSet ( UPtrList< const Field< Type >> &  valueSets,
const Field< Type > &  valueSet 
)
inlinestatic

Helper for variadic write.

Definition at line 83 of file setWriter.H.

◆ unpackTypeValueSets() [1/4]

static void unpackTypeValueSets ( wordList &valueSetNames #define   TypeValueSetsNonConstArgType, nullArg)
inlinestatic

Helper for variadic write.

Definition at line 94 of file setWriter.H.

Referenced by setWriter::unpackTypeValueSets(), setWriter::write(), and surfaceWriter::write().

Here is the caller graph for this function:

◆ unpackTypeValueSets() [2/4]

static void unpackTypeValueSets ( wordList &valueSetNames #define   TypeValueSetsNonConstArgType, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg,
const word valueSetName,
const Field< Type > &  valueSet,
Args &...  args 
)
inlinestatic

Helper for variadic write.

Definition at line 106 of file setWriter.H.

References AppendTypeValueSet, args, Foam::FOR_ALL_FIELD_TYPES(), TypeValueSetsParameter, and setWriter::unpackTypeValueSets().

Here is the call graph for this function:

◆ unpackTypeValueSets() [3/4]

static void unpackTypeValueSets ( wordList &valueSetNames #define   TypeValueSetsNonConstArgType, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg,
const wordList valueSetNamesPart,
const UPtrList< const Field< Type >> &  valueSetsPart,
Args &...  args 
)
inlinestatic

Helper for variadic write.

Definition at line 137 of file setWriter.H.

References AppendTypeValueSet, args, Foam::FOR_ALL_FIELD_TYPES(), forAll, TypeValueSetsParameter, and setWriter::unpackTypeValueSets().

Here is the call graph for this function:

◆ unpackTypeValueSets() [4/4]

static void unpackTypeValueSets ( wordList &valueSetNames #define   TypeValueSetsNonConstArgType, nullArg) FOR_ALL_FIELD_TYPES(TypeValueSetsNonConstArg,
const wordList valueSetNamesPart,
const PtrList< Field< Type >> &  valueSetsPart,
Args &...  args 
)
inlinestatic

Helper for variadic write.

Definition at line 171 of file setWriter.H.

References args, Foam::FOR_ALL_FIELD_TYPES(), TypeValueSetsParameter, and setWriter::unpackTypeValueSets().

Here is the call graph for this function:

◆ writeValueSeparator()

void writeValueSeparator ( Ostream os) const
protectedvirtual

Write a value separator.

Reimplemented in csvSetWriter.

Definition at line 43 of file setWriter.C.

References token::SPACE.

Referenced by setWriter::writeValue().

Here is the caller graph for this function:

◆ writeCoordSeparator()

void writeCoordSeparator ( Ostream os) const
protectedvirtual

Write a coordinate separator.

Definition at line 49 of file setWriter.C.

References Foam::nl.

◆ writeSegmentSeparator()

void writeSegmentSeparator ( Ostream os) const
protectedvirtual

Write a segment separator.

Reimplemented in rawSetWriter, and csvSetWriter.

Definition at line 55 of file setWriter.C.

References Foam::nl.

◆ delimiters()

const Foam::List< Foam::string > & delimiters ( ) const
protected

Possible delimiters that need quoting.

Definition at line 61 of file setWriter.C.

References OStringStream::rewind(), and OStringStream::str().

Here is the call graph for this function:

◆ columnWidth()

static unsigned long columnWidth ( Ostream os)
inlinestaticprotected

Width of columns in tabulated output.

Definition at line 228 of file setWriter.H.

References Ostream::precision().

Referenced by setWriter::writeValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeWord()

Foam::Ostream & writeWord ( const word w,
Ostream os,
const bool  align = false,
const unsigned long  alignPad = 0 
) const
inlineprotected

Write a word.

Definition at line 82 of file setWriter.C.

References forAll, and s().

Here is the call graph for this function:

◆ writeValue() [1/2]

Ostream& writeValue ( const Type &  value,
Ostream os,
const bool  align = false 
) const
protected

Write a value.

◆ writeTableHeader()

void writeTableHeader ( const coordSet set,
const wordList valueSetNames,
#define TypeValueSetsConstArg(Type, nullArg) Ostream os,
const bool  align = false,
const unsigned long  alignPad = 0 
) const
protected

Write multi-column table header.

Definition at line 118 of file setWriter.C.

References Foam::first(), Foam::FOR_ALL_FIELD_TYPES(), forAll, coordSet::hasPointAxis(), coordSet::hasScalarAxis(), coordSet::pointName(), coordSet::scalarName(), and WriteTypeValueSetNames.

Here is the call graph for this function:

◆ writeTable()

void writeTable ( const coordSet set,
#define TypeValueSetsConstArg(Type, nullArg) Ostream os,
const bool  align = false 
) const
protected

Write multi-column table of data.

Definition at line 192 of file setWriter.C.

References Foam::first(), Foam::FOR_ALL_FIELD_TYPES(), forAll, coordSet::hasPointAxis(), coordSet::hasScalarAxis(), coordSet::pointCoord(), coordSet::scalarCoord(), coordSet::segments(), and WriteTypeValueSets.

Here is the call graph for this function:

◆ TypeName()

TypeName ( "setWriter"  )

Runtime type information.

◆ declareRunTimeSelectionTable() [1/2]

declareRunTimeSelectionTable ( autoPtr  ,
setWriter  ,
word  ,
(const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression)  ,
(writeFormat, writeCompression)   
)

◆ declareRunTimeSelectionTable() [2/2]

declareRunTimeSelectionTable ( autoPtr  ,
setWriter  ,
dict  ,
(const dictionary &dict ,
(dict  
)

◆ New() [1/2]

Foam::autoPtr< Foam::setWriter > New ( const word writeType,
const IOstream::streamFormat  writeFormat = IOstream::ASCII,
const IOstream::compressionType  writeCompression = IOstream::UNCOMPRESSED 
)
static

Select given write options.

Definition at line 285 of file setWriter.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Referenced by main(), populationBalanceSizeDistribution::read(), histogram::read(), layerAverage::read(), patchCutLayerAverage::read(), regionSizeDistribution::read(), streamlines::read(), sampledSets::read(), and Foam::writeEk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ New() [2/2]

Foam::autoPtr< Foam::setWriter > New ( const word writeType,
const dictionary dict 
)
static

Select given a dictionary.

Definition at line 309 of file setWriter.C.

References IOstream::ASCII, IOstream::compressionEnum(), dict, IOstream::formatEnum(), dictionary::found(), dictionary::lookup(), and IOstream::UNCOMPRESSED.

Here is the call graph for this function:

◆ clone()

virtual autoPtr<setWriter> clone ( ) const
pure virtual

Construct and return a clone.

Implemented in vtkSetWriter, rawSetWriter, noSetWriter, gnuplotSetWriter, ensightSetWriter, and csvSetWriter.

◆ write() [1/3]

virtual void write ( const fileName outputDir,
const fileName setName,
const coordSet set,
const wordList &valueSetNames #define   TypeValueSetsConstArgType, nullArg 
) const
pure virtual

Write a coordSet and associated data.

Implemented in vtkSetWriter, rawSetWriter, noSetWriter, gnuplotSetWriter, ensightSetWriter, and csvSetWriter.

Referenced by setWriter::write().

Here is the caller graph for this function:

◆ write() [2/3]

virtual void write ( const fileName outputDir,
const fileName setName,
const coordSet set,
const wordList &valueSetNames #define   TypeValueSetsConstArgType, nullArg 
) const
inlinevirtual

Write a coordSet and associated data.

Reimplemented in vtkSetWriter, rawSetWriter, noSetWriter, gnuplotSetWriter, ensightSetWriter, and csvSetWriter.

Definition at line 369 of file setWriter.H.

References Foam::FOR_ALL_FIELD_TYPES(), TypeValueSetsParameter, and setWriter::write().

Here is the call graph for this function:

◆ write() [3/3]

void write ( const fileName outputDir,
const fileName setName,
const coordSet set,
const Args &...  args 
) const
inline

Write fields for a single surface to file. For use in code where.

the fields that are to be written are known. Takes any number of name, values arguments at the end. E.g.:

write ( Output options "myDirectory", "mySet",

Geometry coordSet(true, "position", points),

Fields "p", Field<scalar>(points.size(), ...), "U", Field<vector>(points.size(), ...) );

Definition at line 413 of file setWriter.H.

References args, DeclareTypeValueSets, Foam::FOR_ALL_FIELD_TYPES(), TypeValueSetsParameter, setWriter::unpackTypeValueSets(), and setWriter::write().

Here is the call graph for this function:

◆ writeValue() [2/2]

Foam::Ostream& writeValue ( const Type &  value,
Ostream os,
const bool  align 
) const

Definition at line 32 of file setWriterTemplates.C.

References setWriter::columnWidth(), Foam::component(), Foam::setw(), and setWriter::writeValueSeparator().

Here is the call graph for this function:

Member Data Documentation

◆ writeFormat_

IOstream::streamFormat writeFormat_
protected

Write format.

Definition at line 203 of file setWriter.H.

◆ writeCompression_

IOstream::compressionType writeCompression_
protected

Write compression.

Definition at line 206 of file setWriter.H.

◆ delimiters_

autoPtr<List<string> > delimiters_
mutableprotected

Possible delimiters that need quoting. Constructed on demand from.

the write.*Separator functions.

Definition at line 210 of file setWriter.H.


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