VTK  9.1.0
Classes | Typedefs | Enumerations | Functions
vtkIOSSUtilities Namespace Reference

internal utilities for vtkIOSSReader More...

Classes

class  Cache
 Cache. More...
 

Typedefs

using EntityNameType = std::pair< vtkTypeUInt64, std::string >
 
using ArrayList = typename vtkTypeList::Unique< vtkTypeList::Create< vtkDoubleArray, vtkTypeInt32Array, vtkTypeInt64Array > >::Result
 List of possible ArrayTypes that are produced by vtkIOSSUtilities. More...
 

Enumerations

enum  DatabaseFormatType { UNKNOWN , EXODUS , CGNS , CATALYST }
 

Functions

std::set< double > GetTimeValues (const Ioss::Region *region)
 Reads time / timestep information from a region. More...
 
std::string GetSanitizedBlockName (const Ioss::Region *region, const std::string &name)
 This is primarily intended for CGNS. More...
 
template<typename EntityType >
void GetEntityAndFieldNames (const Ioss::Region *region, const std::vector< EntityType * > &entities, std::set< EntityNameType > &entity_names, std::set< std::string > &field_names)
 Populates entitySelection with available entity block (or set) names and populates fieldSelection with transient and attribute fields on the chosen entity block (or set). More...
 
Ioss::EntityType GetIOSSEntityType (vtkIOSSReader::EntityType vtk_type)
 For the given vtkIOSSReader::EntityType return the corresponding Ioss::EntityType. More...
 
vtkSmartPointer< vtkDataArrayCreateArray (const Ioss::Field &field)
 Create an array for the given field. More...
 
vtkSmartPointer< vtkDataArrayGetData (const Ioss::GroupingEntity *entity, const std::string &fieldname, Ioss::Transform *transform=nullptr, Cache *cache=nullptr, const std::string &cachekey=std::string())
 Returns a VTK array for a given field (fieldname) on the chosen block (or set) entity. More...
 
int GetCellType (const Ioss::ElementTopology *topology)
 Returns VTK celltype for a Ioss topology element. More...
 
vtkSmartPointer< vtkCellArrayGetConnectivity (Ioss::GroupingEntity *group_entity, int &vtk_topology_type, Cache *cache=nullptr)
 Read connectivity information from the group_entity. More...
 
vtkSmartPointer< vtkPointsGetMeshModelCoordinates (const Ioss::GroupingEntity *group_entity, Cache *cache=nullptr)
 Read points from the group_entity. More...
 
bool IsFieldTransient (Ioss::GroupingEntity *entity, const std::string &fieldname)
 Returns true if the field is transient. More...
 
std::string GetDisplacementFieldName (Ioss::GroupingEntity *nodeblock)
 Finds a displacement field name. More...
 
void InitializeEnvironmentForIOSS ()
 Must be called before using any Ioss library functions. More...
 
DatabaseFormatType DetectType (const std::string &dbaseName)
 Given a filename determines and returns the database type. More...
 
DatabaseFormatType GetFormat (const Ioss::GroupingEntity *entity)
 Given any GroupingEntity pointer, returns the format that the associated database is in. More...
 
std::vector< Ioss::StructuredBlock * > GetMatchingStructuredBlocks (Ioss::Region *region, const std::string &blockname)
 Returns collection of StructuredBlock's matching the selected blockname. More...
 

Detailed Description

internal utilities for vtkIOSSReader

vtkIOSSReader provides some helper functions to go between VTK and Ioss. Not intended for public consumption. API likely to change without notice.

Developer Notes

We limit this namespace for utility functions that go between Ioss and VTK or vice-versa. Thus, methods that are not straddling that fence should be not be added here.

Typedef Documentation

◆ EntityNameType

using vtkIOSSUtilities::EntityNameType = typedef std::pair<vtkTypeUInt64, std::string>

Definition at line 102 of file vtkIOSSUtilities.h.

◆ ArrayList

using vtkIOSSUtilities::ArrayList = typedef typename vtkTypeList::Unique< vtkTypeList::Create<vtkDoubleArray, vtkTypeInt32Array, vtkTypeInt64Array> >::Result

List of possible ArrayTypes that are produced by vtkIOSSUtilities.

This can be used with vtkArrayDispatch::DispatchByArray, etc. when dealing with arrays read from Ioss.

Definition at line 110 of file vtkIOSSUtilities.h.

Enumeration Type Documentation

◆ DatabaseFormatType

Enumerator
UNKNOWN 
EXODUS 
CGNS 
CATALYST 

Definition at line 58 of file vtkIOSSUtilities.h.

Function Documentation

◆ GetTimeValues()

std::set< double > vtkIOSSUtilities::GetTimeValues ( const Ioss::Region *  region)

Reads time / timestep information from a region.

Returns an empty vector if no time information in available in the Ioss::Region.

◆ GetSanitizedBlockName()

std::string vtkIOSSUtilities::GetSanitizedBlockName ( const Ioss::Region *  region,
const std::string &  name 
)

This is primarily intended for CGNS.

CGNS ends up naming blocks in separate files separate e.g. block_0_proc-0, block_0_proc-1, etc. This is clunky and causes the block selection as well as the output dataset to be oddly structured. We want all merge all pieces of a block for all procs. This function helps that by stripping out the "proc-\d+" substring.

◆ GetEntityAndFieldNames()

template<typename EntityType >
void vtkIOSSUtilities::GetEntityAndFieldNames ( const Ioss::Region *  region,
const std::vector< EntityType * > &  entities,
std::set< EntityNameType > &  entity_names,
std::set< std::string > &  field_names 
)

Populates entitySelection with available entity block (or set) names and populates fieldSelection with transient and attribute fields on the chosen entity block (or set).

Definition at line 134 of file vtkIOSSUtilities.h.

◆ GetIOSSEntityType()

Ioss::EntityType vtkIOSSUtilities::GetIOSSEntityType ( vtkIOSSReader::EntityType  vtk_type)

For the given vtkIOSSReader::EntityType return the corresponding Ioss::EntityType.

Throws std::runtime_error for invalid values.

◆ CreateArray()

vtkSmartPointer< vtkDataArray > vtkIOSSUtilities::CreateArray ( const Ioss::Field &  field)

Create an array for the given field.

Uses type information from the field to create the correct type of array. Also resizes the array using count and component information from the field.

Throws std::runtime_error for unsupported types.

◆ GetData()

vtkSmartPointer< vtkDataArray > vtkIOSSUtilities::GetData ( const Ioss::GroupingEntity *  entity,
const std::string &  fieldname,
Ioss::Transform *  transform = nullptr,
Cache cache = nullptr,
const std::string &  cachekey = std::string() 
)

Returns a VTK array for a given field (fieldname) on the chosen block (or set) entity.

Throws std::runtime_error on error or field not present.

◆ GetCellType()

int vtkIOSSUtilities::GetCellType ( const Ioss::ElementTopology *  topology)

Returns VTK celltype for a Ioss topology element.

Throws std::runtime_error for unknown and unsupported element types.

Note that the returned VTK cell type may have fewer points than the corresponding Ioss element type.

◆ GetConnectivity()

vtkSmartPointer< vtkCellArray > vtkIOSSUtilities::GetConnectivity ( Ioss::GroupingEntity *  group_entity,
int &  vtk_topology_type,
Cache cache = nullptr 
)

Read connectivity information from the group_entity.

Returns the vtkCellArray and the element type for all elements in this group_entity.

NOTE: this does not support entity groups with mixed topological elements.

Throws std::runtime_error on error.

◆ GetMeshModelCoordinates()

vtkSmartPointer< vtkPoints > vtkIOSSUtilities::GetMeshModelCoordinates ( const Ioss::GroupingEntity *  group_entity,
Cache cache = nullptr 
)

Read points from the group_entity.

Throws std::runtime_error on error or coordinates not present.

◆ IsFieldTransient()

bool vtkIOSSUtilities::IsFieldTransient ( Ioss::GroupingEntity *  entity,
const std::string &  fieldname 
)

Returns true if the field is transient.

This method supports SIDESETs. It iterates into the nest SIDEBLOCK elements to check for the field.

◆ GetDisplacementFieldName()

std::string vtkIOSSUtilities::GetDisplacementFieldName ( Ioss::GroupingEntity *  nodeblock)

Finds a displacement field name.

Returns empty string if none can be found.

◆ InitializeEnvironmentForIOSS()

void vtkIOSSUtilities::InitializeEnvironmentForIOSS ( )

Must be called before using any Ioss library functions.

Necessary to initialize factories used internally by Ioss library.

◆ DetectType()

DatabaseFormatType vtkIOSSUtilities::DetectType ( const std::string &  dbaseName)

Given a filename determines and returns the database type.

Currently, this simply looks at the filename.

◆ GetFormat()

DatabaseFormatType vtkIOSSUtilities::GetFormat ( const Ioss::GroupingEntity *  entity)

Given any GroupingEntity pointer, returns the format that the associated database is in.

Use this to determine if we're dealing with Exodus or CGNS database.

◆ GetMatchingStructuredBlocks()

std::vector< Ioss::StructuredBlock * > vtkIOSSUtilities::GetMatchingStructuredBlocks ( Ioss::Region *  region,
const std::string &  blockname 
)

Returns collection of StructuredBlock's matching the selected blockname.

Since vtkIOSSReader may modify block names to avoid creating separate block for each rank for what logically is the same block, we have to use this method to find the blocks user selected.

See also
GetSanitizedBlockName