ensightSurfaceReader Class Reference

Ensight format surface reader. More...

Inheritance diagram for ensightSurfaceReader:
[legend]
Collaboration diagram for ensightSurfaceReader:
[legend]

Public Member Functions

 TypeName ("ensight")
 Runtime type information. More...
 
 ensightSurfaceReader (const fileName &fName)
 Construct from fileName. More...
 
virtual ~ensightSurfaceReader ()=default
 Destructor. More...
 
virtual const meshedSurfacegeometry (const label timeIndex)
 Return a reference to the surface geometry. More...
 
virtual instantList times () const
 Return a list of the available times. More...
 
virtual wordList fieldNames (const label timeIndex) const
 Return a list of the available fields at a given time. More...
 
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. More...
 
virtual tmp< Field< vector > > field (const label timeIndex, const label fieldIndex, const vector &refValue=pTraits< vector >::zero) const
 Return a scalar field at a given time. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class Type >
Foam::tmp< Foam::Field< Type > > readField (const label timeIndex, const label fieldIndex) const
 
- Public Member Functions inherited from surfaceReader
 TypeName ("surfaceReader")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, surfaceReader, fileName,(const fileName &fName),(fName))
 
 surfaceReader (const fileName &fName)
 Construct from fileName. More...
 
virtual ~surfaceReader ()=default
 Destructor. More...
 
virtual const meshedSurfacegeometry (const label timeIndex)=0
 Return a reference to the surface geometry. More...
 
virtual instantList times () const =0
 Return a list of the available times. More...
 
virtual wordList fieldNames (const label timeIndex) const =0
 Return a list of the available fields at a given time. More...
 
virtual tmp< Field< scalar > > field (const label timeIndex, const label fieldIndex, const scalar &refValue=pTraits< scalar >::zero) const =0
 Return a scalar field at a given time. More...
 
virtual tmp< Field< vector > > field (const label timeIndex, const label fieldIndex, const vector &refValue=pTraits< vector >::zero) const =0
 Return a vector field at a given time. More...
 
virtual tmp< Field< sphericalTensor > > field (const label timeIndex, const label fieldIndex, const sphericalTensor &refValue=pTraits< sphericalTensor >::zero) const =0
 Return a sphericalTensor field at a given time. More...
 
virtual tmp< Field< symmTensor > > field (const label timeIndex, const label fieldIndex, const symmTensor &refValue=pTraits< symmTensor >::zero) const =0
 Return a symmTensor field at a given time. More...
 
virtual tmp< Field< tensor > > field (const label timeIndex, const label fieldIndex, const tensor &refValue=pTraits< tensor >::zero) const =0
 Return a tensor field at a given time. More...
 

Protected Types

enum  idTypes : unsigned char { NONE = 0 , IGNORE = 1 , GIVEN = 2 }
 Handling of node/element id types (off, assign, ignore, given) More...
 

Protected Member Functions

void skip (const label n, Istream &is) const
 Helper function to skip forward n steps in stream. More...
 
void readLine (IFstream &is, string &buffer) const
 Helper function to read an ascii line from file. More...
 
void debugSection (const word &expected, IFstream &is) const
 Read and check a section header. More...
 
Pair< idTypesreadGeometryHeader (ensightReadFile &is) const
 Read (and discard) geometry file header. More...
 
void readCase (IFstream &is)
 Read the case file. More...
 
template<class Type >
void readFromLine (const label nSkip, IStringStream &is, Type &value) const
 Helper function to return Type after skipping n tokens. More...
 
template<class Type >
void readFromLine (const label nSkip, const string &buffer, Type &value) const
 Helper function to return Type after skipping n tokens. More...
 
template<class Type >
tmp< Field< Type > > readField (const label timeIndex, const label fieldIndex) const
 Helper function to return a field. More...
 

Static Protected Member Functions

static fileName replaceMask (const fileName &fName, const label timeIndex)
 Replace the '*' mask chars with a 0 padded string. More...
 

Protected Attributes

IOstreamOption::streamFormat streamFormat_
 Format flag. More...
 
fileName baseDir_
 Base directory. More...
 
fileName meshFileName_
 Name of mesh file, including any subdirectory. More...
 
List< wordfieldNames_
 Field names. More...
 
List< stringfieldFileNames_
 Field file names. More...
 
label nTimeSteps_
 Number of time steps. More...
 
label timeStartIndex_
 Start time index. More...
 
label timeIncrement_
 Time increment. More...
 
instantList timeValues_
 Times. More...
 
autoPtr< meshedSurfacesurfPtr_
 Pointer to the surface. More...
 
List< Tuple2< string, label > > schema_
 
- Protected Attributes inherited from surfaceReader
fileName fileName_
 File name. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from surfaceReader
static autoPtr< surfaceReaderNew (const word &readType, const fileName &fName)
 Return a reference to the selected surfaceReader. More...
 

Detailed Description

Ensight format surface reader.

Source files

Definition at line 54 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 63 of file ensightSurfaceReader.H.

Constructor & Destructor Documentation

◆ ensightSurfaceReader()

ensightSurfaceReader ( const fileName fName)
explicit

Construct from fileName.

Definition at line 342 of file ensightSurfaceReader.C.

References ensightSurfaceReader::readCase().

Here is the call graph for this function:

◆ ~ensightSurfaceReader()

virtual ~ensightSurfaceReader ( )
virtualdefault

Destructor.

Member Function Documentation

◆ skip()

void skip ( const label  n,
Istream is 
) const
protected

Helper function to skip forward n steps in stream.

Definition at line 64 of file ensightSurfaceReader.C.

References DebugInfo, IOstream::good(), n, Foam::nl, and WarningInFunction.

Referenced by ensightSurfaceReader::readFromLine().

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

◆ readLine()

void readLine ( IFstream is,
string buffer 
) const
protected

Helper function to read an ascii line from file.

Definition at line 87 of file ensightSurfaceReader.C.

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

Here is the call graph for this function:

◆ debugSection()

void debugSection ( const word expected,
IFstream is 
) const
protected

Read and check a section header.

Definition at line 105 of file ensightSurfaceReader.C.

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

Here is the call graph for this function:

◆ replaceMask()

Foam::fileName replaceMask ( const fileName fName,
const label  timeIndex 
)
staticprotected

Replace the '*' mask chars with a 0 padded string.

Definition at line 127 of file ensightSurfaceReader.C.

References Foam::stringOps::count(), string::replace(), and timeIndex.

Here is the call 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 155 of file ensightSurfaceReader.C.

References DebugInfo, FixedList< T, N >::first(), Foam::nl, ensightReadFile::read(), ensightReadFile::readBinaryHeader(), and Pair< T >::second().

Here is the call graph for this function:

◆ readCase()

void readCase ( IFstream is)
protected

Read the case file.

Definition at line 232 of file ensightSurfaceReader.C.

References DynamicList< T, SizeMin >::append(), DebugInfo, DebugInFunction, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, IOstream::good(), Foam::Info, IFstream::name(), Foam::name(), Foam::nl, formatter::npos, s(), Foam::stringOps::splitSpace(), and WarningInFunction.

Referenced by ensightSurfaceReader::ensightSurfaceReader().

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

◆ readFromLine() [1/2]

void readFromLine ( const label  nSkip,
IStringStream is,
Type &  value 
) const
protected

Helper function to return Type after skipping n tokens.

Definition at line 34 of file ensightSurfaceReaderTemplates.C.

References ensightSurfaceReader::skip().

Here is the call graph for this function:

◆ readFromLine() [2/2]

void readFromLine ( const label  nSkip,
const string buffer,
Type &  value 
) const
protected

Helper function to return Type after skipping n tokens.

Definition at line 48 of file ensightSurfaceReaderTemplates.C.

◆ readField() [1/2]

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

Helper function to return a field.

◆ 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 363 of file ensightSurfaceReader.C.

References DynamicList< T, SizeMin >::append(), STLCore::ASCII, STLCore::BINARY, DebugInfo, DebugInFunction, Foam::endl(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, FixedList< T, N >::first(), IOstream::good(), Foam::Info, IFstream::name(), pTraits< bool >::nComponents, Foam::nl, nPoints, points, ensightReadFile::read(), Pair< T >::second(), UList< T >::size(), IFstream::stdStream(), timeIndex, and WarningInFunction.

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 622 of file ensightSurfaceReader.C.

◆ 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 628 of file ensightSurfaceReader.C.

◆ 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 637 of file ensightSurfaceReader.C.

References timeIndex.

◆ 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 scalar field at a given time.

Implements surfaceReader.

Definition at line 648 of file ensightSurfaceReader.C.

References timeIndex.

◆ 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 660 of file ensightSurfaceReader.C.

References timeIndex.

◆ 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 671 of file ensightSurfaceReader.C.

References timeIndex.

◆ 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 682 of file ensightSurfaceReader.C.

References timeIndex.

◆ readField() [2/2]

Foam::tmp< Foam::Field< Type > > readField ( const label  timeIndex,
const label  fieldIndex 
) const

Definition at line 62 of file ensightSurfaceReaderTemplates.C.

References DebugInfo, DebugInFunction, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), forAll, IOstream::good(), IOWarningInFunction, n, IFstream::name(), Foam::New(), Foam::nl, ensightReadFile::read(), timeIndex, and Foam::Zero.

Here is the call graph for this function:

Member Data Documentation

◆ streamFormat_

IOstreamOption::streamFormat streamFormat_
protected

Format flag.

Definition at line 71 of file ensightSurfaceReader.H.

◆ baseDir_

fileName baseDir_
protected

Base directory.

Definition at line 74 of file ensightSurfaceReader.H.

◆ meshFileName_

fileName meshFileName_
protected

Name of mesh file, including any subdirectory.

Definition at line 77 of file ensightSurfaceReader.H.

◆ fieldNames_

List<word> fieldNames_
protected

Field names.

Definition at line 80 of file ensightSurfaceReader.H.

◆ fieldFileNames_

List<string> fieldFileNames_
protected

Field file names.

Definition at line 83 of file ensightSurfaceReader.H.

◆ nTimeSteps_

label nTimeSteps_
protected

Number of time steps.

Definition at line 86 of file ensightSurfaceReader.H.

◆ timeStartIndex_

label timeStartIndex_
protected

Start time index.

Definition at line 89 of file ensightSurfaceReader.H.

◆ timeIncrement_

label timeIncrement_
protected

Time increment.

Definition at line 92 of file ensightSurfaceReader.H.

◆ timeValues_

instantList timeValues_
protected

Times.

Definition at line 95 of file ensightSurfaceReader.H.

◆ surfPtr_

autoPtr<meshedSurface> surfPtr_
protected

Pointer to the surface.

Definition at line 98 of file ensightSurfaceReader.H.

◆ schema_

List<Tuple2<string, label> > schema_
protected

Definition at line 100 of file ensightSurfaceReader.H.


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