Loading...
Searching...
No Matches
ensightSurfaceReader Class Reference

Ensight format surface reader. More...

#include <ensightSurfaceReader.H>

Inheritance diagram for ensightSurfaceReader:
Collaboration diagram for ensightSurfaceReader:

Public Member Functions

 ensightSurfaceReader (const ensightSurfaceReader &)=delete
 No copy construct.
void operator= (const ensightSurfaceReader &)=delete
 No copy assignment.
 TypeName ("ensight")
 Runtime type information.
 ensightSurfaceReader (const fileName &fName, const dictionary &options=dictionary())
 Construct from fileName, with reader options.
virtual ~ensightSurfaceReader ()=default
 Destructor.
virtual const meshedSurfacegeometry (const label timeIndex)
 Return a reference to the surface geometry.
virtual instantList times () const
 Return a list of the available times.
virtual wordList fieldNames (const label timeIndex) const
 Return a list of the available fields at a given time.
virtual tmp< Field< scalar > > field (const label timeIndex, const label fieldIndex, const scalar &refValue=pTraits< scalar >::zero) const
 Return a scalar field at a given time.
virtual tmp< Field< vector > > field (const label timeIndex, const label fieldIndex, const vector &refValue=pTraits< vector >::zero) const
 Return a vector field at a given time.
virtual tmp< Field< sphericalTensor > > field (const label timeIndex, const label fieldIndex, const sphericalTensor &refValue=pTraits< sphericalTensor >::zero) const
 Return a sphericalTensor field at a given time.
virtual tmp< Field< symmTensor > > field (const label timeIndex, const label fieldIndex, const symmTensor &refValue=pTraits< symmTensor >::zero) const
 Return a symmTensor field at a given time.
virtual tmp< Field< tensor > > field (const label timeIndex, const label fieldIndex, const tensor &refValue=pTraits< tensor >::zero) const
 Return a tensor field at a given time.
Public Member Functions inherited from surfaceReader
 TypeName ("surfaceReader")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, surfaceReader, fileName,(const fileName &fName, const dictionary &options),(fName, options))
 surfaceReader (const fileName &fName)
 Construct from fileName.
 surfaceReader (const fileName &fName, const dictionary &options)
 Construct from fileName and specified options.
virtual ~surfaceReader ()=default
 Destructor.

Protected Types

enum  idTypes : unsigned char { NONE = 0 , IGNORE = 1 , GIVEN = 2 }
 Handling of node/element id types (off, assign, ignore, given). More...
typedef Tuple2< ensightFaces::elemType, label > faceInfoTuple
 Tuple of face type (tria3, quad4, nsided) and count.

Protected Member Functions

Pair< idTypesreadGeometryHeader (ensightReadFile &is) const
 Read (and discard) geometry file header.
void readCase (ISstream &is)
 Read the case file.
meshedSurface readGeometry (const fileName &geometryFile, const label timeIndex=0)
 Read and return surface geometry. Updates faceTypeInfo_.
template<class Type>
tmp< Field< Type > > readField (const fileName &dataFile, const word &fieldName, const label timeIndex=0) const
 Helper function to return a field.
template<class Type>
tmp< Field< Type > > readField (const label timeIndex, const label fieldIndex) const
 Helper function to return a field.

Static Protected Member Functions

static bool readLine (ISstream &is, std::string &line)
 Helper function to read an ascii line from file, skipping blank lines and comments.
static void checkSection (const word &expected, const string &buffer, const ISstream &is)
 Check a section header.
static void debugSection (const word &expected, ISstream &is)
 Read and check a section header.
template<class Type>
static void readFrom (const std::string &buffer, Type &value)
 Helper function to return Type from string.

Protected Attributes

bool masterOnly_
 Read on master and broadcast (in parallel).
IOstreamOption::streamFormat readFormat_
 Format flag.
fileName baseDir_
 Base directory.
labelPair meshTimeset_
 The timeset/fileset (if any) associated with the mesh.
fileName meshFileName_
 Name of mesh file, including any subdirectory.
List< labelPairfieldTimesets_
 The timeset/fileset (if any) associated with fields.
List< wordfieldNames_
 Field names.
List< stringfieldFileNames_
 Field file names.
label timeStartIndex_
 Start time index.
label timeIncrement_
 Time increment.
labelList fileNumbers_
 Numbers for files.
instantList timeValues_
 Times.
autoPtr< meshedSurfacesurfPtr_
 Pointer to the surface.
List< faceInfoTuplefaceTypeInfo_
 List of face-type/count tuples.
Protected Attributes inherited from surfaceReader
fileName fileName_
 File name.

Additional Inherited Members

Static Public Member Functions inherited from surfaceReader
static dictionary formatOptions (const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
 Same as fileFormats::getFormatOptions.
static autoPtr< surfaceReaderNew (const word &readType, const fileName &fName, const dictionary &options=dictionary())
 Return a reference to the selected surfaceReader.

Detailed Description

Ensight format surface reader.

readOptions
{
    ensight
    {
        debug       false;
        masterOnly  false;
    }
}

Format options for ensight:

Property Description Required Default
debug Add debug flag no false
masterOnly Read files on master and broadcast values no true
Source files

Definition at line 85 of file ensightSurfaceReader.H.

Member Typedef Documentation

◆ faceInfoTuple

typedef Tuple2<ensightFaces::elemType, label> faceInfoTuple
protected

Tuple of face type (tria3, quad4, nsided) and count.

Definition at line 107 of file ensightSurfaceReader.H.

Member Enumeration Documentation

◆ idTypes

enum idTypes : unsigned char
protected

Handling of node/element id types (off, assign, ignore, given).

Enumerator
NONE 

"off", "assign"

IGNORE 

Read but "ignore".

GIVEN 

Use "given" values (not supported).

Definition at line 96 of file ensightSurfaceReader.H.

Constructor & Destructor Documentation

◆ ensightSurfaceReader() [1/2]

ensightSurfaceReader ( const ensightSurfaceReader & )
delete

No copy construct.

References ensightSurfaceReader().

Referenced by ensightSurfaceReader(), and operator=().

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

◆ ensightSurfaceReader() [2/2]

ensightSurfaceReader ( const fileName & fName,
const dictionary & options = dictionary() )
explicit

◆ ~ensightSurfaceReader()

virtual ~ensightSurfaceReader ( )
virtualdefault

Destructor.

References timeIndex.

Member Function Documentation

◆ readLine()

bool readLine ( ISstream & is,
std::string & line )
staticprotected

Helper function to read an ascii line from file, skipping blank lines and comments.

Returns
True if reading was successful

Definition at line 83 of file ensightSurfaceReader.C.

References ISstream::getLine(), IOstream::good(), Foam::stringOps::inplaceTrimRight(), and Foam::pos().

Referenced by debugSection(), and readCase().

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

◆ checkSection()

void checkSection ( const word & expected,
const string & buffer,
const ISstream & is )
staticprotected

Check a section header.

Definition at line 103 of file ensightSurfaceReader.C.

References DebugInfo, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::nl, and string::starts_with().

Referenced by debugSection().

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

◆ debugSection()

void debugSection ( const word & expected,
ISstream & is )
staticprotected

Read and check a section header.

Definition at line 127 of file ensightSurfaceReader.C.

References checkSection(), and readLine().

Referenced by readCase().

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

◆ readFrom()

template<class Type>
void readFrom ( const std::string & buffer,
Type & value )
staticprotected

Helper function to return Type from string.

References timeIndex.

Referenced by readCase().

Here is the caller graph for this function:

◆ readGeometryHeader()

Foam::Pair< Foam::ensightSurfaceReader::idTypes > readGeometryHeader ( ensightReadFile & is) const
protected

Read (and discard) geometry file header.

Returns
information about node/element id handling

Definition at line 143 of file ensightSurfaceReader.C.

References string::contains(), DebugInfo, Pair< T >::first(), GIVEN, IGNORE, string::length(), Foam::nl, NONE, ensightReadFile::read(), Pair< T >::second(), and ensightReadFile::skip().

Referenced by readGeometry().

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

◆ readCase()

◆ readGeometry()

◆ readField() [1/2]

template<class Type>
tmp< Field< Type > > readField ( const fileName & dataFile,
const word & fieldName,
const label timeIndex = 0 ) const
protected

Helper function to return a field.

References timeIndex.

Referenced by field(), field(), field(), field(), and field().

Here is the caller graph for this function:

◆ readField() [2/2]

template<class Type>
tmp< Field< Type > > readField ( const label timeIndex,
const label fieldIndex ) const
protected

Helper function to return a field.

References timeIndex.

◆ operator=()

void operator= ( const ensightSurfaceReader & )
delete

No copy assignment.

References ensightSurfaceReader().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "ensight" )

Runtime type information.

◆ geometry()

const Foam::meshedSurface & geometry ( const label timeIndex)
virtual

Return a reference to the surface geometry.

Implements surfaceReader.

Definition at line 911 of file ensightSurfaceReader.C.

References baseDir_, UPstream::broadcast, DebugInFunction, Foam::endl(), ensightCase::expand_mask(), UPstream::master(), masterOnly_, meshFileName_, UPstream::parRun(), readGeometry(), surfPtr_, timeIndex, and UPstream::worldComm.

Here is the call graph for this function:

◆ times()

Foam::instantList times ( ) const
virtual

Return a list of the available times.

Implements surfaceReader.

Definition at line 945 of file ensightSurfaceReader.C.

References timeValues_.

◆ fieldNames()

Foam::wordList fieldNames ( const label timeIndex) const
virtual

Return a list of the available fields at a given time.

Implements surfaceReader.

Definition at line 951 of file ensightSurfaceReader.C.

References fieldNames_, and timeIndex.

◆ field() [1/5]

Foam::tmp< Foam::Field< Foam::scalar > > field ( const label timeIndex,
const label fieldIndex,
const scalar & refValue = pTraits<scalar>::zero ) const
virtual

Return a scalar field at a given time.

Implements surfaceReader.

Definition at line 960 of file ensightSurfaceReader.C.

References readField(), and timeIndex.

Here is the call graph for this function:

◆ field() [2/5]

Foam::tmp< Foam::Field< Foam::vector > > field ( const label timeIndex,
const label fieldIndex,
const vector & refValue = pTraits<vector>::zero ) const
virtual

Return a vector field at a given time.

Implements surfaceReader.

Definition at line 971 of file ensightSurfaceReader.C.

References readField(), and timeIndex.

Here is the call graph for this function:

◆ field() [3/5]

Foam::tmp< Foam::Field< Foam::sphericalTensor > > field ( const label timeIndex,
const label fieldIndex,
const sphericalTensor & refValue = pTraits<sphericalTensor>::zero ) const
virtual

Return a sphericalTensor field at a given time.

Implements surfaceReader.

Definition at line 983 of file ensightSurfaceReader.C.

References readField(), and timeIndex.

Here is the call graph for this function:

◆ field() [4/5]

Foam::tmp< Foam::Field< Foam::symmTensor > > field ( const label timeIndex,
const label fieldIndex,
const symmTensor & refValue = pTraits<symmTensor>::zero ) const
virtual

Return a symmTensor field at a given time.

Implements surfaceReader.

Definition at line 994 of file ensightSurfaceReader.C.

References readField(), and timeIndex.

Here is the call graph for this function:

◆ field() [5/5]

Foam::tmp< Foam::Field< Foam::tensor > > field ( const label timeIndex,
const label fieldIndex,
const tensor & refValue = pTraits<tensor>::zero ) const
virtual

Return a tensor field at a given time.

Implements surfaceReader.

Definition at line 1005 of file ensightSurfaceReader.C.

References readField(), and timeIndex.

Here is the call graph for this function:

Member Data Documentation

◆ masterOnly_

bool masterOnly_
protected

Read on master and broadcast (in parallel).

Definition at line 115 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and geometry().

◆ readFormat_

IOstreamOption::streamFormat readFormat_
protected

Format flag.

Definition at line 120 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readGeometry().

◆ baseDir_

fileName baseDir_
protected

Base directory.

Definition at line 125 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and geometry().

◆ meshTimeset_

labelPair meshTimeset_
protected

The timeset/fileset (if any) associated with the mesh.

Definition at line 130 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ meshFileName_

fileName meshFileName_
protected

Name of mesh file, including any subdirectory.

Definition at line 135 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), geometry(), and readCase().

◆ fieldTimesets_

List<labelPair> fieldTimesets_
protected

The timeset/fileset (if any) associated with fields.

Definition at line 140 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ fieldNames_

List<word> fieldNames_
protected

Field names.

Definition at line 145 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), fieldNames(), and readCase().

◆ fieldFileNames_

List<string> fieldFileNames_
protected

Field file names.

Definition at line 150 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ timeStartIndex_

label timeStartIndex_
protected

Start time index.

Definition at line 155 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ timeIncrement_

label timeIncrement_
protected

Time increment.

Definition at line 160 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ fileNumbers_

labelList fileNumbers_
protected

Numbers for files.

Definition at line 165 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), and readCase().

◆ timeValues_

instantList timeValues_
protected

Times.

Definition at line 170 of file ensightSurfaceReader.H.

Referenced by ensightSurfaceReader(), readCase(), and times().

◆ surfPtr_

autoPtr<meshedSurface> surfPtr_
protected

Pointer to the surface.

Definition at line 175 of file ensightSurfaceReader.H.

Referenced by geometry().

◆ faceTypeInfo_

List<faceInfoTuple> faceTypeInfo_
protected

List of face-type/count tuples.

Definition at line 180 of file ensightSurfaceReader.H.

Referenced by readGeometry().


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