Loading...
Searching...
No Matches
ensightCase Class Reference

Supports writing of ensight cases as well as providing common factory methods to open new files. More...

#include <ensightCase.H>

Classes

class  options
 Configuration options for the ensightCase. More...

Public Member Functions

 ensightCase (const ensightCase &)=delete
 No copy construct.
void operator= (const ensightCase &)=delete
 No copy assignment.
 ensightCase (const fileName &ensightDir, const word &caseName, const options &opts)
 Construct from components.
 ensightCase (const fileName &ensightDir, const word &caseName, const IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
 Construct from components with all default options.
 ~ensightCase ()=default
 Destructor.
const ensightCase::optionsoption () const
 Reference to the case options.
IOstreamOption::streamFormat format () const
 The output file format (ascii/binary).
const fileNamepath () const noexcept
 The nominal path to the case file.
const wordmask () const
 The output '*' mask.
word padded (const label i) const
 Consistent zero-padded integer value.
bool nodeValues () const
 Force use of values per node instead of per element.
bool separateCloud () const
 Write clouds into their own directory instead in "data" directory.
void nextTime (const scalar t)
 Set time for time-set 1, using next available index.
void nextTime (const instant &t)
 Set time for time-set 1, using next available index.
void setTime (const scalar t, const label index)
 Set current index and time for time-set 1.
void setTime (const instant &t, const label index)
 Set current index and time for time-set 1.
autoPtr< ensightGeoFilenewGeometry (bool moving=false) const
 Open stream for new geometry file (on master). Does not include beginGeometry() marker.
autoPtr< ensightFilenewCloud (const word &cloudName) const
 Open stream for new cloud positions (on master).
template<class Type>
autoPtr< ensightFilenewData (const word &varName, const bool isPointData=false) const
 Open stream for new data file (on master), with current index.
template<class Type>
autoPtr< ensightFilenewPointData (const word &varName) const
 Open stream for new data file (on master), with current index and marking as containing POINT_DATA.
template<class Type>
autoPtr< ensightFilenewCloudData (const word &cloudName, const word &varName) const
 Open stream for new cloud data file (on master), with current index.
void rewind () const
 Rewind the output stream (master only).
void write () const
 Write the case file.
Ostreamoperator() () const
 Output stream (master only).
OstreamprintInfo (Ostream &os) const
 Print some general information.

Static Public Member Functions

static word mask (const int nwidth)
 A '*' mask of specified width.
static word padded (const int nwidth, const label index)
 Stringified zero-padded integer value of specified width.
template<class StringType>
static StringType expand_mask (const StringType &input, const label index)
 Replace the '*' mask chars with zero-padded integer value.
static void setTimeFormat (OSstream &os, IOstreamOption::floatFormat timeFmt, const int timePrec)
 Set output time format for ensight case file.
static void setTimeFormat (OSstream &os, const ensightCase::options &opts)
 Set output time format for ensight case file.
static void printTimeset (OSstream &os, const label ts, const scalar timeValue)
 Print time-set for ensight case file with a single time.
static void printTimeset (OSstream &os, const label ts, const UList< scalar > &times)
 Print time-set for ensight case file, with N times and 0-based file numbering.
static void printTimeset (OSstream &os, const label ts, const UList< scalar > &times, const bitSet &indices)
 Print time-set for ensight case file, with N times, 0-based file numbering but perhaps non-contiguous.

Static Public Attributes

static const char * dataDirName = "data"
 The name for data subdirectory: "data".
static const char * geometryName = "geometry"
 The name for geometry files: "geometry".

Detailed Description

Supports writing of ensight cases as well as providing common factory methods to open new files.

Source files

Definition at line 63 of file ensightCase.H.

Constructor & Destructor Documentation

◆ ensightCase() [1/3]

ensightCase ( const ensightCase & )
delete

No copy construct.

References ensightCase().

Referenced by ensightCase(), newCloudData(), and operator=().

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

◆ ensightCase() [2/3]

ensightCase ( const fileName & ensightDir,
const word & caseName,
const options & opts )

Construct from components.

Definition at line 554 of file ensightCase.C.

◆ ensightCase() [3/3]

ensightCase ( const fileName & ensightDir,
const word & caseName,
const IOstreamOption::streamFormat fmt = IOstreamOption::BINARY )

Construct from components with all default options.

Definition at line 573 of file ensightCase.C.

◆ ~ensightCase()

~ensightCase ( )
default

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const ensightCase & )
delete

No copy assignment.

References IOstreamOption::BINARY, and ensightCase().

Here is the call graph for this function:

◆ mask() [1/2]

Foam::word mask ( const int nwidth)
static

A '*' mask of specified width.

Definition at line 37 of file ensightCase.C.

Referenced by expand_mask(), and write().

Here is the caller graph for this function:

◆ padded() [1/2]

Foam::word padded ( const int nwidth,
const label index )
static

Stringified zero-padded integer value of specified width.

Definition at line 48 of file ensightCase.C.

References Foam::name().

Referenced by expand_mask(), newGeometry(), setTime(), write(), ensightWriter::writeCollated(), and ensightWriter::writeCollated().

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

◆ expand_mask()

template<class StringType>
StringType expand_mask ( const StringType & input,
const label index )
static

Replace the '*' mask chars with zero-padded integer value.

References cloudName(), mask(), newCloud(), newGeometry(), nextTime(), nodeValues(), Foam::noexcept, padded(), separateCloud(), and setTime().

Referenced by ensightSurfaceReader::geometry().

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

◆ option()

const Foam::ensightCase::options & option ( ) const
inline

Reference to the case options.

Definition at line 23 of file ensightCaseI.H.

◆ format()

Foam::IOstreamOption::streamFormat format ( ) const
inline

The output file format (ascii/binary).

Definition at line 29 of file ensightCaseI.H.

◆ path()

const Foam::fileName & path ( ) const
inlinenoexcept

The nominal path to the case file.

Definition at line 35 of file ensightCaseI.H.

References Foam::noexcept.

Referenced by newGeometry().

Here is the caller graph for this function:

◆ mask() [2/2]

const Foam::word & mask ( ) const
inline

The output '*' mask.

Definition at line 41 of file ensightCaseI.H.

◆ padded() [2/2]

Foam::word padded ( const label i) const
inline

Consistent zero-padded integer value.

Definition at line 47 of file ensightCaseI.H.

◆ nodeValues()

bool nodeValues ( ) const
inline

Force use of values per node instead of per element.

Definition at line 53 of file ensightCaseI.H.

Referenced by expand_mask(), printInfo(), write(), and Foam::writeVolField().

Here is the caller graph for this function:

◆ separateCloud()

bool separateCloud ( ) const
inline

Write clouds into their own directory instead in "data" directory.

Definition at line 59 of file ensightCaseI.H.

Referenced by expand_mask(), and write().

Here is the caller graph for this function:

◆ nextTime() [1/2]

void nextTime ( const scalar t)

Set time for time-set 1, using next available index.

Create corresponding sub-directory. Do not mix between nextTime and setTime in an application.

Definition at line 594 of file ensightCase.C.

References setTime().

Referenced by expand_mask(), and nextTime().

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

◆ nextTime() [2/2]

void nextTime ( const instant & t)

Set time for time-set 1, using next available index.

Create corresponding sub-directory. Do not mix between nextTime and setTime in an application.

Definition at line 601 of file ensightCase.C.

References nextTime(), and Instant< T >::value().

Here is the call graph for this function:

◆ setTime() [1/2]

void setTime ( const scalar t,
const label index )

Set current index and time for time-set 1.

Create corresponding sub-directory

Note
do not mix between nextTime and setTime in an application.

Definition at line 607 of file ensightCase.C.

References UPstream::master(), Foam::mkDir(), fileName::name(), Foam::nl, and padded().

Referenced by expand_mask().

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

◆ setTime() [2/2]

void setTime ( const instant & t,
const label index )

Set current index and time for time-set 1.

Create corresponding sub-directory

Note
do not mix between nextTime and setTime in an application.

Definition at line 632 of file ensightCase.C.

References setTime(), and Instant< T >::value().

Here is the call graph for this function:

◆ newGeometry()

Foam::autoPtr< Foam::ensightGeoFile > newGeometry ( bool moving = false) const

Open stream for new geometry file (on master). Does not include beginGeometry() marker.

Definition at line 831 of file ensightCase.C.

References filePtr, format(), geometryName, UPstream::master(), Foam::mkDir(), padded(), and path().

Referenced by expand_mask().

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

◆ newCloud()

Foam::autoPtr< Foam::ensightFile > newCloud ( const word & cloudName) const

Open stream for new cloud positions (on master).

Note the use of ensightFile, not ensightGeoFile.

Definition at line 867 of file ensightCase.C.

References cloudName(), filePtr, UPstream::master(), os(), and cloud::prefix.

Referenced by expand_mask().

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

◆ newData()

template<class Type>
autoPtr< ensightFile > newData ( const word & varName,
const bool isPointData = false ) const

Open stream for new data file (on master), with current index.

Optionally marking as containing POINT_DATA

References newData().

Referenced by newData(), Foam::writeAreaField(), Foam::writePointField(), and Foam::writeVolField().

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

◆ newPointData()

template<class Type>
autoPtr< ensightFile > newPointData ( const word & varName) const

Open stream for new data file (on master), with current index and marking as containing POINT_DATA.

References newPointData().

Referenced by newPointData().

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

◆ newCloudData()

template<class Type>
autoPtr< ensightFile > newCloudData ( const word & cloudName,
const word & varName ) const

Open stream for new cloud data file (on master), with current index.

References cloudName(), ensightCase(), newCloudData(), os(), printInfo(), printTimeset(), rewind(), setTimeFormat(), and write().

Referenced by newCloudData().

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

◆ rewind()

void rewind ( ) const

Rewind the output stream (master only).

Definition at line 893 of file ensightCase.C.

Referenced by newCloudData().

Here is the caller graph for this function:

◆ write()

void write ( ) const

Write the case file.

Definition at line 638 of file ensightCase.C.

References cloudName(), dataDirName, Foam::flush(), geometryName, mask(), Foam::name(), Foam::nl, nodeValues(), padded(), cloud::prefix, word::printf(), separateCloud(), Foam::setw(), HashTable< T, Key, Hash >::sortedToc(), and Foam::writeHeader().

Referenced by newCloudData().

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

◆ operator()()

Foam::Ostream & operator() ( ) const
inline

Output stream (master only).

Definition at line 67 of file ensightCaseI.H.

References Foam::Snull.

◆ printInfo()

Foam::Ostream & printInfo ( Ostream & os) const

Print some general information.

Definition at line 902 of file ensightCase.C.

References format(), Foam::nl, nodeValues(), and os().

Referenced by newCloudData().

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

◆ setTimeFormat() [1/2]

void setTimeFormat ( OSstream & os,
IOstreamOption::floatFormat timeFmt,
const int timePrec )
static

Set output time format for ensight case file.

Definition at line 62 of file ensightCase.C.

References os().

Referenced by newCloudData(), ensightWriter::writeCollated(), ensightWriter::writeCollated(), ensightWriter::writeUncollated(), and ensightWriter::writeUncollated().

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

◆ setTimeFormat() [2/2]

void setTimeFormat ( OSstream & os,
const ensightCase::options & opts )
static

Set output time format for ensight case file.

Definition at line 83 of file ensightCase.C.

References os(), ensightCase::options::timeFormat(), and ensightCase::options::timePrecision().

Here is the call graph for this function:

◆ printTimeset() [1/3]

void printTimeset ( OSstream & os,
const label ts,
const scalar timeValue )
static

Print time-set for ensight case file with a single time.

Definition at line 100 of file ensightCase.C.

References Foam::nl, and os().

Referenced by newCloudData(), printTimeset(), ensightWriter::writeCollated(), ensightWriter::writeCollated(), ensightWriter::writeUncollated(), and ensightWriter::writeUncollated().

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

◆ printTimeset() [2/3]

void printTimeset ( OSstream & os,
const label ts,
const UList< scalar > & times )
static

Print time-set for ensight case file, with N times and 0-based file numbering.

* TIME
* time set: ts
* number of steps: ns
* filename start number: 0
* filename increment: 1
* time values: time_1 time_2 ... time_ns
* 

Definition at line 121 of file ensightCase.C.

References Foam::nl, os(), Foam::setf(), and Foam::setw().

Here is the call graph for this function:

◆ printTimeset() [3/3]

void printTimeset ( OSstream & os,
const label ts,
const UList< scalar > & times,
const bitSet & indices )
static

Print time-set for ensight case file, with N times, 0-based file numbering but perhaps non-contiguous.

* TIME
* time set: ts
* number of steps: ns
* filename numbers: idx_1 idx_2 ... idx_ns
* time values: time_1 time_2 ... time_ns
* 

Definition at line 156 of file ensightCase.C.

References bitSet::all(), bitSet::count(), Foam::nl, os(), printTimeset(), Foam::setf(), Foam::setw(), and PackedList< Width >::size().

Here is the call graph for this function:

Member Data Documentation

◆ dataDirName

const char * dataDirName = "data"
static

The name for data subdirectory: "data".

Definition at line 75 of file ensightCase.H.

Referenced by write().

◆ geometryName

const char * geometryName = "geometry"
static

The name for geometry files: "geometry".

Definition at line 80 of file ensightCase.H.

Referenced by newGeometry(), write(), ensightWriter::writeCollated(), and ensightWriter::writeCollated().


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