VTK
9.4.20241218
|
Internal methods and state for the IOSS reader. More...
#include <vtkIOSSReaderInternal.h>
Public Types | |
using | EntityType = vtkIOSSReader::EntityType |
Public Member Functions | |
vtkIOSSReaderInternal (vtkIOSSReader *reader) | |
virtual | ~vtkIOSSReaderInternal ()=default |
const std::vector< double > & | GetTimeSteps () const |
vtkIOSSUtilities::DatabaseFormatType | GetFormat () const |
void | SetDisplacementMagnitude (double s) |
double | GetDisplacementMagnitude () |
bool | UpdateDatabaseNames (vtkIOSSReader *self) |
Processes filenames to populate names for Ioss databases to read. | |
bool | UpdateTimeInformation (vtkIOSSReader *self) |
Read Ioss databases to generate information about timesteps / times in the databases. | |
bool | NeedToUpdateEntityAndFieldSelections (vtkIOSSReader *self, const std::vector< DatabaseHandle > &dbaseHandles) |
Checks if the entity and field selections have changed. | |
bool | UpdateEntityAndFieldSelections (vtkIOSSReader *self) |
Populates various vtkDataArraySelection objects on the vtkIOSSReader with names for entity-blocks, -sets, and fields defined on them. | |
bool | UpdateAssembly (vtkIOSSReader *self, int *tag) |
Populates the vtkDataAssembly used for block/set selection. | |
vtkDataAssembly * | GetAssembly () const |
bool | GenerateOutput (vtkPartitionedDataSetCollection *output, vtkIOSSReader *self) |
Fills up the output data-structure based on the entity blocks/sets chosen and those available. | |
bool | ReadAssemblies (vtkPartitionedDataSetCollection *output, const DatabaseHandle &handle) |
Fills up the vtkDataAssembly with ioss-assemblies, if present. | |
std::vector< vtkSmartPointer< vtkDataSet > > | GetDataSets (const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle, int timestep, vtkIOSSReader *self) |
Reads datasets (meshes and fields) for the given block. | |
vtkSmartPointer< vtkDataSet > | GetExodusEntityDataSet (const std::vector< std::string > &blockNames, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle, int timestep, vtkIOSSReader *self) |
Reads datasets (meshes and fields) for the given exodus entity. | |
bool | GetQAAndInformationRecords (vtkFieldData *fd, const DatabaseHandle &handle) |
Read quality assurance and information data from the file. | |
bool | GetGlobalFields (vtkFieldData *fd, const DatabaseHandle &handle, int timestep) |
Read global fields. | |
bool | HaveRestartFiles () const |
Get if there are restart files available. | |
std::vector< DatabaseHandle > | GetDatabaseHandles (int piece, int npieces, int timestep) const |
Returns the list of fileids, if any to be read for a given "piece" for the chosen timestep. | |
std::string | GetRawFileName (const DatabaseHandle &handle, bool shortname=false) const |
Useful for printing error messages etc. | |
int | GetFileProcessor (const DatabaseHandle &handle) const |
For spatially partitioned files, this returns the partition identifier for the file identified by the handle. | |
bool | HaveCreatedRegions (const std::vector< DatabaseHandle > &dbaseHandles) |
Returns if the given database handles have regions already created. | |
void | ReleaseHandles () |
Releases any open file handles. | |
void | ReleaseRegions () |
Little more aggressive than ReleaseHandles but less intense than Reset , releases all IOSS regions and thus all the meta-data IOSS may have cached as well. | |
void | Reset () |
Clear all regions, databases etc. | |
void | ResetDatabaseNamesMTime () |
void | ClearCache () |
Cache related API. | |
void | ResetCacheAccessCounts () |
Cache related API. | |
void | ClearCacheUnused () |
Cache related API. | |
Public Attributes | |
Ioss::PropertyManager | DatabaseProperties |
std::set< std::string > | FileNames |
vtkTimeStamp | FileNamesMTime |
std::set< std::string > | Selectors |
Protected Types | |
using | DatabaseNamesType = std::map< std::string, DatabasePartitionInfo > |
Protected Member Functions | |
std::vector< int > | GetFileIds (const std::string &dbasename, int myrank, int numRanks) const |
Ioss::Region * | GetRegion (const std::string &dbasename, int fileid) |
Ioss::Region * | GetRegion (const DatabaseHandle &handle) |
std::vector< std::pair< int, vtkSmartPointer< vtkCellArray > > > | GetTopology (const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle) |
Get a vector of cell arrays and their cell type for the entity block (or set) with the given name (blockname ) and type (vtk_entity_type). | |
std::pair< vtkSmartPointer< vtkUnsignedCharArray >, vtkSmartPointer< vtkCellArray > > | CombineTopologies (const std::vector< std::pair< int, vtkSmartPointer< vtkCellArray > > > &topologies) |
Combine a vector cell types, cell arrays pairs into a single vtkUnsignedCharArray of cell types and a vtkCellArray. | |
bool | GetTopology (vtkUnstructuredGrid *grid, const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle) |
Fill up the grid with connectivity information for the entity block (or set) with the given name (blockname ) and type (vtk_entity_type). | |
vtkSmartPointer< vtkPoints > | GetGeometry (const std::string &blockname, const DatabaseHandle &handle) |
Get with point coordinates aka geometry read from the block with the given name (blockname ). | |
bool | GetGeometry (vtkUnstructuredGrid *grid, const std::string &blockname, const DatabaseHandle &handle) |
Fill up grid with point coordinates aka geometry read from the block with the given name (blockname ). | |
bool | GetGeometry (vtkStructuredGrid *grid, const Ioss::StructuredBlock *groupEntity) |
GetGeometry for vtkStructuredGrid i.e. | |
bool | GetMesh (vtkUnstructuredGrid *grid, const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle, bool remove_unused_points) |
Adds geometry (points) and topology (cell) information to the grid for the entity block or set chosen using the name (blockname ) and type (vtk_entity_type ). | |
bool | GetEntityMesh (vtkUnstructuredGrid *grid, const std::vector< std::string > &blockNames, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle) |
Adds geometry (points) and topology (cell) information to the grid for all the entity blocks or sets chosen using the names (blockNames ) and type (vtk_entity_type ). | |
bool | GetMesh (vtkStructuredGrid *grid, const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle) |
Reads a structured block. | |
bool | GenerateEntityIdArray (vtkCellData *cd, vtkIdType numberOfCells, const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle) |
Add "id" array to the dataset using the id for the grouping entity, if any. | |
bool | GetFields (vtkDataSetAttributes *dsa, vtkDataArraySelection *selection, Ioss::Region *region, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle, int timestep, bool read_ioss_ids, vtkIdTypeArray *ids_to_extract=nullptr, const std::string &cache_key_suffix=std::string()) |
Reads selected field arrays for the given entity block or set. | |
bool | GetNodeFields (vtkDataSetAttributes *dsa, vtkDataArraySelection *selection, Ioss::Region *region, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle, int timestep, bool read_ioss_ids, bool mergeExodusEntityBlocks=false) |
This reads node fields for an entity block or set. | |
bool | ApplyDisplacements (vtkPointSet *grid, Ioss::Region *region, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle, int timestep, bool mergeExodusEntityBlocks=false) |
Reads node block array with displacements and then transforms the points in the grid using those displacements. | |
bool | GenerateFileId (vtkDataSetAttributes *cellData, vtkIdType numberOfCells, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle) |
Adds 'file_id' array to indicate which file the dataset was read from. | |
vtkSmartPointer< vtkAbstractArray > | ConvertFieldForVTK (vtkAbstractArray *array) |
Fields like "ids" have to be vtkIdTypeArray in VTK. | |
unsigned int | GetDataSetIndexForEntity (const Ioss::GroupingEntity *entity) const |
void | GenerateElementAndSideIds (vtkDataSet *dataset, Ioss::SideSet *sideSet, const DatabaseHandle &handle, const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type) |
Add field-data arrays holding side-set specifications (i.e., (cell-id, side-id) tuples) for use by the UnstructuredGridToCellGrid conversion filter. | |
bool | BuildAssembly (Ioss::Region *region, vtkDataAssembly *assembly, int root, bool add_leaves) |
DatabaseNamesType | GenerateSubset (const DatabaseNamesType &databases, vtkIOSSReader *self) |
Generate a subset based the readers current settings for FileRange and FileStride. | |
vtkSmartPointer< vtkAbstractArray > | GetField (const std::string &fieldname, Ioss::Region *region, const Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle, int timestep, vtkIdTypeArray *ids_to_extract=nullptr, const std::string &cache_key_suffix=std::string()) |
Reads a field with name fieldname from entity block or set with chosen name (blockname ) and type (vtk_entity_type ). | |
std::vector< vtkSmartPointer< vtkDataSet > > | GetExodusDataSets (const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle, int timestep, vtkIOSSReader *self) |
Called by GetDataSets to process each type of dataset. | |
std::vector< vtkSmartPointer< vtkDataSet > > | GetCGNSDataSets (const std::string &blockname, vtkIOSSReader::EntityType vtk_entity_type, const DatabaseHandle &handle, int timestep, vtkIOSSReader *self) |
Called by GetDataSets to process each type of dataset. | |
Protected Attributes | |
Ioss::Init::Initializer | io |
double | DisplacementMagnitude = 1. |
DatabaseNamesType | UnfilteredDatabaseNames |
DatabaseNamesType | DatabaseNames |
vtkTimeStamp | DatabaseNamesMTime |
std::map< std::string, std::vector< std::pair< int, double > > > | DatabaseTimes |
std::vector< double > | TimestepValues |
vtkTimeStamp | TimestepValuesMTime |
std::array< std::set< vtkIOSSUtilities::EntityNameType >, vtkIOSSReader::NUMBER_OF_ENTITY_TYPES > | EntityNames |
vtkTimeStamp | SelectionsMTime |
std::map< std::pair< Ioss::EntityType, std::string >, unsigned int > | DatasetIndexMap |
std::map< DatabaseHandle, std::shared_ptr< Ioss::Region > > | RegionMap |
vtkIOSSUtilities::Cache | Cache |
vtkIOSSUtilities::DatabaseFormatType | Format = vtkIOSSUtilities::DatabaseFormatType::UNKNOWN |
vtkIOSSReader * | IOSSReader = nullptr |
vtkSmartPointer< vtkDataAssembly > | Assembly |
vtkTimeStamp | AssemblyMTime |
Internal methods and state for the IOSS reader.
Note that this class is not part of the public API of VTK and thus has no export macros. It has been put in a separate file so that a subclass of the reader local to this module (vtkIOSSCellGridReader) can access it and so it can be subclassed.
Definition at line 74 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 82 of file vtkIOSSReaderInternal.h.
Definition at line 110 of file vtkIOSSReaderInternal.h.
|
inline |
Definition at line 112 of file vtkIOSSReaderInternal.h.
|
virtualdefault |
|
inline |
Definition at line 124 of file vtkIOSSReaderInternal.h.
|
inline |
Definition at line 125 of file vtkIOSSReaderInternal.h.
|
inline |
Definition at line 127 of file vtkIOSSReaderInternal.h.
|
inline |
Definition at line 128 of file vtkIOSSReaderInternal.h.
|
inline |
Cache related API.
Definition at line 134 of file vtkIOSSReaderInternal.h.
|
inline |
Cache related API.
Definition at line 135 of file vtkIOSSReaderInternal.h.
|
inline |
Cache related API.
Definition at line 136 of file vtkIOSSReaderInternal.h.
bool vtkIOSSReaderInternal::UpdateDatabaseNames | ( | vtkIOSSReader * | self | ) |
Processes filenames to populate names for Ioss databases to read.
A file collection representing files partitioned across ranks where each rank generate a separate file (spatial partitioning) are all represented by a single Ioss database.
Multiple Ioss databases are generated when the files are a temporal in nature or represent restarts.
This method simply uses the filenames to determine what type of files we are encountering. For spatial partitions, the filenames must end with '{processor-count}.{rank}'.
false
to indicate failure. bool vtkIOSSReaderInternal::UpdateTimeInformation | ( | vtkIOSSReader * | self | ) |
Read Ioss databases to generate information about timesteps / times in the databases.
This is called after successful call to UpdateDatabaseNames
which should populate the list of Ioss databases. This method iterates over all databases and gathers information about timesteps available in those databases. When running in parallel, only the root node opens the Ioss databases and reads the time information. That information is then exchanged with all ranks thus at the end of this method all ranks should have their time information updated.
false
on failure. bool vtkIOSSReaderInternal::NeedToUpdateEntityAndFieldSelections | ( | vtkIOSSReader * | self, |
const std::vector< DatabaseHandle > & | dbaseHandles | ||
) |
Checks if the entity and field selections have changed.
bool vtkIOSSReaderInternal::UpdateEntityAndFieldSelections | ( | vtkIOSSReader * | self | ) |
Populates various vtkDataArraySelection
objects on the vtkIOSSReader with names for entity-blocks, -sets, and fields defined on them.
bool vtkIOSSReaderInternal::UpdateAssembly | ( | vtkIOSSReader * | self, |
int * | tag | ||
) |
Populates the vtkDataAssembly used for block/set selection.
vtkDataAssembly * vtkIOSSReaderInternal::GetAssembly | ( | ) | const |
bool vtkIOSSReaderInternal::GenerateOutput | ( | vtkPartitionedDataSetCollection * | output, |
vtkIOSSReader * | self | ||
) |
Fills up the output data-structure based on the entity blocks/sets chosen and those available.
bool vtkIOSSReaderInternal::ReadAssemblies | ( | vtkPartitionedDataSetCollection * | output, |
const DatabaseHandle & | handle | ||
) |
Fills up the vtkDataAssembly with ioss-assemblies, if present.
std::vector< vtkSmartPointer< vtkDataSet > > vtkIOSSReaderInternal::GetDataSets | ( | const std::string & | blockname, |
vtkIOSSReader::EntityType | vtk_entity_type, | ||
const DatabaseHandle & | handle, | ||
int | timestep, | ||
vtkIOSSReader * | self | ||
) |
Reads datasets (meshes and fields) for the given block.
vtkSmartPointer< vtkDataSet > vtkIOSSReaderInternal::GetExodusEntityDataSet | ( | const std::vector< std::string > & | blockNames, |
vtkIOSSReader::EntityType | vtk_entity_type, | ||
const DatabaseHandle & | handle, | ||
int | timestep, | ||
vtkIOSSReader * | self | ||
) |
Reads datasets (meshes and fields) for the given exodus entity.
This method is only invoked when MergeExodusEntityBlocks is true (which is not the default).
bool vtkIOSSReaderInternal::GetQAAndInformationRecords | ( | vtkFieldData * | fd, |
const DatabaseHandle & | handle | ||
) |
Read quality assurance and information data from the file.
bool vtkIOSSReaderInternal::GetGlobalFields | ( | vtkFieldData * | fd, |
const DatabaseHandle & | handle, | ||
int | timestep | ||
) |
Read global fields.
|
inline |
Get if there are restart files available.
Definition at line 233 of file vtkIOSSReaderInternal.h.
std::vector< DatabaseHandle > vtkIOSSReaderInternal::GetDatabaseHandles | ( | int | piece, |
int | npieces, | ||
int | timestep | ||
) | const |
Returns the list of fileids, if any to be read for a given "piece" for the chosen timestep.
|
inline |
Useful for printing error messages etc.
Definition at line 244 of file vtkIOSSReaderInternal.h.
|
inline |
For spatially partitioned files, this returns the partition identifier for the file identified by the handle.
Definition at line 268 of file vtkIOSSReaderInternal.h.
|
inline |
Returns if the given database handles have regions already created.
Definition at line 289 of file vtkIOSSReaderInternal.h.
|
inline |
Releases any open file handles.
Definition at line 304 of file vtkIOSSReaderInternal.h.
|
inline |
Little more aggressive than ReleaseHandles
but less intense than Reset
, releases all IOSS regions and thus all the meta-data IOSS may have cached as well.
Definition at line 319 of file vtkIOSSReaderInternal.h.
|
inline |
Clear all regions, databases etc.
Definition at line 324 of file vtkIOSSReaderInternal.h.
|
inline |
Definition at line 335 of file vtkIOSSReaderInternal.h.
|
protected |
|
protected |
|
inlineprotected |
Definition at line 340 of file vtkIOSSReaderInternal.h.
|
protected |
Reads a field with name fieldname
from entity block or set with chosen name (blockname
) and type (vtk_entity_type
).
Field may be a result field which can be time-varying. In that case, timestep
is used to identify the timestep to read.
Returns non-null array on success. Returns nullptr if block or field is missing (which is not an error condition).
On error, std::runtime_error
is thrown.
|
protected |
Get a vector of cell arrays and their cell type for the entity block (or set) with the given name (blockname
) and type (vtk_entity_type).
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
Returns a vector of cell arrays and their cell type.
On file reading error, std::runtime_error
is thrown.
|
protected |
Combine a vector cell types, cell arrays pairs into a single vtkUnsignedCharArray of cell types and a vtkCellArray.
|
protected |
Fill up the grid
with connectivity information for the entity block (or set) with the given name (blockname
) and type (vtk_entity_type).
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
Returns true on success. false
will be returned when the handle doesn't have the chosen blockname/entity.
On file reading error, std::runtime_error
is thrown.
|
protected |
Get with point coordinates aka geometry read from the block with the given name (blockname
).
The point coordinates are always read from a block of type NODEBLOCK.
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
Returns points on success.
On file reading error, std::runtime_error
is thrown.
|
protected |
Fill up grid
with point coordinates aka geometry read from the block with the given name (blockname
).
The point coordinates are always read from a block of type NODEBLOCK.
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
Returns true on success.
On file reading error, std::runtime_error
is thrown.
|
protected |
GetGeometry for vtkStructuredGrid i.e.
CGNS.
|
protected |
Adds geometry (points) and topology (cell) information to the grid for the entity block or set chosen using the name (blockname
) and type (vtk_entity_type
).
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
If remove_unused_points
is true, any points that are not used by the cells are removed. When that is done, an array called __vtk_mesh_original_pt_ids__
is added to the cache for the entity which can be used to identify which points were passed through.
This method is only invoked when MergeExodusEntityBlocks is false (which is the default).
|
protected |
Adds geometry (points) and topology (cell) information to the grid for all the entity blocks or sets chosen using the names (blockNames
) and type (vtk_entity_type
).
handle
is the database / file handle for the current piece / rank obtained by calling GetDatabaseHandles
.
This method is only invoked when MergeExodusEntityBlocks is true (which is not the default).
|
protected |
Reads a structured block.
vtk_entity_type must be vtkIOSSReader::STRUCTUREDBLOCK
.
This method is only invoked when MergeExodusEntityBlocks is false (which is the default).
|
protected |
Add "id" array to the dataset using the id for the grouping entity, if any.
The array named "object_id" is added as a cell-data array to follow the pattern used by vtkExodusIIReader.
|
protected |
Reads selected field arrays for the given entity block or set.
If read_ioss_ids
is true, then element ids are read as applicable.
ids_to_extract
, when specified, is a vtkIdTypeArray
identifying the subset of indices to produce in the output. This is used for point data fields when the mesh was generated with remove_unused_points
on. This ensures that point data arrays match the points. When ids_to_extract
is provided, for the caching to work correctly, the cache_key_suffix
must be set to the name of the entity block (or set) which provided the cells to determine which points to extract.
Returns true on success.
On error, std::runtime_error
is thrown.
|
protected |
This reads node fields for an entity block or set.
Internally calls GetFields()
with correct values for ids_to_extract
and cache_key_suffix
.
|
protected |
Reads node block array with displacements and then transforms the points in the grid using those displacements.
|
protected |
Adds 'file_id' array to indicate which file the dataset was read from.
|
protected |
Fields like "ids" have to be vtkIdTypeArray in VTK.
This method does the conversion if needed.
|
inlineprotected |
Definition at line 538 of file vtkIOSSReaderInternal.h.
|
protected |
Add field-data arrays holding side-set specifications (i.e., (cell-id, side-id) tuples) for use by the UnstructuredGridToCellGrid conversion filter.
|
protected |
Called by GetDataSets
to process each type of dataset.
There's slight difference in how they are handled and hence these separate methods.
|
protected |
Called by GetDataSets
to process each type of dataset.
There's slight difference in how they are handled and hence these separate methods.
|
protected |
|
protected |
Generate a subset based the readers current settings for FileRange and FileStride.
|
protected |
Definition at line 78 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 80 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 83 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 84 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 85 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 87 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 88 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 89 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 93 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 94 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 97 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 99 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 101 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 103 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 104 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 106 of file vtkIOSSReaderInternal.h.
|
protected |
Definition at line 107 of file vtkIOSSReaderInternal.h.
Ioss::PropertyManager vtkIOSSReaderInternal::DatabaseProperties |
Definition at line 118 of file vtkIOSSReaderInternal.h.
std::set<std::string> vtkIOSSReaderInternal::FileNames |
Definition at line 119 of file vtkIOSSReaderInternal.h.
vtkTimeStamp vtkIOSSReaderInternal::FileNamesMTime |
Definition at line 120 of file vtkIOSSReaderInternal.h.
std::set<std::string> vtkIOSSReaderInternal::Selectors |
Definition at line 122 of file vtkIOSSReaderInternal.h.