Sierra Toolkit Version of the Day
stk::io Namespace Reference

Functions

size_t db_api_int_size (const Ioss::GroupingEntity *entity)
bool invalid_rank (stk::mesh::EntityRank rank)
stk::mesh::EntityRank part_primary_entity_rank (const stk::mesh::Part &part)
stk::mesh::EntityRank element_rank (const stk::mesh::MetaData &meta)
stk::mesh::EntityRank side_rank (const stk::mesh::MetaData &meta)
stk::mesh::EntityRank face_rank (const stk::mesh::MetaData &meta)
stk::mesh::EntityRank edge_rank (const stk::mesh::MetaData &meta)
stk::mesh::EntityRank node_rank (const stk::mesh::MetaData &meta)
void set_cell_topology (stk::mesh::Part &part, const CellTopologyData *const cell_topology)
const CellTopologyData * get_cell_topology (const stk::mesh::Part &part)
void initialize_spatial_dimension (stk::mesh::fem::FEMMetaData &fem_meta, size_t spatial_dimension, const std::vector< std::string > &entity_rank_names)
void initialize_spatial_dimension (stk::mesh::MetaData &meta, size_t spatial_dimension, const std::vector< std::string > &entity_rank_names)
void get_io_field_type (const stk::mesh::FieldBase *field, const stk::mesh::FieldRestriction &res, std::pair< std::string, Ioss::Field::BasicType > *result)
const Ioss::GroupingEntity * get_associated_ioss_entity (const mesh::Part &part)
void put_io_part_attribute (mesh::Part &part, Ioss::GroupingEntity *entity)
void remove_io_part_attribute (mesh::Part &part)
bool is_valid_part_field (const stk::mesh::FieldBase *field, const stk::mesh::EntityRank part_type, const stk::mesh::Part &part, const stk::mesh::Part &universal, const Ioss::Field::RoleType filter_role, bool add_all)
const CellTopologyData * map_topology_ioss_to_cell (const Ioss::ElementTopology *topology)
std::string map_topology_cell_to_ioss (const CellTopologyData *cell_top, int spatial_dimension)
void internal_part_processing (Ioss::GroupingEntity *entity, stk::mesh::fem::FEMMetaData &meta)
void internal_part_processing (Ioss::EntityBlock *entity, stk::mesh::fem::FEMMetaData &meta)
void internal_part_processing (Ioss::GroupingEntity *entity, stk::mesh::MetaData &meta)
void internal_part_processing (Ioss::EntityBlock *entity, stk::mesh::MetaData &meta)
void ioss_add_fields (const stk::mesh::Part &part, const stk::mesh::EntityRank part_type, Ioss::GroupingEntity *entity, const Ioss::Field::RoleType filter_role, const bool add_all)
void define_io_fields (Ioss::GroupingEntity *entity, Ioss::Field::RoleType role, stk::mesh::Part &part, stk::mesh::EntityRank part_type)
template<typename INT >
void get_entity_list (Ioss::GroupingEntity *io_entity, stk::mesh::EntityRank part_type, const stk::mesh::BulkData &bulk, std::vector< stk::mesh::Entity * > &entities, INT)
void get_entity_list (Ioss::GroupingEntity *io_entity, stk::mesh::EntityRank part_type, const stk::mesh::BulkData &bulk, std::vector< stk::mesh::Entity * > &entities)
void field_data_from_ioss (const stk::mesh::FieldBase *field, std::vector< stk::mesh::Entity * > &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name)
void field_data_to_ioss (const stk::mesh::FieldBase *field, std::vector< stk::mesh::Entity * > &entities, Ioss::GroupingEntity *io_entity, const std::string &io_fld_name, Ioss::Field::RoleType filter_role)
bool include_entity (const Ioss::GroupingEntity *entity)
void define_output_db (Ioss::Region &io_region, const mesh::BulkData &bulk_data, const Ioss::Region *input_region, const stk::mesh::Selector *anded_selector, const bool sort_stk_parts)
void write_output_db (Ioss::Region &io_region, const stk::mesh::BulkData &bulk, const stk::mesh::Selector *anded_selector)
bool is_part_io_part (stk::mesh::Part &part)
const stk::mesh::Field< double,
stk::mesh::ElementNode > * 
get_distribution_factor_field (const stk::mesh::Part &p)
void set_distribution_factor_field (stk::mesh::Part &p, const stk::mesh::Field< double, stk::mesh::ElementNode > &df_field)
const Ioss::Field::RoleType * get_field_role (const stk::mesh::FieldBase &f)
void set_field_role (stk::mesh::FieldBase &f, const Ioss::Field::RoleType &role)
template<typename T >
void default_part_processing (const std::vector< T * > &entities, stk::mesh::fem::FEMMetaData &fem_meta)
template<typename T >
void default_part_processing (const std::vector< T * > &entities, stk::mesh::MetaData &meta, const stk::mesh::EntityRank)
void show_mesh_help ()
void create_input_mesh (const std::string &mesh_type, const std::string &mesh_filename, stk::ParallelMachine comm, stk::mesh::fem::FEMMetaData &fem_meta, stk::io::MeshData &mesh_data)
void create_output_mesh (const std::string &filename, stk::ParallelMachine comm, stk::mesh::BulkData &bulk_data, MeshData &mesh_data)
int process_output_request (MeshData &mesh_data, stk::mesh::BulkData &bulk, double time, const std::set< const stk::mesh::Part * > &exclude)
void populate_bulk_data (stk::mesh::BulkData &bulk_data, MeshData &mesh_data)
void process_mesh_bulk_data (Ioss::Region *region, stk::mesh::BulkData &bulk_data)
void define_input_fields (MeshData &mesh_data, stk::mesh::fem::FEMMetaData &fem_meta)
void define_output_fields (const MeshData &mesh_data, const stk::mesh::fem::FEMMetaData &fem_meta, bool add_all_fields)
void process_input_request (MeshData &mesh_data, stk::mesh::BulkData &bulk, double time)
void process_input_request (MeshData &mesh_data, stk::mesh::BulkData &bulk, int step)
void input_mesh_fields (Ioss::Region *region, stk::mesh::BulkData &bulk, int step)
template<typename INT >
void get_element_block_sizes (MeshData &mesh_data, std::vector< INT > &el_blocks)
template void get_element_block_sizes (MeshData &mesh_data, std::vector< int > &el_blocks)
template void get_element_block_sizes (MeshData &mesh_data, std::vector< int64_t > &el_blocks)

Detailed Description

The stk::io namespace contains functions related to the transfer of data between the Ioss classes and the stk::mesh classes. These functions do not provide a total turnkey mesh reading or results writing capability; rather, they provide helper functions for the application to use which make it easier to read and/or write the data. The application has full control over the mesh reading and results/restart writing.

The basic flow chart for reading mesh data from the Ioss and defining and populating an stk::mesh structure is shown in the use_cases/io_example.cpp file.


Function Documentation

void stk::io::show_mesh_help ( )

Output a help message showing the valid options for the mesh read and options for generated mesh.

Definition at line 481 of file MeshReadWriteUtils.cpp.

void stk::io::create_input_mesh ( const std::string &  type,
const std::string &  filename,
MPI_Comm  comm,
stk::mesh::fem::FEMMetaData metadata,
MeshData &  mesh_data 
)

Read/Generate the metadata for mesh of the specified type. By default, all entities in the mesh (nodeblocks, element blocks, nodesets, sidesets) will have an associated stk mesh part created for it.

If the mesh_data argument contains a non-null m_input_region data member, then this is assumed to be a valid Ioss::Region* that should be used instead of opening the file and creating a new Ioss::Region.

Following this call, the 'populate_bulk_data()' function should be called to read the bulk data from the mesh and generate the corresponding stk mesh entities (nodes, elements, faces, ...)

Only the non-transient data stored in the mesh database will be accessed in this function. To access any transient field data that may be on the mesh database, use the 'define_input_fields()' function.

Parameters:
[in]typeThe format of the mesh that will be "read". Valid types are "exodus", "generated", "pamgen".
[in]filenameIf the mesh type is file based ("exodus"), then this contains the full pathname to the file containing the mesh information. If the mesh type is a generated type, then this parameter contains data used by the generation routines. See the output from the show_mesh_help() function for details.
[in]commMPI Communicator to be used for all parallel communication needed to generate the mesh.
[in,out]meta_dataThe STK meta data object which will be populated with parts and fields based on the mesh model described by the mesh in filename. The meta_data will not be committed by this function, so the caller will need to call meta_data.commit() after the function returns.
[in,out]mesh_dataA small class used for maintaining some state used by the stk_io routines.

Definition at line 584 of file MeshReadWriteUtils.cpp.

void stk::io::create_output_mesh ( const std::string &  filename,
MPI_Comm  comm,
stk::mesh::BulkData bulk_data,
MeshData &  mesh_data 
)

Create an exodus mesh database with the specified filename. This function creates the exodus metadata which is the number and type of element blocks, nodesets, and sidesets; and then outputs the mesh bulk data such as the node coordinates, id maps, element connectivity. When the function returns, the non-transient portion of the mesh will have been defined.

A stk part will have a corresponding exodus entity (element block, nodeset, sideset) defined if the "is_io_part()" function returns true. By default, all parts read from the mesh database in the create_input_mesh() function will return true as will all stk parts on which the function stk::io::put_io_part_attribute() was called. The function stk::io::remove_io_part_attribute(part) can be called to omit a part from being output.

Parameters:
[in]filenameThe full pathname to the file which will be created and the mesh data written to. If the file already exists, it will be overwritten.
[in]commMPI Communicator to be used for all parallel communication needed by the mesh routines.
[in]bulkThe STK bulk data object defining the stk mesh.
[in,out]mesh_dataA small class used for maintaining some state used by the stk_io routines.

Definition at line 625 of file MeshReadWriteUtils.cpp.

int stk::io::process_output_request ( MeshData &  mesh_data,
stk::mesh::BulkData bulk,
double  time,
const std::set< const stk::mesh::Part * > &  exclude = std::set< const stk::mesh::Part * >() 
)

Add a transient step to the mesh database at time 'time' and output the data for all defined fields to the database.

Definition at line 662 of file MeshReadWriteUtils.cpp.

void stk::io::populate_bulk_data ( stk::mesh::BulkData bulk_data,
stk::io::MeshData &  mesh_data 
)

Read/Generate the bulk data for the mesh. The bulk_data must have been constructed using the meta_data passed to the create_input_mesh() function and the mesh_data must also be the same. This function will create all stk mesh entities (nodes, elements) with the correct nodeal coordinates, element connectivity, element attribute data, and nodeset and sideset membership. Note that meta_data.commit() needs to be called prior to calling this function.

Definition at line 679 of file MeshReadWriteUtils.cpp.

void stk::io::process_mesh_bulk_data ( Ioss::Region *  region,
stk::mesh::BulkData bulk_data 
)

Read/Generate the bulk data for the mesh. The bulk_data must have been constructed using the meta_data passed to the create_input_mesh() function and the mesh_data must also be the same. This function will create all stk mesh entities (nodes, elements) with the correct nodal coordinates, element connectivity, element attribute data, and nodeset and sideset membership. Note that meta_data.commit() followed by bulk_data.modification_begin() needs to be called prior to calling this function. Further, bulk_data.modification_end() must be called upon return from this function. The above populate_bulk_data call is a wrapper for this function.

Definition at line 697 of file MeshReadWriteUtils.cpp.

void stk::io::define_input_fields ( MeshData &  mesh_data,
stk::mesh::fem::FEMMetaData meta_data 
)

Iterate over all Ioss entities in the input mesh database and define a stk field for each transient field found. The stk field will have the same name as the field on the database.

Note that all transient fields found on the mesh database will have a corresponding stk field defined. If you want just a selected subset of the database fields defined in the stk mesh, you need to define the fields manually.

To populate the stk field with data from the database, call process_input_request().

Definition at line 867 of file MeshReadWriteUtils.cpp.

void stk::io::define_output_fields ( const MeshData &  mesh_data,
const stk::mesh::fem::FEMMetaData fem_meta,
bool  add_all_fields = false 
)

Iterate over all stk fields and for each transient field defined on a part that is output to the mesh file, define a corresponding database field. The database field will have the same name as the stk field. A transient field will be defined if the stk::io::is_valid_part_field() returns true. This can be set via a call to stk::io::set_field_role().

If the 'add_all_fields' param is true, then all transient stk fields will have a corresponding database field defined.

Definition at line 890 of file MeshReadWriteUtils.cpp.

void stk::io::process_input_request ( MeshData &  mesh_data,
stk::mesh::BulkData bulk,
double  time 
)

For all transient input fields defined either manually or via the define_input_fields() function, read the data at the specified database time 'time' and populate the stk data structures with those values. The database time closest to the specified time will be used with no interpolation (yet).

Definition at line 925 of file MeshReadWriteUtils.cpp.

void stk::io::process_input_request ( MeshData &  mesh_data,
stk::mesh::BulkData bulk,
int  step 
)

For all transient input fields defined either manually or via the define_input_fields() function, read the data at the specified database step 'step' (1-based) and populate the stk data structures with those values.

Definition at line 946 of file MeshReadWriteUtils.cpp.

void stk::io::input_mesh_fields ( Ioss::Region *  region,
stk::mesh::BulkData bulk_data,
int  step 
)

For all transient input fields defined either manually or via the define_input_fields() function, read the data at the specified database step 'step' (1-based) and populate the stk data structures with those values. Note that bulk_data.modification_begin() needs to be called prior to calling this function. Further, bulk_data.modification_end() must be called upon return from this function. Also note that the two above functions are wrappers for this one.

Definition at line 967 of file MeshReadWriteUtils.cpp.

template<typename INT >
void stk::io::get_element_block_sizes ( MeshData &  mesh_data,
std::vector< INT > &  el_blocks 
)

Method to query a MeshData for the number of element blocks and the number of elements in each. MeshData is input, std:vector is output

Definition at line 983 of file MeshReadWriteUtils.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends