VTK
9.1.0
|
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. | |
Enumerations | |
enum | DatabaseFormatType { UNKNOWN , EXODUS , CGNS , CATALYST } |
Functions | |
std::set< double > | GetTimeValues (const Ioss::Region *region) |
Reads time / timestep information from a region. | |
std::string | GetSanitizedBlockName (const Ioss::Region *region, const std::string &name) |
This is primarily intended for CGNS. | |
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). | |
Ioss::EntityType | GetIOSSEntityType (vtkIOSSReader::EntityType vtk_type) |
For the given vtkIOSSReader::EntityType return the corresponding Ioss::EntityType. | |
vtkSmartPointer< vtkDataArray > | CreateArray (const Ioss::Field &field) |
Create an array for the given field . | |
vtkSmartPointer< vtkDataArray > | 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. | |
int | GetCellType (const Ioss::ElementTopology *topology) |
Returns VTK celltype for a Ioss topology element. | |
vtkSmartPointer< vtkCellArray > | GetConnectivity (Ioss::GroupingEntity *group_entity, int &vtk_topology_type, Cache *cache=nullptr) |
Read connectivity information from the group_entity. | |
vtkSmartPointer< vtkPoints > | GetMeshModelCoordinates (const Ioss::GroupingEntity *group_entity, Cache *cache=nullptr) |
Read points from the group_entity. | |
bool | IsFieldTransient (Ioss::GroupingEntity *entity, const std::string &fieldname) |
Returns true if the field is transient. | |
std::string | GetDisplacementFieldName (Ioss::GroupingEntity *nodeblock) |
Finds a displacement field name. | |
void | InitializeEnvironmentForIOSS () |
Must be called before using any Ioss library functions. | |
DatabaseFormatType | DetectType (const std::string &dbaseName) |
Given a filename determines and returns the database type. | |
DatabaseFormatType | GetFormat (const Ioss::GroupingEntity *entity) |
Given any GroupingEntity pointer, returns the format that the associated database is in. | |
std::vector< Ioss::StructuredBlock * > | GetMatchingStructuredBlocks (Ioss::Region *region, const std::string &blockname) |
Returns collection of StructuredBlock's matching the selected blockname. | |
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.
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.
using vtkIOSSUtilities::EntityNameType = typedef std::pair<vtkTypeUInt64, std::string> |
Definition at line 102 of file vtkIOSSUtilities.h.
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.
Enumerator | |
---|---|
UNKNOWN | |
EXODUS | |
CGNS | |
CATALYST |
Definition at line 58 of file vtkIOSSUtilities.h.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
std::string vtkIOSSUtilities::GetDisplacementFieldName | ( | Ioss::GroupingEntity * | nodeblock | ) |
Finds a displacement field name.
Returns empty string if none can be found.
void vtkIOSSUtilities::InitializeEnvironmentForIOSS | ( | ) |
Must be called before using any Ioss library functions.
Necessary to initialize factories used internally by Ioss library.
DatabaseFormatType vtkIOSSUtilities::DetectType | ( | const std::string & | dbaseName | ) |
Given a filename determines and returns the database type.
Currently, this simply looks at the filename.
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.
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.