libMesh
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
libMesh::Nemesis_IO_Helper Class Reference

This is the Nemesis_IO_Helper class. More...

#include <nemesis_io_helper.h>

Inheritance diagram for libMesh::Nemesis_IO_Helper:
[legend]

Public Types

enum  ExodusVarType {
  NODAL =0 , ELEMENTAL =1 , GLOBAL =2 , SIDESET =3 ,
  NODESET =4 , ELEMSET =5
}
 Wraps calls to exII::ex_get_var_names() and exII::ex_get_var_param(). More...
 

Public Member Functions

 Nemesis_IO_Helper (const ParallelObject &parent, bool verbose=false, bool single_precision=false)
 Constructor.
 
virtual ~Nemesis_IO_Helper ()
 Destructor.
 
void write_complex_magnitude (bool val)
 Set the flag indicating whether the complex modulus should be written when complex numbers are enabled.
 
void read_nodeset (int id)
 Reading functions.
 
void get_init_global ()
 Fills: num_nodes_global, num_elems_global, num_elem_blks_global, num_node_sets_global, num_side_sets_global Call after: read_and_store_header_info() Call before: Any other get_* function from this class.
 
void get_ss_param_global ()
 Fills: global_sideset_ids, num_global_side_counts, num_global_side_df_counts Call after: get_init_global()
 
void get_ns_param_global ()
 
void get_eb_info_global ()
 
void get_init_info ()
 
void get_loadbal_param ()
 
void get_elem_map ()
 
void get_node_map ()
 
void get_cmap_params ()
 
void get_node_cmap ()
 
void get_elem_cmap ()
 
void put_init_info (unsigned num_proc, unsigned num_proc_in_file, const char *ftype)
 Writing functions.
 
void put_init_global (dof_id_type num_nodes_global, dof_id_type num_elems_global, unsigned num_elem_blks_global, unsigned num_node_sets_global, unsigned num_side_sets_global)
 Writes global information including: .) global number of nodes .) global number of elems .) global number of element blocks .) global number of node sets .) global number of side sets.
 
void put_eb_info_global (std::vector< int > &global_elem_blk_ids, std::vector< int > &global_elem_blk_cnts)
 Writes global block information to the file .) global_elem_blk_ids - list of block IDs for all blocks present in the mesh .) global_elem_blk_cnts - number of elements in each block for the global mesh.
 
void put_ns_param_global (std::vector< int > &global_nodeset_ids, std::vector< int > &num_global_node_counts, std::vector< int > &num_global_node_df_counts)
 This function writes information about global node sets.
 
void put_ss_param_global (std::vector< int > &global_sideset_ids, std::vector< int > &num_global_side_counts, std::vector< int > &num_global_side_df_counts)
 This function writes information about global side sets.
 
void put_loadbal_param (unsigned num_internal_nodes, unsigned num_border_nodes, unsigned num_external_nodes, unsigned num_internal_elems, unsigned num_border_elems, unsigned num_node_cmaps, unsigned num_elem_cmaps)
 Writes load balance parameters, some of which are described below: .) num_internal_nodes - nodes "wholly" owned by the current processor .) num_border_nodes - nodes local to a processor but residing in an element which also has nodes on other processors .) num_external_nodes - nodes that reside on other processors but whose element "partially" resides on the current processor – we assert this should be zero on reading! .) num_border_elems - elements local to this processor but whose nodes reside on other processors as well.
 
void put_cmap_params (std::vector< int > &node_cmap_ids, std::vector< int > &node_cmap_node_cnts, std::vector< int > &elem_cmap_ids, std::vector< int > &elem_cmap_elem_cnts)
 Outputs initial information for communication maps.
 
void put_node_cmap (std::vector< std::vector< int > > &node_cmap_node_ids, std::vector< std::vector< int > > &node_cmap_proc_ids)
 Outputs all of the nodal communication maps for this processor.
 
void put_node_map (std::vector< int > &node_mapi, std::vector< int > &node_mapb, std::vector< int > &node_mape)
 Outputs IDs of internal, border, and external nodes.
 
void put_elem_cmap (std::vector< std::vector< int > > &elem_cmap_elem_ids, std::vector< std::vector< int > > &elem_cmap_side_ids, std::vector< std::vector< int > > &elem_cmap_proc_ids)
 Writes information about elemental communication map.
 
void put_elem_map (std::vector< int > &elem_mapi, std::vector< int > &elem_mapb)
 Outputs IDs of internal and border elements.
 
virtual void write_nodal_coordinates (const MeshBase &mesh, bool use_discontinuous=false) override
 This function is specialized from ExodusII_IO_Helper to write only the nodal coordinates stored on the local piece of the Mesh.
 
virtual void write_elements (const MeshBase &mesh, bool use_discontinuous=false) override
 This function is specialized to write the connectivity.
 
virtual void write_sidesets (const MeshBase &mesh) override
 Writes the sidesets for this processor.
 
virtual void write_nodesets (const MeshBase &mesh) override
 Writes the nodesets for this processor.
 
virtual void initialize (std::string title, const MeshBase &mesh, bool use_discontinuous=false) override
 Specialization of the initialize function from ExodusII_IO_Helper that also writes global initial data to file.
 
void compute_num_global_elem_blocks (const MeshBase &pmesh)
 This function uses global communication routines to determine the number of element blocks across the entire mesh.
 
void build_element_and_node_maps (const MeshBase &pmesh)
 This function builds the libmesh -> exodus and exodus -> libmesh node and element maps.
 
void write_nodal_solution (const NumericVector< Number > &parallel_soln, const std::vector< std::string > &names, int timestep, const std::vector< std::string > &output_names)
 Takes a parallel solution vector containing the node-major solution vector for all variables and outputs it to the files.
 
void write_nodal_solution (const EquationSystems &es, const std::vector< std::pair< unsigned int, unsigned int > > &var_nums, int timestep, const std::vector< std::string > &output_names)
 Outputs EquationSystems current_local_solution nodal values.
 
void write_nodal_solution (const std::vector< Number > &values, const std::vector< std::string > &names, int timestep)
 Takes a solution vector containing the solution for all variables and outputs it to the files.
 
virtual void initialize_element_variables (std::vector< std::string > names, const std::vector< std::set< subdomain_id_type > > &vars_active_subdomains) override
 Override the Exodus Helper's implementation of this function so that it works correctly in parallel.
 
void write_element_values (const MeshBase &mesh, const EquationSystems &es, const std::vector< std::pair< unsigned int, unsigned int > > &var_nums, int timestep, const std::vector< std::set< subdomain_id_type > > &vars_active_subdomains)
 Writes the vector of elemental variable values, one variable and one subdomain at a time.
 
std::string construct_nemesis_filename (std::string_view base_filename)
 Given base_filename, foo.e, constructs the Nemesis filename foo.e.X.Y, where X=n.
 
const char * get_elem_type () const
 
void set_add_sides (bool add_sides)
 Sets whether or not to write extra "side" elements.
 
bool get_add_sides ()
 
void open (const char *filename, bool read_only)
 Opens an ExodusII mesh file named filename.
 
ExodusHeaderInfo read_header () const
 Reads an ExodusII mesh file header, leaving this object's internal data structures unchanged.
 
void read_and_store_header_info ()
 Reads an ExodusII mesh file header, and stores required information on this object.
 
void read_qa_records ()
 Reads the QA records from an ExodusII file.
 
void print_header ()
 Prints the ExodusII mesh file header, which includes the mesh title, the number of nodes, number of elements, mesh dimension, number of sidesets, and number of nodesets.
 
void read_nodes ()
 Reads the nodal data (x,y,z coordinates) from the ExodusII mesh file.
 
void read_node_num_map ()
 Reads the optional node_num_map from the ExodusII mesh file.
 
void read_bex_cv_blocks ()
 Reads the optional bex_cv_blocks from the ExodusII mesh file.
 
void print_nodes (std::ostream &out_stream=libMesh::out)
 Prints the nodal information, by default to libMesh::out.
 
void read_block_info ()
 Reads information for all of the blocks in the ExodusII mesh file.
 
int get_block_id (int index)
 Get the block number for the given block index.
 
std::string get_block_name (int index)
 Get the block name for the given block index if supplied in the mesh file.
 
int get_side_set_id (int index)
 Get the side set id for the given side set index.
 
std::string get_side_set_name (int index)
 Get the side set name for the given side set index if supplied in the mesh file.
 
int get_node_set_id (int index)
 Get the node set id for the given node set index.
 
std::string get_node_set_name (int index)
 Get the node set name for the given node set index if supplied in the mesh file.
 
void read_elem_in_block (int block)
 Reads all of the element connectivity for block block in the ExodusII mesh file.
 
void read_face_blocks ()
 Reads NSIDED face blocks used by NFACED element blocks.
 
void read_edge_blocks (MeshBase &mesh)
 Read in edge blocks, storing information in the BoundaryInfo object.
 
void read_elem_num_map ()
 Reads the optional node_num_map from the ExodusII mesh file.
 
void read_sideset_info ()
 Reads information about all of the sidesets in the ExodusII mesh file.
 
void read_nodeset_info ()
 Reads information about all of the nodesets in the ExodusII mesh file.
 
void read_elemset_info ()
 Reads information about all of the elemsets in the ExodusII mesh file.
 
void read_sideset (int id, int offset)
 Reads information about sideset id and inserts it into the global sideset array at the position offset.
 
void read_elemset (int id, int offset)
 Reads information about elemset id and inserts it into the global elemset array at the position offset.
 
void read_all_nodesets ()
 New API that reads all nodesets simultaneously.
 
void close () noexcept
 Closes the ExodusII mesh file.
 
void read_time_steps ()
 Reads and stores the timesteps in the 'time_steps' array.
 
void read_num_time_steps ()
 Reads the number of timesteps currently stored in the Exodus file and stores it in the num_time_steps variable.
 
void read_nodal_var_values (std::string nodal_var_name, int time_step)
 Reads the nodal values for the variable 'nodal_var_name' at the specified time into the 'nodal_var_values' array.
 
void read_elemental_var_values (std::string elemental_var_name, int time_step, std::map< dof_id_type, Real > &elem_var_value_map)
 Reads elemental values for the variable 'elemental_var_name' at the specified timestep into the 'elem_var_value_map' which is passed in.
 
dof_id_type get_libmesh_node_id (int exodus_node_id)
 Helper function that takes a (1-based) Exodus node/elem id and determines the corresponding libMesh Node/Elem id.
 
dof_id_type get_libmesh_elem_id (int exodus_elem_id)
 
void conditionally_set_node_unique_id (MeshBase &mesh, Node *node, int zero_based_node_num_map_index)
 Helper function that conditionally sets the unique_id of the passed-in Node/Elem.
 
void conditionally_set_elem_unique_id (MeshBase &mesh, Elem *elem, int zero_based_elem_num_map_index)
 
virtual void create (std::string filename)
 Opens an ExodusII mesh file named filename for writing.
 
void initialize_nodal_variables (std::vector< std::string > names)
 Sets up the nodal variables.
 
void initialize_global_variables (std::vector< std::string > names)
 Sets up the global variables.
 
void write_timestep (int timestep, Real time)
 Writes the time for the timestep.
 
void write_elemsets (const MeshBase &mesh)
 Write elemsets stored on the Mesh to the exo file.
 
void write_sideset_data (const MeshBase &mesh, int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< boundary_id_type > > &side_ids, const std::vector< std::map< BoundaryInfo::BCTuple, Real > > &bc_vals)
 Write sideset data for the requested timestep.
 
void read_sideset_data (const MeshBase &mesh, int timestep, std::vector< std::string > &var_names, std::vector< std::set< boundary_id_type > > &side_ids, std::vector< std::map< BoundaryInfo::BCTuple, Real > > &bc_vals)
 Read sideset variables, if any, into the provided data structures.
 
void get_sideset_data_indices (const MeshBase &mesh, std::map< BoundaryInfo::BCTuple, unsigned int > &bc_array_indices)
 Similar to read_sideset_data(), but instead of creating one std::map per sideset per variable, creates a single map of (elem, side, boundary_id) tuples, and stores the exo file array indexing for any/all sideset variables on that sideset (they are all the same).
 
void write_nodeset_data (int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< boundary_id_type > > &node_boundary_ids, const std::vector< std::map< BoundaryInfo::NodeBCTuple, Real > > &bc_vals)
 Write nodeset data for the requested timestep.
 
void read_nodeset_data (int timestep, std::vector< std::string > &var_names, std::vector< std::set< boundary_id_type > > &node_boundary_ids, std::vector< std::map< BoundaryInfo::NodeBCTuple, Real > > &bc_vals)
 Read nodeset variables, if any, into the provided data structures.
 
void get_nodeset_data_indices (std::map< BoundaryInfo::NodeBCTuple, unsigned int > &bc_array_indices)
 Similar to read_nodeset_data(), but instead of creating one std::map per nodeset per variable, creates a single map of (node_id, boundary_id) tuples, and stores the exo file array indexing for any/all nodeset variables on that nodeset (they are all the same).
 
void write_elemset_data (int timestep, const std::vector< std::string > &var_names, const std::vector< std::set< elemset_id_type > > &elemset_ids_in, const std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real > > &elemset_vals)
 Write elemset data for the requested timestep.
 
void read_elemset_data (int timestep, std::vector< std::string > &var_names, std::vector< std::set< elemset_id_type > > &elemset_ids_in, std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real > > &elemset_vals)
 Read elemset variables, if any, into the provided data structures.
 
void get_elemset_data_indices (std::map< std::pair< dof_id_type, elemset_id_type >, unsigned int > &elemset_array_indices)
 Similar to read_elemset_data(), but instead of creating one std::map per elemset per variable, creates a single map of (elem_id, elemset_id) tuples, and stores the exo file array indexing for any/all elemset variables on that elemset (they are all the same).
 
void write_element_values (const MeshBase &mesh, const std::vector< Real > &values, int timestep, const std::vector< std::set< subdomain_id_type > > &vars_active_subdomains)
 Writes the vector of values to the element variables.
 
void write_element_values_element_major (const MeshBase &mesh, const std::vector< Real > &values, int timestep, const std::vector< std::set< subdomain_id_type > > &vars_active_subdomains, const std::vector< std::string > &derived_var_names, const std::map< subdomain_id_type, std::vector< std::string > > &subdomain_to_var_names)
 Same as the function above, but assume the input 'values' vector is in element-major order, i.e.
 
void write_nodal_values (int var_id, const std::vector< Real > &values, int timestep)
 Writes the vector of values to a nodal variable.
 
void write_information_records (const std::vector< std::string > &records)
 Writes the vector of information records.
 
void write_global_values (const std::vector< Real > &values, int timestep)
 Writes the vector of global variables.
 
void update ()
 Uses ex_update() to flush buffers to file.
 
void read_global_values (std::vector< Real > &values, int timestep)
 Reads the vector of global variables.
 
void use_mesh_dimension_instead_of_spatial_dimension (bool val)
 Sets the underlying value of the boolean flag _use_mesh_dimension_instead_of_spatial_dimension.
 
void set_hdf5_writing (bool write_hdf5)
 Set to true (the default) to write files in an HDF5-based file format (when HDF5 is available), or to false to write files in the old NetCDF3-based format.
 
void write_as_dimension (unsigned dim)
 Sets the value of _write_as_dimension.
 
void set_coordinate_offset (Point p)
 Allows you to set a vector that is added to the coordinates of all of the nodes.
 
void set_max_name_length (unsigned int max_length)
 Set how many characters to use in names when opening a file for writing.
 
std::vector< std::string > get_complex_names (const std::vector< std::string > &names, bool write_complex_abs) const
 
std::vector< std::set< subdomain_id_type > > get_complex_vars_active_subdomains (const std::vector< std::set< subdomain_id_type > > &vars_active_subdomains, bool write_complex_abs) const
 returns a "tripled" copy of vars_active_subdomains, which is necessary in the complex-valued case.
 
std::map< subdomain_id_type, std::vector< std::string > > get_complex_subdomain_to_var_names (const std::map< subdomain_id_type, std::vector< std::string > > &subdomain_to_var_names, bool write_complex_abs) const
 Takes a map from subdomain id -> vector of active variable names as input and returns a corresponding map where the original variable names have been replaced by their complex counterparts.
 
void message (std::string_view msg)
 Prints the message defined in msg.
 
void message (std::string_view msg, int i)
 Prints the message defined in msg, and appends the number i to the end of the message.
 
int end_elem_id () const
 
void read_var_names (ExodusVarType type)
 
const ExodusII_IO_Helper::Conversion & get_conversion (const ElemType type) const
 
const ExodusII_IO_Helper::Conversion & get_conversion (std::string type_str) const
 
dof_id_type node_id_to_vec_id (dof_id_type n) const
 
dof_id_type added_node_offset_on (processor_id_type p) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static int get_exodus_version ()
 

Public Attributes

int nemesis_err_flag
 Member data.
 
int num_nodes_global
 Global initial information.
 
int num_elems_global
 
int num_elem_blks_global
 
int num_node_sets_global
 
int num_side_sets_global
 
int num_proc
 The number of processors for which the NEMESIS I file was created.
 
int num_proc_in_file
 The number of processors for which the NEMESIS I file stores information.
 
char ftype
 The type of file to be written.
 
std::vector< int > node_list
 
std::vector< int > global_sideset_ids
 Containers for reading global sideset (boundary conditions) information.
 
std::vector< int > num_global_side_counts
 
std::vector< int > num_global_side_df_counts
 
std::vector< int > global_nodeset_ids
 Containers for reading global nodeset information.
 
std::vector< int > num_global_node_counts
 
std::vector< int > num_global_node_df_counts
 
std::vector< int > global_elem_blk_ids
 Read the global element block IDs and counts.
 
std::vector< int > global_elem_blk_cnts
 
std::set< int > nodes_attached_to_local_elems
 libMesh numbered node ids attached to local elems.
 
std::map< subdomain_id_type, std::vector< dof_id_type > > subdomain_map
 Map of subdomains to element numbers.
 
std::map< int, std::vector< int > > block_id_to_elem_connectivity
 This is the block connectivity, i.e.
 
int num_internal_nodes
 To be used with the Nemesis::ne_get_loadbal_param() routine.
 
int num_border_nodes
 The number of FEM nodes local to a processor but residing in an element which also has FEM nodes on other processors.
 
int num_external_nodes
 The number of FEM nodes that reside on another processor but whose element partially resides on the current processor.
 
int num_internal_elems
 The number of internal FEM elements.
 
int num_border_elems
 The number of border FEM elements.
 
int num_node_cmaps
 The number of nodal communication maps for this processor.
 
int num_elem_cmaps
 The number of elemental communication maps for this processor.
 
std::vector< int > elem_mapi
 Vector which stores internal element IDs.
 
std::vector< int > elem_mapb
 Vector which stores border element IDs.
 
std::vector< int > node_mapi
 Vector which stores internal node IDs.
 
std::vector< int > node_mapb
 Vector which stores border node IDs.
 
std::vector< int > node_mape
 Vector which stores external node IDs.
 
std::vector< int > node_cmap_ids
 Vectors for storing the communication map parameters.
 
std::vector< int > node_cmap_node_cnts
 
std::vector< int > elem_cmap_ids
 
std::vector< int > elem_cmap_elem_cnts
 
std::vector< std::vector< int > > node_cmap_node_ids
 2 vectors of vectors for storing the node communication IDs for this processor.
 
std::vector< std::vector< int > > node_cmap_proc_ids
 
std::vector< std::vector< int > > elem_cmap_elem_ids
 3 vectors of vectors for storing element communication IDs for this processor.
 
std::vector< std::vector< int > > elem_cmap_side_ids
 
std::vector< std::vector< int > > elem_cmap_proc_ids
 
bool write_complex_abs
 By default, when complex numbers are enabled, for each variable we write out three values: the real part, "r_u" the imaginary part, "i_u", and the complex modulus, a_u := sqrt(r_u*r_u + i_u*i_u), which is also the value returned by std::abs(std::complex).
 
int ex_id
 
int ex_err
 
ExodusHeaderInfo header_info
 
std::vector< char > & title
 
int & num_dim
 
int & num_nodes
 
int & num_elem
 
int & num_elem_blk
 
int & num_edge
 
int & num_edge_blk
 
int & num_face
 
int & num_face_blk
 
int & num_node_sets
 
int & num_side_sets
 
int & num_elem_sets
 
int num_global_vars
 
int num_sideset_vars
 
int num_nodeset_vars
 
int num_elemset_vars
 
int num_elem_this_blk
 
int num_nodes_per_elem
 
int num_attr
 
int num_elem_all_sidesets
 
int num_elem_all_elemsets
 
std::vector< int > block_ids
 
std::vector< int > edge_block_ids
 
std::vector< int > connect
 
std::vector< int > elem_node_counts
 
std::vector< int > elem_face_counts
 
std::vector< std::vector< int > > c0polyhedron_face_connect
 
std::vector< int > ss_ids
 
std::vector< int > nodeset_ids
 
std::vector< int > elemset_ids
 
std::vector< int > num_sides_per_set
 
std::vector< int > num_nodes_per_set
 
std::vector< int > num_elems_per_set
 
std::vector< int > num_df_per_set
 
std::vector< int > num_node_df_per_set
 
std::vector< int > num_elem_df_per_set
 
std::vector< int > node_sets_node_index
 
std::vector< int > node_sets_dist_index
 
std::vector< int > node_sets_node_list
 
std::vector< Real > node_sets_dist_fact
 
std::vector< int > elem_list
 
std::vector< int > side_list
 
std::vector< int > id_list
 
std::vector< int > elemset_list
 
std::vector< int > elemset_id_list
 
std::vector< int > node_num_map
 
std::vector< int > elem_num_map
 
std::vector< Real > x
 
std::vector< Real > y
 
std::vector< Real > z
 
std::vector< Real > w
 
unsigned int bex_num_elem_cvs
 
std::vector< std::vector< long unsigned int > > bex_cv_conn
 
std::vector< std::vector< std::vector< Real > > > bex_dense_constraint_vecs
 
std::vector< char > elem_type
 
std::map< dof_id_type, dof_id_type > libmesh_elem_num_to_exodus
 
std::vector< int > exodus_elem_num_to_libmesh
 
std::map< dof_id_type, dof_id_type > libmesh_node_num_to_exodus
 
std::vector< int > exodus_node_num_to_libmesh
 
int num_time_steps
 
std::vector< Real > time_steps
 
int num_nodal_vars
 
std::vector< std::string > nodal_var_names
 
std::map< dof_id_type, Real > nodal_var_values
 
int num_elem_vars
 
std::vector< std::string > elem_var_names
 
std::vector< Real > elem_var_values
 
std::vector< std::string > global_var_names
 
std::vector< std::string > sideset_var_names
 
std::vector< std::string > nodeset_var_names
 
std::vector< std::string > elemset_var_names
 
std::map< int, std::string > id_to_block_names
 
std::map< int, std::string > id_to_edge_block_names
 
std::map< int, std::string > id_to_ss_names
 
std::map< int, std::string > id_to_ns_names
 
std::map< int, std::string > id_to_elemset_names
 
bool verbose
 
bool set_unique_ids_from_maps
 
bool opened_for_writing
 
bool opened_for_reading
 
std::string current_filename
 

Protected Member Functions

virtual void read_var_names_impl (const char *var_type, int &count, std::vector< std::string > &result) override
 read_var_names() dispatches to this function.
 
void check_existing_vars (ExodusVarType type, std::vector< std::string > &names, std::vector< std::string > &names_from_file)
 When appending: during initialization, check that variable names in the file match those you attempt to initialize with.
 
void write_var_names (ExodusVarType type, const std::vector< std::string > &names)
 Wraps calls to exII::ex_put_var_names() and exII::ex_put_var_param().
 

Protected Attributes

bool _run_only_on_proc0
 
bool _opened_by_create
 
bool _elem_vars_initialized
 
bool _global_vars_initialized
 
bool _nodal_vars_initialized
 
bool _use_mesh_dimension_instead_of_spatial_dimension
 
bool _write_hdf5
 
unsigned int _max_name_length
 
int _end_elem_id
 
unsigned _write_as_dimension
 
Point _coordinate_offset
 
bool _single_precision
 
std::vector< dof_id_type > _added_side_node_offsets
 If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, _added_side_node_offsets[p] gives us the total solution vector offset to use on processor p+1 from the nodes on those previous ranks' sides.
 
std::vector< dof_id_type > _true_node_offsets
 If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, we also need to know how many real nodes from previous ranks are taking up space in a solution vector.
 
const Parallel::Communicator & _communicator
 

Private Types

typedef std::map< unsigned, std::set< unsigned > >::iterator proc_nodes_touched_iterator
 Typedef for an iterator into the data structure above.
 
typedef std::map< unsigned, std::set< std::pair< unsigned, unsigned > > >::iterator proc_border_elem_sets_iterator
 Typedef for an iterator into the data structure above.
 

Private Member Functions

void compute_num_global_nodesets (const MeshBase &pmesh)
 This function uses global communication routines to determine the number of nodesets across the entire mesh.
 
void compute_num_global_sidesets (const MeshBase &pmesh)
 This function uses global communication routines to determine the number of sidesets across the entire mesh.
 
void compute_border_node_ids (const MeshBase &pmesh)
 This function constructs the set of border node IDs present on the current mesh.
 
void compute_internal_and_border_elems_and_internal_nodes (const MeshBase &pmesh)
 This function constructs the set of border and internal element IDs and internal node IDs present on the current mesh.
 
void compute_communication_map_parameters ()
 This function determines the communication map parameters which will eventually be written to file.
 
void compute_node_communication_maps ()
 Compute the node communication maps (really just pack vectors) in preparation for writing them to file.
 
void compute_node_maps ()
 Compute the node maps (really just pack vectors) which map the nodes to internal, border, and external nodes in the file.
 
void compute_elem_communication_maps ()
 This function computes element communication maps (really just packs vectors) in preparation for writing them to file.
 
void compute_element_maps ()
 This function computes element maps (really just packs vectors) which map the elements to internal and border elements.
 
void write_exodus_initialization_info (const MeshBase &pmesh, const std::string &title)
 This function writes exodus-specific initialization information.
 
dof_id_type get_libmesh_id (int exodus_id, const std::vector< int > &num_map)
 Internal implementation for the two sets of functions above.
 
void set_dof_object_unique_id (MeshBase &mesh, DofObject *dof_object, int exodus_mapped_id)
 
void write_var_names_impl (const char *var_type, int &count, const std::vector< std::string > &names)
 write_var_names() dispatches to this function.
 
void init_element_equivalence_map ()
 
void init_conversion_map ()
 

Private Attributes

std::map< subdomain_id_type, unsigned > local_subdomain_counts
 This map keeps track of the number of elements in each subdomain (block) for this processor.
 
std::set< unsigned > border_node_ids
 The set which will eventually contain the IDs of "border nodes".
 
std::map< unsigned, std::set< unsigned > > proc_nodes_touched_intersections
 Another map to store sets of intersections with each other processor (other than ourself, of course).
 
std::map< unsigned, std::set< std::pair< unsigned, unsigned > > > proc_border_elem_sets
 Map between processor ID and (element,side) pairs bordering that processor ID.
 
std::set< unsigned > internal_node_ids
 A set of internal node IDs for this processor.
 
std::set< unsigned > internal_elem_ids
 A set of internal elem IDs for this processor.
 
std::set< unsigned > border_elem_ids
 A set of border elem IDs for this processor.
 
bool _add_sides = false
 Set to true iff we want to write separate "side" elements too.
 
std::map< std::string, ElemType > element_equivalence_map
 Defines equivalence classes of Exodus element types that map to libmesh ElemTypes.
 
std::map< int, std::map< ElemType, ExodusII_IO_Helper::Conversion > > conversion_map
 Associates libMesh ElemTypes with node/face/edge/etc.
 

Detailed Description

This is the Nemesis_IO_Helper class.

Think of it as a big struct with storage for all the stuff one might want to pull from a Nemesis file. Derived from ExodusII_IO_Helper object, since Nemesis is based on the same file format.

Author
John W. Peterson
Roy Stogner
Date
2008
2020

Definition at line 52 of file nemesis_io_helper.h.

Member Typedef Documentation

◆ proc_border_elem_sets_iterator

typedef std::map<unsigned,std::set<std::pair<unsigned,unsigned>>>::iterator libMesh::Nemesis_IO_Helper::proc_border_elem_sets_iterator
private

Typedef for an iterator into the data structure above.

Definition at line 626 of file nemesis_io_helper.h.

◆ proc_nodes_touched_iterator

typedef std::map<unsigned,std::set<unsigned>>::iterator libMesh::Nemesis_IO_Helper::proc_nodes_touched_iterator
private

Typedef for an iterator into the data structure above.

Definition at line 616 of file nemesis_io_helper.h.

Member Enumeration Documentation

◆ ExodusVarType

Wraps calls to exII::ex_get_var_names() and exII::ex_get_var_param().

The enumeration controls whether nodal, elemental, global, etc. variable names are read and which class members are filled in. NODAL: num_nodal_vars nodal_var_names ELEMENTAL: num_elem_vars elem_var_names GLOBAL: num_global_vars global_var_names SIDESET: num_sideset_vars sideset_var_names NODESET: num_nodeset_vars nodeset_var_names

Enumerator
NODAL 
ELEMENTAL 
GLOBAL 
SIDESET 
NODESET 
ELEMSET 

Definition at line 951 of file exodusII_io_helper.h.

Constructor & Destructor Documentation

◆ Nemesis_IO_Helper()

libMesh::Nemesis_IO_Helper::Nemesis_IO_Helper ( const ParallelObject &  parent,
bool  verbose = false,
bool  single_precision = false 
)
explicit

Constructor.

Definition at line 77 of file nemesis_io_helper.C.

78 :
79 ExodusII_IO_Helper(parent, verbose_in, /*run_only_on_proc0=*/false, /*single_precision=*/single_precision),
86 num_proc(0),
88 ftype('\0'),
97{
98 // Warn about using untested code!
99 libmesh_experimental();
100}
ExodusII_IO_Helper(const ParallelObject &parent, bool v=false, bool run_only_on_proc0=true, bool single_precision=false)
Constructor.
int num_border_elems
The number of border FEM elements.
int num_external_nodes
The number of FEM nodes that reside on another processor but whose element partially resides on the c...
int num_internal_nodes
To be used with the Nemesis::ne_get_loadbal_param() routine.
int num_internal_elems
The number of internal FEM elements.
char ftype
The type of file to be written.
int num_border_nodes
The number of FEM nodes local to a processor but residing in an element which also has FEM nodes on o...
int num_proc_in_file
The number of processors for which the NEMESIS I file stores information.
int num_node_cmaps
The number of nodal communication maps for this processor.
int num_nodes_global
Global initial information.
bool write_complex_abs
By default, when complex numbers are enabled, for each variable we write out three values: the real p...
int num_elem_cmaps
The number of elemental communication maps for this processor.
int num_proc
The number of processors for which the NEMESIS I file was created.

◆ ~Nemesis_IO_Helper()

libMesh::Nemesis_IO_Helper::~Nemesis_IO_Helper ( )
virtual

Destructor.

Definition at line 103 of file nemesis_io_helper.C.

104{
105 // Our destructor is called from Nemesis_IO. We close the Exodus file here since we have
106 // responsibility for managing the file's lifetime. Only call ex_update() if the file was
107 // opened for writing!
108 if (this->opened_for_writing)
109 {
110 this->ex_err = exII::ex_update(this->ex_id);
111 EX_EXCEPTIONLESS_CHECK_ERR(ex_err, "Error flushing buffers to file.");
112 }
113 this->close();
114}
void close() noexcept
Closes the ExodusII mesh file.

References libMesh::ExodusII_IO_Helper::close(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, and libMesh::ExodusII_IO_Helper::opened_for_writing.

Member Function Documentation

◆ added_node_offset_on()

dof_id_type libMesh::ExodusII_IO_Helper::added_node_offset_on ( processor_id_type  p) const
inlineinherited

Definition at line 985 of file exodusII_io_helper.h.

986 {
988 const dof_id_type added_node_offsets =
989 (_added_side_node_offsets.empty() || !p) ? 0 :
991 return _true_node_offsets[p] + added_node_offsets;
992 }
std::vector< dof_id_type > _true_node_offsets
If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, we also need to know how many...
std::vector< dof_id_type > _added_side_node_offsets
If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, _added_side_node_offsets[p] g...
libmesh_assert(ctx)
uint8_t dof_id_type
Definition id_types.h:67

References libMesh::ExodusII_IO_Helper::_added_side_node_offsets, libMesh::ExodusII_IO_Helper::_true_node_offsets, and libMesh::libmesh_assert().

◆ build_element_and_node_maps()

void libMesh::Nemesis_IO_Helper::build_element_and_node_maps ( const MeshBase &  pmesh)

This function builds the libmesh -> exodus and exodus -> libmesh node and element maps.

These maps allow us to have a consistent numbering scheme within an Exodus file, given an existing globally consistent numbering scheme from LibMesh.

Definition at line 1649 of file nemesis_io_helper.C.

1650{
1651 // If we don't have any local subdomains, it had better be because
1652 // we don't have any local elements
1653#ifdef DEBUG
1654 if (local_subdomain_counts.empty())
1655 {
1656 libmesh_assert(pmesh.active_local_elements_begin() ==
1657 pmesh.active_local_elements_end());
1659 }
1660#endif
1661
1662 // Elements have to be numbered contiguously based on what block
1663 // number they are in. Therefore we have to do a bit of work to get
1664 // the block (ie subdomain) numbers first and store them off as
1665 // block_ids.
1666
1667 // Make sure there is no leftover information in the subdomain_map, and reserve
1668 // enough space to store the elements we need.
1669 this->subdomain_map.clear();
1670 for (const auto & [sbd_id, cnt] : local_subdomain_counts)
1671 {
1672 if (verbose)
1673 {
1674 libMesh::out << "[" << this->processor_id() << "] "
1675 << "local_subdomain_counts [" << static_cast<unsigned>(sbd_id) << "]= "
1676 << cnt
1677 << std::endl;
1678 }
1679
1680 this->subdomain_map[sbd_id].reserve(cnt);
1681 }
1682
1683
1684 // First loop over the elements to figure out which elements are in which subdomain
1685 for (const auto & elem : pmesh.active_local_element_ptr_range())
1686 {
1687 // Grab the nodes while we're here.
1688 for (auto n : elem->node_index_range())
1689 this->nodes_attached_to_local_elems.insert( elem->node_id(n) );
1690
1691 subdomain_id_type cur_subdomain = elem->subdomain_id();
1692
1693 this->subdomain_map[cur_subdomain].push_back(elem->id());
1694 }
1695
1696 // Set num_nodes which is used by exodusII_io_helper
1697 this->num_nodes =
1698 cast_int<int>(this->nodes_attached_to_local_elems.size());
1699
1700 // Now come up with a 1-based numbering for these nodes
1701 this->exodus_node_num_to_libmesh.clear(); // Make sure it's empty
1703
1704 // Also make sure there's no leftover information in the map which goes the
1705 // other direction.
1706 this->libmesh_node_num_to_exodus.clear();
1707
1708 // Set the map for nodes
1709 for (const auto & id : nodes_attached_to_local_elems)
1710 {
1711 // I.e. given exodus_node_id,
1712 // exodus_node_num_to_libmesh[ exodus_node_id ] returns the
1713 // libmesh ID for that node, plus one.
1714 // Here we index libMesh IDs with an offset of 1 because they're
1715 // the literal numbers that get written to the exodus file, but
1716 // we index Exodus IDs with an offset of 0 because we read that
1717 // exodus data into a C++ vector. Confused yet?
1718 this->exodus_node_num_to_libmesh.push_back(id+1);
1719
1720 // Likewise, given libmesh_node_id,
1721 // libmesh_node_num_to_exodus[ libmesh_node_id] returns the
1722 // *Exodus* ID for that node. Unlike the
1723 // exodus_node_num_to_libmesh vector above, this one is a
1724 // std::map. We're never handing a data buffer from it over to
1725 // another API so we don't need to do any weird offsets with it.
1726 this->libmesh_node_num_to_exodus[id] =
1727 this->exodus_node_num_to_libmesh.size(); // should never be zero...
1728 }
1729
1730 // Now we're going to loop over the subdomain map and build a few things right
1731 // now that we'll use later.
1732
1733 // First make sure our data structures don't have any leftover data...
1734 this->exodus_elem_num_to_libmesh.clear();
1735 this->block_ids.clear();
1736 this->libmesh_elem_num_to_exodus.clear();
1737
1738 // Now loop over each subdomain and get a unique numbering for the elements
1739 for (auto & [block_id, elem_ids_this_subdomain] : subdomain_map)
1740 {
1741 block_ids.push_back(block_id);
1742
1743 // The code below assumes this subdomain block is not empty, make sure that's the case!
1744 libmesh_error_msg_if(elem_ids_this_subdomain.size() == 0,
1745 "Error, no element IDs found in subdomain " << block_id);
1746
1747 // Use the first element in this block to get representative information.
1748 // Note that Exodus assumes all elements in a block are of the same type!
1749 // We are using that same assumption here!
1750 const auto & conv = get_conversion
1751 (pmesh.elem_ref(elem_ids_this_subdomain[0]).type());
1752 this->num_nodes_per_elem =
1753 pmesh.elem_ref(elem_ids_this_subdomain[0]).n_nodes();
1754
1755 // Get a reference to the connectivity vector for this subdomain. This vector
1756 // is most likely empty, we are going to fill it up now.
1757 std::vector<int> & current_block_connectivity = this->block_id_to_elem_connectivity[block_id];
1758
1759 // Just in case it's not already empty...
1760 current_block_connectivity.clear();
1761 current_block_connectivity.resize(elem_ids_this_subdomain.size() * this->num_nodes_per_elem);
1762
1763 for (auto i : index_range(elem_ids_this_subdomain))
1764 {
1765 auto elem_id = elem_ids_this_subdomain[i];
1766
1767 // Set the number map for elements
1768 // exodus_elem_num_to_libmesh[ exodus_node_id ] returns the
1769 // libmesh ID for that element, plus one.
1770 // Like with nodes above, we index libMesh IDs with an
1771 // offset of 1 because they're the literal numbers that get
1772 // written to the exodus file, but we index Exodus IDs with
1773 // an offset of 0 because we read that exodus data into a
1774 // C++ vector.
1775 this->exodus_elem_num_to_libmesh.push_back(elem_id+1);
1776
1777 // Likewise, given libmesh elem_id,
1778 // libmesh_elem_num_to_exodus[ elem_id ] returns the
1779 // *Exodus* ID for that node. Unlike the
1780 // exodus_elem_num_to_libmesh vector above, this one is a
1781 // std::map. We're never handing a data buffer from it over to
1782 // another API so we don't need to do any weird offsets with it.
1783 this->libmesh_elem_num_to_exodus[elem_id] =
1784 this->exodus_elem_num_to_libmesh.size();
1785
1786 const Elem & elem = pmesh.elem_ref(elem_id);
1787
1788 // Exodus/Nemesis want every block to have the same element type
1789 // libmesh_assert_equal_to (elem->type(), conv.libmesh_elem_type());
1790
1791 // But we can get away with writing e.g. HEX8 and INFHEX8 in
1792 // the same block...
1793 libmesh_assert_equal_to (elem.n_nodes(), Elem::build(conv.libmesh_elem_type(), nullptr)->n_nodes());
1794
1795 for (auto j : make_range(this->num_nodes_per_elem))
1796 {
1797 const unsigned int connect_index = (i*this->num_nodes_per_elem)+j;
1798 const unsigned int elem_node_index = conv.get_inverse_node_map(j); // inverse node map is used for writing
1799
1800 current_block_connectivity[connect_index] =
1801 libmesh_map_find(libmesh_node_num_to_exodus,
1802 elem.node_id(elem_node_index));
1803 }
1804 } // End loop over elems in this subdomain
1805 } // end loop over subdomain_map
1806}
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition elem.C:382
std::vector< int > exodus_node_num_to_libmesh
std::vector< int > exodus_elem_num_to_libmesh
std::map< dof_id_type, dof_id_type > libmesh_elem_num_to_exodus
std::map< dof_id_type, dof_id_type > libmesh_node_num_to_exodus
const ExodusII_IO_Helper::Conversion & get_conversion(const ElemType type) const
std::map< subdomain_id_type, unsigned > local_subdomain_counts
This map keeps track of the number of elements in each subdomain (block) for this processor.
std::map< subdomain_id_type, std::vector< dof_id_type > > subdomain_map
Map of subdomains to element numbers.
std::set< int > nodes_attached_to_local_elems
libMesh numbered node ids attached to local elems.
std::map< int, std::vector< int > > block_id_to_elem_connectivity
This is the block connectivity, i.e.
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153
OStreamProxy out
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn't work with exodusII at all....
Definition id_types.h:43
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176

References block_id_to_elem_connectivity, libMesh::ExodusII_IO_Helper::block_ids, libMesh::Elem::build(), libMesh::MeshBase::elem_ref(), libMesh::ExodusII_IO_Helper::exodus_elem_num_to_libmesh, libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::index_range(), libMesh::libmesh_assert(), libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus, local_subdomain_counts, libMesh::make_range(), libMesh::Elem::n_nodes(), libMesh::Elem::node_id(), nodes_attached_to_local_elems, libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ExodusII_IO_Helper::num_nodes_per_elem, libMesh::out, libMesh::ParallelObject::processor_id(), subdomain_map, libMesh::Elem::type(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ check_existing_vars()

void libMesh::ExodusII_IO_Helper::check_existing_vars ( ExodusVarType  type,
std::vector< std::string > &  names,
std::vector< std::string > &  names_from_file 
)
protectedinherited

When appending: during initialization, check that variable names in the file match those you attempt to initialize with.

Definition at line 4149 of file exodusII_io_helper.C.

4152{
4153 // There may already be global variables in the file (for example,
4154 // if we're appending) and in that case, we
4155 // 1.) Cannot initialize them again.
4156 // 2.) Should check to be sure that the global variable names are the same.
4157
4158 // Fills up names_from_file for us
4159 this->read_var_names(type);
4160
4161 // Both the number of variables and their names (up to the first
4162 // MAX_STR_LENGTH characters) must match for the names we are
4163 // planning to write and the names already in the file.
4164 bool match =
4165 std::equal(names.begin(), names.end(),
4166 names_from_file.begin(),
4167 [this](const std::string & a,
4168 const std::string & b) -> bool
4169 {
4170 return a.compare(/*pos=*/0, /*len=*/_max_name_length, b) == 0;
4171 });
4172
4173 if (!match)
4174 {
4175 libMesh::err << "Error! The Exodus file already contains the variables:" << std::endl;
4176 for (const auto & name : names_from_file)
4177 libMesh::err << name << std::endl;
4178
4179 libMesh::err << "And you asked to write:" << std::endl;
4180 for (const auto & name : names)
4181 libMesh::err << name << std::endl;
4182
4183 libmesh_error_msg("Cannot overwrite existing variables in Exodus II file.");
4184 }
4185}
void read_var_names(ExodusVarType type)
static const Real b
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
The libMesh namespace provides an interface to certain functionality in the library.
OStreamProxy err

References b, libMesh::err, and libMesh::ExodusII_IO_Helper::read_var_names().

Referenced by libMesh::ExodusII_IO_Helper::initialize_element_variables(), initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), and libMesh::ExodusII_IO_Helper::initialize_nodal_variables().

◆ close()

void libMesh::ExodusII_IO_Helper::close ( )
noexceptinherited

Closes the ExodusII mesh file.

This function is called from the ExodusII_IO destructor, so it should not throw an exception.

Definition at line 2128 of file exodusII_io_helper.C.

2129{
2130 // Call ex_close on every processor that did ex_open or ex_create;
2131 // newer Exodus versions error if we try to reopen a file that
2132 // hasn't been officially closed. Don't close the file if we didn't
2133 // open it; this also raises an Exodus error.
2134
2135 // We currently do read-only ex_open on every proc (to do read
2136 // operations on every proc), but we do ex_open and ex_create for
2137 // writes on every proc only with Nemesis files.
2139 (this->processor_id() == 0) ||
2141 {
2143 {
2144 ex_err = exII::ex_close(ex_id);
2145 // close() is called from the destructor, so it may be called e.g.
2146 // during stack unwinding while processing an exception. In that case
2147 // we don't want to throw another exception or immediately terminate
2148 // the code, since that would prevent any possible recovery from the
2149 // exception in question. So we just log the error closing the file
2150 // and continue.
2151 if (ex_err < 0)
2152 message("Error closing Exodus file.");
2153 else
2154 message("Exodus file closed successfully.");
2155 }
2156 }
2157
2158 // Now that the file is closed, it's no longer opened for
2159 // reading or writing.
2160 opened_for_writing = false;
2161 opened_for_reading = false;
2162 _opened_by_create = false;
2163}
void message(std::string_view msg)
Prints the message defined in msg.

References libMesh::ExodusII_IO_Helper::_opened_by_create, libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::opened_for_reading, libMesh::ExodusII_IO_Helper::opened_for_writing, and libMesh::ParallelObject::processor_id().

Referenced by ExodusC0PolyhedronTest::test_write_and_read_mixed_hex_tet_block_names_impl(), and ~Nemesis_IO_Helper().

◆ comm()

const Parallel::Communicator & libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 97 of file parallel_object.h.

98 { return _communicator; }
const Parallel::Communicator & _communicator

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::RBEIMEvaluation::add_interpolation_data(), libMesh::CondensedEigenSystem::add_matrices(), libMesh::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::System::add_matrix(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::BoundaryInfo::build_side_list_from_node_list(), libMesh::MeshBase::cache_elem_data(), centroid_l2_error(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshTetInterface::check_hull_integrity(), MeshInputTest::checkHexPrismPolyhedron(), libMesh::MeshBase::complete_preparation(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), compute_num_global_elem_blocks(), compute_num_global_nodesets(), compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), PetscSolverConfiguration::configure_solver(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshBase::count_constraint_rows(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::PetscMatrix< T >::create_submatrix_nosort(), create_wrapped_function(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::RBEIMEvaluation::distribute_bfs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::MeshBase::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), libMesh::RBEIMConstruction::get_random_point(), libMesh::RBEIMConstruction::get_random_point(), libMesh::MeshTetInterface::improve_hull_integrity(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::StaticCondensation::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::LocationMap< T >::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), ElasticitySystem::init_data(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::Modification::interpolate_surface(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::DofMap::n_constrained_dofs(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_per_processor(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::PetscVector< T >::operator=(), libMesh::MeshBase::operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), MeshGenerationTest::polyhedronTetNeighbor(), LaplaceSystem::postprocess(), PoissonSystem::postprocess(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::XdrIO::read(), libMesh::Nemesis_IO::read(), FEMParameters::read(), libMesh::EquationSystems::read(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), read_var_names_impl(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::BoundaryInfo::remove_edge_id(), libMesh::BoundaryInfo::remove_node_id(), libMesh::BoundaryInfo::remove_shellface_id(), libMesh::BoundaryInfo::remove_side_id(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::NoxNonlinearSolver< Number >::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshBase::sync_subdomain_name_map(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), MeshGenerationTest::testBuildCube(), BoundaryInfoTest::testBuildSideListFromNodeListThinMesh(), CheckpointIOTest::testC0PolygonCheckpoint(), VolumeTest::testC0PolygonMethods(), CheckpointIOTest::testC0PolyhedronCheckpoint(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriEdge3ToTri7CenterFixup(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectScalarCoarsening(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryMeshSubdomainTest::testSingleSubdomain(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_assembly(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

◆ compute_border_node_ids()

void libMesh::Nemesis_IO_Helper::compute_border_node_ids ( const MeshBase &  pmesh)
private

This function constructs the set of border node IDs present on the current mesh.

These are nodes which live on the "border" between elements which live on different processors.

Definition at line 1812 of file nemesis_io_helper.C.

1813{
1814 // The set which will eventually contain the IDs of "border nodes". These are nodes
1815 // that lie on the boundary between one or more processors.
1816 //std::set<unsigned> border_node_ids;
1817
1818 // map from processor ID to set of nodes which elements from this processor "touch",
1819 // that is,
1820 // proc_nodes_touched[p] = (set all node IDs found in elements owned by processor p)
1821 std::map<unsigned, std::set<unsigned>> proc_nodes_touched;
1822
1823
1824 // We are going to create a lot of intermediate data structures here, so make sure
1825 // as many as possible all cleaned up by creating scope!
1826 {
1827 // Loop over active (not just active local) elements, make sets of node IDs for each
1828 // processor which has an element that "touches" a node.
1829 for (const auto & elem : pmesh.active_element_ptr_range())
1830 {
1831 // Get reference to the set for this processor. If it does not exist
1832 // it will be created.
1833 std::set<unsigned> & set_p = proc_nodes_touched[ elem->processor_id() ];
1834
1835 // Insert all nodes touched by this element into the set
1836 for (auto node : elem->node_index_range())
1837 set_p.insert(elem->node_id(node));
1838 }
1839
1840 if (verbose)
1841 {
1842 libMesh::out << "[" << this->processor_id()
1843 << "] proc_nodes_touched contains "
1844 << proc_nodes_touched.size()
1845 << " sets of nodes."
1846 << std::endl;
1847
1848 for (const auto & [proc_id, set] : proc_nodes_touched)
1849 libMesh::out << "[" << this->processor_id()
1850 << "] proc_nodes_touched[" << proc_id << "] has "
1851 << set.size()
1852 << " entries."
1853 << std::endl;
1854 }
1855
1856
1857 // Loop over all the sets we just created and compute intersections with the
1858 // this processor's set. Obviously, don't intersect with ourself.
1860 for (auto & [proc_id, other_set] : proc_nodes_touched)
1861 {
1862 // Don't compute intersections with ourself
1863 if (proc_id == this->processor_id())
1864 continue;
1865
1866 std::set<unsigned int> this_intersection;
1867
1868 // Otherwise, compute intersection with other processor and ourself
1869 std::set<unsigned> & my_set = proc_nodes_touched[this->processor_id()];
1870
1871 std::set_intersection(my_set.begin(), my_set.end(),
1872 other_set.begin(), other_set.end(),
1873 std::inserter(this_intersection, this_intersection.end()));
1874
1875 if (!this_intersection.empty())
1877 (proc_id, std::move(this_intersection));
1878 }
1879
1880 if (verbose)
1881 {
1882 for (const auto & [proc_id, set] : proc_nodes_touched_intersections)
1883 libMesh::out << "[" << this->processor_id()
1884 << "] this->proc_nodes_touched_intersections[" << proc_id << "] has "
1885 << set.size()
1886 << " entries."
1887 << std::endl;
1888 }
1889
1890 // The number of node communication maps is the number of other processors
1891 // with which we share nodes.
1892 this->num_node_cmaps =
1893 cast_int<int>(proc_nodes_touched_intersections.size());
1894
1895 // We can't be connecting to more processors than exist outside
1896 // ourselves
1897 libmesh_assert_less (this->num_node_cmaps, this->n_processors());
1898
1899 // Compute the set_union of all the preceding intersections. This will be the set of
1900 // border node IDs for this processor.
1901 for (auto & pr : proc_nodes_touched_intersections)
1902 {
1903 std::set<unsigned> & other_set = pr.second;
1904 std::set<unsigned> intermediate_result; // Don't think we can insert into one of the sets we're unioning...
1905
1906 std::set_union(this->border_node_ids.begin(), this->border_node_ids.end(),
1907 other_set.begin(), other_set.end(),
1908 std::inserter(intermediate_result, intermediate_result.end()));
1909
1910 // Swap our intermediate result into the final set
1911 this->border_node_ids.swap(intermediate_result);
1912 }
1913
1914 libmesh_assert_less_equal
1916 std::size_t(this->num_node_cmaps));
1917
1918 if (verbose)
1919 {
1920 libMesh::out << "[" << this->processor_id()
1921 << "] border_node_ids.size()=" << this->border_node_ids.size()
1922 << std::endl;
1923 }
1924 } // end scope for border node ID creation
1925
1926 // Store the number of border node IDs to be written to Nemesis file
1927 this->num_border_nodes = cast_int<int>(this->border_node_ids.size());
1928}
std::map< unsigned, std::set< unsigned > > proc_nodes_touched_intersections
Another map to store sets of intersections with each other processor (other than ourself,...
std::set< unsigned > border_node_ids
The set which will eventually contain the IDs of "border nodes".
processor_id_type n_processors() const

References border_node_ids, libMesh::ParallelObject::n_processors(), num_border_nodes, num_node_cmaps, libMesh::out, proc_nodes_touched_intersections, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_communication_map_parameters()

void libMesh::Nemesis_IO_Helper::compute_communication_map_parameters ( )
private

This function determines the communication map parameters which will eventually be written to file.

Definition at line 1129 of file nemesis_io_helper.C.

1130{
1131 // For the nodes, these are the number of entries in the sets in proc_nodes_touched_intersections
1132 // map computed above. Note: this map does not contain self-intersections so we can loop over it
1133 // directly.
1134 this->node_cmap_node_cnts.clear(); // Make sure we don't have any leftover information...
1135 this->node_cmap_ids.clear(); // Make sure we don't have any leftover information...
1136 this->node_cmap_node_cnts.resize(this->num_node_cmaps);
1137 this->node_cmap_ids.resize(this->num_node_cmaps);
1138
1139 {
1140 unsigned cnt=0; // Index into the vector
1142 it = this->proc_nodes_touched_intersections.begin(),
1143 end = this->proc_nodes_touched_intersections.end();
1144
1145 for (; it != end; ++it)
1146 {
1147 this->node_cmap_ids[cnt] = it->first; // The ID of the proc we communicate with
1148 this->node_cmap_node_cnts[cnt] = cast_int<int>(it->second.size()); // The number of nodes we communicate
1149 cnt++; // increment vector index!
1150 }
1151 }
1152
1153 // Print the packed vectors we just filled
1154 if (verbose)
1155 {
1156 libMesh::out << "[" << this->processor_id() << "] node_cmap_node_cnts = ";
1157 for (const auto & node_cnt : node_cmap_node_cnts)
1158 libMesh::out << node_cnt << ", ";
1159 libMesh::out << std::endl;
1160
1161 libMesh::out << "[" << this->processor_id() << "] node_cmap_ids = ";
1162 for (const auto & node_id : node_cmap_ids)
1163 libMesh::out << node_id << ", ";
1164 libMesh::out << std::endl;
1165 }
1166
1167 // For the elements, we have not yet computed all this information..
1168 this->elem_cmap_elem_cnts.clear(); // Make sure we don't have any leftover information...
1169 this->elem_cmap_ids.clear(); // Make sure we don't have any leftover information...
1170 this->elem_cmap_elem_cnts.resize(this->num_elem_cmaps);
1171 this->elem_cmap_ids.resize(this->num_elem_cmaps);
1172
1173 // Pack the elem_cmap_ids and elem_cmap_elem_cnts vectors
1174 {
1175 unsigned cnt=0; // Index into the vectors we're filling
1177 it = this->proc_border_elem_sets.begin(),
1178 end = this->proc_border_elem_sets.end();
1179
1180 for (; it != end; ++it)
1181 {
1182 this->elem_cmap_ids[cnt] = it->first; // The ID of the proc we communicate with
1183 this->elem_cmap_elem_cnts[cnt] = cast_int<int>(it->second.size()); // The number of elems we communicate to/from that proc
1184 cnt++; // increment vector index!
1185 }
1186 }
1187
1188 // Print the packed vectors we just filled
1189 if (verbose)
1190 {
1191 libMesh::out << "[" << this->processor_id() << "] elem_cmap_elem_cnts = ";
1192 for (const auto & elem_cnt : elem_cmap_elem_cnts)
1193 libMesh::out << elem_cnt << ", ";
1194 libMesh::out << std::endl;
1195
1196 libMesh::out << "[" << this->processor_id() << "] elem_cmap_ids = ";
1197 for (const auto & elem_id : elem_cmap_ids)
1198 libMesh::out << elem_id << ", ";
1199 libMesh::out << std::endl;
1200 }
1201}
std::vector< int > elem_cmap_elem_cnts
std::map< unsigned, std::set< unsigned > >::iterator proc_nodes_touched_iterator
Typedef for an iterator into the data structure above.
std::vector< int > node_cmap_node_cnts
std::vector< int > node_cmap_ids
Vectors for storing the communication map parameters.
std::vector< int > elem_cmap_ids
std::map< unsigned, std::set< std::pair< unsigned, unsigned > > >::iterator proc_border_elem_sets_iterator
Typedef for an iterator into the data structure above.
std::map< unsigned, std::set< std::pair< unsigned, unsigned > > > proc_border_elem_sets
Map between processor ID and (element,side) pairs bordering that processor ID.

References elem_cmap_elem_cnts, elem_cmap_ids, node_cmap_ids, node_cmap_node_cnts, num_elem_cmaps, num_node_cmaps, libMesh::out, proc_border_elem_sets, proc_nodes_touched_intersections, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_elem_communication_maps()

void libMesh::Nemesis_IO_Helper::compute_elem_communication_maps ( )
private

This function computes element communication maps (really just packs vectors) in preparation for writing them to file.

Definition at line 977 of file nemesis_io_helper.C.

978{
979 // Make sure there is no leftover information
980 this->elem_cmap_elem_ids.clear();
981 this->elem_cmap_side_ids.clear();
982 this->elem_cmap_proc_ids.clear();
983
984 // Allocate enough space for all our element maps
985 this->elem_cmap_elem_ids.resize(this->num_elem_cmaps);
986 this->elem_cmap_side_ids.resize(this->num_elem_cmaps);
987 this->elem_cmap_proc_ids.resize(this->num_elem_cmaps);
988 {
989 unsigned cnt=0; // Index into vectors
991 it = this->proc_border_elem_sets.begin(),
992 end = this->proc_border_elem_sets.end();
993
994 for (; it != end; ++it)
995 {
996 // Make sure the current elem_cmap_id matches the index in our map of node intersections
997 libmesh_assert_equal_to (static_cast<unsigned>(this->elem_cmap_ids[cnt]), it->first);
998
999 // Get reference to the set of IDs to be packed into the vector
1000 std::set<std::pair<unsigned,unsigned>> & elem_set = it->second;
1001
1002 // Resize the vectors to receive their payload
1003 this->elem_cmap_elem_ids[cnt].resize(elem_set.size());
1004 this->elem_cmap_side_ids[cnt].resize(elem_set.size());
1005 this->elem_cmap_proc_ids[cnt].resize(elem_set.size());
1006
1007 std::set<std::pair<unsigned,unsigned>>::iterator elem_set_iter = elem_set.begin();
1008
1009 // Pack the vectors with elem IDs, side IDs, and processor IDs.
1010 for (std::size_t j=0, eceis=this->elem_cmap_elem_ids[cnt].size(); j<eceis; ++j, ++elem_set_iter)
1011 {
1012 this->elem_cmap_elem_ids[cnt][j] =
1013 libmesh_map_find(libmesh_elem_num_to_exodus, elem_set_iter->first);
1014 this->elem_cmap_side_ids[cnt][j] = elem_set_iter->second; // Side ID, this has already been converted above
1015 this->elem_cmap_proc_ids[cnt][j] = it->first; // All have the same processor ID
1016 }
1017
1018 // increment vector index to go to next processor
1019 cnt++;
1020 }
1021 } // end scope for packing
1022}
std::vector< std::vector< int > > elem_cmap_proc_ids
std::vector< std::vector< int > > elem_cmap_elem_ids
3 vectors of vectors for storing element communication IDs for this processor.
std::vector< std::vector< int > > elem_cmap_side_ids

References elem_cmap_elem_ids, elem_cmap_ids, elem_cmap_proc_ids, elem_cmap_side_ids, libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, num_elem_cmaps, and proc_border_elem_sets.

Referenced by initialize().

◆ compute_element_maps()

void libMesh::Nemesis_IO_Helper::compute_element_maps ( )
private

This function computes element maps (really just packs vectors) which map the elements to internal and border elements.

Definition at line 952 of file nemesis_io_helper.C.

953{
954 // Make sure we don't have any leftover info
955 this->elem_mapi.clear();
956 this->elem_mapb.clear();
957
958 // Copy set contents into vectors
959 this->elem_mapi.resize(this->internal_elem_ids.size());
960 this->elem_mapb.resize(this->border_elem_ids.size());
961
962 {
963 unsigned cnt = 0;
964 for (const auto & id : this->internal_elem_ids)
965 this->elem_mapi[cnt++] = libmesh_map_find(libmesh_elem_num_to_exodus, id);
966 }
967
968 {
969 unsigned cnt = 0;
970 for (const auto & id : this->border_elem_ids)
971 this->elem_mapb[cnt++] = libmesh_map_find(libmesh_elem_num_to_exodus, id);
972 }
973}
std::set< unsigned > internal_elem_ids
A set of internal elem IDs for this processor.
std::vector< int > elem_mapb
Vector which stores border element IDs.
std::set< unsigned > border_elem_ids
A set of border elem IDs for this processor.
std::vector< int > elem_mapi
Vector which stores internal element IDs.

References border_elem_ids, elem_mapb, elem_mapi, internal_elem_ids, and libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus.

Referenced by initialize().

◆ compute_internal_and_border_elems_and_internal_nodes()

void libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes ( const MeshBase &  pmesh)
private

This function constructs the set of border and internal element IDs and internal node IDs present on the current mesh.

Definition at line 1207 of file nemesis_io_helper.C.

1208{
1209 // Set of all local, active element IDs. After we have identified border element
1210 // IDs, the set_difference between this set and the border_elem_ids set will give us
1211 // the set of internal_elem_ids.
1212 std::set<unsigned> all_elem_ids;
1213
1214 // A set of processor IDs which elements on this processor have as
1215 // neighbors. The size of this set will determine the number of
1216 // element communication maps in Exodus.
1217 std::set<unsigned> neighboring_processor_ids;
1218
1219 for (const auto & elem : pmesh.active_local_element_ptr_range())
1220 {
1221 // Add this Elem's ID to all_elem_ids, later we will take the difference
1222 // between this set and the set of border_elem_ids, to get the set of
1223 // internal_elem_ids.
1224 all_elem_ids.insert(elem->id());
1225
1226 // Will be set to true if element is determined to be a border element
1227 bool is_border_elem = false;
1228
1229 // Construct a conversion object for this Element. This will help us map
1230 // Libmesh numberings into Nemesis numberings for sides.
1231 const auto & conv = get_conversion(elem->type());
1232
1233 // Add all this element's node IDs to the set of all node IDs.
1234 // The set of internal_node_ids will be the set difference between
1235 // the set of all nodes and the set of border nodes.
1236 //
1237 // In addition, if any node of a local node is listed in the
1238 // border nodes list, then this element goes into the proc_border_elem_sets.
1239 // Note that there is not a 1:1 correspondence between
1240 // border_elem_ids and the entries which go into proc_border_elem_sets.
1241 // The latter is for communication purposes, ie determining which elements
1242 // should be shared between processors.
1243 for (auto node : elem->node_index_range())
1244 this->nodes_attached_to_local_elems.insert(elem->node_id(node));
1245
1246 // Loop over element's neighbors, see if it has a neighbor which is off-processor
1247 for (auto n : elem->side_index_range())
1248 {
1249 if (elem->neighbor_ptr(n) != nullptr)
1250 {
1251 unsigned neighbor_proc_id = elem->neighbor_ptr(n)->processor_id();
1252
1253 // If my neighbor has a different processor ID, I must be a border element.
1254 // Also track the neighboring processor ID if it is are different from our processor ID
1255 if (neighbor_proc_id != this->processor_id())
1256 {
1257 is_border_elem = true;
1258 neighboring_processor_ids.insert(neighbor_proc_id);
1259
1260 // Convert libmesh side(n) of this element into a side ID for Nemesis
1261 unsigned nemesis_side_id = conv.get_inverse_side_map(n);
1262
1263 if (verbose)
1264 libMesh::out << "[" << this->processor_id() << "] LibMesh side "
1265 << n
1266 << " mapped to (1-based) Exodus side "
1267 << nemesis_side_id
1268 << std::endl;
1269
1270 // Add this element's ID and the ID of the side which is on the boundary
1271 // to the set of border elements for this processor.
1272 // Note: if the set does not already exist, this creates it.
1273 this->proc_border_elem_sets[ neighbor_proc_id ].emplace(elem->id(), nemesis_side_id);
1274 }
1275 }
1276 } // end for loop over neighbors
1277
1278 // If we're on a border element, add it to the set
1279 if (is_border_elem)
1280 this->border_elem_ids.insert( elem->id() );
1281
1282 } // end for loop over active local elements
1283
1284 // Take the set_difference between all elements and border elements to get internal
1285 // element IDs
1286 std::set_difference(all_elem_ids.begin(), all_elem_ids.end(),
1287 this->border_elem_ids.begin(), this->border_elem_ids.end(),
1288 std::inserter(this->internal_elem_ids, this->internal_elem_ids.end()));
1289
1290 // Take the set_difference between all nodes and border nodes to get internal nodes
1291 std::set_difference(this->nodes_attached_to_local_elems.begin(), this->nodes_attached_to_local_elems.end(),
1292 this->border_node_ids.begin(), this->border_node_ids.end(),
1293 std::inserter(this->internal_node_ids, this->internal_node_ids.end()));
1294
1295 if (verbose)
1296 {
1297 libMesh::out << "[" << this->processor_id() << "] neighboring_processor_ids = ";
1298 for (const auto & id : neighboring_processor_ids)
1299 libMesh::out << id << " ";
1300 libMesh::out << std::endl;
1301 }
1302
1303 // The size of the neighboring_processor_ids set should be the number of element communication maps
1304 this->num_elem_cmaps =
1305 cast_int<int>(neighboring_processor_ids.size());
1306
1307 if (verbose)
1308 libMesh::out << "[" << this->processor_id() << "] "
1309 << "Number of neighboring processor IDs="
1310 << this->num_elem_cmaps
1311 << std::endl;
1312
1313 if (verbose)
1314 {
1315 // Print out counts of border elements for each processor
1316 for (const auto & [proc_id, set] : proc_border_elem_sets)
1317 {
1318 libMesh::out << "[" << this->processor_id() << "] "
1319 << "Proc "
1320 << proc_id << " communicates "
1321 << set.size() << " elements." << std::endl;
1322 }
1323 }
1324
1325 // Store the number of internal and border elements, and the number of internal nodes,
1326 // to be written to the Nemesis file.
1327 this->num_internal_elems =
1328 cast_int<int>(this->internal_elem_ids.size());
1329 this->num_border_elems =
1330 cast_int<int>(this->border_elem_ids.size());
1331 this->num_internal_nodes =
1332 cast_int<int>(this->internal_node_ids.size());
1333
1334 if (verbose)
1335 {
1336 libMesh::out << "[" << this->processor_id() << "] num_internal_nodes=" << this->num_internal_nodes << std::endl;
1337 libMesh::out << "[" << this->processor_id() << "] num_border_nodes=" << this->num_border_nodes << std::endl;
1338 libMesh::out << "[" << this->processor_id() << "] num_border_elems=" << this->num_border_elems << std::endl;
1339 libMesh::out << "[" << this->processor_id() << "] num_internal_elems=" << this->num_internal_elems << std::endl;
1340 }
1341}
std::set< unsigned > internal_node_ids
A set of internal node IDs for this processor.

References border_elem_ids, libMesh::ExodusII_IO_Helper::get_conversion(), internal_elem_ids, internal_node_ids, nodes_attached_to_local_elems, num_border_elems, num_border_nodes, num_elem_cmaps, num_internal_elems, num_internal_nodes, libMesh::out, proc_border_elem_sets, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_node_communication_maps()

void libMesh::Nemesis_IO_Helper::compute_node_communication_maps ( )
private

Compute the node communication maps (really just pack vectors) in preparation for writing them to file.

Definition at line 1057 of file nemesis_io_helper.C.

1058{
1059 // Make sure there's no left-over information
1060 this->node_cmap_node_ids.clear();
1061 this->node_cmap_proc_ids.clear();
1062
1063 libmesh_assert_less_equal
1065 std::size_t(this->num_node_cmaps));
1066
1067 // Allocate enough space for all our node maps
1068 this->node_cmap_node_ids.resize(this->num_node_cmaps);
1069 this->node_cmap_proc_ids.resize(this->num_node_cmaps);
1070 {
1071 unsigned cnt=0; // Index into vectors
1073 it = this->proc_nodes_touched_intersections.begin(),
1074 end = this->proc_nodes_touched_intersections.end();
1075
1076 for (; it != end; ++it)
1077 {
1078 // Make sure the current node_cmap_id matches the index in our map of node intersections
1079 libmesh_assert_equal_to (static_cast<unsigned>(this->node_cmap_ids[cnt]), it->first);
1080
1081 // Get reference to the set of IDs to be packed into the vector.
1082 std::set<unsigned> & node_set = it->second;
1083
1084 // Resize the vectors to receive their payload
1085 this->node_cmap_node_ids[cnt].resize(node_set.size());
1086 this->node_cmap_proc_ids[cnt].resize(node_set.size());
1087
1088 std::set<unsigned>::iterator node_set_iter = node_set.begin();
1089
1090 // Pack the vectors with node IDs and processor IDs.
1091 for (std::size_t j=0, nceis=this->node_cmap_node_ids[cnt].size(); j<nceis; ++j, ++node_set_iter)
1092 {
1093 this->node_cmap_node_ids[cnt][j] =
1094 libmesh_map_find(libmesh_node_num_to_exodus, *node_set_iter);
1095 this->node_cmap_proc_ids[cnt][j] = it->first;
1096 }
1097
1098 // increment vector index to go to next processor
1099 cnt++;
1100 }
1101 } // end scope for packing
1102
1103 // Print out the vectors we just packed
1104 if (verbose)
1105 {
1106 for (auto i : index_range(this->node_cmap_node_ids))
1107 {
1108 libMesh::out << "[" << this->processor_id() << "] nodes communicated to proc "
1109 << this->node_cmap_ids[i]
1110 << " = ";
1111 for (const auto & node_id : this->node_cmap_node_ids[i])
1112 libMesh::out << node_id << " ";
1113 libMesh::out << std::endl;
1114 }
1115
1116 for (const auto & id_vec : this->node_cmap_node_ids)
1117 {
1118 libMesh::out << "[" << this->processor_id() << "] processor ID node communicated to = ";
1119 for (const auto & proc_id : id_vec)
1120 libMesh::out << proc_id << " ";
1121 libMesh::out << std::endl;
1122 }
1123 }
1124}
std::vector< std::vector< int > > node_cmap_proc_ids
std::vector< std::vector< int > > node_cmap_node_ids
2 vectors of vectors for storing the node communication IDs for this processor.
std::unordered_set< const Node * > & node_set

References libMesh::index_range(), libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus, node_cmap_ids, node_cmap_node_ids, node_cmap_proc_ids, node_set, num_node_cmaps, libMesh::out, proc_nodes_touched_intersections, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_node_maps()

void libMesh::Nemesis_IO_Helper::compute_node_maps ( )
private

Compute the node maps (really just pack vectors) which map the nodes to internal, border, and external nodes in the file.

Definition at line 1028 of file nemesis_io_helper.C.

1029{
1030 // Make sure we don't have any leftover information
1031 this->node_mapi.clear();
1032 this->node_mapb.clear();
1033 this->node_mape.clear();
1034
1035 // Make sure there's enough space to hold all our node IDs
1036 this->node_mapi.resize(this->internal_node_ids.size());
1037 this->node_mapb.resize(this->border_node_ids.size());
1038
1039 // Copy set contents into vectors
1040 {
1041 unsigned cnt = 0;
1042 for (const auto & id : this->internal_node_ids)
1043 this->node_mapi[cnt++] = libmesh_map_find(libmesh_node_num_to_exodus, id);
1044 }
1045
1046 {
1047 unsigned cnt=0;
1048 for (const auto & id : this->border_node_ids)
1049 this->node_mapb[cnt++] = libmesh_map_find(libmesh_node_num_to_exodus, id);
1050 }
1051}
std::vector< int > node_mape
Vector which stores external node IDs.
std::vector< int > node_mapb
Vector which stores border node IDs.
std::vector< int > node_mapi
Vector which stores internal node IDs.

References border_node_ids, internal_node_ids, libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus, node_mapb, node_mape, and node_mapi.

Referenced by initialize().

◆ compute_num_global_elem_blocks()

void libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks ( const MeshBase &  pmesh)

This function uses global communication routines to determine the number of element blocks across the entire mesh.

Definition at line 1549 of file nemesis_io_helper.C.

1550{
1551 // 1.) Loop over active local elements, build up set of subdomain IDs.
1552 std::set<subdomain_id_type> global_subdomain_ids;
1553
1554 // This map keeps track of the number of elements in each subdomain over all processors
1555 std::map<subdomain_id_type, unsigned> global_subdomain_counts;
1556
1557 for (const auto & elem : pmesh.active_local_element_ptr_range())
1558 {
1559 subdomain_id_type cur_subdomain = elem->subdomain_id();
1560
1561 /*
1562 // We can't have a zero subdomain ID in Exodus (for some reason?)
1563 // so map zero subdomains to a max value...
1564 if (cur_subdomain == 0)
1565 cur_subdomain = std::numeric_limits<subdomain_id_type>::max();
1566 */
1567
1568 global_subdomain_ids.insert(cur_subdomain);
1569
1570 // Increment the count of elements in this subdomain
1571 global_subdomain_counts[cur_subdomain]++;
1572 }
1573
1574 // We're next going to this->comm().sum the subdomain counts, so save the local counts
1575 this->local_subdomain_counts = global_subdomain_counts;
1576
1577 {
1578 // 2.) Copy local subdomain IDs into a vector for communication
1579 std::vector<subdomain_id_type> global_subdomain_ids_vector(global_subdomain_ids.begin(),
1580 global_subdomain_ids.end());
1581
1582 // 3.) Gather them into an enlarged vector
1583 this->comm().allgather(global_subdomain_ids_vector);
1584
1585 // 4.) Insert any new IDs into the set (any duplicates will be dropped)
1586 global_subdomain_ids.insert(global_subdomain_ids_vector.begin(),
1587 global_subdomain_ids_vector.end());
1588 }
1589
1590 // 5.) Now global_subdomain_ids actually contains a global list of all subdomain IDs
1591 this->num_elem_blks_global =
1592 cast_int<int>(global_subdomain_ids.size());
1593
1594 // Print the number of elements found locally in each subdomain
1595 if (verbose)
1596 {
1597 libMesh::out << "[" << this->processor_id() << "] ";
1598 for (const auto & [subdomain_id, cnt] : global_subdomain_counts)
1599 {
1600 libMesh::out << "ID: "
1601 << static_cast<unsigned>(subdomain_id)
1602 << ", Count: " << cnt << ", ";
1603 }
1604 libMesh::out << std::endl;
1605 }
1606
1607 // 6.) this->comm().sum up the number of elements in each block. We know the global
1608 // subdomain IDs, so pack them into a vector one by one. Use a vector of int since
1609 // that is what Nemesis wants
1610 this->global_elem_blk_cnts.resize(global_subdomain_ids.size());
1611
1612 unsigned cnt=0;
1613 // Find the entry in the local map, note: if not found, will be created with 0 default value, which is OK...
1614 for (const auto & id : global_subdomain_ids)
1615 this->global_elem_blk_cnts[cnt++] = global_subdomain_counts[id];
1616
1617 // Sum up subdomain counts from all processors
1618 this->comm().sum(this->global_elem_blk_cnts);
1619
1620 if (verbose)
1621 {
1622 libMesh::out << "[" << this->processor_id() << "] global_elem_blk_cnts = ";
1623 for (const auto & bc : this->global_elem_blk_cnts)
1624 libMesh::out << bc << ", ";
1625 libMesh::out << std::endl;
1626 }
1627
1628 // 7.) Create a vector<int> from the global_subdomain_ids set, for passing to Nemesis
1629 this->global_elem_blk_ids.clear();
1630 this->global_elem_blk_ids.insert(this->global_elem_blk_ids.end(), // pos
1631 global_subdomain_ids.begin(),
1632 global_subdomain_ids.end());
1633
1634 if (verbose)
1635 {
1636 libMesh::out << "[" << this->processor_id() << "] global_elem_blk_ids = ";
1637 for (const auto & id : this->global_elem_blk_ids)
1638 libMesh::out << id << ", ";
1639 libMesh::out << std::endl;
1640 }
1641
1642
1643 // 8.) We will call put_eb_info_global later, it must be called after this->put_init_global().
1644}
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
std::vector< int > global_elem_blk_cnts
std::vector< int > global_elem_blk_ids
Read the global element block IDs and counts.
const Parallel::Communicator & comm() const

References libMesh::Parallel::Communicator::allgather(), libMesh::ParallelObject::comm(), global_elem_blk_cnts, global_elem_blk_ids, local_subdomain_counts, num_elem_blks_global, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::sum(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_num_global_nodesets()

void libMesh::Nemesis_IO_Helper::compute_num_global_nodesets ( const MeshBase &  pmesh)
private

This function uses global communication routines to determine the number of nodesets across the entire mesh.

Definition at line 1438 of file nemesis_io_helper.C.

1439{
1440 std::set<boundary_id_type> local_node_boundary_ids;
1441
1442 // 1.) Get reference to the set of node boundary IDs *for this processor*
1443 std::set<boundary_id_type> global_node_boundary_ids
1444 (pmesh.get_boundary_info().get_node_boundary_ids().begin(),
1445 pmesh.get_boundary_info().get_node_boundary_ids().end());
1446
1447 // Save a copy of the local_node_boundary_ids...
1448 local_node_boundary_ids = global_node_boundary_ids;
1449
1450 // 2.) Gather boundary node IDs from other processors
1451 this->comm().set_union(global_node_boundary_ids);
1452
1453 // 3.) Now global_node_boundary_ids actually contains a global list of all node boundary IDs
1454 this->num_node_sets_global =
1455 cast_int<int>(global_node_boundary_ids.size());
1456
1457 // 4.) Create a vector<int> from the global_node_boundary_ids set
1458 this->global_nodeset_ids.clear();
1459 this->global_nodeset_ids.insert(this->global_nodeset_ids.end(),
1460 global_node_boundary_ids.begin(),
1461 global_node_boundary_ids.end());
1462
1463 if (verbose)
1464 {
1465 libMesh::out << "[" << this->processor_id() << "] global_nodeset_ids = ";
1466 for (const auto & id : global_nodeset_ids)
1467 libMesh::out << id << ", ";
1468 libMesh::out << std::endl;
1469
1470 libMesh::out << "[" << this->processor_id() << "] local_node_boundary_ids = ";
1471 for (const auto & id : local_node_boundary_ids)
1472 libMesh::out << id << ", ";
1473 libMesh::out << std::endl;
1474 }
1475
1476 // 7.) We also need to know the number of nodes which is in each of the nodesets, globally.
1477
1478 // Build list of (node-id, bc-id) tuples.
1479 typedef std::tuple<dof_id_type, boundary_id_type> Tuple;
1480 std::vector<Tuple> bc_tuples = pmesh.get_boundary_info().build_node_list();
1481
1482 if (verbose)
1483 {
1484 libMesh::out << "[" << this->processor_id() << "] boundary_node_list.size()="
1485 << bc_tuples.size() << std::endl;
1486 libMesh::out << "[" << this->processor_id() << "] (boundary_node_id, boundary_id) = ";
1487 for (const auto & t : bc_tuples)
1488 libMesh::out << "(" << std::get<0>(t) << ", " << std::get<1>(t) << ") ";
1489 libMesh::out << std::endl;
1490 }
1491
1492 // Now get the global information. In this case, we only want to count boundary
1493 // information for nodes *owned* by this processor, so there are no duplicates.
1494
1495 // Make sure we don't have any left over information
1496 this->num_global_node_counts.clear();
1497 this->num_global_node_counts.resize(this->global_nodeset_ids.size());
1498
1499 // Unfortunately, we can't just count up all occurrences of a given id,
1500 // that would give us duplicate entries when we do the parallel summation.
1501 // So instead, only count entries for nodes owned by this processor.
1502 // Start by getting rid of all non-local node entries from the vectors.
1503 std::vector<Tuple>::iterator
1504 it = bc_tuples.begin(),
1505 new_end = bc_tuples.end();
1506
1507 while (it != new_end)
1508 {
1509 if (pmesh.node_ptr(std::get<0>(*it))->processor_id() != this->processor_id())
1510 {
1511 // Back up the new end iterators to prepare for swap
1512 --new_end;
1513
1514 // Swap places, the non-local node will now be "past-the-end"
1515 std::swap(*it, *new_end);
1516 }
1517 else // node is local, go to next
1518 ++it;
1519 }
1520
1521 // Erase from "new" end to old end.
1522 bc_tuples.erase(new_end, bc_tuples.end());
1523
1524 // Now we can do the local count for each ID...
1525 for (auto i : index_range(global_nodeset_ids))
1526 {
1527 int id = this->global_nodeset_ids[i];
1528 this->num_global_node_counts[i] =
1529 cast_int<int>(std::count_if(bc_tuples.begin(),
1530 bc_tuples.end(),
1531 [id](const Tuple & t)->bool { return std::get<1>(t) == id; }));
1532 }
1533
1534 // And finally we can sum them up
1535 this->comm().sum(this->num_global_node_counts);
1536
1537 if (verbose)
1538 {
1539 libMesh::out << "[" << this->processor_id() << "] num_global_node_counts = ";
1540 for (const auto & cnt : num_global_node_counts)
1541 libMesh::out << cnt << ", ";
1542 libMesh::out << std::endl;
1543 }
1544}
void set_union(T &data, const unsigned int root_id) const
std::vector< int > global_nodeset_ids
Containers for reading global nodeset information.
std::vector< int > num_global_node_counts
const Elem & get(const ElemType type_in)

References libMesh::BoundaryInfo::build_node_list(), libMesh::ParallelObject::comm(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::get_node_boundary_ids(), global_nodeset_ids, libMesh::index_range(), libMesh::MeshBase::node_ptr(), num_global_node_counts, num_node_sets_global, libMesh::out, libMesh::DofObject::processor_id(), libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::set_union(), libMesh::Parallel::Communicator::sum(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ compute_num_global_sidesets()

void libMesh::Nemesis_IO_Helper::compute_num_global_sidesets ( const MeshBase &  pmesh)
private

This function uses global communication routines to determine the number of sidesets across the entire mesh.

Definition at line 1345 of file nemesis_io_helper.C.

1346{
1347 // 1.) Get reference to the set of side boundary IDs
1348 std::set<boundary_id_type> global_side_boundary_ids
1349 (pmesh.get_boundary_info().get_side_boundary_ids().begin(),
1350 pmesh.get_boundary_info().get_side_boundary_ids().end());
1351
1352 // 2.) Gather boundary side IDs from other processors
1353 this->comm().set_union(global_side_boundary_ids);
1354
1355 // 3.) Now global_side_boundary_ids actually contains a global list of all side boundary IDs
1356 this->num_side_sets_global =
1357 cast_int<int>(global_side_boundary_ids.size());
1358
1359 // 4.) Pack these sidesets into a vector so they can be written by Nemesis
1360 this->global_sideset_ids.clear(); // Make sure there is no leftover information
1361 this->global_sideset_ids.insert(this->global_sideset_ids.end(),
1362 global_side_boundary_ids.begin(),
1363 global_side_boundary_ids.end());
1364
1365 if (verbose)
1366 {
1367 libMesh::out << "[" << this->processor_id() << "] global_sideset_ids = ";
1368 for (const auto & id : this->global_sideset_ids)
1369 libMesh::out << id << ", ";
1370 libMesh::out << std::endl;
1371 }
1372
1373 // We also need global counts of sides in each of the sidesets.
1374 // Build a list of (elem, side, bc) tuples.
1375 typedef std::tuple<dof_id_type, unsigned short int, boundary_id_type> Tuple;
1376 std::vector<Tuple> bc_triples = pmesh.get_boundary_info().build_side_list();
1377
1378 // Iterators to the beginning and end of the current range.
1379 std::vector<Tuple>::iterator
1380 it = bc_triples.begin(),
1381 new_end = bc_triples.end();
1382
1383 while (it != new_end)
1384 {
1385 if (pmesh.elem_ref(std::get<0>(*it)).processor_id() != this->processor_id())
1386 {
1387 // Back up the new end iterators to prepare for swap
1388 --new_end;
1389
1390 // Swap places, the non-local elem will now be "past-the-end"
1391 std::swap (*it, *new_end);
1392 }
1393 else // elem is local, go to next
1394 ++it;
1395 }
1396
1397 // Erase from "new" end to old.
1398 bc_triples.erase(new_end, bc_triples.end());
1399
1400 this->num_global_side_counts.clear(); // Make sure we don't have any leftover information
1401 this->num_global_side_counts.resize(this->global_sideset_ids.size());
1402
1403 // Get the count for each global sideset ID
1404 for (auto i : index_range(global_sideset_ids))
1405 {
1406 int id = global_sideset_ids[i];
1407 this->num_global_side_counts[i] =
1408 cast_int<int>(std::count_if(bc_triples.begin(),
1409 bc_triples.end(),
1410 [id](const Tuple & t)->bool { return std::get<2>(t) == id; }));
1411 }
1412
1413 if (verbose)
1414 {
1415 libMesh::out << "[" << this->processor_id() << "] num_global_side_counts = ";
1416 for (const auto & cnt : this->num_global_side_counts)
1417 libMesh::out << cnt << ", ";
1418 libMesh::out << std::endl;
1419 }
1420
1421 // Finally sum up the result
1422 this->comm().sum(this->num_global_side_counts);
1423
1424 if (verbose)
1425 {
1426 libMesh::out << "[" << this->processor_id() << "] num_global_side_counts = ";
1427 for (const auto & cnt : this->num_global_side_counts)
1428 libMesh::out << cnt << ", ";
1429 libMesh::out << std::endl;
1430 }
1431}
std::vector< int > num_global_side_counts
std::vector< int > global_sideset_ids
Containers for reading global sideset (boundary conditions) information.

References libMesh::BoundaryInfo::build_side_list(), libMesh::ParallelObject::comm(), libMesh::MeshBase::elem_ref(), libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::get_side_boundary_ids(), global_sideset_ids, libMesh::index_range(), num_global_side_counts, num_side_sets_global, libMesh::out, libMesh::DofObject::processor_id(), libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::set_union(), libMesh::Parallel::Communicator::sum(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ conditionally_set_elem_unique_id()

void libMesh::ExodusII_IO_Helper::conditionally_set_elem_unique_id ( MeshBase &  mesh,
Elem *  elem,
int  zero_based_elem_num_map_index 
)
inherited

Definition at line 2557 of file exodusII_io_helper.C.

2559{
2560 this->set_dof_object_unique_id(mesh, elem, libmesh_vector_at(this->elem_num_map, zero_based_elem_num_map_index));
2561}
void set_dof_object_unique_id(MeshBase &mesh, DofObject *dof_object, int exodus_mapped_id)

References libMesh::ExodusII_IO_Helper::elem_num_map, and libMesh::ExodusII_IO_Helper::set_dof_object_unique_id().

◆ conditionally_set_node_unique_id()

void libMesh::ExodusII_IO_Helper::conditionally_set_node_unique_id ( MeshBase &  mesh,
Node *  node,
int  zero_based_node_num_map_index 
)
inherited

Helper function that conditionally sets the unique_id of the passed-in Node/Elem.

Calling this function does nothing if _set_unique_ids_from_maps == false, otherwise it sets the unique_id based on the entries of the {node,elem_num_map}. The input index is assumed to be a zero-based index into the {node,elem}_num_map array.

Definition at line 2550 of file exodusII_io_helper.C.

2552{
2553 this->set_dof_object_unique_id(mesh, node, libmesh_vector_at(this->node_num_map, zero_based_node_num_map_index));
2554}

References libMesh::ExodusII_IO_Helper::node_num_map, and libMesh::ExodusII_IO_Helper::set_dof_object_unique_id().

◆ construct_nemesis_filename()

std::string libMesh::Nemesis_IO_Helper::construct_nemesis_filename ( std::string_view  base_filename)

Given base_filename, foo.e, constructs the Nemesis filename foo.e.X.Y, where X=n.

CPUs and Y=processor ID

Definition at line 2896 of file nemesis_io_helper.C.

2897{
2898 // Build a filename for this processor. This code is cut-n-pasted from the read function
2899 // and should probably be put into a separate function...
2900 std::ostringstream file_oss;
2901
2902 // We have to be a little careful here: Nemesis left pads its file
2903 // numbers based on the number of processors, so for example on 10
2904 // processors, we'd have:
2905 // mesh.e.10.00
2906 // mesh.e.10.01
2907 // mesh.e.10.02
2908 // ...
2909 // mesh.e.10.09
2910
2911 // And on 100 you'd have:
2912 // mesh.e.100.000
2913 // mesh.e.100.001
2914 // ...
2915 // mesh.e.128.099
2916
2917 // Find the length of the highest processor ID
2918 file_oss << (this->n_processors());
2919 unsigned int field_width = cast_int<unsigned int>(file_oss.str().size());
2920
2921 if (verbose)
2922 libMesh::out << "field_width=" << field_width << std::endl;
2923
2924 file_oss.str(""); // reset the string stream
2925 file_oss << base_filename
2926 << '.' << this->n_processors()
2927 << '.' << std::setfill('0') << std::setw(field_width) << this->processor_id();
2928
2929 // Return the resulting string
2930 return file_oss.str();
2931}

References libMesh::ParallelObject::n_processors(), libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ create()

void libMesh::ExodusII_IO_Helper::create ( std::string  filename)
virtualinherited

Opens an ExodusII mesh file named filename for writing.

Definition at line 2601 of file exodusII_io_helper.C.

2602{
2603 // If we're processor 0, always create the file.
2604 // If we running on all procs, e.g. as one of several Nemesis files, also
2605 // call create there.
2606 if ((this->processor_id() == 0) || (!_run_only_on_proc0))
2607 {
2608 int
2609 comp_ws = 0,
2610 io_ws = 0;
2611
2613 {
2614 comp_ws = cast_int<int>(sizeof(float));
2615 io_ws = cast_int<int>(sizeof(float));
2616 }
2617 // Fall back on double precision when necessary since ExodusII
2618 // doesn't seem to support long double
2619 else
2620 {
2621 comp_ws = cast_int<int>
2622 (std::min(sizeof(Real), sizeof(double)));
2623 io_ws = cast_int<int>
2624 (std::min(sizeof(Real), sizeof(double)));
2625 }
2626
2627 // By default we just open the Exodus file in "EX_CLOBBER" mode,
2628 // which, according to "ncdump -k", writes the file in "64-bit
2629 // offset" mode, which is a NETCDF3 file format.
2630 int mode = EX_CLOBBER;
2631
2632 // If HDF5 is available, by default we will write Exodus files
2633 // in a more modern NETCDF4-compatible format. For this file
2634 // type, "ncdump -k" will report "netCDF-4".
2635#ifdef LIBMESH_HAVE_HDF5
2636 if (this->_write_hdf5)
2637 {
2638 mode |= EX_NETCDF4;
2639 mode |= EX_NOCLASSIC;
2640 }
2641#endif
2642
2643 {
2644 FPEDisabler disable_fpes;
2645 ex_id = exII::ex_create(filename.c_str(), mode, &comp_ws, &io_ws);
2646 }
2647
2648 EX_CHECK_ERR(ex_id, "Error creating ExodusII/Nemesis mesh file.");
2649
2650 // We don't have access to the names we might be writing until we
2651 // write them, so we can't set a guaranteed max name length here.
2652 // But it looks like the most ExodusII can support is 80, so we'll
2653 // just waste 48 bytes here and there.
2654 ex_err = exII::ex_set_max_name_length(ex_id, _max_name_length);
2655 EX_CHECK_ERR(ex_err, "Error setting max ExodusII name length.");
2656
2657 if (verbose)
2658 libMesh::out << "File created successfully." << std::endl;
2659 }
2660
2661 opened_for_writing = true;
2662 _opened_by_create = true;
2663 current_filename = filename;
2664}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The FPEDisabler class puts Floating-Point Exception (FPE) trapping on hold during its lifetime,...

References libMesh::ExodusII_IO_Helper::_max_name_length, libMesh::ExodusII_IO_Helper::_opened_by_create, libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::_write_hdf5, libMesh::ExodusII_IO_Helper::current_filename, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::opened_for_writing, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::Real, and libMesh::ExodusII_IO_Helper::verbose.

Referenced by ExodusC0PolyhedronTest::test_write_and_read_mixed_hex_tet_block_names_impl().

◆ end_elem_id()

int libMesh::ExodusII_IO_Helper::end_elem_id ( ) const
inlineinherited

◆ get_add_sides()

bool libMesh::ExodusII_IO_Helper::get_add_sides ( )
inlineinherited

Definition at line 1368 of file exodusII_io_helper.h.

1369{
1370 return _add_sides;
1371}
bool _add_sides
Set to true iff we want to write separate "side" elements too.

References libMesh::ExodusII_IO_Helper::_add_sides.

◆ get_block_id()

int libMesh::ExodusII_IO_Helper::get_block_id ( int  index)
inherited

Get the block number for the given block index.

Definition at line 1237 of file exodusII_io_helper.C.

1238{
1239 libmesh_assert_less (index, block_ids.size());
1240
1241 return block_ids[index];
1242}

References libMesh::ExodusII_IO_Helper::block_ids.

Referenced by libMesh::ExodusII_IO_Helper::write_element_values(), and libMesh::ExodusII_IO_Helper::write_element_values_element_major().

◆ get_block_name()

std::string libMesh::ExodusII_IO_Helper::get_block_name ( int  index)
inherited

Get the block name for the given block index if supplied in the mesh file.

Otherwise an empty string is returned.

Definition at line 1246 of file exodusII_io_helper.C.

1247{
1248 libmesh_assert_less (index, block_ids.size());
1249
1250 return id_to_block_names[block_ids[index]];
1251}
std::map< int, std::string > id_to_block_names

References libMesh::ExodusII_IO_Helper::block_ids, and libMesh::ExodusII_IO_Helper::id_to_block_names.

◆ get_cmap_params()

void libMesh::Nemesis_IO_Helper::get_cmap_params ( )

Definition at line 388 of file nemesis_io_helper.C.

389{
394
396 Nemesis::ne_get_cmap_params(ex_id,
397 node_cmap_ids.empty() ? nullptr : node_cmap_ids.data(),
398 node_cmap_node_cnts.empty() ? nullptr : node_cmap_node_cnts.data(),
399 elem_cmap_ids.empty() ? nullptr : elem_cmap_ids.data(),
400 elem_cmap_elem_cnts.empty() ? nullptr : elem_cmap_elem_cnts.data(),
401 this->processor_id());
402 EX_CHECK_ERR(nemesis_err_flag, "Error reading cmap parameters!");
403
404
405 if (verbose)
406 {
407 libMesh::out << "[" << this->processor_id() << "] ";
408 for (auto i : index_range(node_cmap_ids))
409 libMesh::out << "node_cmap_ids[" << i << "]=" << node_cmap_ids[i] << " ";
410 libMesh::out << std::endl;
411
412 libMesh::out << "[" << this->processor_id() << "] ";
413 for (auto i : index_range(node_cmap_node_cnts))
414 libMesh::out << "node_cmap_node_cnts[" << i << "]=" << node_cmap_node_cnts[i] << " ";
415 libMesh::out << std::endl;
416
417 libMesh::out << "[" << this->processor_id() << "] ";
418 for (auto i : index_range(elem_cmap_ids))
419 libMesh::out << "elem_cmap_ids[" << i << "]=" << elem_cmap_ids[i] << " ";
420 libMesh::out << std::endl;
421
422 libMesh::out << "[" << this->processor_id() << "] ";
423 for (auto i : index_range(elem_cmap_elem_cnts))
424 libMesh::out << "elem_cmap_elem_cnts[" << i << "]=" << elem_cmap_elem_cnts[i] << " ";
425 libMesh::out << std::endl;
426 }
427}

References elem_cmap_elem_cnts, elem_cmap_ids, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), nemesis_err_flag, node_cmap_ids, node_cmap_node_cnts, num_elem_cmaps, num_node_cmaps, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_complex_names()

std::vector< std::string > libMesh::ExodusII_IO_Helper::get_complex_names ( const std::vector< std::string > &  names,
bool  write_complex_abs 
) const
inherited
Returns
A vector with three copies of each element in the provided name vector, starting with r_, i_ and a_ respectively. If the "write_complex_abs" parameter is true (default), the complex modulus is written, otherwise only the real and imaginary parts are written.

Definition at line 5506 of file exodusII_io_helper.C.

5508{
5509 std::vector<std::string> complex_names;
5510
5511 // This will loop over all names and create new "complex" names
5512 // (i.e. names that start with r_, i_ or a_)
5513 for (const auto & name : names)
5514 {
5515 complex_names.push_back("r_" + name);
5516 complex_names.push_back("i_" + name);
5517 if (write_complex_abs)
5518 complex_names.push_back("a_" + name);
5519 }
5520
5521 return complex_names;
5522}

◆ get_complex_subdomain_to_var_names()

std::map< subdomain_id_type, std::vector< std::string > > libMesh::ExodusII_IO_Helper::get_complex_subdomain_to_var_names ( const std::map< subdomain_id_type, std::vector< std::string > > &  subdomain_to_var_names,
bool  write_complex_abs 
) const
inherited

Takes a map from subdomain id -> vector of active variable names as input and returns a corresponding map where the original variable names have been replaced by their complex counterparts.

Used by the ExodusII_IO::write_element_data_from_discontinuous_nodal_data() function.

Definition at line 5550 of file exodusII_io_helper.C.

5554{
5555 // Eventual return value
5556 std::map<subdomain_id_type, std::vector<std::string>> ret;
5557
5558 unsigned int num_complex_outputs = write_complex_abs ? 3 : 2;
5559
5560 for (const auto & pr : subdomain_to_var_names)
5561 {
5562 // Initialize entry for current subdomain
5563 auto & vec = ret[pr.first];
5564
5565 // Get list of non-complex variable names active on this subdomain.
5566 const auto & varnames = pr.second;
5567
5568 // Allocate space for the complex-valued entries
5569 vec.reserve(num_complex_outputs * varnames.size());
5570
5571 // For each varname in the input map, write three variable names
5572 // to the output formed by prepending "r_", "i_", and "a_",
5573 // respectively.
5574 for (const auto & varname : varnames)
5575 {
5576 vec.push_back("r_" + varname);
5577 vec.push_back("i_" + varname);
5578 if (write_complex_abs)
5579 vec.push_back("a_" + varname);
5580 }
5581 }
5582 return ret;
5583}

◆ get_complex_vars_active_subdomains()

std::vector< std::set< subdomain_id_type > > libMesh::ExodusII_IO_Helper::get_complex_vars_active_subdomains ( const std::vector< std::set< subdomain_id_type > > &  vars_active_subdomains,
bool  write_complex_abs 
) const
inherited

returns a "tripled" copy of vars_active_subdomains, which is necessary in the complex-valued case.

Definition at line 5527 of file exodusII_io_helper.C.

5531{
5532 std::vector<std::set<subdomain_id_type>> complex_vars_active_subdomains;
5533
5534 for (auto & s : vars_active_subdomains)
5535 {
5536 // Push back the same data enough times for the real, imag, (and
5537 // possibly modulus) for the complex-valued solution.
5538 complex_vars_active_subdomains.push_back(s);
5539 complex_vars_active_subdomains.push_back(s);
5540 if (write_complex_abs)
5541 complex_vars_active_subdomains.push_back(s);
5542 }
5543
5544 return complex_vars_active_subdomains;
5545}

◆ get_conversion() [1/2]

const ExodusII_IO_Helper::Conversion & libMesh::ExodusII_IO_Helper::get_conversion ( const ElemType  type) const
inherited

◆ get_conversion() [2/2]

const ExodusII_IO_Helper::Conversion & libMesh::ExodusII_IO_Helper::get_conversion ( std::string  type_str) const
inherited

Definition at line 667 of file exodusII_io_helper.C.

668{
669 // Do only upper-case comparisons
670 std::transform(type_str.begin(), type_str.end(), type_str.begin(), ::toupper);
671 return get_conversion (libmesh_map_find(element_equivalence_map, type_str));
672}
std::map< std::string, ElemType > element_equivalence_map
Defines equivalence classes of Exodus element types that map to libmesh ElemTypes.

References libMesh::ExodusII_IO_Helper::element_equivalence_map, and libMesh::ExodusII_IO_Helper::get_conversion().

◆ get_eb_info_global()

void libMesh::Nemesis_IO_Helper::get_eb_info_global ( )

Definition at line 242 of file nemesis_io_helper.C.

243{
246
247 if (num_elem_blks_global > 0)
248 {
250 Nemesis::ne_get_eb_info_global(ex_id,
251 global_elem_blk_ids.data(),
252 global_elem_blk_cnts.data());
253 EX_CHECK_ERR(nemesis_err_flag, "Error reading global element block info!");
254 }
255
256 if (verbose)
257 {
258 libMesh::out << "[" << this->processor_id() << "] " << "Global Element Block IDs and Counts:" << std::endl;
259 for (auto bn : index_range(global_elem_blk_ids))
260 {
261 libMesh::out << " [" << this->processor_id() << "] "
262 << "global_elem_blk_ids[" << bn << "]=" << global_elem_blk_ids[bn]
263 << ", global_elem_blk_cnts[" << bn << "]=" << global_elem_blk_cnts[bn]
264 << std::endl;
265 }
266 }
267}

References libMesh::ExodusII_IO_Helper::ex_id, global_elem_blk_cnts, global_elem_blk_ids, libMesh::index_range(), nemesis_err_flag, num_elem_blks_global, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_elem_cmap()

void libMesh::Nemesis_IO_Helper::get_elem_cmap ( )

Definition at line 473 of file nemesis_io_helper.C.

474{
478
479 for (auto i : index_range(elem_cmap_elem_ids))
480 {
484
485 if (elem_cmap_elem_cnts[i] > 0)
486 {
488 Nemesis::ne_get_elem_cmap(ex_id,
489 elem_cmap_ids[i],
490 elem_cmap_elem_ids[i].data(),
491 elem_cmap_side_ids[i].data(),
492 elem_cmap_proc_ids[i].data(),
493 this->processor_id());
494 EX_CHECK_ERR(nemesis_err_flag, "Error reading elem cmap elem, side, and processor ids!");
495 }
496
497 if (verbose)
498 {
499 libMesh::out << "[" << this->processor_id() << "] elem_cmap_elem_ids[" << i << "]=";
500 for (const auto & dof : elem_cmap_elem_ids[i])
501 libMesh::out << dof << " ";
502 libMesh::out << std::endl;
503
504 // These must be the (local) side IDs (in the ExodusII face numbering scheme)
505 // of the sides shared across processors.
506 libMesh::out << "[" << this->processor_id() << "] elem_cmap_side_ids[" << i << "]=";
507 for (const auto & dof : elem_cmap_side_ids[i])
508 libMesh::out << dof << " ";
509 libMesh::out << std::endl;
510
511 // This is basically a vector, all entries of which are = elem_cmap_ids[i]
512 // Not sure if it's always guaranteed to be that or what...
513 libMesh::out << "[" << this->processor_id() << "] elem_cmap_proc_ids[" << i << "]=";
514 for (const auto & dof : elem_cmap_proc_ids[i])
515 libMesh::out << dof << " ";
516 libMesh::out << std::endl;
517 }
518 }
519}

References elem_cmap_elem_cnts, elem_cmap_elem_ids, elem_cmap_ids, elem_cmap_proc_ids, elem_cmap_side_ids, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), nemesis_err_flag, num_elem_cmaps, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_elem_map()

void libMesh::Nemesis_IO_Helper::get_elem_map ( )

Definition at line 320 of file nemesis_io_helper.C.

321{
324
326 Nemesis::ne_get_elem_map(ex_id,
327 elem_mapi.empty() ? nullptr : elem_mapi.data(),
328 elem_mapb.empty() ? nullptr : elem_mapb.data(),
329 this->processor_id()
330 );
331 EX_CHECK_ERR(nemesis_err_flag, "Error reading element maps!");
332
333
334 if (verbose)
335 {
336 libMesh::out << "[" << this->processor_id() << "] elem_mapi[i] = ";
337 for (auto i : make_range(num_internal_elems-1))
338 libMesh::out << elem_mapi[i] << ", ";
339 libMesh::out << "... " << elem_mapi.back() << std::endl;
340
341 libMesh::out << "[" << this->processor_id() << "] elem_mapb[i] = ";
342 for (auto i : make_range(std::min(10, num_border_elems-1)))
343 libMesh::out << elem_mapb[i] << ", ";
344 libMesh::out << "... " << elem_mapb.back() << std::endl;
345 }
346}

References elem_mapb, elem_mapi, libMesh::ExodusII_IO_Helper::ex_id, libMesh::make_range(), nemesis_err_flag, num_border_elems, num_internal_elems, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_elem_type()

const char * libMesh::ExodusII_IO_Helper::get_elem_type ( ) const
inherited
Returns
The current element type.
Note
The default behavior is for this value to be in all capital letters, e.g. HEX27.

Definition at line 674 of file exodusII_io_helper.C.

675{
676 return elem_type.data();
677}

References libMesh::ExodusII_IO_Helper::elem_type.

◆ get_elemset_data_indices()

void libMesh::ExodusII_IO_Helper::get_elemset_data_indices ( std::map< std::pair< dof_id_type, elemset_id_type >, unsigned int > &  elemset_array_indices)
inherited

Similar to read_elemset_data(), but instead of creating one std::map per elemset per variable, creates a single map of (elem_id, elemset_id) tuples, and stores the exo file array indexing for any/all elemset variables on that elemset (they are all the same).

Definition at line 4937 of file exodusII_io_helper.C.

4939{
4940 // Clear existing data, we are going to build these data structures from scratch
4941 elemset_array_indices.clear();
4942
4943 // Read the elemset data.
4944 //
4945 // Note: we assume that the functions
4946 // 1.) this->read_elemset_info() and
4947 // 2.) this->read_elemset()
4948 // have already been called, so that we already know e.g. how
4949 // many elems are in each set, their ids, etc.
4950 int offset=0;
4951 for (int es=0; es<num_elem_sets; ++es)
4952 {
4953 offset += (es > 0 ? num_elems_per_set[es-1] : 0);
4954
4955 // Note: we don't actually call exII::ex_get_var() here because
4956 // we don't need the values. We only need the indices into that vector
4957 // for each (elem_id, elemset_id) tuple.
4958 for (int i=0; i<num_elems_per_set[es]; ++i)
4959 {
4960 dof_id_type exodus_elem_id = elemset_list[i + offset];
4961
4962 // FIXME: We should use exodus_elem_num_to_libmesh for this,
4963 // but it apparently is never set up, so just
4964 // subtract 1 from the Exodus elem id.
4965 dof_id_type converted_elem_id = exodus_elem_id - 1;
4966
4967 // Make key based on the elem and set ids
4968 // Make a NodeBCTuple key from the converted information.
4969 auto key = std::make_pair(converted_elem_id,
4970 static_cast<elemset_id_type>(elemset_ids[es]));
4971
4972 // Store the array index of this (node, b_id) tuple
4973 elemset_array_indices.emplace(key, cast_int<unsigned int>(i));
4974 } // end for (i)
4975 } // end for (es)
4976}
std::vector< int > num_elems_per_set

References libMesh::ExodusII_IO_Helper::elemset_ids, libMesh::ExodusII_IO_Helper::elemset_list, libMesh::ExodusII_IO_Helper::num_elem_sets, and libMesh::ExodusII_IO_Helper::num_elems_per_set.

◆ get_exodus_version()

int libMesh::ExodusII_IO_Helper::get_exodus_version ( )
staticinherited
Returns
The ExodusII API version, in "nodot" format; e.g. 822 for 8.22

Definition at line 420 of file exodusII_io_helper.C.

421{
422 return EX_API_VERS_NODOT;
423}

Referenced by libMesh::ExodusII_IO::get_exodus_version().

◆ get_init_global()

void libMesh::Nemesis_IO_Helper::get_init_global ( )

Fills: num_nodes_global, num_elems_global, num_elem_blks_global, num_node_sets_global, num_side_sets_global Call after: read_and_store_header_info() Call before: Any other get_* function from this class.

Definition at line 151 of file nemesis_io_helper.C.

152{
154 Nemesis::ne_get_init_global(ex_id,
160 EX_CHECK_ERR(nemesis_err_flag, "Error reading initial global data!");
161
162 if (verbose)
163 {
164 libMesh::out << "[" << this->processor_id() << "] " << "num_nodes_global=" << num_nodes_global << std::endl;
165 libMesh::out << "[" << this->processor_id() << "] " << "num_elems_global=" << num_elems_global << std::endl;
166 libMesh::out << "[" << this->processor_id() << "] " << "num_elem_blks_global=" << num_elem_blks_global << std::endl;
167 libMesh::out << "[" << this->processor_id() << "] " << "num_node_sets_global=" << num_node_sets_global << std::endl;
168 libMesh::out << "[" << this->processor_id() << "] " << "num_side_sets_global=" << num_side_sets_global << std::endl;
169 }
170}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, num_elem_blks_global, num_elems_global, num_node_sets_global, num_nodes_global, num_side_sets_global, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_init_info()

void libMesh::Nemesis_IO_Helper::get_init_info ( )

Definition at line 271 of file nemesis_io_helper.C.

272{
274 Nemesis::ne_get_init_info(ex_id,
275 &num_proc,
277 &ftype);
278 EX_CHECK_ERR(nemesis_err_flag, "Error reading initial info!");
279
280 if (verbose)
281 {
282 libMesh::out << "[" << this->processor_id() << "] " << "num_proc=" << num_proc << std::endl;
283 libMesh::out << "[" << this->processor_id() << "] " << "num_proc_in_file=" << num_proc_in_file << std::endl;
284 libMesh::out << "[" << this->processor_id() << "] " << "ftype=" << ftype << std::endl;
285 }
286}

References libMesh::ExodusII_IO_Helper::ex_id, ftype, nemesis_err_flag, num_proc, num_proc_in_file, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_libmesh_elem_id()

dof_id_type libMesh::ExodusII_IO_Helper::get_libmesh_elem_id ( int  exodus_elem_id)
inherited

Definition at line 2511 of file exodusII_io_helper.C.

2512{
2513 return this->get_libmesh_id(exodus_elem_id, this->elem_num_map);
2514}
dof_id_type get_libmesh_id(int exodus_id, const std::vector< int > &num_map)
Internal implementation for the two sets of functions above.

References libMesh::ExodusII_IO_Helper::elem_num_map, and libMesh::ExodusII_IO_Helper::get_libmesh_id().

Referenced by libMesh::ExodusII_IO_Helper::read_elemental_var_values().

◆ get_libmesh_id()

dof_id_type libMesh::ExodusII_IO_Helper::get_libmesh_id ( int  exodus_id,
const std::vector< int > &  num_map 
)
privateinherited

Internal implementation for the two sets of functions above.

Definition at line 2517 of file exodusII_io_helper.C.

2519{
2520 // The input exodus_id is assumed to be a (1-based) index into
2521 // the {node,elem}_num_map, so in order to use exodus_id as an index
2522 // in C++, we need to first make it zero-based.
2523 auto exodus_id_zero_based =
2524 cast_int<dof_id_type>(exodus_id - 1);
2525
2526 // Throw an informative error message rather than accessing past the
2527 // end of the provided num_map. If we are setting Elem unique_ids
2528 // based on the num_map, we don't need to do this check.
2529 if (!this->set_unique_ids_from_maps)
2530 libmesh_error_msg_if(exodus_id_zero_based >= num_map.size(),
2531 "Cannot get LibMesh id for Exodus id: " << exodus_id);
2532
2533 // If the user set the flag which stores Exodus node/elem ids as
2534 // unique_ids instead of regular ids, then the libmesh id we are
2535 // looking for is actually just "exodus_id_zero_based". Otherwise,
2536 // we need to look up the Node/Elem's id in the provided num_map,
2537 // *and* then subtract 1 from that because the entries in the
2538 // num_map are also 1-based.
2539 dof_id_type libmesh_id =
2541 cast_int<dof_id_type>(exodus_id_zero_based) :
2542 cast_int<dof_id_type>(num_map[exodus_id_zero_based] - 1);
2543
2544 return libmesh_id;
2545}
Tnew cast_int(Told oldvar)

References libMesh::ExodusII_IO_Helper::set_unique_ids_from_maps.

Referenced by libMesh::ExodusII_IO_Helper::get_libmesh_elem_id(), and libMesh::ExodusII_IO_Helper::get_libmesh_node_id().

◆ get_libmesh_node_id()

dof_id_type libMesh::ExodusII_IO_Helper::get_libmesh_node_id ( int  exodus_node_id)
inherited

Helper function that takes a (1-based) Exodus node/elem id and determines the corresponding libMesh Node/Elem id.

Takes into account whether the user has chosen to set the Node/Elem unique ids based on the {node,elem}_num_map or to let libMesh set them.

Definition at line 2506 of file exodusII_io_helper.C.

2507{
2508 return this->get_libmesh_id(exodus_node_id, this->node_num_map);
2509}

References libMesh::ExodusII_IO_Helper::get_libmesh_id(), and libMesh::ExodusII_IO_Helper::node_num_map.

Referenced by libMesh::ExodusII_IO_Helper::read_edge_blocks(), and libMesh::ExodusII_IO_Helper::read_nodal_var_values().

◆ get_loadbal_param()

void libMesh::Nemesis_IO_Helper::get_loadbal_param ( )

Definition at line 290 of file nemesis_io_helper.C.

291{
293 Nemesis::ne_get_loadbal_param(ex_id,
301 this->processor_id() // The ID of the processor for which info is to be read
302 );
303 EX_CHECK_ERR(nemesis_err_flag, "Error reading load balance parameters!");
304
305
306 if (verbose)
307 {
308 libMesh::out << "[" << this->processor_id() << "] " << "num_internal_nodes=" << num_internal_nodes << std::endl;
309 libMesh::out << "[" << this->processor_id() << "] " << "num_border_nodes=" << num_border_nodes << std::endl;
310 libMesh::out << "[" << this->processor_id() << "] " << "num_external_nodes=" << num_external_nodes << std::endl;
311 libMesh::out << "[" << this->processor_id() << "] " << "num_internal_elems=" << num_internal_elems << std::endl;
312 libMesh::out << "[" << this->processor_id() << "] " << "num_border_elems=" << num_border_elems << std::endl;
313 libMesh::out << "[" << this->processor_id() << "] " << "num_node_cmaps=" << num_node_cmaps << std::endl;
314 libMesh::out << "[" << this->processor_id() << "] " << "num_elem_cmaps=" << num_elem_cmaps << std::endl;
315 }
316}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, num_border_elems, num_border_nodes, num_elem_cmaps, num_external_nodes, num_internal_elems, num_internal_nodes, num_node_cmaps, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_node_cmap()

void libMesh::Nemesis_IO_Helper::get_node_cmap ( )

Definition at line 431 of file nemesis_io_helper.C.

432{
435
436 for (auto i : index_range(node_cmap_node_ids))
437 {
440
441 // Don't call ne_get_node_cmap() if there is nothing there to
442 // get, Nemesis throws an error in this case.
443 if (node_cmap_node_cnts[i] > 0)
444 {
446 Nemesis::ne_get_node_cmap(ex_id,
447 node_cmap_ids[i],
448 node_cmap_node_ids[i].data(),
449 node_cmap_proc_ids[i].data(),
450 this->processor_id());
451 EX_CHECK_ERR(nemesis_err_flag, "Error reading node cmap node and processor ids!");
452 }
453
454 if (verbose)
455 {
456 libMesh::out << "[" << this->processor_id() << "] node_cmap_node_ids[" << i << "]=";
457 for (const auto & dof : node_cmap_node_ids[i])
458 libMesh::out << dof << " ";
459 libMesh::out << std::endl;
460
461 // This is basically a vector, all entries of which are = node_cmap_ids[i]
462 // Not sure if it's always guaranteed to be that or what...
463 libMesh::out << "[" << this->processor_id() << "] node_cmap_proc_ids[" << i << "]=";
464 for (const auto & dof : node_cmap_proc_ids[i])
465 libMesh::out << dof << " ";
466 libMesh::out << std::endl;
467 }
468 }
469}

References libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), nemesis_err_flag, node_cmap_ids, node_cmap_node_cnts, node_cmap_node_ids, node_cmap_proc_ids, num_node_cmaps, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_node_map()

void libMesh::Nemesis_IO_Helper::get_node_map ( )

Definition at line 351 of file nemesis_io_helper.C.

352{
356
358 Nemesis::ne_get_node_map(ex_id,
359 node_mapi.empty() ? nullptr : node_mapi.data(),
360 node_mapb.empty() ? nullptr : node_mapb.data(),
361 node_mape.empty() ? nullptr : node_mape.data(),
362 this->processor_id()
363 );
364 EX_CHECK_ERR(nemesis_err_flag, "Error reading node maps!");
365
366 if (verbose)
367 {
368 // Remark: The Exodus/Nemesis node numbering is always (?) 1-based! This means the first interior node id will
369 // always be == 1.
370 libMesh::out << "[" << this->processor_id() << "] " << "first interior node id=" << node_mapi[0] << std::endl;
371 libMesh::out << "[" << this->processor_id() << "] " << "last interior node id=" << node_mapi.back() << std::endl;
372
373 libMesh::out << "[" << this->processor_id() << "] " << "first boundary node id=" << node_mapb[0] << std::endl;
374 libMesh::out << "[" << this->processor_id() << "] " << "last boundary node id=" << node_mapb.back() << std::endl;
375
376 // The number of external nodes is sometimes zero, don't try to access
377 // node_mape.back() in this case!
378 if (num_external_nodes > 0)
379 {
380 libMesh::out << "[" << this->processor_id() << "] " << "first external node id=" << node_mape[0] << std::endl;
381 libMesh::out << "[" << this->processor_id() << "] " << "last external node id=" << node_mape.back() << std::endl;
382 }
383 }
384}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, node_mapb, node_mape, node_mapi, num_border_nodes, num_external_nodes, num_internal_nodes, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_node_set_id()

int libMesh::ExodusII_IO_Helper::get_node_set_id ( int  index)
inherited

Get the node set id for the given node set index.

Definition at line 1273 of file exodusII_io_helper.C.

1274{
1275 libmesh_assert_less (index, nodeset_ids.size());
1276
1277 return nodeset_ids[index];
1278}

References libMesh::ExodusII_IO_Helper::nodeset_ids.

◆ get_node_set_name()

std::string libMesh::ExodusII_IO_Helper::get_node_set_name ( int  index)
inherited

Get the node set name for the given node set index if supplied in the mesh file.

Otherwise an empty string is returned.

Definition at line 1282 of file exodusII_io_helper.C.

1283{
1284 libmesh_assert_less (index, nodeset_ids.size());
1285
1286 return id_to_ns_names[nodeset_ids[index]];
1287}
std::map< int, std::string > id_to_ns_names

References libMesh::ExodusII_IO_Helper::id_to_ns_names, and libMesh::ExodusII_IO_Helper::nodeset_ids.

◆ get_nodeset_data_indices()

void libMesh::ExodusII_IO_Helper::get_nodeset_data_indices ( std::map< BoundaryInfo::NodeBCTuple, unsigned int > &  bc_array_indices)
inherited

Similar to read_nodeset_data(), but instead of creating one std::map per nodeset per variable, creates a single map of (node_id, boundary_id) tuples, and stores the exo file array indexing for any/all nodeset variables on that nodeset (they are all the same).

Definition at line 5079 of file exodusII_io_helper.C.

5081{
5082 // Clear existing data, we are going to build these data structures from scratch
5083 bc_array_indices.clear();
5084
5085 // Read the nodeset data.
5086 //
5087 // Note: we assume that the functions
5088 // 1.) this->read_nodeset_info() and
5089 // 2.) this->read_all_nodesets()
5090 // have already been called, so that we already know e.g. how
5091 // many nodes are in each set, their ids, etc.
5092 int offset=0;
5093 for (int ns=0; ns<num_node_sets; ++ns)
5094 {
5095 offset += (ns > 0 ? num_nodes_per_set[ns-1] : 0);
5096 // Note: we don't actually call exII::ex_get_var() here because
5097 // we don't need the values. We only need the indices into that vector
5098 // for each (node_id, boundary_id) tuple.
5099 for (int i=0; i<num_nodes_per_set[ns]; ++i)
5100 {
5101 // The read_all_nodesets() function now reads all the node ids into the
5102 // node_sets_node_list vector, which is of length "total_nodes_in_all_sets"
5103 // The old read_nodset() function is no longer called as far as I can tell,
5104 // and should probably be removed? The "offset" that we are using only
5105 // depends on the current nodeset index and the num_nodes_per_set vector,
5106 // which gets filled in by the call to read_all_nodesets().
5107 dof_id_type exodus_node_id = node_sets_node_list[i + offset];
5108
5109 // FIXME: We should use exodus_node_num_to_libmesh for this,
5110 // but it apparently is never set up, so just
5111 // subtract 1 from the Exodus node id.
5112 dof_id_type converted_node_id = exodus_node_id - 1;
5113
5114 // Make a NodeBCTuple key from the converted information.
5115 BoundaryInfo::NodeBCTuple key = std::make_tuple
5116 (converted_node_id, nodeset_ids[ns]);
5117
5118 // Store the array index of this (node, b_id) tuple
5119 bc_array_indices.emplace(key, cast_int<unsigned int>(i));
5120 } // end for (i)
5121 } // end for (ns)
5122}
std::tuple< dof_id_type, boundary_id_type > NodeBCTuple
Create a list of (node_id, boundary_id) tuples for all relevant nodes.
std::vector< int > num_nodes_per_set
std::vector< int > node_sets_node_list

References libMesh::ExodusII_IO_Helper::node_sets_node_list, libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::num_node_sets, and libMesh::ExodusII_IO_Helper::num_nodes_per_set.

◆ get_ns_param_global()

void libMesh::Nemesis_IO_Helper::get_ns_param_global ( )

Definition at line 210 of file nemesis_io_helper.C.

211{
212 if (num_node_sets_global > 0)
213 {
217
219 Nemesis::ne_get_ns_param_global(ex_id,
220 global_nodeset_ids.data(),
223 EX_CHECK_ERR(nemesis_err_flag, "Error reading global nodeset parameters!");
224
225 if (verbose)
226 {
227 libMesh::out << "[" << this->processor_id() << "] " << "Global Nodeset IDs, Node Counts, and DF counts:" << std::endl;
228 for (auto bn : index_range(global_nodeset_ids))
229 {
230 libMesh::out << " [" << this->processor_id() << "] "
231 << "global_nodeset_ids["<<bn<<"]=" << global_nodeset_ids[bn]
232 << ", num_global_node_counts["<<bn<<"]=" << num_global_node_counts[bn]
233 << ", num_global_node_df_counts["<<bn<<"]=" << num_global_node_df_counts[bn]
234 << std::endl;
235 }
236 }
237 }
238}
std::vector< int > num_global_node_df_counts

References libMesh::ExodusII_IO_Helper::ex_id, global_nodeset_ids, libMesh::index_range(), nemesis_err_flag, num_global_node_counts, num_global_node_df_counts, num_node_sets_global, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ get_side_set_id()

int libMesh::ExodusII_IO_Helper::get_side_set_id ( int  index)
inherited

Get the side set id for the given side set index.

Definition at line 1255 of file exodusII_io_helper.C.

1256{
1257 libmesh_assert_less (index, ss_ids.size());
1258
1259 return ss_ids[index];
1260}

References libMesh::ExodusII_IO_Helper::ss_ids.

◆ get_side_set_name()

std::string libMesh::ExodusII_IO_Helper::get_side_set_name ( int  index)
inherited

Get the side set name for the given side set index if supplied in the mesh file.

Otherwise an empty string is returned.

Definition at line 1264 of file exodusII_io_helper.C.

1265{
1266 libmesh_assert_less (index, ss_ids.size());
1267
1268 return id_to_ss_names[ss_ids[index]];
1269}
std::map< int, std::string > id_to_ss_names

References libMesh::ExodusII_IO_Helper::id_to_ss_names, and libMesh::ExodusII_IO_Helper::ss_ids.

◆ get_sideset_data_indices()

void libMesh::ExodusII_IO_Helper::get_sideset_data_indices ( const MeshBase &  mesh,
std::map< BoundaryInfo::BCTuple, unsigned int > &  bc_array_indices 
)
inherited

Similar to read_sideset_data(), but instead of creating one std::map per sideset per variable, creates a single map of (elem, side, boundary_id) tuples, and stores the exo file array indexing for any/all sideset variables on that sideset (they are all the same).

This function does not actually call exII::ex_get_sset_var() to get values, and can be useful if only the original ordering of (elem, side) pairs in the exo file is required in cases where a separate approach is used to read the sideset data arrays.

Definition at line 4552 of file exodusII_io_helper.C.

4555{
4556 // Clear any existing data, we are going to build this data structure from scratch
4557 bc_array_indices.clear();
4558
4559 // Store the sideset data array indices.
4560 //
4561 // Note: we assume that read_sideset() has already been called
4562 // for each sideset, so the required values in elem_list and
4563 // side_list are already present.
4564 int offset=0;
4565 for (int ss=0; ss<num_side_sets; ++ss)
4566 {
4567 offset += (ss > 0 ? num_sides_per_set[ss-1] : 0);
4568 for (int i=0; i<num_sides_per_set[ss]; ++i)
4569 {
4570 dof_id_type exodus_elem_id = elem_list[i + offset];
4571 unsigned int exodus_side_id = side_list[i + offset];
4572
4573 // FIXME: We should use exodus_elem_num_to_libmesh for this,
4574 // but it apparently is never set up, so just
4575 // subtract 1 from the Exodus elem id.
4576 dof_id_type converted_elem_id = exodus_elem_id - 1;
4577
4578 // Conversion operator for this Elem type
4579 const auto & conv = get_conversion(mesh.elem_ptr(converted_elem_id)->type());
4580
4581 // Map from Exodus side id to libmesh side id.
4582 // Note: the mapping is defined on 0-based indices, so subtract
4583 // 1 before doing the mapping.
4584 unsigned int converted_side_id = conv.get_side_map(exodus_side_id - 1);
4585
4586 // Make a BCTuple key from the converted information.
4587 BoundaryInfo::BCTuple key = std::make_tuple
4588 (converted_elem_id,
4589 converted_side_id,
4590 ss_ids[ss]);
4591
4592 // Store (elem, side, b_id) tuple with corresponding array index
4593 bc_array_indices.emplace(key, cast_int<unsigned int>(i));
4594 } // end for (i)
4595 } // end for (ss)
4596}
std::tuple< dof_id_type, unsigned short int, boundary_id_type > BCTuple
Create a list of (element_id, side_id, boundary_id) tuples for relevant sides.
virtual ElemType type() const =0
std::vector< int > num_sides_per_set
virtual const Elem * elem_ptr(const dof_id_type i) const =0
MeshBase & mesh

References libMesh::ExodusII_IO_Helper::elem_list, libMesh::MeshBase::elem_ptr(), libMesh::ExodusII_IO_Helper::get_conversion(), mesh, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::ExodusII_IO_Helper::num_sides_per_set, libMesh::ExodusII_IO_Helper::side_list, libMesh::ExodusII_IO_Helper::ss_ids, and libMesh::Elem::type().

◆ get_ss_param_global()

void libMesh::Nemesis_IO_Helper::get_ss_param_global ( )

Fills: global_sideset_ids, num_global_side_counts, num_global_side_df_counts Call after: get_init_global()

Definition at line 174 of file nemesis_io_helper.C.

175{
176 if (num_side_sets_global > 0)
177 {
180
181 // df = "distribution factor", not really sure what that is. I don't yet have a file
182 // which has distribution factors so I guess we'll worry about it later...
184
186 Nemesis::ne_get_ss_param_global(ex_id,
187 global_sideset_ids.data(),
190 EX_CHECK_ERR(nemesis_err_flag, "Error reading global sideset parameters!");
191
192 if (verbose)
193 {
194 libMesh::out << "[" << this->processor_id() << "] " << "Global Sideset IDs, Side Counts, and DF counts:" << std::endl;
195 for (auto bn : index_range(global_sideset_ids))
196 {
197 libMesh::out << " [" << this->processor_id() << "] "
198 << "global_sideset_ids["<<bn<<"]=" << global_sideset_ids[bn]
199 << ", num_global_side_counts["<<bn<<"]=" << num_global_side_counts[bn]
200 << ", num_global_side_df_counts["<<bn<<"]=" << num_global_side_df_counts[bn]
201 << std::endl;
202 }
203 }
204 }
205}
std::vector< int > num_global_side_df_counts

References libMesh::ExodusII_IO_Helper::ex_id, global_sideset_ids, libMesh::index_range(), nemesis_err_flag, num_global_side_counts, num_global_side_df_counts, num_side_sets_global, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ init_conversion_map()

void libMesh::ExodusII_IO_Helper::init_conversion_map ( )
privateinherited

Definition at line 428 of file exodusII_io_helper.C.

429{
430 auto convert_type = [this](ElemType type,
431 std::string_view exodus_type,
432 const std::vector<int> * node_map = nullptr,
433 const std::vector<int> * inverse_node_map = nullptr,
434 const std::vector<int> * side_map = nullptr,
435 const std::vector<int> * inverse_side_map = nullptr,
436 const std::vector<int> * shellface_map = nullptr,
437 const std::vector<int> * inverse_shellface_map = nullptr,
438 size_t shellface_index_offset = 0)
439 {
440 std::unique_ptr<Elem> elem = Elem::build(type);
441 auto & conv = conversion_map[elem->dim()][type];
442 conv.libmesh_type = type;
443 conv.exodus_type = exodus_type;
444 conv.node_map = node_map;
445 conv.inverse_node_map = inverse_node_map;
446 conv.side_map = side_map;
447 conv.inverse_side_map = inverse_side_map;
448 conv.shellface_map = shellface_map;
449 conv.inverse_shellface_map = inverse_shellface_map;
450 conv.shellface_index_offset = shellface_index_offset;
451 conv.n_nodes = elem->n_nodes();
452 for (int d = elem->dim()+1; d <= 3; ++d)
453 conversion_map[d][type] = conv;
454 };
455
456 convert_type(NODEELEM, "SPHERE");
457 convert_type(EDGE2, "EDGE2");
458 convert_type(EDGE3, "EDGE3");
459 convert_type(EDGE4, "EDGE4");
460 convert_type(QUAD4, "QUAD4");
461 convert_type(QUAD8, "QUAD8");
462 convert_type(QUAD9, "QUAD9");
463 convert_type(C0POLYGON, "NSIDED");
464 {
465 auto & conv = conversion_map[3][C0POLYHEDRON];
466 conv.libmesh_type = C0POLYHEDRON;
467 conv.exodus_type = "NFACED";
468 conv.dim = 3;
469 conv.n_nodes = 0;
470 }
471 convert_type(QUADSHELL4, "SHELL4", nullptr, nullptr, nullptr,
472 /* inverse_side_map = */ &quadshell4_inverse_edge_map,
473 nullptr, nullptr, /* shellface_index_offset = */ 2);
474 convert_type(QUADSHELL8, "SHELL8", nullptr, nullptr, nullptr,
475 /* inverse_side_map = */ &quadshell4_inverse_edge_map,
476 nullptr, nullptr, /* shellface_index_offset = */ 2);
477 convert_type(QUADSHELL9, "SHELL9", nullptr, nullptr, nullptr,
478 /* inverse_side_map = */ &quadshell4_inverse_edge_map,
479 nullptr, nullptr, /* shellface_index_offset = */ 2);
480
481 convert_type(TRI3, "TRI3");
482 convert_type(TRI6, "TRI6");
483 convert_type(TRI7, "TRI7");
484 // Exodus does weird things to triangle side mapping in 3D. See
485 // https://sandialabs.github.io/seacas-docs/html/element_types.html#tri
486 conversion_map[3][TRI3].inverse_side_map = &trishell3_inverse_edge_map;
487 conversion_map[3][TRI3].shellface_index_offset = 2;
488 conversion_map[3][TRI6].inverse_side_map = &trishell3_inverse_edge_map;
489 conversion_map[3][TRI6].shellface_index_offset = 2;
490 conversion_map[3][TRI7].inverse_side_map = &trishell3_inverse_edge_map;
491 conversion_map[3][TRI7].shellface_index_offset = 2;
492
493 convert_type(TRISHELL3, "TRISHELL3", nullptr, nullptr, nullptr,
494 /* inverse_side_map = */ &trishell3_inverse_edge_map,
495 nullptr, nullptr, /* shellface_index_offset = */ 2);
496 convert_type(TRI3SUBDIVISION, "TRI3");
497 convert_type(HEX8, "HEX8", nullptr, nullptr,
498 &hex_face_map, &hex_inverse_face_map);
499 convert_type(HEX20, "HEX20", nullptr, nullptr,
500 &hex_face_map, &hex_inverse_face_map);
501 convert_type(HEX27, "HEX27", &hex27_node_map,
502 &hex27_inverse_node_map,
503 &hex_face_map, &hex_inverse_face_map);
504 convert_type(TET4, "TETRA4", nullptr, nullptr,
505 &tet_face_map, &tet_inverse_face_map);
506 convert_type(TET10, "TETRA10", nullptr, nullptr,
507 &tet_face_map, &tet_inverse_face_map);
508 convert_type(TET14, "TETRA14", &tet14_node_map,
509 &tet14_inverse_node_map,
510 &tet_face_map, &tet_inverse_face_map);
511 convert_type(PRISM6, "WEDGE", nullptr, nullptr,
512 &prism_face_map, &prism_inverse_face_map);
513 convert_type(PRISM15, "WEDGE15", nullptr, nullptr,
514 &prism_face_map, &prism_inverse_face_map);
515 convert_type(PRISM18, "WEDGE18", nullptr, nullptr,
516 &prism_face_map, &prism_inverse_face_map);
517 convert_type(PRISM20, "WEDGE20", &prism20_node_map,
518 &prism20_inverse_node_map,
519 &prism_face_map, &prism_inverse_face_map);
520 convert_type(PRISM21, "WEDGE21", &prism21_node_map,
521 &prism21_inverse_node_map,
522 &prism_face_map, &prism_inverse_face_map);
523 convert_type(PYRAMID5, "PYRAMID5");
524 convert_type(PYRAMID13, "PYRAMID13");
525 convert_type(PYRAMID14, "PYRAMID14");
526 convert_type(PYRAMID18, "PYRAMID18");
527}
ElemType
Defines an enum for geometric element types.

References libMesh::Elem::build(), libMesh::C0POLYGON, libMesh::C0POLYHEDRON, libMesh::ExodusII_IO_Helper::conversion_map, libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM20, libMesh::PRISM21, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID18, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::QUADSHELL9, libMesh::TET10, libMesh::TET14, libMesh::TET4, libMesh::TRI3, libMesh::TRI3SUBDIVISION, libMesh::TRI6, libMesh::TRI7, and libMesh::TRISHELL3.

Referenced by libMesh::ExodusII_IO_Helper::ExodusII_IO_Helper().

◆ init_element_equivalence_map()

void libMesh::ExodusII_IO_Helper::init_element_equivalence_map ( )
privateinherited

Definition at line 533 of file exodusII_io_helper.C.

534{
535 // We use an ExodusII SPHERE element to represent a NodeElem
537
538 // EDGE2 equivalences
544 element_equivalence_map["TRUSS2"] = EDGE2;
547
548 // EDGE3 equivalences
550 element_equivalence_map["TRUSS3"] = EDGE3;
553
554 // EDGE4 equivalences
556 element_equivalence_map["TRUSS4"] = EDGE4;
559
560 // This whole design is going to need to be refactored whenever we
561 // support higher-order IGA, with one element type having variable
562 // polynomiaal degree...
563 element_equivalence_map["BEX_CURVE"] = EDGE3;
564
565 // QUAD4 equivalences
568
569 // QUADSHELL4 equivalences
572
573 // QUAD8 equivalences
575
576 // QUADSHELL8 equivalences
578
579 // QUAD9 equivalences
581 // This only supports p==2 IGA:
582 element_equivalence_map["BEX_QUAD"] = QUAD9;
583
584 // QUADSHELL9 equivalences
586
587 // Runtime-topology polytope equivalences
590
591 // TRI3 equivalences
594 element_equivalence_map["TRIANGLE"] = TRI3;
595
596 // TRISHELL3 equivalences
598 element_equivalence_map["TRISHELL3"] = TRISHELL3;
599
600 // TRI6 equivalences
602 // element_equivalence_map["TRISHELL6"] = TRI6;
603 // This only supports p==2 IGA:
604 element_equivalence_map["BEX_TRIANGLE"] = TRI6;
605
606 // TRI7 equivalences
608
609 // HEX8 equivalences
612
613 // HEX20 equivalences
615
616 // HEX27 equivalences
618 // This only supports p==2 IGA:
619 element_equivalence_map["BEX_HEX"] = HEX27;
620
621 // TET4 equivalences
622 element_equivalence_map["TETRA"] = TET4;
623 element_equivalence_map["TETRA4"] = TET4;
624
625 // TET10 equivalences
626 element_equivalence_map["TETRA10"] = TET10;
627 // This only supports p==2 IGA:
628 element_equivalence_map["BEX_TETRA"] = TET10;
629
630 // TET14 (in Exodus 8) equivalence
631 element_equivalence_map["TETRA14"] = TET14;
632
633 // PRISM6 equivalences
636
637 // PRISM15 equivalences
638 element_equivalence_map["WEDGE15"] = PRISM15;
639
640 // PRISM18 equivalences
641 element_equivalence_map["WEDGE18"] = PRISM18;
642 // This only supports p==2 IGA:
643 element_equivalence_map["BEX_WEDGE"] = PRISM18;
644
645 // PRISM20 equivalences
646 element_equivalence_map["WEDGE20"] = PRISM20;
647
648 // PRISM21 equivalences
649 element_equivalence_map["WEDGE21"] = PRISM21;
650
651 // PYRAMID equivalences
653 element_equivalence_map["PYRAMID5"] = PYRAMID5;
654 element_equivalence_map["PYRAMID13"] = PYRAMID13;
655 element_equivalence_map["PYRAMID14"] = PYRAMID14;
656 element_equivalence_map["PYRAMID18"] = PYRAMID18;
657}

References libMesh::C0POLYGON, libMesh::C0POLYHEDRON, libMesh::EDGE2, libMesh::EDGE3, libMesh::EDGE4, libMesh::ExodusII_IO_Helper::element_equivalence_map, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM20, libMesh::PRISM21, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID18, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::QUADSHELL9, libMesh::TET10, libMesh::TET14, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, libMesh::TRI7, and libMesh::TRISHELL3.

Referenced by libMesh::ExodusII_IO_Helper::ExodusII_IO_Helper().

◆ initialize()

void libMesh::Nemesis_IO_Helper::initialize ( std::string  title,
const MeshBase &  mesh,
bool  use_discontinuous = false 
)
overridevirtual

Specialization of the initialize function from ExodusII_IO_Helper that also writes global initial data to file.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 754 of file nemesis_io_helper.C.

755{
756 // Make sure that the reference passed in is really a DistributedMesh
757 // const DistributedMesh & pmesh = cast_ref<const DistributedMesh &>(mesh);
758 const MeshBase & pmesh = mesh;
759
760 // If _write_as_dimension is nonzero, use it to set num_dim later in the Exodus file.
764 num_dim = mesh.mesh_dimension();
765 else
766 num_dim = mesh.spatial_dimension();
767
768 // According to Nemesis documentation, first call when writing should be to
769 // ne_put_init_info(). Our reader doesn't actually call this, but we should
770 // strive to be as close to a normal nemesis file as possible...
771 this->put_init_info(this->n_processors(), 1, "p");
772
773
774 // Gather global "initial" information for Nemesis. This consists of
775 // three parts labeled I, II, and III below...
776
777 //
778 // I.) Need to compute the number of global element blocks. To be consistent with
779 // Exodus, we also incorrectly associate the number of element blocks with the
780 // number of libmesh subdomains...
781 //
783
784 //
785 // II.) Determine the global number of nodesets by communication.
786 // This code relies on BoundaryInfo storing side and node
787 // boundary IDs separately at the time they are added to the
788 // BoundaryInfo object.
789 //
790 this->compute_num_global_nodesets(pmesh);
791
792 //
793 // III.) Need to compute the global number of sidesets by communication:
794 // This code relies on BoundaryInfo storing side and node
795 // boundary IDs separately at the time they are added to the
796 // BoundaryInfo object.
797 //
798 this->compute_num_global_sidesets(pmesh);
799
800 // Now write the global data obtained in steps I, II, and III to the Nemesis file
801 this->put_init_global(pmesh.parallel_n_nodes(),
802 pmesh.parallel_n_elem(),
803 this->num_elem_blks_global, /* I. */
804 this->num_node_sets_global, /* II. */
805 this->num_side_sets_global /* III. */
806 );
807
808 // Next, we'll write global element block information to the file. This was already
809 // gathered in step I. above
812
813
814 // Next, write global nodeset information to the file. This was already gathered in
815 // step II. above.
816 this->num_global_node_df_counts.clear();
817 this->num_global_node_df_counts.resize(this->global_nodeset_ids.size()); // distribution factors all zero...
821
822
823 // Next, write global sideset information to the file. This was already gathered in
824 // step III. above.
825 this->num_global_side_df_counts.clear();
826 this->num_global_side_df_counts.resize(this->global_sideset_ids.size()); // distribution factors all zero...
830
831
832 // Before we go any further we need to derive consistent node and
833 // element numbering schemes for all local elems and nodes connected
834 // to local elements.
835 //
836 // Must be called *after* the local_subdomain_counts map has been constructed
837 // by the compute_num_global_elem_blocks() function!
838 this->build_element_and_node_maps(pmesh);
839
840 // Next step is to write "load balance" parameters. Several things need to
841 // be computed first though...
842
843 // First we'll collect IDs of border nodes.
844 this->compute_border_node_ids(pmesh);
845
846 // Next we'll collect numbers of internal and border elements, and internal nodes.
847 // Note: "A border node does not a border element make...", that is, just because one
848 // of an element's nodes has been identified as a border node, the element is not
849 // necessarily a border element. It must have a side on the boundary between processors,
850 // i.e. have a face neighbor with a different processor id...
852
853 // Finally we are ready to write the loadbal information to the file
855 this->num_border_nodes,
856 this->num_external_nodes,
857 this->num_internal_elems,
858 this->num_border_elems,
859 this->num_node_cmaps,
860 this->num_elem_cmaps);
861
862
863 // Now we need to compute the "communication map" parameters. These are basically
864 // lists of nodes and elements which need to be communicated between different processors
865 // when the mesh file is read back in.
867
868 // Write communication map parameters to file.
869 this->put_cmap_params(this->node_cmap_ids,
871 this->elem_cmap_ids,
872 this->elem_cmap_elem_cnts);
873
874 // Ready the node communication maps. The node IDs which
875 // are communicated are the ones currently stored in
876 // proc_nodes_touched_intersections.
878
879 // Write the packed node communication vectors to file.
881 this->node_cmap_proc_ids);
882
883 // Ready the node maps. These have nothing to do with communication, they map
884 // the nodes to internal, border, and external nodes in the file.
885 this->compute_node_maps();
886
887 // Call the Nemesis API to write the node maps to file.
888 this->put_node_map(this->node_mapi,
889 this->node_mapb,
890 this->node_mape);
891
892 // Ready the element communication maps. This includes border
893 // element IDs, sides which are on the border, and the processors to which
894 // they are to be communicated...
896
897 // Call the Nemesis API to write the packed element communication maps vectors to file
899 this->elem_cmap_side_ids,
900 this->elem_cmap_proc_ids);
901
902 // Ready the Nemesis element maps (internal and border) for writing to file.
903 this->compute_element_maps();
904
905 // Call the Nemesis API to write the internal and border element IDs.
906 this->put_elem_map(this->elem_mapi,
907 this->elem_mapb);
908
909 // Now write Exodus-specific initialization information, some of which is
910 // different when you are using Nemesis.
911 this->write_exodus_initialization_info(pmesh, title_in);
912} // end initialize()
void compute_node_maps()
Compute the node maps (really just pack vectors) which map the nodes to internal, border,...
void put_node_map(std::vector< int > &node_mapi, std::vector< int > &node_mapb, std::vector< int > &node_mape)
Outputs IDs of internal, border, and external nodes.
void put_loadbal_param(unsigned num_internal_nodes, unsigned num_border_nodes, unsigned num_external_nodes, unsigned num_internal_elems, unsigned num_border_elems, unsigned num_node_cmaps, unsigned num_elem_cmaps)
Writes load balance parameters, some of which are described below: .) num_internal_nodes - nodes "who...
void put_node_cmap(std::vector< std::vector< int > > &node_cmap_node_ids, std::vector< std::vector< int > > &node_cmap_proc_ids)
Outputs all of the nodal communication maps for this processor.
void put_ns_param_global(std::vector< int > &global_nodeset_ids, std::vector< int > &num_global_node_counts, std::vector< int > &num_global_node_df_counts)
This function writes information about global node sets.
void put_init_info(unsigned num_proc, unsigned num_proc_in_file, const char *ftype)
Writing functions.
void put_ss_param_global(std::vector< int > &global_sideset_ids, std::vector< int > &num_global_side_counts, std::vector< int > &num_global_side_df_counts)
This function writes information about global side sets.
void compute_communication_map_parameters()
This function determines the communication map parameters which will eventually be written to file.
void compute_num_global_elem_blocks(const MeshBase &pmesh)
This function uses global communication routines to determine the number of element blocks across the...
void compute_num_global_nodesets(const MeshBase &pmesh)
This function uses global communication routines to determine the number of nodesets across the entir...
void put_elem_cmap(std::vector< std::vector< int > > &elem_cmap_elem_ids, std::vector< std::vector< int > > &elem_cmap_side_ids, std::vector< std::vector< int > > &elem_cmap_proc_ids)
Writes information about elemental communication map.
void write_exodus_initialization_info(const MeshBase &pmesh, const std::string &title)
This function writes exodus-specific initialization information.
void compute_elem_communication_maps()
This function computes element communication maps (really just packs vectors) in preparation for writ...
void compute_element_maps()
This function computes element maps (really just packs vectors) which map the elements to internal an...
void put_elem_map(std::vector< int > &elem_mapi, std::vector< int > &elem_mapb)
Outputs IDs of internal and border elements.
void compute_internal_and_border_elems_and_internal_nodes(const MeshBase &pmesh)
This function constructs the set of border and internal element IDs and internal node IDs present on ...
void compute_num_global_sidesets(const MeshBase &pmesh)
This function uses global communication routines to determine the number of sidesets across the entir...
void put_cmap_params(std::vector< int > &node_cmap_ids, std::vector< int > &node_cmap_node_cnts, std::vector< int > &elem_cmap_ids, std::vector< int > &elem_cmap_elem_cnts)
Outputs initial information for communication maps.
void compute_border_node_ids(const MeshBase &pmesh)
This function constructs the set of border node IDs present on the current mesh.
void build_element_and_node_maps(const MeshBase &pmesh)
This function builds the libmesh -> exodus and exodus -> libmesh node and element maps.
void put_eb_info_global(std::vector< int > &global_elem_blk_ids, std::vector< int > &global_elem_blk_cnts)
Writes global block information to the file .) global_elem_blk_ids - list of block IDs for all blocks...
void put_init_global(dof_id_type num_nodes_global, dof_id_type num_elems_global, unsigned num_elem_blks_global, unsigned num_node_sets_global, unsigned num_side_sets_global)
Writes global information including: .) global number of nodes .) global number of elems ....
void compute_node_communication_maps()
Compute the node communication maps (really just pack vectors) in preparation for writing them to fil...

References libMesh::ExodusII_IO_Helper::_use_mesh_dimension_instead_of_spatial_dimension, libMesh::ExodusII_IO_Helper::_write_as_dimension, build_element_and_node_maps(), compute_border_node_ids(), compute_communication_map_parameters(), compute_elem_communication_maps(), compute_element_maps(), compute_internal_and_border_elems_and_internal_nodes(), compute_node_communication_maps(), compute_node_maps(), compute_num_global_elem_blocks(), compute_num_global_nodesets(), compute_num_global_sidesets(), elem_cmap_elem_cnts, elem_cmap_elem_ids, elem_cmap_ids, elem_cmap_proc_ids, elem_cmap_side_ids, elem_mapb, elem_mapi, global_elem_blk_cnts, global_elem_blk_ids, global_nodeset_ids, global_sideset_ids, mesh, libMesh::MeshBase::mesh_dimension(), libMesh::ParallelObject::n_processors(), node_cmap_ids, node_cmap_node_cnts, node_cmap_node_ids, node_cmap_proc_ids, node_mapb, node_mape, node_mapi, num_border_elems, num_border_nodes, libMesh::ExodusII_IO_Helper::num_dim, num_elem_cmaps, num_external_nodes, num_global_node_counts, num_global_node_df_counts, num_global_side_counts, num_global_side_df_counts, num_internal_elems, num_internal_nodes, num_node_cmaps, libMesh::MeshBase::parallel_n_elem(), libMesh::MeshBase::parallel_n_nodes(), put_cmap_params(), put_eb_info_global(), put_elem_cmap(), put_elem_map(), put_init_global(), put_init_info(), put_loadbal_param(), put_node_cmap(), put_node_map(), put_ns_param_global(), put_ss_param_global(), and write_exodus_initialization_info().

◆ initialize_element_variables()

void libMesh::Nemesis_IO_Helper::initialize_element_variables ( std::vector< std::string >  names,
const std::vector< std::set< subdomain_id_type > > &  vars_active_subdomains 
)
overridevirtual

Override the Exodus Helper's implementation of this function so that it works correctly in parallel.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 2687 of file nemesis_io_helper.C.

2689{
2690 // Quick return if there are no element variables to write
2691 if (names.size() == 0)
2692 return;
2693
2694 // Quick return if we have already called this function
2696 return;
2697
2698 // Be sure that variables in the file match what we are asking for
2699 if (num_elem_vars > 0)
2700 {
2701 this->check_existing_vars(ELEMENTAL, names, this->elem_var_names);
2702 return;
2703 }
2704
2705 // Set the flag so we can skip this stuff on subsequent calls to
2706 // initialize_element_variables()
2708
2709 this->write_var_names(ELEMENTAL, names);
2710
2711 // Create a truth table from global_elem_blk_ids and the information
2712 // in vars_active_subdomains. Create a truth table of
2713 // size global_elem_blk_ids.size() * names.size().
2714 std::vector<int> truth_tab(global_elem_blk_ids.size() * names.size());
2715 for (auto blk : index_range(global_elem_blk_ids))
2716 for (auto var : index_range(names))
2717 if (vars_active_subdomains[var].empty() ||
2718 vars_active_subdomains[var].count(cast_int<subdomain_id_type>(global_elem_blk_ids[blk])))
2719 truth_tab[names.size() * blk + var] = 1;
2720
2721 // Write truth table to file.
2722 if (truth_tab.size())
2723 {
2724 ex_err = exII::ex_put_elem_var_tab(ex_id,
2725 cast_int<int>(global_elem_blk_ids.size()),
2726 cast_int<int>(names.size()),
2727 truth_tab.data());
2728 EX_CHECK_ERR(ex_err, "Error writing element truth table.");
2729 }
2730}
void write_var_names(ExodusVarType type, const std::vector< std::string > &names)
Wraps calls to exII::ex_put_var_names() and exII::ex_put_var_param().
std::vector< std::string > elem_var_names
void check_existing_vars(ExodusVarType type, std::vector< std::string > &names, std::vector< std::string > &names_from_file)
When appending: during initialization, check that variable names in the file match those you attempt ...

References libMesh::ExodusII_IO_Helper::_elem_vars_initialized, libMesh::ExodusII_IO_Helper::check_existing_vars(), libMesh::ExodusII_IO_Helper::elem_var_names, libMesh::ExodusII_IO_Helper::ELEMENTAL, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, global_elem_blk_ids, libMesh::index_range(), libMesh::ExodusII_IO_Helper::num_elem_vars, and libMesh::ExodusII_IO_Helper::write_var_names().

◆ initialize_global_variables()

void libMesh::ExodusII_IO_Helper::initialize_global_variables ( std::vector< std::string >  names)
inherited

Sets up the global variables.

Definition at line 4123 of file exodusII_io_helper.C.

4124{
4125 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4126 return;
4127
4128 // Quick return if there are no global variables to write
4129 if (names.size() == 0)
4130 return;
4131
4133 return;
4134
4135 // Be sure that variables in the file match what we are asking for
4136 if (num_global_vars > 0)
4137 {
4138 this->check_existing_vars(GLOBAL, names, this->global_var_names);
4139 return;
4140 }
4141
4143
4144 this->write_var_names(GLOBAL, names);
4145}
std::vector< std::string > global_var_names

References libMesh::ExodusII_IO_Helper::_global_vars_initialized, libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::check_existing_vars(), libMesh::ExodusII_IO_Helper::GLOBAL, libMesh::ExodusII_IO_Helper::global_var_names, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::write_var_names().

◆ initialize_nodal_variables()

void libMesh::ExodusII_IO_Helper::initialize_nodal_variables ( std::vector< std::string >  names)
inherited

Sets up the nodal variables.

Definition at line 4095 of file exodusII_io_helper.C.

4096{
4097 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4098 return;
4099
4100 // Quick return if there are no nodal variables to write
4101 if (names.size() == 0)
4102 return;
4103
4104 // Quick return if we have already called this function
4106 return;
4107
4108 // Be sure that variables in the file match what we are asking for
4109 if (num_nodal_vars > 0)
4110 {
4111 this->check_existing_vars(NODAL, names, this->nodal_var_names);
4112 return;
4113 }
4114
4115 // Set the flag so we can skip the rest of this function on subsequent calls.
4117
4118 this->write_var_names(NODAL, names);
4119}
std::vector< std::string > nodal_var_names

References libMesh::ExodusII_IO_Helper::_nodal_vars_initialized, libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::check_existing_vars(), libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::nodal_var_names, libMesh::ExodusII_IO_Helper::num_nodal_vars, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::write_var_names().

◆ message() [1/2]

void libMesh::ExodusII_IO_Helper::message ( std::string_view  msg)
inherited

◆ message() [2/2]

void libMesh::ExodusII_IO_Helper::message ( std::string_view  msg,
int  i 
)
inherited

Prints the message defined in msg, and appends the number i to the end of the message.

Useful for printing messages in loops. Can be turned off if verbosity is set to 0.

Definition at line 688 of file exodusII_io_helper.C.

689{
690 if (verbose) libMesh::out << msg << i << "." << std::endl;
691}

References libMesh::out, and libMesh::ExodusII_IO_Helper::verbose.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 103 of file parallel_object.h.

104 {
105 processor_id_type returnval =
106 cast_int<processor_id_type>(_communicator.size());
107 libmesh_assert(returnval); // We never have an empty comm
108 return returnval;
109 }
processor_id_type size() const
uint8_t processor_id_type
Definition id_types.h:104

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and libMesh::Parallel::Communicator::size().

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), ExodusC0PolyhedronTest::assert_distributed_if_parallel(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::Partitioner::build_graph(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), compute_border_node_ids(), construct_nemesis_filename(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::MeshBase::get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::NumericVector< T >::is_effectively_ghosted(), libMesh::NumericVector< T >::is_effectively_serial(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::DofMap::n_dofs_per_processor(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::NameBasedIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_ids(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DistributedMesh::set_next_unique_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), ExodusC0PolyhedronTest::test_write_and_read_mixed_hex_tet_block_names_impl(), CheckpointIOTest::testDisjointNeighborPairsCheckpoint(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

◆ node_id_to_vec_id()

dof_id_type libMesh::ExodusII_IO_Helper::node_id_to_vec_id ( dof_id_type  n) const
inlineinherited

Definition at line 966 of file exodusII_io_helper.h.

967 {
968 if (_added_side_node_offsets.empty())
969 return n;
970
971 // Find the processor id that has node_id in the parallel vec
972 const auto lb = std::upper_bound(_true_node_offsets.begin(),
973 _true_node_offsets.end(), n);
975 const processor_id_type p = lb - _true_node_offsets.begin();
976
977 return n + (p ? _added_side_node_offsets[p-1] : 0);
978 }

References libMesh::ExodusII_IO_Helper::_added_side_node_offsets, libMesh::ExodusII_IO_Helper::_true_node_offsets, and libMesh::libmesh_assert().

◆ open()

void libMesh::ExodusII_IO_Helper::open ( const char *  filename,
bool  read_only 
)
inherited

Opens an ExodusII mesh file named filename.

If read_only==true, the file will be opened with the EX_READ flag, otherwise it will be opened with the EX_WRITE flag.

Definition at line 780 of file exodusII_io_helper.C.

781{
782 // Version of Exodus you are using
783 float ex_version = 0.;
784
785 int comp_ws = 0;
786
788 comp_ws = cast_int<int>(sizeof(float));
789
790 // Fall back on double precision when necessary since ExodusII
791 // doesn't seem to support long double
792 else
793 comp_ws = cast_int<int>(std::min(sizeof(Real), sizeof(double)));
794
795 // Word size in bytes of the floating point data as they are stored
796 // in the ExodusII file. "If this argument is 0, the word size of the
797 // floating point data already stored in the file is returned"
798 int io_ws = 0;
799
800 {
801 FPEDisabler disable_fpes;
802 ex_id = exII::ex_open(filename,
803 read_only ? EX_READ : EX_WRITE,
804 &comp_ws,
805 &io_ws,
806 &ex_version);
807 }
808
809 std::string err_msg = std::string("Error opening ExodusII mesh file: ") + std::string(filename);
810 EX_CHECK_ERR(ex_id, err_msg);
811 if (verbose) libMesh::out << "File opened successfully." << std::endl;
812
813 // If we're writing then we'll want to use the specified length;
814 // if we're reading then we'll override this by what's in the file.
815 int max_name_length_to_set = _max_name_length;
816
817 if (read_only)
818 {
819 opened_for_reading = true;
820 elem_node_counts.clear();
821 elem_face_counts.clear();
823
824 // ExodusII reads truncate to 32-char strings by default; we'd
825 // like to support whatever's in the file, so as early as possible
826 // let's find out what that is.
827 int max_name_length = exII::ex_inquire_int(ex_id, exII::EX_INQ_DB_MAX_USED_NAME_LENGTH);
828
829 libmesh_error_msg_if(max_name_length > MAX_LINE_LENGTH,
830 "Unexpected maximum name length of " <<
831 max_name_length << " in file " << filename <<
832 " exceeds expected " << MAX_LINE_LENGTH);
833
834 // I don't think the 32 here should be necessary, but let's make
835 // sure we don't accidentally make things *worse* for anyone.
836 max_name_length_to_set = std::max(max_name_length, 32);
837 }
838 else
839 opened_for_writing = true;
840
841 ex_err = exII::ex_set_max_name_length(ex_id, max_name_length_to_set);
842 EX_CHECK_ERR(ex_err, "Error setting max ExodusII name length.");
843
844 current_filename = std::string(filename);
845}
std::vector< int > elem_face_counts
std::vector< std::vector< int > > c0polyhedron_face_connect
std::vector< int > elem_node_counts

References libMesh::ExodusII_IO_Helper::_max_name_length, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::c0polyhedron_face_connect, libMesh::ExodusII_IO_Helper::current_filename, libMesh::ExodusII_IO_Helper::elem_face_counts, libMesh::ExodusII_IO_Helper::elem_node_counts, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::opened_for_reading, libMesh::ExodusII_IO_Helper::opened_for_writing, libMesh::out, libMesh::Real, and libMesh::ExodusII_IO_Helper::verbose.

◆ print_header()

void libMesh::ExodusII_IO_Helper::print_header ( )
inherited

Prints the ExodusII mesh file header, which includes the mesh title, the number of nodes, number of elements, mesh dimension, number of sidesets, and number of nodesets.

Definition at line 977 of file exodusII_io_helper.C.

978{
979 if (verbose)
980 libMesh::out << "Title: \t" << title.data() << std::endl
981 << "Mesh Dimension: \t" << num_dim << std::endl
982 << "Number of Nodes: \t" << num_nodes << std::endl
983 << "Number of elements: \t" << num_elem << std::endl
984 << "Number of elt blocks: \t" << num_elem_blk << std::endl
985 << "Number of node sets: \t" << num_node_sets << std::endl
986 << "Number of side sets: \t" << num_side_sets << std::endl
987 << "Number of elem sets: \t" << num_elem_sets << std::endl;
988}

References libMesh::ExodusII_IO_Helper::num_dim, libMesh::ExodusII_IO_Helper::num_elem, libMesh::ExodusII_IO_Helper::num_elem_blk, libMesh::ExodusII_IO_Helper::num_elem_sets, libMesh::ExodusII_IO_Helper::num_node_sets, libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::out, libMesh::ExodusII_IO_Helper::title, and libMesh::ExodusII_IO_Helper::verbose.

◆ print_nodes()

void libMesh::ExodusII_IO_Helper::print_nodes ( std::ostream &  out_stream = libMesh::out)
inherited

Prints the nodal information, by default to libMesh::out.

Definition at line 1179 of file exodusII_io_helper.C.

1180{
1181 for (int i=0; i<num_nodes; i++)
1182 out_stream << "(" << x[i] << ", " << y[i] << ", " << z[i] << ")" << std::endl;
1183}

References libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ExodusII_IO_Helper::x, libMesh::ExodusII_IO_Helper::y, and libMesh::ExodusII_IO_Helper::z.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 114 of file parallel_object.h.

115 { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshFunction::check_found_elem(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::ExodusII_IO_Helper::close(), compute_border_node_ids(), compute_communication_map_parameters(), compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), compute_node_communication_maps(), compute_num_global_elem_blocks(), compute_num_global_nodesets(), compute_num_global_sidesets(), construct_nemesis_filename(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshBase::count_constraint_rows(), libMesh::ExodusII_IO_Helper::create(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), get_cmap_params(), get_eb_info_global(), get_elem_cmap(), get_elem_map(), libMesh::MeshBase::get_info(), get_init_global(), get_init_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::MeshBase::get_local_constraints(), get_node_cmap(), get_node_map(), get_ns_param_global(), get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::Modification::interpolate_surface(), libMesh::SparsityPattern::Build::join(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), put_cmap_params(), put_elem_cmap(), put_elem_map(), put_loadbal_param(), put_node_cmap(), put_node_map(), libMesh::XdrIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::NameBasedIO::read(), libMesh::EquationSystems::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::read_header(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_ids(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DistributedMesh::set_next_unique_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolyhedronTest::test_write_and_read_mixed_hex_tet_block_names_impl(), ExodusC0PolygonTest::test_write_and_read_pentagon(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), BoundaryInfoTest::testBoundaryIDs(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyHighOrderElementSolution(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), DofMapTest::testGhostConstraintSendList(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), BoundaryMeshSubdomainTest::testSingleSubdomain(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::ExodusII_IO_Helper::write_nodesets(), write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::ExodusII_IO_Helper::write_sidesets(), write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ put_cmap_params()

void libMesh::Nemesis_IO_Helper::put_cmap_params ( std::vector< int > &  node_cmap_ids,
std::vector< int > &  node_cmap_node_cnts,
std::vector< int > &  elem_cmap_ids,
std::vector< int > &  elem_cmap_elem_cnts 
)

Outputs initial information for communication maps.

Note
The order of the arguments specified in the Nemesis User's Manual is wrong. The correct order is (ids, counts, ids, counts). Must be called after put_loadbal_param().

Definition at line 639 of file nemesis_io_helper.C.

643{
645 Nemesis::ne_put_cmap_params(ex_id,
646 node_cmap_ids_in.empty() ? nullptr : node_cmap_ids_in.data(),
647 node_cmap_node_cnts_in.empty() ? nullptr : node_cmap_node_cnts_in.data(),
648 elem_cmap_ids_in.empty() ? nullptr : elem_cmap_ids_in.data(),
649 elem_cmap_elem_cnts_in.empty() ? nullptr : elem_cmap_elem_cnts_in.data(),
650 this->processor_id());
651
652 EX_CHECK_ERR(nemesis_err_flag, "Error writing cmap parameters!");
653}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, and libMesh::ParallelObject::processor_id().

Referenced by initialize().

◆ put_eb_info_global()

void libMesh::Nemesis_IO_Helper::put_eb_info_global ( std::vector< int > &  global_elem_blk_ids,
std::vector< int > &  global_elem_blk_cnts 
)

Writes global block information to the file .) global_elem_blk_ids - list of block IDs for all blocks present in the mesh .) global_elem_blk_cnts - number of elements in each block for the global mesh.

Must be called after put_init_global().

Definition at line 559 of file nemesis_io_helper.C.

561{
563 Nemesis::ne_put_eb_info_global(ex_id,
564 global_elem_blk_ids_in.data(),
565 global_elem_blk_cnts_in.data());
566
567 EX_CHECK_ERR(nemesis_err_flag, "Error writing global element block information!");
568}

References libMesh::ExodusII_IO_Helper::ex_id, and nemesis_err_flag.

Referenced by initialize().

◆ put_elem_cmap()

void libMesh::Nemesis_IO_Helper::put_elem_cmap ( std::vector< std::vector< int > > &  elem_cmap_elem_ids,
std::vector< std::vector< int > > &  elem_cmap_side_ids,
std::vector< std::vector< int > > &  elem_cmap_proc_ids 
)

Writes information about elemental communication map.

Note
This class contains elem_cmap_elem_ids, elem_cmap_side_ids, abd elem_cmap_proc_ids which can be used when calling this function.

Must be called after put_cmap_params().

Definition at line 719 of file nemesis_io_helper.C.

722{
723 for (auto i : index_range(elem_cmap_ids))
724 {
726 Nemesis::ne_put_elem_cmap(ex_id,
727 this->elem_cmap_ids[i],
728 elem_cmap_elem_ids_in[i].data(),
729 elem_cmap_side_ids_in[i].data(),
730 elem_cmap_proc_ids_in[i].data(),
731 this->processor_id());
732
733 EX_CHECK_ERR(nemesis_err_flag, "Error writing elem communication map to file!");
734 }
735}

References elem_cmap_ids, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), nemesis_err_flag, and libMesh::ParallelObject::processor_id().

Referenced by initialize().

◆ put_elem_map()

void libMesh::Nemesis_IO_Helper::put_elem_map ( std::vector< int > &  elem_mapi,
std::vector< int > &  elem_mapb 
)

Outputs IDs of internal and border elements.

Must be called after ne_put_loadbal_param().

Definition at line 740 of file nemesis_io_helper.C.

742{
744 Nemesis::ne_put_elem_map(ex_id,
745 elem_mapi_in.empty() ? nullptr : elem_mapi_in.data(),
746 elem_mapb_in.empty() ? nullptr : elem_mapb_in.data(),
747 this->processor_id());
748
749 EX_CHECK_ERR(nemesis_err_flag, "Error writing Nemesis internal and border element maps to file!");
750}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, and libMesh::ParallelObject::processor_id().

Referenced by initialize().

◆ put_init_global()

void libMesh::Nemesis_IO_Helper::put_init_global ( dof_id_type  num_nodes_global,
dof_id_type  num_elems_global,
unsigned  num_elem_blks_global,
unsigned  num_node_sets_global,
unsigned  num_side_sets_global 
)

Writes global information including: .) global number of nodes .) global number of elems .) global number of element blocks .) global number of node sets .) global number of side sets.

Definition at line 540 of file nemesis_io_helper.C.

545{
547 Nemesis::ne_put_init_global(ex_id,
548 num_nodes_global_in,
549 num_elems_global_in,
550 num_elem_blks_global_in,
551 num_node_sets_global_in,
552 num_side_sets_global_in);
553
554 EX_CHECK_ERR(nemesis_err_flag, "Error writing initial global data!");
555}

References libMesh::ExodusII_IO_Helper::ex_id, and nemesis_err_flag.

Referenced by initialize().

◆ put_init_info()

void libMesh::Nemesis_IO_Helper::put_init_info ( unsigned  num_proc,
unsigned  num_proc_in_file,
const char *  ftype 
)

Writing functions.

Writes basic info about the partitioning to file .) num_proc - number of processors .) num_proc_in_file - number of processors in the current file - generally equal to 1 .) ftype = "s" for scalar load-balance file, "p" for parallel file

Definition at line 524 of file nemesis_io_helper.C.

527{
529 Nemesis::ne_put_init_info(ex_id,
530 num_proc_in,
531 num_proc_in_file_in,
532 const_cast<char *>(ftype_in));
533
534 EX_CHECK_ERR(nemesis_err_flag, "Error writing initial information!");
535}

References libMesh::ExodusII_IO_Helper::ex_id, and nemesis_err_flag.

Referenced by initialize().

◆ put_loadbal_param()

void libMesh::Nemesis_IO_Helper::put_loadbal_param ( unsigned  num_internal_nodes,
unsigned  num_border_nodes,
unsigned  num_external_nodes,
unsigned  num_internal_elems,
unsigned  num_border_elems,
unsigned  num_node_cmaps,
unsigned  num_elem_cmaps 
)

Writes load balance parameters, some of which are described below: .) num_internal_nodes - nodes "wholly" owned by the current processor .) num_border_nodes - nodes local to a processor but residing in an element which also has nodes on other processors .) num_external_nodes - nodes that reside on other processors but whose element "partially" resides on the current processor – we assert this should be zero on reading! .) num_border_elems - elements local to this processor but whose nodes reside on other processors as well.

.) processor - ID of the processor for which information is to be written

Definition at line 613 of file nemesis_io_helper.C.

620{
622 Nemesis::ne_put_loadbal_param(ex_id,
623 num_internal_nodes_in,
624 num_border_nodes_in,
625 num_external_nodes_in,
626 num_internal_elems_in,
627 num_border_elems_in,
628 num_node_cmaps_in,
629 num_elem_cmaps_in,
630 this->processor_id());
631
632 EX_CHECK_ERR(nemesis_err_flag, "Error writing loadbal parameters!");
633}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, and libMesh::ParallelObject::processor_id().

Referenced by initialize().

◆ put_node_cmap()

void libMesh::Nemesis_IO_Helper::put_node_cmap ( std::vector< std::vector< int > > &  node_cmap_node_ids,
std::vector< std::vector< int > > &  node_cmap_proc_ids 
)

Outputs all of the nodal communication maps for this processor.

Internally, this function loops over all communication maps and calls Nemesis::ne_put_node_cmap() for each one.

.) node_cmap_node_ids = Nodal IDs of the FEM nodes in this communication map .) node_cmap_proc_ids = processor IDs associated with each of the nodes in node_ids

In the Nemesis file, these all appear to be written to the same chunks of data: n_comm_nids and n_comm_proc, but don't rely on these names...

Note
This class contains node_cmap_node_ids and node_cmap_proc_ids which can be used when calling this function.

Must be called after put_cmap_params().

Definition at line 658 of file nemesis_io_helper.C.

660{
661 // Print to screen what we are about to print to Nemesis file
662 if (verbose)
663 {
664 for (auto i : index_range(node_cmap_node_ids_in))
665 {
666 libMesh::out << "[" << this->processor_id() << "] put_node_cmap() : nodes communicated to proc "
667 << this->node_cmap_ids[i]
668 << " = ";
669 for (const auto & node_id : node_cmap_node_ids_in[i])
670 libMesh::out << node_id << " ";
671 libMesh::out << std::endl;
672 }
673
674 for (auto i : index_range(node_cmap_node_ids_in))
675 {
676 libMesh::out << "[" << this->processor_id() << "] put_node_cmap() : processor IDs = ";
677 for (const auto & proc_id : node_cmap_proc_ids_in[i])
678 libMesh::out << proc_id << " ";
679 libMesh::out << std::endl;
680 }
681 }
682
683 for (auto i : index_range(node_cmap_node_ids_in))
684 {
685 int * node_ids_ptr = node_cmap_node_ids_in[i].empty() ?
686 nullptr : node_cmap_node_ids_in[i].data();
687 int * proc_ids_ptr = node_cmap_proc_ids_in[i].empty() ?
688 nullptr : node_cmap_proc_ids_in[i].data();
689
691 Nemesis::ne_put_node_cmap(ex_id, this->node_cmap_ids[i],
692 node_ids_ptr, proc_ids_ptr,
693 this->processor_id());
694
695 EX_CHECK_ERR(nemesis_err_flag, "Error writing node communication map to file!");
696 }
697}

References libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), nemesis_err_flag, node_cmap_ids, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ put_node_map()

void libMesh::Nemesis_IO_Helper::put_node_map ( std::vector< int > &  node_mapi,
std::vector< int > &  node_mapb,
std::vector< int > &  node_mape 
)

Outputs IDs of internal, border, and external nodes.

LibMesh asserts that the number of external nodes is zero in the Nemesis files it reads

Definition at line 702 of file nemesis_io_helper.C.

705{
707 Nemesis::ne_put_node_map(ex_id,
708 node_mapi_in.empty() ? nullptr : node_mapi_in.data(),
709 node_mapb_in.empty() ? nullptr : node_mapb_in.data(),
710 node_mape_in.empty() ? nullptr : node_mape_in.data(),
711 this->processor_id());
712
713 EX_CHECK_ERR(nemesis_err_flag, "Error writing Nemesis internal and border node maps to file!");
714}

References libMesh::ExodusII_IO_Helper::ex_id, nemesis_err_flag, and libMesh::ParallelObject::processor_id().

Referenced by initialize().

◆ put_ns_param_global()

void libMesh::Nemesis_IO_Helper::put_ns_param_global ( std::vector< int > &  global_nodeset_ids,
std::vector< int > &  num_global_node_counts,
std::vector< int > &  num_global_node_df_counts 
)

This function writes information about global node sets.

.) global_nodeset_ids - vector of global node set IDs .) num_global_node_counts - vector of global node counts contained in each global node set .) num_global_df_count - vector of global distribution factors in each global node set

Must be called after put_init_global()

Definition at line 573 of file nemesis_io_helper.C.

576{
577 // Only add nodesets if there are some
578 if (global_nodeset_ids.size())
579 {
581 Nemesis::ne_put_ns_param_global(ex_id,
582 global_nodeset_ids_in.data(),
583 num_global_node_counts_in.data(),
584 num_global_node_df_counts_in.data());
585 }
586
587 EX_CHECK_ERR(nemesis_err_flag, "Error writing global nodeset parameters!");
588}

References libMesh::ExodusII_IO_Helper::ex_id, global_nodeset_ids, and nemesis_err_flag.

Referenced by initialize().

◆ put_ss_param_global()

void libMesh::Nemesis_IO_Helper::put_ss_param_global ( std::vector< int > &  global_sideset_ids,
std::vector< int > &  num_global_side_counts,
std::vector< int > &  num_global_side_df_counts 
)

This function writes information about global side sets.

.) global_sideset_ids - vector of global side set IDs .) num_global_side_counts - vector of global side counts contained in each global side set .) num_global_df_count - vector of global distribution factors in each global side set

Must be called after put_init_global()

Definition at line 593 of file nemesis_io_helper.C.

596{
597 // Only add sidesets if there are some
598 if (global_sideset_ids.size())
599 {
601 Nemesis::ne_put_ss_param_global(ex_id,
602 global_sideset_ids_in.data(),
603 num_global_side_counts_in.data(),
604 num_global_side_df_counts_in.data());
605 }
606
607 EX_CHECK_ERR(nemesis_err_flag, "Error writing global sideset parameters!");
608}

References libMesh::ExodusII_IO_Helper::ex_id, global_sideset_ids, and nemesis_err_flag.

Referenced by initialize().

◆ read_all_nodesets()

void libMesh::ExodusII_IO_Helper::read_all_nodesets ( )
inherited

New API that reads all nodesets simultaneously.

This may be slightly faster than reading them one at a time. Calls ex_get_concat_node_sets() under the hood.

Definition at line 2058 of file exodusII_io_helper.C.

2059{
2060 LOG_SCOPE("read_all_nodesets()", "ExodusII_IO_Helper");
2061
2062 // Figure out how many nodesets there are in the file so we can
2063 // properly resize storage as necessary.
2065 inquire
2066 (*this, exII::EX_INQ_NODE_SETS,
2067 "Error retrieving number of node sets");
2068
2069 // Figure out how many nodes there are in all the nodesets.
2070 int total_nodes_in_all_sets =
2071 inquire
2072 (*this, exII::EX_INQ_NS_NODE_LEN,
2073 "Error retrieving number of nodes in all node sets.");
2074
2075 // Figure out how many distribution factors there are in all the nodesets.
2076 int total_df_in_all_sets =
2077 inquire
2078 (*this, exII::EX_INQ_NS_DF_LEN,
2079 "Error retrieving number of distribution factors in all node sets.");
2080
2081 // If there are no nodesets, there's nothing to read in.
2082 if (num_node_sets == 0)
2083 return;
2084
2085 // Allocate space to read all the nodeset data.
2086 // Use existing class members where possible to avoid shadowing
2087 nodeset_ids.clear(); nodeset_ids.resize(num_node_sets);
2092 node_sets_node_list.clear(); node_sets_node_list.resize(total_nodes_in_all_sets);
2093 node_sets_dist_fact.clear(); node_sets_dist_fact.resize(total_df_in_all_sets);
2094
2095 // Handle single-precision files
2096 MappedInputVector mapped_node_sets_dist_fact(node_sets_dist_fact, _single_precision);
2097
2098 // Build exII::ex_set_spec struct
2099 exII::ex_set_specs set_specs = {};
2100 set_specs.sets_ids = nodeset_ids.data();
2101 set_specs.num_entries_per_set = num_nodes_per_set.data();
2102 set_specs.num_dist_per_set = num_node_df_per_set.data();
2103 set_specs.sets_entry_index = node_sets_node_index.data();
2104 set_specs.sets_dist_index = node_sets_dist_index.data();
2105 set_specs.sets_entry_list = node_sets_node_list.data();
2106 set_specs.sets_extra_list = nullptr;
2107 set_specs.sets_dist_fact = total_df_in_all_sets ? mapped_node_sets_dist_fact.data() : nullptr;
2108
2109 ex_err = exII::ex_get_concat_sets(ex_id, exII::EX_NODE_SET, &set_specs);
2110 EX_CHECK_ERR(ex_err, "Error reading concatenated nodesets");
2111
2112 // Read the nodeset names from file!
2113 char name_buffer[libmesh_max_str_length+1];
2114 for (int i=0; i<num_node_sets; ++i)
2115 {
2116 ex_err = exII::ex_get_name
2117 (ex_id,
2118 exII::EX_NODE_SET,
2119 nodeset_ids[i],
2120 name_buffer);
2121 EX_CHECK_ERR(ex_err, "Error getting node set name.");
2122 id_to_ns_names[nodeset_ids[i]] = name_buffer;
2123 }
2124}
std::vector< int > node_sets_dist_index
std::vector< int > node_sets_node_index
std::vector< int > num_node_df_per_set
std::vector< Real > node_sets_dist_fact

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::MappedInputVector::data(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_to_ns_names, libMesh::ExodusII_IO_Helper::node_sets_dist_fact, libMesh::ExodusII_IO_Helper::node_sets_dist_index, libMesh::ExodusII_IO_Helper::node_sets_node_index, libMesh::ExodusII_IO_Helper::node_sets_node_list, libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::num_node_df_per_set, libMesh::ExodusII_IO_Helper::num_node_sets, and libMesh::ExodusII_IO_Helper::num_nodes_per_set.

Referenced by libMesh::ExodusII_IO_Helper::write_nodeset_data().

◆ read_and_store_header_info()

void libMesh::ExodusII_IO_Helper::read_and_store_header_info ( )
inherited

Reads an ExodusII mesh file header, and stores required information on this object.

Definition at line 882 of file exodusII_io_helper.C.

883{
884 // Read header params from file, storing them in this class's
885 // ExodusHeaderInfo struct. This automatically updates the local
886 // num_dim, num_elem, etc. references.
887 this->header_info = this->read_header();
888
889 // Read the number of timesteps which are present in the file
890 this->read_num_time_steps();
891
892 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_NODAL, &num_nodal_vars);
893 EX_CHECK_ERR(ex_err, "Error reading number of nodal variables.");
894
895 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_ELEM_BLOCK, &num_elem_vars);
896 EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
897
898 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_GLOBAL, &num_global_vars);
899 EX_CHECK_ERR(ex_err, "Error reading number of global variables.");
900
901 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_SIDE_SET, &num_sideset_vars);
902 EX_CHECK_ERR(ex_err, "Error reading number of sideset variables.");
903
904 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_NODE_SET, &num_nodeset_vars);
905 EX_CHECK_ERR(ex_err, "Error reading number of nodeset variables.");
906
907 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_ELEM_SET, &num_elemset_vars);
908 EX_CHECK_ERR(ex_err, "Error reading number of elemset variables.");
909
910 message("Exodus header info retrieved successfully.");
911}
ExodusHeaderInfo read_header() const
Reads an ExodusII mesh file header, leaving this object's internal data structures unchanged.
void read_num_time_steps()
Reads the number of timesteps currently stored in the Exodus file and stores it in the num_time_steps...

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::header_info, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ExodusII_IO_Helper::num_elemset_vars, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ExodusII_IO_Helper::num_nodal_vars, libMesh::ExodusII_IO_Helper::num_nodeset_vars, libMesh::ExodusII_IO_Helper::num_sideset_vars, libMesh::ExodusII_IO_Helper::read_header(), and libMesh::ExodusII_IO_Helper::read_num_time_steps().

◆ read_bex_cv_blocks()

void libMesh::ExodusII_IO_Helper::read_bex_cv_blocks ( )
inherited

Reads the optional bex_cv_blocks from the ExodusII mesh file.

Definition at line 1067 of file exodusII_io_helper.C.

1068{
1069 // If a bex blob exists, we look for Bezier Extraction coefficient
1070 // data there.
1071
1072 // These APIs require newer Exodus than 5.22
1073#if EX_API_VERS_NODOT >= 800
1074 int n_blobs = exII::ex_inquire_int(ex_id, exII::EX_INQ_BLOB);
1075
1076 if (n_blobs > 0)
1077 {
1078 std::vector<exII::ex_blob> blobs(n_blobs);
1079 std::vector<std::vector<char>> blob_names(n_blobs);
1080 for (auto i : make_range(n_blobs))
1081 {
1082 blob_names[i].resize(libmesh_max_str_length+1);
1083 blobs[i].name = blob_names[i].data();
1084 }
1085
1086 ex_err = exII::ex_get_blobs(ex_id, blobs.data());
1087 EX_CHECK_ERR(ex_err, "Error getting blobs.");
1088
1089 bool found_blob = false;
1090 const exII::ex_blob * my_blob = &blobs[0];
1091 for (const auto & blob : blobs)
1092 {
1093 if (std::string("bex_cv_blob") == blob.name)
1094 {
1095 found_blob = true;
1096 my_blob = &blob;
1097 }
1098 }
1099
1100 if (!found_blob)
1101 libmesh_error_msg("Found no bex_cv_blob for bezier elements");
1102
1103 const int n_blob_attr =
1104 exII::ex_get_attribute_count(ex_id, exII::EX_BLOB,
1105 my_blob->id);
1106
1107 std::vector<exII::ex_attribute> attributes(n_blob_attr);
1108 ex_err = exII::ex_get_attribute_param(ex_id, exII::EX_BLOB,
1109 my_blob->id,
1110 attributes.data());
1111 EX_CHECK_ERR(ex_err, "Error getting bex blob attribute parameters.");
1112
1113 int bex_num_dense_cv_blocks = 0;
1114 std::vector<int> bex_dense_cv_info;
1115 for (auto & attr : attributes)
1116 {
1117 if (std::string("bex_dense_cv_info") == attr.name)
1118 {
1119 const std::size_t value_count = attr.value_count;
1120 if (value_count % 2)
1121 libmesh_error_msg("Found odd number of bex_dense_cv_info");
1122
1123 bex_dense_cv_info.resize(value_count);
1124 attr.values = bex_dense_cv_info.data();
1125 exII::ex_get_attribute(ex_id, &attr);
1126
1127 bex_num_dense_cv_blocks = value_count / 2;
1128
1129 libmesh_error_msg_if(bex_num_dense_cv_blocks > 1,
1130 "Found more than 1 dense bex CV block; unsure how to handle that");
1131 }
1132 }
1133
1134 if (bex_dense_cv_info.empty())
1135 libmesh_error_msg("No bex_dense_cv_info found");
1136
1137 int n_blob_vars;
1138 exII::ex_get_variable_param(ex_id, exII::EX_BLOB, &n_blob_vars);
1139 std::vector<char> var_name (libmesh_max_str_length + 1);
1140 for (auto v_id : make_range(1,n_blob_vars+1))
1141 {
1142 ex_err = exII::ex_get_variable_name(ex_id, exII::EX_BLOB, v_id, var_name.data());
1143 EX_CHECK_ERR(ex_err, "Error reading bex blob var name.");
1144
1145 if (std::string("bex_dense_cv_blocks") == var_name.data())
1146 {
1147 std::vector<double> bex_dense_cv_blocks(my_blob->num_entry);
1148
1149 ex_err = exII::ex_get_var(ex_id, 1, exII::EX_BLOB, v_id,
1150 my_blob->id, my_blob->num_entry,
1151 bex_dense_cv_blocks.data());
1152 EX_CHECK_ERR(ex_err, "Error reading bex_dense_cv_blocks.");
1153
1155 bex_dense_constraint_vecs.resize(bex_num_dense_cv_blocks);
1156
1157 std::size_t offset = 0;
1158 for (auto i : IntRange<std::size_t>(0, bex_num_dense_cv_blocks))
1159 {
1160 bex_dense_constraint_vecs[i].resize(bex_dense_cv_info[2*i]);
1161 const int vecsize = bex_dense_cv_info[2*i+1];
1162 for (auto & vec : bex_dense_constraint_vecs[i])
1163 {
1164 vec.resize(vecsize);
1165 std::copy(std::next(bex_dense_cv_blocks.begin(), offset),
1166 std::next(bex_dense_cv_blocks.begin(), offset + vecsize),
1167 vec.begin());
1168 offset += vecsize;
1169 }
1170 }
1171 libmesh_assert(offset == bex_dense_cv_blocks.size());
1172 }
1173 }
1174 }
1175#endif // EX_API_VERS_NODOT >= 800
1176}
std::vector< std::vector< std::vector< Real > > > bex_dense_constraint_vecs
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
Definition int_range.h:54

References libMesh::ExodusII_IO_Helper::bex_dense_constraint_vecs, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::libmesh_assert(), and libMesh::make_range().

◆ read_block_info()

void libMesh::ExodusII_IO_Helper::read_block_info ( )
inherited

Reads information for all of the blocks in the ExodusII mesh file.

Definition at line 1187 of file exodusII_io_helper.C.

1188{
1189 if (num_elem_blk)
1190 {
1191 // Read all element block IDs.
1192 block_ids.resize(num_elem_blk);
1193 ex_err = exII::ex_get_ids(ex_id,
1194 exII::EX_ELEM_BLOCK,
1195 block_ids.data());
1196
1197 EX_CHECK_ERR(ex_err, "Error getting block IDs.");
1198 message("All block IDs retrieved successfully.");
1199
1200 char name_buffer[libmesh_max_str_length+1];
1201 for (int i=0; i<num_elem_blk; ++i)
1202 {
1203 ex_err = exII::ex_get_name(ex_id, exII::EX_ELEM_BLOCK,
1204 block_ids[i], name_buffer);
1205 EX_CHECK_ERR(ex_err, "Error getting block name.");
1206 id_to_block_names[block_ids[i]] = name_buffer;
1207 }
1208 message("All block names retrieved successfully.");
1209 }
1210
1211 if (num_edge_blk)
1212 {
1213 // Read all edge block IDs.
1215 ex_err = exII::ex_get_ids(ex_id,
1216 exII::EX_EDGE_BLOCK,
1217 edge_block_ids.data());
1218
1219 EX_CHECK_ERR(ex_err, "Error getting edge block IDs.");
1220 message("All edge block IDs retrieved successfully.");
1221
1222 // Read in edge block names
1223 char name_buffer[libmesh_max_str_length+1];
1224 for (int i=0; i<num_edge_blk; ++i)
1225 {
1226 ex_err = exII::ex_get_name(ex_id, exII::EX_EDGE_BLOCK,
1227 edge_block_ids[i], name_buffer);
1228 EX_CHECK_ERR(ex_err, "Error getting block name.");
1229 id_to_edge_block_names[edge_block_ids[i]] = name_buffer;
1230 }
1231 message("All edge block names retrieved successfully.");
1232 }
1233}
std::map< int, std::string > id_to_edge_block_names

References libMesh::ExodusII_IO_Helper::block_ids, libMesh::ExodusII_IO_Helper::edge_block_ids, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_to_block_names, libMesh::ExodusII_IO_Helper::id_to_edge_block_names, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_edge_blk, and libMesh::ExodusII_IO_Helper::num_elem_blk.

◆ read_edge_blocks()

void libMesh::ExodusII_IO_Helper::read_edge_blocks ( MeshBase &  mesh)
inherited

Read in edge blocks, storing information in the BoundaryInfo object.

Definition at line 1655 of file exodusII_io_helper.C.

1656{
1657 LOG_SCOPE("read_edge_blocks()", "ExodusII_IO_Helper");
1658
1659 // Check for quick return if there are no edge blocks.
1660 if (num_edge_blk == 0)
1661 return;
1662
1663 // Build data structure that we can quickly search for edges
1664 // and then add required BoundaryInfo information. This is a
1665 // map from edge->key() to a list of (elem_id, edge_id) pairs
1666 // for the Edge in question. Since edge->key() is edge orientation
1667 // invariant, this map does not distinguish different orientations
1668 // of the same Edge. Since edge->key() is also not guaranteed to be
1669 // unique (though it is very unlikely for two distinct edges to have
1670 // the same key()), when we later look up an (elem_id, edge_id) pair
1671 // in the edge_map, we need to verify that the edge indeed matches
1672 // the searched edge by doing some further checks.
1673 typedef std::pair<dof_id_type, unsigned int> ElemEdgePair;
1674 std::unordered_map<dof_id_type, std::vector<ElemEdgePair>> edge_map;
1675 std::unique_ptr<Elem> edge_ptr;
1676 for (const auto & elem : mesh.element_ptr_range())
1677 for (auto e : elem->edge_index_range())
1678 {
1679 elem->build_edge_ptr(edge_ptr, e);
1680 dof_id_type edge_key = edge_ptr->key();
1681
1682 // Creates vector if not already there
1683 auto & vec = edge_map[edge_key];
1684 vec.emplace_back(elem->id(), e);
1685
1686 // If edge_ptr is a higher-order Elem (EDGE3 or higher) then also add
1687 // a map entry for the lower-order (EDGE2) element which has matching
1688 // vertices. This allows us to match lower-order edge blocks to edges
1689 // of higher-order 3D elems (e.g. HEX20, TET10) and simplifies the
1690 // definition of edge blocks.
1691 if (edge_ptr->default_order() != FIRST)
1692 {
1693 // Construct a temporary low-order edge so that we can compute its key()
1694 auto low_order_edge =
1696
1697 // Assign node pointers to low-order edge
1698 for (unsigned int v=0; v<edge_ptr->n_vertices(); ++v)
1699 low_order_edge->set_node(v, edge_ptr->node_ptr(v));
1700
1701 // Compute the key for the temporary low-order edge we just built
1702 dof_id_type low_order_edge_key = low_order_edge->key();
1703
1704 // Add this key to the map associated with the same (elem,
1705 // edge) pair as the higher-order edge
1706 auto & low_order_vec = edge_map[low_order_edge_key];
1707 low_order_vec.emplace_back(elem->id(), e);
1708 }
1709 }
1710
1711 // Get reference to the mesh's BoundaryInfo object, as we will be
1712 // adding edges to this below.
1714
1715 for (const auto & edge_block_id : edge_block_ids)
1716 {
1717 // exII::ex_get_block() output parameters. Unlike the other
1718 // "extended" APIs, exII::ex_get_block() does not use a
1719 // parameter struct.
1720 int num_edge_this_blk = 0;
1721 int num_nodes_per_edge = 0;
1722 int num_edges_per_edge = 0;
1723 int num_faces_per_edge = 0;
1724 int num_attr_per_edge = 0;
1725 ex_err = exII::ex_get_block(ex_id,
1726 exII::EX_EDGE_BLOCK,
1727 edge_block_id,
1728 elem_type.data(),
1729 &num_edge_this_blk,
1730 &num_nodes_per_edge,
1731 &num_edges_per_edge, // 0 or -1 for edge blocks
1732 &num_faces_per_edge, // 0 or -1 for edge blocks
1733 &num_attr_per_edge);
1734
1735 EX_CHECK_ERR(ex_err, "Error getting edge block info.");
1736 message("Info retrieved successfully for block: ", edge_block_id);
1737
1738 // Read in the connectivity of the edges of this block,
1739 // watching out for the case where we actually have no
1740 // elements in this block (possible with parallel files)
1741 connect.resize(num_nodes_per_edge * num_edge_this_blk);
1742
1743 if (!connect.empty())
1744 {
1745 ex_err = exII::ex_get_conn(ex_id,
1746 exII::EX_EDGE_BLOCK,
1747 edge_block_id,
1748 connect.data(), // node_conn
1749 nullptr, // elem_edge_conn (unused)
1750 nullptr); // elem_face_conn (unused)
1751
1752 EX_CHECK_ERR(ex_err, "Error reading block connectivity.");
1753 message("Connectivity retrieved successfully for block: ", edge_block_id);
1754
1755 // All edge types have an identity mapping from the corresponding
1756 // Exodus type, so we don't need to bother with mapping ids, but
1757 // we do need to know what kind of elements to build.
1758 const auto & conv = get_conversion(std::string(elem_type.data()));
1759
1760 // Loop over indices in connectivity array, build edge elements,
1761 // look them up in the edge_map.
1762 for (auto [i, sz] = std::make_tuple(0u, connect.size()); i<sz; i+=num_nodes_per_edge)
1763 {
1764 auto edge = Elem::build(conv.libmesh_elem_type());
1765 for (int n=0; n<num_nodes_per_edge; ++n)
1766 {
1767 auto exodus_node_id = this->connect[i+n];
1768 dof_id_type libmesh_node_id = this->get_libmesh_node_id(exodus_node_id);
1769 edge->set_node(n, mesh.node_ptr(libmesh_node_id));
1770 }
1771
1772 // Compute key for the edge Elem we just built.
1773 dof_id_type edge_key = edge->key();
1774
1775 // If this key is not found in the edge_map, which is
1776 // supposed to include every edge in the Mesh, then we
1777 // will throw an error now.
1778 auto & elem_edge_pair_vec =
1779 libmesh_map_find(edge_map, edge_key);
1780
1781 for (const auto & elem_edge_pair : elem_edge_pair_vec)
1782 {
1783 // We only want to match edges which have the same
1784 // nodes (possibly with different orientation) to the one in the
1785 // Exodus file, otherwise we ignore this elem_edge_pair.
1786 //
1787 // Note: this also handles the situation where two
1788 // edges have the same key (hash collision) as then
1789 // this check avoids a false positive.
1790
1791 // Build edge indicated by elem_edge_pair
1792 mesh.elem_ptr(elem_edge_pair.first)->
1793 build_edge_ptr(edge_ptr, elem_edge_pair.second);
1794
1795 // Determine whether this candidate edge is a "real" match,
1796 // i.e. has the same nodes with a possibly different
1797 // orientation. Note that here we only check that
1798 // the vertices match regardless of how many nodes
1799 // the edge has, which allows us to match a
1800 // lower-order edge to a higher-order Elem.
1801 bool is_match =
1802 ((edge_ptr->node_id(0) == edge->node_id(0)) && (edge_ptr->node_id(1) == edge->node_id(1))) ||
1803 ((edge_ptr->node_id(0) == edge->node_id(1)) && (edge_ptr->node_id(1) == edge->node_id(0)));
1804
1805 if (is_match)
1806 {
1807 // Add this (elem, edge, id) combo to the BoundaryInfo object.
1808 bi.add_edge(elem_edge_pair.first,
1809 elem_edge_pair.second,
1810 edge_block_id);
1811 }
1812 } // end loop over elem_edge_pairs
1813 } // end loop over connectivity array
1814
1815 // Set edgeset name in the BoundaryInfo object.
1816 bi.edgeset_name(edge_block_id) = id_to_edge_block_names[edge_block_id];
1817 } // end if !connect.empty()
1818 } // end for edge_block_id : edge_block_ids
1819}
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
Add edge edge of element number elem with boundary id id to the boundary information data structure.
std::string & edgeset_name(boundary_id_type id)
static ElemType first_order_equivalent_type(const ElemType et)
Definition elem.C:3201
dof_id_type get_libmesh_node_id(int exodus_node_id)
Helper function that takes a (1-based) Exodus node/elem id and determines the corresponding libMesh N...
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition mesh_base.h:170
virtual const Node * node_ptr(const dof_id_type i) const =0

References libMesh::BoundaryInfo::add_edge(), libMesh::Elem::build(), libMesh::Elem::build_edge_ptr(), libMesh::ExodusII_IO_Helper::connect, libMesh::ExodusII_IO_Helper::edge_block_ids, libMesh::Elem::edge_index_range(), libMesh::BoundaryInfo::edgeset_name(), libMesh::MeshBase::elem_ptr(), libMesh::ExodusII_IO_Helper::elem_type, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::FIRST, libMesh::Elem::first_order_equivalent_type(), libMesh::MeshBase::get_boundary_info(), libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::ExodusII_IO_Helper::get_libmesh_node_id(), libMesh::DofObject::id(), libMesh::ExodusII_IO_Helper::id_to_edge_block_names, mesh, libMesh::ExodusII_IO_Helper::message(), libMesh::MeshBase::node_ptr(), and libMesh::ExodusII_IO_Helper::num_edge_blk.

◆ read_elem_in_block()

void libMesh::ExodusII_IO_Helper::read_elem_in_block ( int  block)
inherited

Reads all of the element connectivity for block block in the ExodusII mesh file.

Definition at line 1410 of file exodusII_io_helper.C.

1411{
1412 LOG_SCOPE("read_elem_in_block()", "ExodusII_IO_Helper");
1413
1414 libmesh_assert_less (block, block_ids.size());
1415 elem_node_counts.clear();
1416 elem_face_counts.clear();
1417
1418 // Unlike the other "extended" APIs, this one does not use a parameter struct.
1419 int num_edges_per_elem = 0;
1420 int num_faces_per_elem = 0;
1421 int num_node_data_per_elem = 0;
1422 ex_err = exII::ex_get_block(ex_id,
1423 exII::EX_ELEM_BLOCK,
1424 block_ids[block],
1425 elem_type.data(),
1427 &num_node_data_per_elem,
1428 &num_edges_per_elem, // 0 or -1 if no "extended" block info
1429 &num_faces_per_elem, // 0 or -1 if no "extended" block info
1430 &num_attr);
1431
1432 EX_CHECK_ERR(ex_err, "Error getting block info.");
1433 message("Info retrieved successfully for block: ", block);
1434
1435 // Nemesis uses "Empty" as the element type for blocks with no
1436 // elements on the current processor. There is no element conversion
1437 // for that sentinel type, nor is one needed for an empty block.
1438 const bool is_bezier = is_bezier_elem(elem_type.data());
1439 const Conversion * conversion = nullptr;
1440 if (num_elem_this_blk || is_bezier)
1441 conversion = &get_conversion(std::string(elem_type.data()));
1442
1443 const bool is_c0polygon =
1444 conversion && conversion->libmesh_elem_type() == C0POLYGON;
1445 const bool is_c0polyhedron =
1446 conversion && conversion->libmesh_elem_type() == C0POLYHEDRON;
1447
1448 // Warn or error when we don't currently support reading blocks with extended info.
1449 // Note: the docs say -1 will be returned for this but I found that it was
1450 // actually 0, so not sure which it will be in general.
1451 if (is_c0polyhedron && !(num_edges_per_elem == 0) && !(num_edges_per_elem == -1))
1452 libmesh_error_msg("Error: Exodus NFACED element blocks with edge "
1453 "connectivity are not currently supported.");
1454 else if (!(num_edges_per_elem == 0) && !(num_edges_per_elem == -1))
1455 libmesh_warning("Exodus files with extended edge connectivity not currently supported.");
1456 if (!is_c0polyhedron && !(num_faces_per_elem == 0) && !(num_faces_per_elem == -1))
1457 libmesh_warning("Exodus files with extended face connectivity not currently supported.");
1458
1459 // If we have a Bezier element here, then we've packed constraint
1460 // vector connectivity at the end of the nodal connectivity, and
1461 // num_nodes_per_elem reflected both.
1462 if (is_bezier)
1463 {
1464 libmesh_assert(conversion);
1465 num_nodes_per_elem = conversion->n_nodes;
1466 }
1467 else if (is_c0polygon)
1468 {
1470
1471 if (!elem_node_counts.empty())
1472 {
1473 ex_err = exII::ex_get_entity_count_per_polyhedra
1474 (ex_id,
1475 exII::EX_ELEM_BLOCK,
1476 block_ids[block],
1477 elem_node_counts.data());
1478 EX_CHECK_ERR(ex_err, "Error reading polygon node counts");
1479 }
1480
1481 int counted_nodes = 0;
1482 for (const auto count : elem_node_counts)
1483 counted_nodes += count;
1484
1485 libmesh_error_msg_if(counted_nodes != num_node_data_per_elem,
1486 "Error: Exodus NSIDED block "
1487 << block_ids[block]
1488 << " says it has " << num_node_data_per_elem
1489 << " total node entries, but its per-element "
1490 << "node counts sum to " << counted_nodes << ".");
1491
1493 }
1494 else if (is_c0polyhedron)
1495 {
1496 if (c0polyhedron_face_connect.empty())
1497 this->read_face_blocks();
1498
1500
1501 if (!elem_face_counts.empty())
1502 {
1503 ex_err = exII::ex_get_entity_count_per_polyhedra
1504 (ex_id,
1505 exII::EX_ELEM_BLOCK,
1506 block_ids[block],
1507 elem_face_counts.data());
1508 EX_CHECK_ERR(ex_err, "Error reading polyhedron face counts");
1509 }
1510
1511 int counted_faces = 0;
1512 for (const auto count : elem_face_counts)
1513 counted_faces += count;
1514
1515 libmesh_error_msg_if(counted_faces != num_faces_per_elem,
1516 "Error: Exodus NFACED block "
1517 << block_ids[block]
1518 << " says it has " << num_faces_per_elem
1519 << " total face entries, but its per-element "
1520 << "face counts sum to " << counted_faces << ".");
1521
1523 }
1524 else
1525 num_nodes_per_elem = num_node_data_per_elem;
1526
1527 if (verbose)
1528 {
1529 libMesh::out << "Read a block of " << num_elem_this_blk
1530 << " " << elem_type.data() << "(s)";
1531 if (is_c0polygon)
1532 libMesh::out << " having " << num_node_data_per_elem
1533 << " total node entries.";
1534 else if (is_c0polyhedron)
1535 libMesh::out << " having " << num_faces_per_elem
1536 << " total face entries.";
1537 else
1538 libMesh::out << " having " << num_nodes_per_elem
1539 << " nodes per element.";
1540 libMesh::out << std::endl;
1541 }
1542
1543 // Read in the connectivity of the elements of this block,
1544 // watching out for the case where we actually have no
1545 // elements in this block (possible with parallel files)
1546 connect.resize(is_c0polygon ?
1547 num_node_data_per_elem :
1548 is_c0polyhedron ?
1549 num_faces_per_elem :
1550 num_node_data_per_elem*num_elem_this_blk);
1551
1552 if (!connect.empty())
1553 {
1554 ex_err = exII::ex_get_conn(ex_id,
1555 exII::EX_ELEM_BLOCK,
1556 block_ids[block],
1557 is_c0polyhedron ? nullptr : connect.data(),
1558 nullptr, // elem_edge_conn (unused)
1559 is_c0polyhedron ? connect.data() : nullptr);
1560
1561 EX_CHECK_ERR(ex_err, "Error reading block connectivity.");
1562 message("Connectivity retrieved successfully for block: ", block);
1563 }
1564
1565 // If we had any attributes for this block, check to see if some of
1566 // them were Bezier-extension attributes.
1567
1568 // num_attr above is zero, not actually the number of block attributes?
1569 // ex_get_attr_param *also* gives me zero? Really, Exodus?
1570#if EX_API_VERS_NODOT >= 800
1571 int real_n_attr = exII::ex_get_attribute_count(ex_id, exII::EX_ELEM_BLOCK, block_ids[block]);
1572 EX_CHECK_ERR(real_n_attr, "Error getting number of element block attributes.");
1573
1574 if (real_n_attr > 0)
1575 {
1576 std::vector<exII::ex_attribute> attributes(real_n_attr);
1577
1578 ex_err = exII::ex_get_attribute_param(ex_id, exII::EX_ELEM_BLOCK, block_ids[block], attributes.data());
1579 EX_CHECK_ERR(ex_err, "Error getting element block attribute parameters.");
1580
1581 ex_err = exII::ex_get_attributes(ex_id, real_n_attr, attributes.data());
1582 EX_CHECK_ERR(ex_err, "Error getting element block attribute values.");
1583
1584 for (auto attr : attributes)
1585 {
1586 if (std::string("bex_elem_degrees") == attr.name)
1587 {
1588 if (attr.type != exII::EX_INTEGER)
1589 libmesh_error_msg("Found non-integer bex_elem_degrees");
1590
1591 if (attr.value_count > 3)
1592 libmesh_error_msg("Looking for at most 3 bex_elem_degrees; found " << attr.value_count);
1593
1594 libmesh_assert(is_bezier);
1595
1596 std::vector<int> bex_elem_degrees(3); // max dim
1597
1598 const int * as_int = static_cast<int *>(attr.values);
1599 std::copy(as_int, as_int+attr.value_count, bex_elem_degrees.begin());
1600
1601
1602 // Right now Bezier extraction elements aren't possible
1603 // for p>2 and aren't useful for p<2, and we don't
1604 // support anisotropic p...
1605#ifndef NDEBUG
1606 libmesh_assert(conversion);
1607 for (auto d : IntRange<int>(0, conversion->dim))
1608 libmesh_assert_equal_to(bex_elem_degrees[d], 2);
1609#endif
1610 }
1611 // ex_get_attributes did a values=calloc(); free() is our job.
1612 if (attr.values)
1613 free(attr.values);
1614 }
1615 }
1616
1617 if (is_bezier)
1618 {
1619 // We'd better have the number of cvs we expect
1620 if( num_node_data_per_elem > num_nodes_per_elem )
1621 bex_num_elem_cvs = num_node_data_per_elem / 2;
1622 else
1624 libmesh_assert_greater_equal(bex_num_elem_cvs, 0);
1625
1626 // The old connect vector is currently a mix of the expected
1627 // connectivity and any Bezier extraction connectivity;
1628 // disentangle that, if necessary.
1630 if (num_node_data_per_elem > num_nodes_per_elem)
1631 {
1632 std::vector<int> old_connect(bex_num_elem_cvs * num_elem_this_blk);
1633 old_connect.swap(connect);
1634 auto src = old_connect.data();
1635 auto dst = connect.data();
1636 for (auto e : IntRange<std::size_t>(0, num_elem_this_blk))
1637 {
1638 std::copy(src, src + bex_num_elem_cvs, dst);
1639 src += bex_num_elem_cvs;
1640 dst += bex_num_elem_cvs;
1641
1642 bex_cv_conn[e].resize(bex_num_elem_cvs);
1643 std::copy(src, src + bex_num_elem_cvs,
1644 bex_cv_conn[e].begin());
1645 src += bex_num_elem_cvs;
1646 }
1647 }
1648 }
1649
1650#endif // EX_API_VERS_NODOT >= 800
1651}
unsigned int dim
void ErrorVector unsigned int
void read_face_blocks()
Reads NSIDED face blocks used by NFACED element blocks.
std::vector< std::vector< long unsigned int > > bex_cv_conn

References libMesh::ExodusII_IO_Helper::bex_cv_conn, libMesh::ExodusII_IO_Helper::bex_num_elem_cvs, libMesh::ExodusII_IO_Helper::block_ids, libMesh::C0POLYGON, libMesh::C0POLYHEDRON, libMesh::ExodusII_IO_Helper::c0polyhedron_face_connect, libMesh::ExodusII_IO_Helper::connect, libMesh::ExodusII_IO_Helper::Conversion::dim, libMesh::ExodusII_IO_Helper::elem_face_counts, libMesh::ExodusII_IO_Helper::elem_node_counts, libMesh::ExodusII_IO_Helper::elem_type, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::libmesh_assert(), libMesh::ExodusII_IO_Helper::Conversion::libmesh_elem_type(), libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::Conversion::n_nodes, libMesh::ExodusII_IO_Helper::num_attr, libMesh::ExodusII_IO_Helper::num_elem_this_blk, libMesh::ExodusII_IO_Helper::num_nodes_per_elem, libMesh::out, libMesh::ExodusII_IO_Helper::read_face_blocks(), and libMesh::ExodusII_IO_Helper::verbose.

◆ read_elem_num_map()

void libMesh::ExodusII_IO_Helper::read_elem_num_map ( )
inherited

Reads the optional node_num_map from the ExodusII mesh file.

Definition at line 1823 of file exodusII_io_helper.C.

1824{
1825 elem_num_map.resize(num_elem);
1826
1827 // Note: we cannot use the exII::ex_get_num_map() here because it
1828 // (apparently) does not behave like ex_get_elem_num_map() when
1829 // there is no elem number map in the file: it throws an error
1830 // instead of returning a default identity array (1,2,3,...).
1831 ex_err = exII::ex_get_elem_num_map
1832 (ex_id, elem_num_map.empty() ? nullptr : elem_num_map.data());
1833
1834 EX_CHECK_ERR(ex_err, "Error retrieving element number map.");
1835 message("Element numbering map retrieved successfully.");
1836
1837 if (num_elem)
1838 {
1839 // The elem_num_map may contain ids larger than num_elem. In
1840 // other words, the elem_num_map is not necessarily just a
1841 // permutation of the "trivial" 1,2,3,... mapping, it can
1842 // contain effectively "any" numbers. Therefore, to get
1843 // "_end_elem_id", we need to check what the max entry in the
1844 // elem_num_map is.
1845 auto it = std::max_element(elem_num_map.begin(), elem_num_map.end());
1846 _end_elem_id = *it;
1847 }
1848 else
1849 _end_elem_id = 0;
1850
1851 if (verbose)
1852 {
1853 libMesh::out << "[" << this->processor_id() << "] elem_num_map[i] = ";
1854 for (unsigned int i=0; i<static_cast<unsigned int>(std::min(10, num_elem-1)); ++i)
1855 libMesh::out << elem_num_map[i] << ", ";
1856 libMesh::out << "... " << elem_num_map.back() << std::endl;
1857 }
1858}

References libMesh::ExodusII_IO_Helper::_end_elem_id, libMesh::ExodusII_IO_Helper::elem_num_map, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_elem, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ read_elemental_var_values()

void libMesh::ExodusII_IO_Helper::read_elemental_var_values ( std::string  elemental_var_name,
int  time_step,
std::map< dof_id_type, Real > &  elem_var_value_map 
)
inherited

Reads elemental values for the variable 'elemental_var_name' at the specified timestep into the 'elem_var_value_map' which is passed in.

Definition at line 2417 of file exodusII_io_helper.C.

2420{
2421 LOG_SCOPE("read_elemental_var_values()", "ExodusII_IO_Helper");
2422
2424
2425 // See if we can find the variable we are looking for
2426 unsigned int var_index = 0;
2427 bool found = false;
2428
2429 // Do a linear search for elem_var_name in elemental_var_names
2430 for (; var_index != elem_var_names.size(); ++var_index)
2431 if (elem_var_names[var_index] == elemental_var_name)
2432 {
2433 found = true;
2434 break;
2435 }
2436
2437 if (!found)
2438 {
2439 libMesh::err << "Available variables: " << std::endl;
2440 for (const auto & var_name : elem_var_names)
2441 libMesh::err << var_name << std::endl;
2442
2443 libmesh_error_msg("Unable to locate variable named: " << elemental_var_name);
2444 }
2445
2446 // Sequential index which we can use to look up the element ID in the elem_num_map.
2447 unsigned ex_el_num = 0;
2448
2449 // Element variable truth table
2450 std::vector<int> var_table(block_ids.size() * elem_var_names.size());
2451 exII::ex_get_truth_table(ex_id, exII::EX_ELEM_BLOCK, block_ids.size(), elem_var_names.size(), var_table.data());
2452
2453 for (unsigned i=0; i<static_cast<unsigned>(num_elem_blk); i++)
2454 {
2455 ex_err = exII::ex_get_block(ex_id,
2456 exII::EX_ELEM_BLOCK,
2457 block_ids[i],
2458 /*elem_type=*/nullptr,
2460 /*num_nodes_per_entry=*/nullptr,
2461 /*num_edges_per_entry=*/nullptr,
2462 /*num_faces_per_entry=*/nullptr,
2463 /*num_attr=*/nullptr);
2464 EX_CHECK_ERR(ex_err, "Error getting number of elements in block.");
2465
2466 // If the current variable isn't active on this subdomain, advance
2467 // the index by the number of elements on this block and go to the
2468 // next loop iteration.
2469 if (!var_table[elem_var_names.size()*i + var_index])
2470 {
2471 ex_el_num += num_elem_this_blk;
2472 continue;
2473 }
2474
2475 std::vector<Real> block_elem_var_values(num_elem_this_blk);
2476
2477 ex_err = exII::ex_get_var
2478 (ex_id,
2479 time_step,
2480 exII::EX_ELEM_BLOCK,
2481 var_index+1,
2482 block_ids[i],
2484 MappedInputVector(block_elem_var_values, _single_precision).data());
2485 EX_CHECK_ERR(ex_err, "Error getting elemental values.");
2486
2487 for (unsigned j=0; j<static_cast<unsigned>(num_elem_this_blk); j++)
2488 {
2489 // Determine the libmesh id of the element with zero-based
2490 // index "ex_el_num". This function expects a one-based
2491 // index, so we add 1 to ex_el_num when we pass it in.
2492 auto libmesh_elem_id =
2493 this->get_libmesh_elem_id(ex_el_num + 1);
2494
2495 // Store the elemental value in the map.
2496 elem_var_value_map[libmesh_elem_id] = block_elem_var_values[j];
2497
2498 // Go to the next sequential element ID.
2499 ex_el_num++;
2500 }
2501 }
2502}
dof_id_type get_libmesh_elem_id(int exodus_elem_id)

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::block_ids, libMesh::ExodusII_IO_Helper::elem_var_names, libMesh::ExodusII_IO_Helper::ELEMENTAL, libMesh::err, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_libmesh_elem_id(), libMesh::ExodusII_IO_Helper::num_elem_blk, libMesh::ExodusII_IO_Helper::num_elem_this_blk, and libMesh::ExodusII_IO_Helper::read_var_names().

◆ read_elemset()

void libMesh::ExodusII_IO_Helper::read_elemset ( int  id,
int  offset 
)
inherited

Reads information about elemset id and inserts it into the global elemset array at the position offset.

Definition at line 2013 of file exodusII_io_helper.C.

2014{
2015 LOG_SCOPE("read_elemset()", "ExodusII_IO_Helper");
2016
2017 libmesh_assert_less (id, elemset_ids.size());
2018 libmesh_assert_less (id, num_elems_per_set.size());
2019 libmesh_assert_less (id, num_elem_df_per_set.size());
2020 libmesh_assert_less_equal (offset, elemset_list.size());
2021
2022 ex_err = exII::ex_get_set_param(ex_id,
2023 exII::EX_ELEM_SET,
2024 elemset_ids[id],
2025 &num_elems_per_set[id],
2026 &num_elem_df_per_set[id]);
2027 EX_CHECK_ERR(ex_err, "Error retrieving elemset parameters.");
2028 message("Parameters retrieved successfully for elemset: ", id);
2029
2030
2031 // It's OK for offset==elemset_list.size() as long as num_elems_per_set[id]==0
2032 // because in that case we don't actually read anything...
2033 #ifdef DEBUG
2034 if (static_cast<unsigned int>(offset) == elemset_list.size())
2035 libmesh_assert_equal_to (num_elems_per_set[id], 0);
2036 #endif
2037
2038 // Don't call ex_get_set() unless there are actually elems there to get.
2039 // Exodus prints an annoying warning in DEBUG mode otherwise...
2040 if (num_elems_per_set[id] > 0)
2041 {
2042 ex_err = exII::ex_get_set(ex_id,
2043 exII::EX_ELEM_SET,
2044 elemset_ids[id],
2045 &elemset_list[offset],
2046 /*set_extra_list=*/nullptr);
2047 EX_CHECK_ERR(ex_err, "Error retrieving elemset data.");
2048 message("Data retrieved successfully for elemset: ", id);
2049
2050 // Create vector containing elemset ids for each element in the set
2051 for (int i=0; i<num_elems_per_set[id]; i++)
2052 elemset_id_list[i+offset] = elemset_ids[id];
2053 }
2054}
std::vector< int > num_elem_df_per_set

References libMesh::ExodusII_IO_Helper::elemset_id_list, libMesh::ExodusII_IO_Helper::elemset_ids, libMesh::ExodusII_IO_Helper::elemset_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_elem_df_per_set, and libMesh::ExodusII_IO_Helper::num_elems_per_set.

Referenced by libMesh::ExodusII_IO_Helper::write_elemset_data().

◆ read_elemset_data()

void libMesh::ExodusII_IO_Helper::read_elemset_data ( int  timestep,
std::vector< std::string > &  var_names,
std::vector< std::set< elemset_id_type > > &  elemset_ids_in,
std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real > > &  elemset_vals 
)
inherited

Read elemset variables, if any, into the provided data structures.

Definition at line 4828 of file exodusII_io_helper.C.

4833{
4834 LOG_SCOPE("read_elemset_data()", "ExodusII_IO_Helper");
4835
4836 // This reads the elemset variable names into the local
4837 // elemset_var_names data structure.
4838 this->read_var_names(ELEMSET);
4839
4840 // Debugging
4841 // libMesh::out << "elmeset variable names:" << std::endl;
4842 // for (const auto & name : elemset_var_names)
4843 // libMesh::out << name << " ";
4844 // libMesh::out << std::endl;
4845
4846 if (num_elemset_vars)
4847 {
4848 // Debugging
4849 // std::cout << "Reading " << num_elem_sets
4850 // << " elemsets and " << num_elemset_vars
4851 // << " elemset variables." << std::endl;
4852
4853 // Read the elemset data truth table.
4854 std::vector<int> elemset_var_tab(num_elem_sets * num_elemset_vars);
4855 exII::ex_get_truth_table(ex_id,
4856 exII::EX_ELEM_SET, // exII::ex_entity_type
4859 elemset_var_tab.data());
4860 EX_CHECK_ERR(ex_err, "Error reading elemset variable truth table.");
4861
4862 // Debugging
4863 // libMesh::out << "Elemset variable truth table:" << std::endl;
4864 // for (const auto & val : elemset_var_tab)
4865 // libMesh::out << val << " ";
4866 // libMesh::out << std::endl;
4867
4868 // Debugging
4869 // for (auto i : make_range(num_elem_sets))
4870 // {
4871 // for (auto j : make_range(num_elemset_vars))
4872 // libMesh::out << elemset_var_tab[num_elemset_vars*i + j] << " ";
4873 // libMesh::out << std::endl;
4874 // }
4875
4876 // Set up/allocate space in incoming data structures. All vectors are
4877 // num_elemset_vars in length.
4878 var_names = elemset_var_names;
4879 elemset_ids_in.resize(num_elemset_vars);
4880 elemset_vals.resize(num_elemset_vars);
4881
4882 // Read the elemset data
4883 int offset=0;
4884 for (int es=0; es<num_elem_sets; ++es)
4885 {
4886 offset += (es > 0 ? num_elems_per_set[es-1] : 0);
4887 for (int var=0; var<num_elemset_vars; ++var)
4888 {
4889 int is_present = elemset_var_tab[num_elemset_vars*es + var];
4890
4891 if (is_present)
4892 {
4893 // Debugging
4894 // libMesh::out << "Variable " << var << " is present on elemset " << es << std::endl;
4895
4896 // Record the fact that this variable is defined on this elemset.
4897 elemset_ids_in[var].insert(elemset_ids[es]);
4898
4899 // Note: the assumption here is that a previous call
4900 // to this->read_elemset_info() has already set the
4901 // values of num_elems_per_set, so we just use those values here.
4902 std::vector<Real> elemset_var_vals(num_elems_per_set[es]);
4903 ex_err = exII::ex_get_var
4904 (ex_id,
4905 timestep,
4906 exII::EX_ELEM_SET, // exII::ex_entity_type
4907 var + 1, // 1-based sideset variable index!
4908 elemset_ids[es],
4910 MappedInputVector(elemset_var_vals, _single_precision).data());
4911 EX_CHECK_ERR(ex_err, "Error reading elemset variable.");
4912
4913 for (int i=0; i<num_elems_per_set[es]; ++i)
4914 {
4915 dof_id_type exodus_elem_id = elemset_list[i + offset];
4916
4917 // FIXME: We should use exodus_elem_num_to_libmesh for this,
4918 // but it apparently is never set up, so just
4919 // subtract 1 from the Exodus elem id.
4920 dof_id_type converted_elem_id = exodus_elem_id - 1;
4921
4922 // Make key based on the elem and set ids
4923 auto key = std::make_pair(converted_elem_id,
4924 static_cast<elemset_id_type>(elemset_ids[es]));
4925
4926 // Store value in the map
4927 elemset_vals[var].emplace(key, elemset_var_vals[i]);
4928 } // end for (i)
4929 } // end if (present)
4930 } // end for (var)
4931 } // end for (es)
4932 } // end if (num_elemset_vars)
4933}
std::vector< std::string > elemset_var_names

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ELEMSET, libMesh::ExodusII_IO_Helper::elemset_ids, libMesh::ExodusII_IO_Helper::elemset_list, libMesh::ExodusII_IO_Helper::elemset_var_names, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::num_elem_sets, libMesh::ExodusII_IO_Helper::num_elems_per_set, libMesh::ExodusII_IO_Helper::num_elemset_vars, and libMesh::ExodusII_IO_Helper::read_var_names().

◆ read_elemset_info()

void libMesh::ExodusII_IO_Helper::read_elemset_info ( )
inherited

Reads information about all of the elemsets in the ExodusII mesh file.

Definition at line 1926 of file exodusII_io_helper.C.

1927{
1928 elemset_ids.resize(num_elem_sets);
1929 if (num_elem_sets > 0)
1930 {
1931 ex_err = exII::ex_get_ids(ex_id,
1932 exII::EX_ELEM_SET,
1933 elemset_ids.data());
1934 EX_CHECK_ERR(ex_err, "Error retrieving elemset information.");
1935 message("All elemset information retrieved successfully.");
1936
1937 // Resize appropriate data structures -- only do this once outside the loop
1940
1941 // Inquire about the length of the concatenated elemset list
1943 inquire(*this, exII::EX_INQ_ELS_LEN,
1944 "Error retrieving length of the concatenated elem sets element list!");
1945
1948
1949 // Debugging
1950 // libMesh::out << "num_elem_all_elemsets = " << num_elem_all_elemsets << std::endl;
1951 }
1952
1953 char name_buffer[libmesh_max_str_length+1];
1954 for (int i=0; i<num_elem_sets; ++i)
1955 {
1956 ex_err = exII::ex_get_name(ex_id, exII::EX_ELEM_SET,
1957 elemset_ids[i], name_buffer);
1958 EX_CHECK_ERR(ex_err, "Error getting node set name.");
1959 id_to_elemset_names[elemset_ids[i]] = name_buffer;
1960 }
1961 message("All elem set names retrieved successfully.");
1962}
std::map< int, std::string > id_to_elemset_names

References libMesh::ExodusII_IO_Helper::elemset_id_list, libMesh::ExodusII_IO_Helper::elemset_ids, libMesh::ExodusII_IO_Helper::elemset_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_to_elemset_names, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_elem_all_elemsets, libMesh::ExodusII_IO_Helper::num_elem_df_per_set, libMesh::ExodusII_IO_Helper::num_elem_sets, and libMesh::ExodusII_IO_Helper::num_elems_per_set.

Referenced by libMesh::ExodusII_IO_Helper::write_elemset_data().

◆ read_face_blocks()

void libMesh::ExodusII_IO_Helper::read_face_blocks ( )
inherited

Reads NSIDED face blocks used by NFACED element blocks.

Definition at line 1290 of file exodusII_io_helper.C.

1291{
1292 LOG_SCOPE("read_face_blocks()", "ExodusII_IO_Helper");
1293
1294 if (!c0polyhedron_face_connect.empty())
1295 return;
1296
1297 libmesh_error_msg_if(num_face_blk == 0,
1298 "Error: Exodus NFACED element block found, "
1299 "but the file has no face blocks.");
1300
1301 std::vector<int> face_block_ids(num_face_blk);
1302 ex_err = exII::ex_get_ids(ex_id,
1303 exII::EX_FACE_BLOCK,
1304 face_block_ids.data());
1305 EX_CHECK_ERR(ex_err, "Error getting face block IDs.");
1306
1309
1310 for (auto block : index_range(face_block_ids))
1311 {
1312 std::vector<char> face_type(libmesh_max_str_length+1);
1313 int num_face_this_blk = 0;
1314 int num_node_data_this_blk = 0;
1315 int num_edges_per_face = 0;
1316 int num_faces_per_face = 0;
1317 int num_attr_face = 0;
1318
1319 ex_err = exII::ex_get_block(ex_id,
1320 exII::EX_FACE_BLOCK,
1321 face_block_ids[block],
1322 face_type.data(),
1323 &num_face_this_blk,
1324 &num_node_data_this_blk,
1325 &num_edges_per_face,
1326 &num_faces_per_face,
1327 &num_attr_face);
1328 EX_CHECK_ERR(ex_err, "Error getting face block info.");
1329
1330 const auto & conv = get_conversion(std::string(face_type.data()));
1331 libmesh_error_msg_if(conv.libmesh_elem_type() != C0POLYGON,
1332 "Error: NFACED polyhedron input currently expects "
1333 "NSIDED face blocks, but face block "
1334 << face_block_ids[block] << " has Exodus type "
1335 << face_type.data() << ".");
1336
1337 libmesh_error_msg_if
1338 (!(num_edges_per_face == 0) && !(num_edges_per_face == -1),
1339 "Error: Exodus NSIDED face block "
1340 << face_block_ids[block]
1341 << " has edge connectivity, which NFACED polyhedron input "
1342 << "does not currently support.");
1343 libmesh_error_msg_if
1344 (!(num_faces_per_face == 0) && !(num_faces_per_face == -1),
1345 "Error: Exodus NSIDED face block "
1346 << face_block_ids[block]
1347 << " has face-in-face connectivity, which NFACED polyhedron "
1348 << "input does not currently support.");
1349
1350 std::vector<int> face_node_counts(num_face_this_blk);
1351 if (!face_node_counts.empty())
1352 {
1353 ex_err = exII::ex_get_entity_count_per_polyhedra
1354 (ex_id,
1355 exII::EX_FACE_BLOCK,
1356 face_block_ids[block],
1357 face_node_counts.data());
1358 EX_CHECK_ERR(ex_err, "Error reading polyhedron face node counts");
1359 }
1360
1361 int counted_nodes = 0;
1362 for (const auto count : face_node_counts)
1363 counted_nodes += count;
1364
1365 libmesh_error_msg_if(counted_nodes != num_node_data_this_blk,
1366 "Error: Exodus NSIDED face block "
1367 << face_block_ids[block]
1368 << " says it has " << num_node_data_this_blk
1369 << " total node entries, but its per-face "
1370 << "node counts sum to " << counted_nodes << ".");
1371
1372 std::vector<int> face_connect(num_node_data_this_blk);
1373 if (!face_connect.empty())
1374 {
1375 ex_err = exII::ex_get_conn(ex_id,
1376 exII::EX_FACE_BLOCK,
1377 face_block_ids[block],
1378 face_connect.data(),
1379 nullptr,
1380 nullptr);
1381 EX_CHECK_ERR(ex_err, "Error reading polyhedron face connectivity.");
1382 }
1383
1384 std::size_t offset = 0;
1385 for (const auto count : face_node_counts)
1386 {
1387 libmesh_error_msg_if(count < 3,
1388 "Error: Exodus NSIDED face block "
1389 << face_block_ids[block]
1390 << " has a face with only "
1391 << count << " nodes.");
1392
1393 c0polyhedron_face_connect.emplace_back
1394 (face_connect.begin() + offset,
1395 face_connect.begin() + offset + count);
1396 offset += count;
1397 }
1398 }
1399
1400 libmesh_error_msg_if(c0polyhedron_face_connect.size() !=
1401 cast_int<std::size_t>(num_face),
1402 "Error: Exodus file says it has "
1403 << num_face << " faces, but its face blocks contain "
1404 << c0polyhedron_face_connect.size() << " faces.");
1405}

References libMesh::C0POLYGON, libMesh::ExodusII_IO_Helper::c0polyhedron_face_connect, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::index_range(), libMesh::ExodusII_IO_Helper::num_face, and libMesh::ExodusII_IO_Helper::num_face_blk.

Referenced by libMesh::ExodusII_IO_Helper::read_elem_in_block().

◆ read_global_values()

void libMesh::ExodusII_IO_Helper::read_global_values ( std::vector< Real > &  values,
int  timestep 
)
inherited

Reads the vector of global variables.

Definition at line 5445 of file exodusII_io_helper.C.

5446{
5447 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5448 return;
5449
5450 values.clear();
5451 values.resize(num_global_vars);
5452 ex_err = exII::ex_get_var
5453 (ex_id,
5454 timestep,
5455 exII::EX_GLOBAL,
5456 1, // var_index
5457 1, // obj_id
5459 MappedInputVector(values, _single_precision).data());
5460
5461 EX_CHECK_ERR(ex_err, "Error reading global values.");
5462}

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::num_global_vars, and libMesh::ParallelObject::processor_id().

◆ read_header()

ExodusHeaderInfo libMesh::ExodusII_IO_Helper::read_header ( ) const
inherited

Reads an ExodusII mesh file header, leaving this object's internal data structures unchanged.

Definition at line 850 of file exodusII_io_helper.C.

851{
852 // Read init params using newer API that reads into a struct. For
853 // backwards compatibility, assign local member values from struct
854 // afterwards. Note: using the new API allows us to automatically
855 // read edge and face block/set information if it's present in the
856 // file.
857 exII::ex_init_params params = {};
858 int err_flag = exII::ex_get_init_ext(ex_id, &params);
859 EX_CHECK_ERR(err_flag, "Error retrieving header info.");
860
861 // Extract required data into our struct
863 h.title.assign(params.title, params.title + MAX_LINE_LENGTH);
864 h.num_dim = params.num_dim;
865 h.num_nodes = params.num_nodes;
866 h.num_elem = params.num_elem;
867 h.num_elem_blk = params.num_elem_blk;
868 h.num_node_sets = params.num_node_sets;
869 h.num_side_sets = params.num_side_sets;
870 h.num_elem_sets = params.num_elem_sets;
871 h.num_edge_blk = params.num_edge_blk;
872 h.num_edge = params.num_edge;
873 h.num_face_blk = params.num_face_blk;
874 h.num_face = params.num_face;
875
876 // And return it
877 return h;
878}
This class is used as both an external data structure for passing around Exodus file header informati...

References libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusHeaderInfo::num_dim, libMesh::ExodusHeaderInfo::num_edge, libMesh::ExodusHeaderInfo::num_edge_blk, libMesh::ExodusHeaderInfo::num_elem, libMesh::ExodusHeaderInfo::num_elem_blk, libMesh::ExodusHeaderInfo::num_elem_sets, libMesh::ExodusHeaderInfo::num_face, libMesh::ExodusHeaderInfo::num_face_blk, libMesh::ExodusHeaderInfo::num_node_sets, libMesh::ExodusHeaderInfo::num_nodes, libMesh::ExodusHeaderInfo::num_side_sets, and libMesh::ExodusHeaderInfo::title.

Referenced by libMesh::ExodusII_IO_Helper::read_and_store_header_info().

◆ read_nodal_var_values()

void libMesh::ExodusII_IO_Helper::read_nodal_var_values ( std::string  nodal_var_name,
int  time_step 
)
inherited

Reads the nodal values for the variable 'nodal_var_name' at the specified time into the 'nodal_var_values' array.

Definition at line 2192 of file exodusII_io_helper.C.

2193{
2194 LOG_SCOPE("read_nodal_var_values()", "ExodusII_IO_Helper");
2195
2196 // Read the nodal variable names from file, so we can see if we have the one we're looking for
2197 this->read_var_names(NODAL);
2198
2199 // See if we can find the variable we are looking for
2200 unsigned int var_index = 0;
2201 bool found = false;
2202
2203 // Do a linear search for nodal_var_name in nodal_var_names
2204 for (; var_index<nodal_var_names.size(); ++var_index)
2205 {
2206 found = (nodal_var_names[var_index] == nodal_var_name);
2207 if (found)
2208 break;
2209 }
2210
2211 if (!found)
2212 {
2213 libMesh::err << "Available variables: " << std::endl;
2214 for (const auto & var_name : nodal_var_names)
2215 libMesh::err << var_name << std::endl;
2216
2217 libmesh_error_msg("Unable to locate variable named: " << nodal_var_name);
2218 }
2219
2220 // Clear out any previously read nodal variable values
2221 this->nodal_var_values.clear();
2222
2223 std::vector<Real> unmapped_nodal_var_values(num_nodes);
2224
2225 // Call the Exodus API to read the nodal variable values
2226 ex_err = exII::ex_get_var
2227 (ex_id,
2228 time_step,
2229 exII::EX_NODAL,
2230 var_index+1,
2231 1, // exII::ex_entity_id, not sure exactly what this is but in the ex_get_nodal_var.c shim, they pass 1
2232 num_nodes,
2233 MappedInputVector(unmapped_nodal_var_values, _single_precision).data());
2234 EX_CHECK_ERR(ex_err, "Error reading nodal variable values!");
2235
2236 for (auto i : make_range(num_nodes))
2237 {
2238 // Determine the libmesh node id implied by "i". The
2239 // get_libmesh_node_id() helper function expects a 1-based
2240 // Exodus node id, so we construct the "implied" Exodus node id
2241 // from "i" by adding 1.
2242 //
2243 // If the user has set the "set_unique_ids_from_maps" flag to
2244 // true, then calling get_libmesh_node_id(i+1) will just return
2245 // i, otherwise it will determine the value (with error
2246 // checking) using this->node_num_map.
2247 auto libmesh_node_id = this->get_libmesh_node_id(/*exodus_node_id=*/i+1);
2248
2249 // Store the nodal value in the map.
2250 this->nodal_var_values[libmesh_node_id] = unmapped_nodal_var_values[i];
2251 }
2252}
std::map< dof_id_type, Real > nodal_var_values

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::err, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_libmesh_node_id(), libMesh::make_range(), libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::nodal_var_names, libMesh::ExodusII_IO_Helper::nodal_var_values, libMesh::ExodusII_IO_Helper::num_nodes, and libMesh::ExodusII_IO_Helper::read_var_names().

◆ read_node_num_map()

void libMesh::ExodusII_IO_Helper::read_node_num_map ( )
inherited

Reads the optional node_num_map from the ExodusII mesh file.

Definition at line 1043 of file exodusII_io_helper.C.

1044{
1045 node_num_map.resize(num_nodes);
1046
1047 // Note: we cannot use the exII::ex_get_num_map() here because it
1048 // (apparently) does not behave like ex_get_node_num_map() when
1049 // there is no node number map in the file: it throws an error
1050 // instead of returning a default identity array (1,2,3,...).
1051 ex_err = exII::ex_get_node_num_map
1052 (ex_id, node_num_map.empty() ? nullptr : node_num_map.data());
1053
1054 EX_CHECK_ERR(ex_err, "Error retrieving nodal number map.");
1055 message("Nodal numbering map retrieved successfully.");
1056
1057 if (verbose)
1058 {
1059 libMesh::out << "[" << this->processor_id() << "] node_num_map[i] = ";
1060 for (unsigned int i=0; i<static_cast<unsigned int>(std::min(10, num_nodes-1)); ++i)
1061 libMesh::out << node_num_map[i] << ", ";
1062 libMesh::out << "... " << node_num_map.back() << std::endl;
1063 }
1064}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::node_num_map, libMesh::ExodusII_IO_Helper::num_nodes, libMesh::out, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::verbose.

◆ read_nodes()

void libMesh::ExodusII_IO_Helper::read_nodes ( )
inherited

Reads the nodal data (x,y,z coordinates) from the ExodusII mesh file.

Definition at line 992 of file exodusII_io_helper.C.

993{
994 LOG_SCOPE("read_nodes()", "ExodusII_IO_Helper");
995
996 x.resize(num_nodes);
997 y.resize(num_nodes);
998 z.resize(num_nodes);
999
1000 if (num_nodes)
1001 {
1002 ex_err = exII::ex_get_coord
1003 (ex_id,
1004 MappedInputVector(x, _single_precision).data(),
1005 MappedInputVector(y, _single_precision).data(),
1006 MappedInputVector(z, _single_precision).data());
1007
1008 EX_CHECK_ERR(ex_err, "Error retrieving nodal data.");
1009 message("Nodal data retrieved successfully.");
1010 }
1011
1012 // If a nodal attribute bex_weight exists, we get spline weights
1013 // from it
1014 int n_nodal_attr = 0;
1015 ex_err = exII::ex_get_attr_param(ex_id, exII::EX_NODAL, 0, & n_nodal_attr);
1016 EX_CHECK_ERR(ex_err, "Error getting number of nodal attributes.");
1017
1018 if (n_nodal_attr > 0)
1019 {
1020 std::vector<std::vector<char>> attr_name_data
1021 (n_nodal_attr, std::vector<char>(libmesh_max_str_length + 1));
1022 std::vector<char *> attr_names(n_nodal_attr);
1023 for (auto i : index_range(attr_names))
1024 attr_names[i] = attr_name_data[i].data();
1025
1026 ex_err = exII::ex_get_attr_names(ex_id, exII::EX_NODAL, 0, attr_names.data());
1027 EX_CHECK_ERR(ex_err, "Error getting nodal attribute names.");
1028
1029 for (auto i : index_range(attr_names))
1030 if (std::string("bex_weight") == attr_names[i])
1031 {
1032 w.resize(num_nodes);
1033 ex_err =
1034 exII::ex_get_one_attr (ex_id, exII::EX_NODAL, 0, i+1,
1035 MappedInputVector(w, _single_precision).data());
1036 EX_CHECK_ERR(ex_err, "Error getting Bezier Extraction nodal weights");
1037 }
1038 }
1039}

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ExodusII_IO_Helper::w, libMesh::ExodusII_IO_Helper::x, libMesh::ExodusII_IO_Helper::y, and libMesh::ExodusII_IO_Helper::z.

◆ read_nodeset()

void libMesh::Nemesis_IO_Helper::read_nodeset ( int  id)

Reading functions.

These just allocate memory for you and call the Nemesis routines of the same name. They also handle error checking for the Nemesis return value. Be careful calling these at random, some depend on others being called first... Reads the node ids of nodeset id and stores them in the node_list member of this class.

Note
This used to be an ExodusII_IO_Helper function but it use was completely replaced by read_all_nodesets(). For now, it is still used by the Nemesis reader so we have moved it here.

Definition at line 118 of file nemesis_io_helper.C.

119{
120 libmesh_assert_less (id, nodeset_ids.size());
121 libmesh_assert_less (id, num_nodes_per_set.size());
122 libmesh_assert_less (id, num_node_df_per_set.size());
123
124 ex_err = exII::ex_get_set_param(ex_id,
125 exII::EX_NODE_SET,
126 nodeset_ids[id],
129 EX_CHECK_ERR(ex_err, "Error retrieving nodeset parameters.");
130 message("Parameters retrieved successfully for nodeset: ", id);
131
132 node_list.resize(num_nodes_per_set[id]);
133
134 // Don't call ex_get_set unless there are actually nodes there to get.
135 // Exodus prints an annoying warning message in DEBUG mode otherwise...
136 if (num_nodes_per_set[id] > 0)
137 {
138 ex_err = exII::ex_get_set(ex_id,
139 exII::EX_NODE_SET,
140 nodeset_ids[id],
141 node_list.data(),
142 nullptr); // set_extra_list, ignored for node sets
143
144 EX_CHECK_ERR(ex_err, "Error retrieving nodeset data.");
145 message("Data retrieved successfully for nodeset: ", id);
146 }
147}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), node_list, libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::num_node_df_per_set, and libMesh::ExodusII_IO_Helper::num_nodes_per_set.

◆ read_nodeset_data()

void libMesh::ExodusII_IO_Helper::read_nodeset_data ( int  timestep,
std::vector< std::string > &  var_names,
std::vector< std::set< boundary_id_type > > &  node_boundary_ids,
std::vector< std::map< BoundaryInfo::NodeBCTuple, Real > > &  bc_vals 
)
inherited

Read nodeset variables, if any, into the provided data structures.

Definition at line 4980 of file exodusII_io_helper.C.

4985{
4986 LOG_SCOPE("read_nodeset_data()", "ExodusII_IO_Helper");
4987
4988 // This reads the sideset variable names into the local
4989 // sideset_var_names data structure.
4990 this->read_var_names(NODESET);
4991
4992 if (num_nodeset_vars)
4993 {
4994 // Read the nodeset data truth table
4995 std::vector<int> nset_var_tab(num_node_sets * num_nodeset_vars);
4996 ex_err = exII::ex_get_truth_table
4997 (ex_id,
4998 exII::EX_NODE_SET,
5001 nset_var_tab.data());
5002 EX_CHECK_ERR(ex_err, "Error reading nodeset variable truth table.");
5003
5004 // Set up/allocate space in incoming data structures.
5005 var_names = nodeset_var_names;
5006 node_boundary_ids.resize(num_nodeset_vars);
5007 bc_vals.resize(num_nodeset_vars);
5008
5009 // Read the nodeset data.
5010 //
5011 // Note: we assume that the functions
5012 // 1.) this->read_nodeset_info() and
5013 // 2.) this->read_all_nodesets()
5014 // have already been called, so that we already know e.g. how
5015 // many nodes are in each set, their ids, etc.
5016 //
5017 // TODO: As a future optimization, we could read only the values
5018 // requested by the user by looking at the input parameter
5019 // var_names and checking whether it already has entries in
5020 // it.
5021 int offset=0;
5022 for (int ns=0; ns<num_node_sets; ++ns)
5023 {
5024 offset += (ns > 0 ? num_nodes_per_set[ns-1] : 0);
5025 for (int var=0; var<num_nodeset_vars; ++var)
5026 {
5027 int is_present = nset_var_tab[num_nodeset_vars*ns + var];
5028
5029 if (is_present)
5030 {
5031 // Record the fact that this variable is defined on this nodeset.
5032 node_boundary_ids[var].insert(nodeset_ids[ns]);
5033
5034 // Note: the assumption here is that a previous call
5035 // to this->read_nodeset_info() has already set the
5036 // values of num_nodes_per_set, so we just use those values here.
5037 std::vector<Real> nset_var_vals(num_nodes_per_set[ns]);
5038 ex_err = exII::ex_get_var
5039 (ex_id,
5040 timestep,
5041 exII::EX_NODE_SET,
5042 var + 1, // 1-based nodeset variable index!
5043 nodeset_ids[ns],
5045 MappedInputVector(nset_var_vals, _single_precision).data());
5046 EX_CHECK_ERR(ex_err, "Error reading nodeset variable.");
5047
5048 for (int i=0; i<num_nodes_per_set[ns]; ++i)
5049 {
5050 // The read_all_nodesets() function now reads all the node ids into the
5051 // node_sets_node_list vector, which is of length "total_nodes_in_all_sets"
5052 // The old read_nodset() function is no longer called as far as I can tell,
5053 // and should probably be removed? The "offset" that we are using only
5054 // depends on the current nodeset index and the num_nodes_per_set vector,
5055 // which gets filled in by the call to read_all_nodesets().
5056 dof_id_type exodus_node_id = node_sets_node_list[i + offset];
5057
5058 // FIXME: We should use exodus_node_num_to_libmesh for this,
5059 // but it apparently is never set up, so just
5060 // subtract 1 from the Exodus node id.
5061 dof_id_type converted_node_id = exodus_node_id - 1;
5062
5063 // Make a NodeBCTuple key from the converted information.
5064 BoundaryInfo::NodeBCTuple key = std::make_tuple
5065 (converted_node_id, nodeset_ids[ns]);
5066
5067 // Store (node, b_id) tuples in bc_vals[var]
5068 bc_vals[var].emplace(key, nset_var_vals[i]);
5069 } // end for (i)
5070 } // end if (present)
5071 } // end for (var)
5072 } // end for (ns)
5073 } // end if (num_nodeset_vars)
5074}
std::vector< std::string > nodeset_var_names

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::node_sets_node_list, libMesh::ExodusII_IO_Helper::NODESET, libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::nodeset_var_names, libMesh::ExodusII_IO_Helper::num_node_sets, libMesh::ExodusII_IO_Helper::num_nodes_per_set, libMesh::ExodusII_IO_Helper::num_nodeset_vars, and libMesh::ExodusII_IO_Helper::read_var_names().

◆ read_nodeset_info()

void libMesh::ExodusII_IO_Helper::read_nodeset_info ( )
inherited

Reads information about all of the nodesets in the ExodusII mesh file.

Definition at line 1897 of file exodusII_io_helper.C.

1898{
1899 nodeset_ids.resize(num_node_sets);
1900 if (num_node_sets > 0)
1901 {
1902 ex_err = exII::ex_get_ids(ex_id,
1903 exII::EX_NODE_SET,
1904 nodeset_ids.data());
1905 EX_CHECK_ERR(ex_err, "Error retrieving nodeset information.");
1906 message("All nodeset information retrieved successfully.");
1907
1908 // Resize appropriate data structures -- only do this once outside the loop
1911 }
1912
1913 char name_buffer[libmesh_max_str_length+1];
1914 for (int i=0; i<num_node_sets; ++i)
1915 {
1916 ex_err = exII::ex_get_name(ex_id, exII::EX_NODE_SET,
1917 nodeset_ids[i], name_buffer);
1918 EX_CHECK_ERR(ex_err, "Error getting node set name.");
1919 id_to_ns_names[nodeset_ids[i]] = name_buffer;
1920 }
1921 message("All node set names retrieved successfully.");
1922}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_to_ns_names, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::num_node_df_per_set, libMesh::ExodusII_IO_Helper::num_node_sets, and libMesh::ExodusII_IO_Helper::num_nodes_per_set.

◆ read_num_time_steps()

void libMesh::ExodusII_IO_Helper::read_num_time_steps ( )
inherited

Reads the number of timesteps currently stored in the Exodus file and stores it in the num_time_steps variable.

Definition at line 2184 of file exodusII_io_helper.C.

2185{
2187 inquire(*this, exII::EX_INQ_TIME, "Error retrieving number of time steps");
2188}

References libMesh::ExodusII_IO_Helper::num_time_steps.

Referenced by libMesh::ExodusII_IO_Helper::read_and_store_header_info(), and libMesh::ExodusII_IO_Helper::read_time_steps().

◆ read_qa_records()

void libMesh::ExodusII_IO_Helper::read_qa_records ( )
inherited

Reads the QA records from an ExodusII file.

We can use this to detect when e.g. CUBIT 14+ was used to generate a Mesh file, and work around certain known bugs in that version.

Definition at line 916 of file exodusII_io_helper.C.

917{
918 // The QA records are four MAX_STR_LENGTH-byte character strings.
919 int num_qa_rec =
920 inquire(*this, exII::EX_INQ_QA, "Error retrieving number of QA records");
921
922 if (verbose)
923 libMesh::out << "Found "
924 << num_qa_rec
925 << " QA record(s) in the Exodus file."
926 << std::endl;
927
928 if (num_qa_rec > 0)
929 {
930 // Actual (num_qa_rec x 4) storage for strings. The object we
931 // pass to the Exodus API will just contain pointers into the
932 // qa_storage object, which will have all automatic memory
933 // management.
934 std::vector<std::vector<std::vector<char>>> qa_storage(num_qa_rec);
935 for (auto i : make_range(num_qa_rec))
936 {
937 qa_storage[i].resize(4);
938 for (auto j : make_range(4))
939 qa_storage[i][j].resize(libmesh_max_str_length+1);
940 }
941
942 // inner_array_t is a fixed-size array of 4 strings
943 typedef char * inner_array_t[4];
944
945 // There is at least one compiler (Clang 12.0.1) that complains about
946 // "a non-scalar type used in a pseudo-destructor expression" when
947 // we try to instantiate a std::vector of inner_array_t objects as in:
948 // std::vector<inner_array_t> qa_record(num_qa_rec);
949 // So, we instead attempt to achieve the same effect with a std::unique_ptr.
950 auto qa_record = std::make_unique<inner_array_t[]>(num_qa_rec);
951
952 // Create data structure to be passed to Exodus API by setting
953 // pointers to the actual strings which are in qa_storage.
954 for (auto i : make_range(num_qa_rec))
955 for (auto j : make_range(4))
956 qa_record[i][j] = qa_storage[i][j].data();
957
958 ex_err = exII::ex_get_qa (ex_id, qa_record.get());
959 EX_CHECK_ERR(ex_err, "Error reading the QA records.");
960
961 // Print the QA records
962 if (verbose)
963 {
964 for (auto i : make_range(num_qa_rec))
965 {
966 libMesh::out << "QA Record: " << i << std::endl;
967 for (auto j : make_range(4))
968 libMesh::out << qa_record[i][j] << std::endl;
969 }
970 }
971 }
972}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::make_range(), libMesh::out, and libMesh::ExodusII_IO_Helper::verbose.

◆ read_sideset()

void libMesh::ExodusII_IO_Helper::read_sideset ( int  id,
int  offset 
)
inherited

Reads information about sideset id and inserts it into the global sideset array at the position offset.

Definition at line 1966 of file exodusII_io_helper.C.

1967{
1968 LOG_SCOPE("read_sideset()", "ExodusII_IO_Helper");
1969
1970 libmesh_assert_less (id, ss_ids.size());
1971 libmesh_assert_less (id, num_sides_per_set.size());
1972 libmesh_assert_less (id, num_df_per_set.size());
1973 libmesh_assert_less_equal (offset, elem_list.size());
1974 libmesh_assert_less_equal (offset, side_list.size());
1975
1976 ex_err = exII::ex_get_set_param(ex_id,
1977 exII::EX_SIDE_SET,
1978 ss_ids[id],
1979 &num_sides_per_set[id],
1980 &num_df_per_set[id]);
1981 EX_CHECK_ERR(ex_err, "Error retrieving sideset parameters.");
1982 message("Parameters retrieved successfully for sideset: ", id);
1983
1984
1985 // It's OK for offset==elem_list.size() as long as num_sides_per_set[id]==0
1986 // because in that case we don't actually read anything...
1987#ifdef DEBUG
1988 if (static_cast<unsigned int>(offset) == elem_list.size() ||
1989 static_cast<unsigned int>(offset) == side_list.size() )
1990 libmesh_assert_equal_to (num_sides_per_set[id], 0);
1991#endif
1992
1993
1994 // Don't call ex_get_set unless there are actually sides there to get.
1995 // Exodus prints an annoying warning in DEBUG mode otherwise...
1996 if (num_sides_per_set[id] > 0)
1997 {
1998 ex_err = exII::ex_get_set(ex_id,
1999 exII::EX_SIDE_SET,
2000 ss_ids[id],
2001 &elem_list[offset],
2002 &side_list[offset]);
2003 EX_CHECK_ERR(ex_err, "Error retrieving sideset data.");
2004 message("Data retrieved successfully for sideset: ", id);
2005
2006 for (int i=0; i<num_sides_per_set[id]; i++)
2007 id_list[i+offset] = ss_ids[id];
2008 }
2009}

References libMesh::ExodusII_IO_Helper::elem_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_list, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_df_per_set, libMesh::ExodusII_IO_Helper::num_sides_per_set, libMesh::ExodusII_IO_Helper::side_list, and libMesh::ExodusII_IO_Helper::ss_ids.

Referenced by libMesh::ExodusII_IO_Helper::write_sideset_data().

◆ read_sideset_data()

void libMesh::ExodusII_IO_Helper::read_sideset_data ( const MeshBase &  mesh,
int  timestep,
std::vector< std::string > &  var_names,
std::vector< std::set< boundary_id_type > > &  side_ids,
std::vector< std::map< BoundaryInfo::BCTuple, Real > > &  bc_vals 
)
inherited

Read sideset variables, if any, into the provided data structures.

Definition at line 4448 of file exodusII_io_helper.C.

4454{
4455 LOG_SCOPE("read_sideset_data()", "ExodusII_IO_Helper");
4456
4457 // This reads the sideset variable names into the local
4458 // sideset_var_names data structure.
4459 this->read_var_names(SIDESET);
4460
4461 if (num_sideset_vars)
4462 {
4463 // Read the sideset data truth table
4464 std::vector<int> sset_var_tab(num_side_sets * num_sideset_vars);
4465 ex_err = exII::ex_get_truth_table
4466 (ex_id,
4467 exII::EX_SIDE_SET,
4470 sset_var_tab.data());
4471 EX_CHECK_ERR(ex_err, "Error reading sideset variable truth table.");
4472
4473 // Set up/allocate space in incoming data structures.
4474 var_names = sideset_var_names;
4475 side_ids.resize(num_sideset_vars);
4476 bc_vals.resize(num_sideset_vars);
4477
4478 // Read the sideset data.
4479 //
4480 // Note: we assume that read_sideset() has already been called
4481 // for each sideset, so the required values in elem_list and
4482 // side_list are already present.
4483 //
4484 // TODO: As a future optimization, we could read only the values
4485 // requested by the user by looking at the input parameter
4486 // var_names and checking whether it already has entries in
4487 // it. We could do the same thing with the input side_ids
4488 // container and only read values for requested sidesets.
4489 int offset=0;
4490 for (int ss=0; ss<num_side_sets; ++ss)
4491 {
4492 offset += (ss > 0 ? num_sides_per_set[ss-1] : 0);
4493 for (int var=0; var<num_sideset_vars; ++var)
4494 {
4495 int is_present = sset_var_tab[num_sideset_vars*ss + var];
4496
4497 if (is_present)
4498 {
4499 // Record the fact that this variable is defined on this sideset.
4500 side_ids[var].insert(ss_ids[ss]);
4501
4502 // Note: the assumption here is that a previous call
4503 // to this->read_sideset_info() has already set the
4504 // values of num_sides_per_set, so we just use those values here.
4505 std::vector<Real> sset_var_vals(num_sides_per_set[ss]);
4506 ex_err = exII::ex_get_var
4507 (ex_id,
4508 timestep,
4509 exII::EX_SIDE_SET,
4510 var + 1, // 1-based sideset variable index!
4511 ss_ids[ss],
4513 MappedInputVector(sset_var_vals, _single_precision).data());
4514 EX_CHECK_ERR(ex_err, "Error reading sideset variable.");
4515
4516 for (int i=0; i<num_sides_per_set[ss]; ++i)
4517 {
4518 dof_id_type exodus_elem_id = elem_list[i + offset];
4519 unsigned int exodus_side_id = side_list[i + offset];
4520
4521 // FIXME: We should use exodus_elem_num_to_libmesh for this,
4522 // but it apparently is never set up, so just
4523 // subtract 1 from the Exodus elem id.
4524 dof_id_type converted_elem_id = exodus_elem_id - 1;
4525
4526 // Map Exodus side id to libmesh side id.
4527 // Map from Exodus side ids to libmesh side ids.
4528 const auto & conv = get_conversion(mesh.elem_ptr(converted_elem_id)->type());
4529
4530 // Map from Exodus side id to libmesh side id.
4531 // Note: the mapping is defined on 0-based indices, so subtract
4532 // 1 before doing the mapping.
4533 unsigned int converted_side_id = conv.get_side_map(exodus_side_id - 1);
4534
4535 // Make a BCTuple key from the converted information.
4536 BoundaryInfo::BCTuple key = std::make_tuple
4537 (converted_elem_id,
4538 converted_side_id,
4539 ss_ids[ss]);
4540
4541 // Store (elem, side, b_id) tuples in bc_vals[var]
4542 bc_vals[var].emplace(key, sset_var_vals[i]);
4543 } // end for (i)
4544 } // end if (present)
4545 } // end for (var)
4546 } // end for (ss)
4547 } // end if (num_sideset_vars)
4548}
std::vector< std::string > sideset_var_names

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::elem_list, libMesh::MeshBase::elem_ptr(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), mesh, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::ExodusII_IO_Helper::num_sides_per_set, libMesh::ExodusII_IO_Helper::num_sideset_vars, libMesh::ExodusII_IO_Helper::read_var_names(), libMesh::ExodusII_IO_Helper::side_list, libMesh::ExodusII_IO_Helper::SIDESET, libMesh::ExodusII_IO_Helper::sideset_var_names, libMesh::ExodusII_IO_Helper::ss_ids, and libMesh::Elem::type().

◆ read_sideset_info()

void libMesh::ExodusII_IO_Helper::read_sideset_info ( )
inherited

Reads information about all of the sidesets in the ExodusII mesh file.

Definition at line 1862 of file exodusII_io_helper.C.

1863{
1864 ss_ids.resize(num_side_sets);
1865 if (num_side_sets > 0)
1866 {
1867 ex_err = exII::ex_get_ids(ex_id,
1868 exII::EX_SIDE_SET,
1869 ss_ids.data());
1870 EX_CHECK_ERR(ex_err, "Error retrieving sideset information.");
1871 message("All sideset information retrieved successfully.");
1872
1873 // Resize appropriate data structures -- only do this once outside the loop
1876
1877 // Inquire about the length of the concatenated side sets element list
1878 num_elem_all_sidesets = inquire(*this, exII::EX_INQ_SS_ELEM_LEN, "Error retrieving length of the concatenated side sets element list!");
1879
1883 }
1884
1885 char name_buffer[libmesh_max_str_length+1];
1886 for (int i=0; i<num_side_sets; ++i)
1887 {
1888 ex_err = exII::ex_get_name(ex_id, exII::EX_SIDE_SET,
1889 ss_ids[i], name_buffer);
1890 EX_CHECK_ERR(ex_err, "Error getting side set name.");
1891 id_to_ss_names[ss_ids[i]] = name_buffer;
1892 }
1893 message("All side set names retrieved successfully.");
1894}

References libMesh::ExodusII_IO_Helper::elem_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::id_list, libMesh::ExodusII_IO_Helper::id_to_ss_names, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_df_per_set, libMesh::ExodusII_IO_Helper::num_elem_all_sidesets, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::ExodusII_IO_Helper::num_sides_per_set, libMesh::ExodusII_IO_Helper::side_list, and libMesh::ExodusII_IO_Helper::ss_ids.

Referenced by libMesh::ExodusII_IO_Helper::write_sideset_data().

◆ read_time_steps()

void libMesh::ExodusII_IO_Helper::read_time_steps ( )
inherited

Reads and stores the timesteps in the 'time_steps' array.

Definition at line 2167 of file exodusII_io_helper.C.

2168{
2169 // Make sure we have an up-to-date count of the number of time steps in the file.
2170 this->read_num_time_steps();
2171
2172 if (num_time_steps > 0)
2173 {
2174 time_steps.resize(num_time_steps);
2175 ex_err = exII::ex_get_all_times
2176 (ex_id,
2177 MappedInputVector(time_steps, _single_precision).data());
2178 EX_CHECK_ERR(ex_err, "Error reading timesteps!");
2179 }
2180}

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::num_time_steps, libMesh::ExodusII_IO_Helper::read_num_time_steps(), and libMesh::ExodusII_IO_Helper::time_steps.

◆ read_var_names()

void libMesh::ExodusII_IO_Helper::read_var_names ( ExodusVarType  type)
inherited

Definition at line 2256 of file exodusII_io_helper.C.

2257{
2258 switch (type)
2259 {
2260 case NODAL:
2262 break;
2263 case ELEMENTAL:
2265 break;
2266 case GLOBAL:
2268 break;
2269 case SIDESET:
2271 break;
2272 case NODESET:
2274 break;
2275 case ELEMSET:
2277 break;
2278 default:
2279 libmesh_error_msg("Unrecognized ExodusVarType " << type);
2280 }
2281}
virtual void read_var_names_impl(const char *var_type, int &count, std::vector< std::string > &result)
read_var_names() dispatches to this function.

References libMesh::ExodusII_IO_Helper::elem_var_names, libMesh::ExodusII_IO_Helper::ELEMENTAL, libMesh::ExodusII_IO_Helper::ELEMSET, libMesh::ExodusII_IO_Helper::elemset_var_names, libMesh::ExodusII_IO_Helper::GLOBAL, libMesh::ExodusII_IO_Helper::global_var_names, libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::nodal_var_names, libMesh::ExodusII_IO_Helper::NODESET, libMesh::ExodusII_IO_Helper::nodeset_var_names, libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ExodusII_IO_Helper::num_elemset_vars, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ExodusII_IO_Helper::num_nodal_vars, libMesh::ExodusII_IO_Helper::num_nodeset_vars, libMesh::ExodusII_IO_Helper::num_sideset_vars, libMesh::ExodusII_IO_Helper::read_var_names_impl(), libMesh::ExodusII_IO_Helper::SIDESET, and libMesh::ExodusII_IO_Helper::sideset_var_names.

Referenced by libMesh::ExodusII_IO_Helper::check_existing_vars(), libMesh::ExodusII_IO_Helper::read_elemental_var_values(), libMesh::ExodusII_IO_Helper::read_elemset_data(), libMesh::ExodusII_IO_Helper::read_nodal_var_values(), libMesh::ExodusII_IO_Helper::read_nodeset_data(), and libMesh::ExodusII_IO_Helper::read_sideset_data().

◆ read_var_names_impl()

void libMesh::Nemesis_IO_Helper::read_var_names_impl ( const char *  var_type,
int &  count,
std::vector< std::string > &  result 
)
overrideprotectedvirtual

read_var_names() dispatches to this function.

We need to override it slightly for Nemesis.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 2868 of file nemesis_io_helper.C.

2871{
2872 // Most of what we need to do is the same as for Exodus
2873 this->ExodusII_IO_Helper::read_var_names_impl(var_type, count, result);
2874
2875 // But with tests where we have more processors than elements,
2876 // Nemesis doesn't let us put variable names in files written by
2877 // processors owning nothing, but we may still *need* those
2878 // variable names on every processor, so let's sync them up...
2879
2880 processor_id_type pid_broadcasting_names = this->processor_id();
2881 const std::size_t n_names = result.size();
2882 if (!n_names)
2883 pid_broadcasting_names = DofObject::invalid_processor_id;
2884
2885 libmesh_assert(this->comm().semiverify
2886 (n_names ? nullptr : &n_names));
2887
2888 this->comm().min(pid_broadcasting_names);
2889
2890 if (pid_broadcasting_names != DofObject::invalid_processor_id)
2891 this->comm().broadcast(result, pid_broadcasting_names);
2892}
void min(const T &r, T &o, Request &req) const
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
static constexpr processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition dof_object.h:484

References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::DofObject::invalid_processor_id, libMesh::libmesh_assert(), libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::read_var_names_impl().

◆ set_add_sides()

void libMesh::ExodusII_IO_Helper::set_add_sides ( bool  add_sides)
inlineinherited

Sets whether or not to write extra "side" elements.

This is useful for plotting SIDE_DISCONTINUOUS data.

Definition at line 1362 of file exodusII_io_helper.h.

1363{
1364 _add_sides = add_sides;
1365}

References libMesh::ExodusII_IO_Helper::_add_sides.

Referenced by ExodusC0PolyhedronTest::test_write_and_read_mixed_hex_tet_block_names_impl().

◆ set_coordinate_offset()

void libMesh::ExodusII_IO_Helper::set_coordinate_offset ( Point  p)
inherited

Allows you to set a vector that is added to the coordinates of all of the nodes.

Effectively, this "moves" the mesh to a particular position

Definition at line 5499 of file exodusII_io_helper.C.

5500{
5502}

References libMesh::ExodusII_IO_Helper::_coordinate_offset.

◆ set_dof_object_unique_id()

void libMesh::ExodusII_IO_Helper::set_dof_object_unique_id ( MeshBase &  mesh,
DofObject *  dof_object,
int  exodus_mapped_id 
)
privateinherited

Definition at line 2564 of file exodusII_io_helper.C.

2568{
2569 if (this->set_unique_ids_from_maps)
2570 {
2571 // Exodus ids are always 1-based while libmesh ids are always
2572 // 0-based, so to make a libmesh unique_id here, we subtract 1
2573 // from the exodus_mapped_id to make it 0-based.
2574 auto exodus_mapped_id_zero_based =
2575 cast_int<dof_id_type>(exodus_mapped_id - 1);
2576
2577 // Set added_node's unique_id to "exodus_mapped_id_zero_based".
2578 dof_object->set_unique_id(cast_int<unique_id_type>(exodus_mapped_id_zero_based));
2579
2580 // Normally the Mesh is responsible for setting the unique_ids
2581 // of Nodes/Elems in a consistent manner, so when we set the unique_id
2582 // of a Node/Elem manually based on the {node,elem}_num_map, we need to
2583 // make sure that the "next" unique id assigned by the Mesh
2584 // will still be valid. We do this by making sure that the
2585 // next_unique_id is greater than the one we set manually. The
2586 // APIs for doing this are only defined when unique ids are
2587 // enabled.
2588#ifdef LIBMESH_ENABLE_UNIQUE_ID
2589 unique_id_type next_unique_id = mesh.next_unique_id();
2590 mesh.set_next_unique_id(std::max(next_unique_id, static_cast<unique_id_type>(exodus_mapped_id_zero_based + 1)));
2591#else
2592 // Avoid compiler warnings about the unused variable
2594#endif
2595 }
2596}
void set_unique_id(unique_id_type new_id)
Sets the unique_id for this DofObject.
Definition dof_object.h:862
virtual void set_next_unique_id(unique_id_type id)=0
Sets the next available unique id to be used.
unique_id_type next_unique_id() const
Definition mesh_base.h:607
uint8_t unique_id_type
Definition id_types.h:86
void libmesh_ignore(const Args &...)

References libMesh::libmesh_ignore(), mesh, libMesh::MeshBase::next_unique_id(), libMesh::MeshBase::set_next_unique_id(), libMesh::DofObject::set_unique_id(), and libMesh::ExodusII_IO_Helper::set_unique_ids_from_maps.

Referenced by libMesh::ExodusII_IO_Helper::conditionally_set_elem_unique_id(), and libMesh::ExodusII_IO_Helper::conditionally_set_node_unique_id().

◆ set_hdf5_writing()

void libMesh::ExodusII_IO_Helper::set_hdf5_writing ( bool  write_hdf5)
inherited

Set to true (the default) to write files in an HDF5-based file format (when HDF5 is available), or to false to write files in the old NetCDF3-based format.

If HDF5 is unavailable, this setting does nothing.

Definition at line 5472 of file exodusII_io_helper.C.

5473{
5474 _write_hdf5 = write_hdf5;
5475}

References libMesh::ExodusII_IO_Helper::_write_hdf5.

◆ set_max_name_length()

void libMesh::ExodusII_IO_Helper::set_max_name_length ( unsigned int  max_length)
inherited

Set how many characters to use in names when opening a file for writing.

Definition at line 5478 of file exodusII_io_helper.C.

5479{
5480 // Opt mode error, because this may be exposed to users
5481 libmesh_error_msg_if (max_length > libmesh_max_str_length,
5482 "Exodus maximum name length is limited to " <<
5483 libmesh_max_str_length << " characters");
5484
5485 // Devel+dbg mode assertion, because developers should do better
5487
5488 _max_name_length = max_length;
5489}

References libMesh::ExodusII_IO_Helper::_max_name_length, libMesh::libmesh_assert(), and libMesh::ExodusII_IO_Helper::opened_for_writing.

◆ update()

void libMesh::ExodusII_IO_Helper::update ( )
inherited

◆ use_mesh_dimension_instead_of_spatial_dimension()

void libMesh::ExodusII_IO_Helper::use_mesh_dimension_instead_of_spatial_dimension ( bool  val)
inherited

Sets the underlying value of the boolean flag _use_mesh_dimension_instead_of_spatial_dimension.

By default, the value of this flag is false.

See the ExodusII_IO class documentation for a detailed description of this flag.

Definition at line 5466 of file exodusII_io_helper.C.

References libMesh::ExodusII_IO_Helper::_use_mesh_dimension_instead_of_spatial_dimension.

◆ write_as_dimension()

void libMesh::ExodusII_IO_Helper::write_as_dimension ( unsigned  dim)
inherited

Sets the value of _write_as_dimension.

This directly controls the num_dim which is written to the Exodus file. If non-zero, this value supersedes all other dimensions, including: 1.) MeshBase::spatial_dimension() 2.) MeshBase::mesh_dimension() 3.) Any value passed to use_mesh_dimension_instead_of_spatial_dimension() This is useful/necessary for working around a bug in Paraview which prevents the "Plot Over Line" filter from working on 1D meshes.

Definition at line 5492 of file exodusII_io_helper.C.

5493{
5495}

References libMesh::ExodusII_IO_Helper::_write_as_dimension, and dim.

◆ write_complex_magnitude()

void libMesh::Nemesis_IO_Helper::write_complex_magnitude ( bool  val)

Set the flag indicating whether the complex modulus should be written when complex numbers are enabled.

By default this flag is set to true.

◆ write_element_values() [1/2]

void libMesh::Nemesis_IO_Helper::write_element_values ( const MeshBase &  mesh,
const EquationSystems &  es,
const std::vector< std::pair< unsigned int, unsigned int > > &  var_nums,
int  timestep,
const std::vector< std::set< subdomain_id_type > > &  vars_active_subdomains 
)

Writes the vector of elemental variable values, one variable and one subdomain at a time.

Definition at line 2735 of file nemesis_io_helper.C.

2740{
2741 // For each variable in names,
2742 // For each subdomain in subdomain_map,
2743 // If this (subdomain, variable) combination is active
2744 // For each component in variable
2745 // Extract element values into local_soln (localize is a collective)
2746 // Write local_soln to file
2747 // Update var_ctr with number of vector components for variable
2748 //
2749 unsigned int var_ctr = 0;
2750 for (auto v : index_range(var_nums))
2751 {
2752 const unsigned int sys_num = var_nums[v].first;
2753 const unsigned int var = var_nums[v].second;
2754 const System & system = es.get_system(sys_num);
2755
2756 // We need to check if the constant monomial is a scalar or a vector and set the number of
2757 // components for the latter as per es.find_variable_numbers().
2758 // Even for the case where a variable is not active on any subdomain belonging to the
2759 // processor, we still need to know this number to update 'var_ctr'.
2760 const auto & var_type = system.variable_type(var);
2761 const unsigned int n_comps =
2762 (FEInterface::field_type(var_type) == TYPE_VECTOR) ?
2763 FEInterface::n_vec_dim(mesh, var_type) : 1;
2764
2765 // Get list of active subdomains for variable v
2766 const auto & active_subdomains = vars_active_subdomains[v];
2767
2768 for (const int sbd_id_int : global_elem_blk_ids)
2769 {
2770 const subdomain_id_type sbd_id =
2771 restrict_int<subdomain_id_type>(sbd_id_int);
2772 auto it = subdomain_map.find(sbd_id);
2773 const std::vector<dof_id_type> empty_vec;
2774 const std::vector<dof_id_type> & elem_ids =
2775 (it == subdomain_map.end()) ? empty_vec : it->second;
2776
2777 // Possibly skip this (variable, subdomain) combination. Also, check that there is at
2778 // least one element on the subdomain... Indeed, it is possible to have zero elements,
2779 // e.g., when running "adaptivity_ex3" in parallel with the 'dimension=1' argument.
2780 if ((active_subdomains.empty() || active_subdomains.count(sbd_id)) && elem_ids.size())
2781 {
2782 std::vector<numeric_index_type> required_indices;
2783 required_indices.reserve(elem_ids.size());
2784
2785 // The number of DOF components needs to be equal to the expected number so that we
2786 // know where to store data to correctly correspond to variable names - verify this by
2787 // accessing the n_comp method for the last element ID, which should return the same
2788 // value for all elements on a given subdomain, so we only need to check this once.
2789 libmesh_assert_equal_to(n_comps, mesh.elem_ref(elem_ids.back()).n_comp(sys_num, var));
2790
2791 // Loop through the DOFs of the variable and write the values for it on each element.
2792 // The variable name should have been decomposed by es.find_variable_numbers().
2793 for (unsigned int comp = 0; comp < n_comps; ++comp)
2794 {
2795 for (const auto & id : elem_ids)
2796 required_indices.push_back(mesh.elem_ref(id).dof_number(sys_num, var, comp));
2797
2798 std::vector<Number> local_soln;
2799 system.current_local_solution->get(required_indices, local_soln);
2800
2801 // reset for the next component
2802 required_indices.clear();
2803
2804 // It's possible that there's nothing for us to write:
2805 // we may not be responsible for any elements on the
2806 // current subdomain. We did still have to participate
2807 // in the localize() call above, however, since it is a
2808 // collective.
2809 if (local_soln.size())
2810 {
2811#ifdef LIBMESH_USE_COMPLEX_NUMBERS
2812 int stride = write_complex_abs ? 3 : 2;
2813 std::vector<Real> local_soln_buffer(local_soln.size());
2814 std::transform(local_soln.begin(), local_soln.end(),
2815 local_soln_buffer.begin(), [](Number n) { return n.real(); });
2816 ex_err = exII::ex_put_elem_var(ex_id,
2817 timestep,
2818 static_cast<int>(stride*(var_ctr+comp)+1),
2819 static_cast<int>(sbd_id),
2820 static_cast<int>(local_soln.size()),
2821 MappedOutputVector(local_soln_buffer, _single_precision).data());
2822 EX_CHECK_ERR(ex_err, "Error writing element real values.");
2823
2824 std::transform(local_soln.begin(), local_soln.end(),
2825 local_soln_buffer.begin(), [](Number n) { return n.imag(); });
2826 ex_err = exII::ex_put_elem_var(ex_id,
2827 timestep,
2828 static_cast<int>(stride*(var_ctr+comp)+2),
2829 static_cast<int>(sbd_id),
2830 static_cast<int>(local_soln.size()),
2831 MappedOutputVector(local_soln_buffer, _single_precision).data());
2832 EX_CHECK_ERR(ex_err, "Error writing element imaginary values.");
2833
2835 {
2836 std::transform(local_soln.begin(), local_soln.end(),
2837 local_soln_buffer.begin(), [](Number n) { return std::abs(n); });
2838 ex_err = exII::ex_put_elem_var(ex_id,
2839 timestep,
2840 static_cast<int>(stride*(var_ctr+comp)+2),
2841 static_cast<int>(sbd_id),
2842 static_cast<int>(local_soln.size()),
2843 MappedOutputVector(local_soln_buffer, _single_precision).data());
2844 EX_CHECK_ERR(ex_err, "Error writing element magnitudes.");
2845 }
2846#else // LIBMESH_USE_COMPLEX_NUMBERS
2847 ex_err = exII::ex_put_elem_var(ex_id,
2848 timestep,
2849 static_cast<int>(var_ctr+comp+1),
2850 static_cast<int>(sbd_id),
2851 static_cast<int>(local_soln.size()),
2852 MappedOutputVector(local_soln, _single_precision).data());
2853 EX_CHECK_ERR(ex_err, "Error writing element values.");
2854#endif // LIBMESH_USE_COMPLEX_NUMBERS
2855 }
2856 } // end loop over vector components
2857 }
2858 } // end loop over active subdomains
2859
2860 var_ctr += n_comps;
2861 } // end loop over vars
2862
2863 this->update();
2864}
void update()
Uses ex_update() to flush buffers to file.
static unsigned int n_vec_dim(const MeshBase &mesh, const FEType &fe_type)
static FEFieldType field_type(const FEType &fe_type)

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::System::current_local_solution, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::FEInterface::field_type(), libMesh::EquationSystems::get_system(), global_elem_blk_ids, libMesh::index_range(), mesh, libMesh::FEInterface::n_vec_dim(), subdomain_map, libMesh::TYPE_VECTOR, libMesh::ExodusII_IO_Helper::update(), libMesh::System::variable_type(), and write_complex_abs.

◆ write_element_values() [2/2]

void libMesh::ExodusII_IO_Helper::write_element_values ( const MeshBase &  mesh,
const std::vector< Real > &  values,
int  timestep,
const std::vector< std::set< subdomain_id_type > > &  vars_active_subdomains 
)
inherited

Writes the vector of values to the element variables.

The 'values' vector is assumed to be in the order: {(u1, u2, u3, ..., uN), (v1, v2, v3, ..., vN), (w1, w2, w3, ..., wN)} where N is the number of elements.

This ordering is produced by calls to ES::build_elemental_solution_vector(). ES::build_discontinuous_solution_vector(), on the other hand, produces an element-major ordering. See the function below for that case.

Definition at line 5124 of file exodusII_io_helper.C.

5129{
5130 LOG_SCOPE("write_element_values()", "ExodusII_IO_Helper");
5131
5132 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5133 return;
5134
5135 // Ask the file how many element vars it has, store it in the num_elem_vars variable.
5136 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_ELEM_BLOCK, &num_elem_vars);
5137 EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
5138
5139 // We will eventually loop over the element blocks (subdomains) and
5140 // write the data one block at a time. Build a data structure that
5141 // maps each subdomain to a list of element ids it contains.
5142 std::map<subdomain_id_type, std::vector<unsigned int>> subdomain_map;
5143 for (const auto & elem : mesh.active_element_ptr_range())
5144 subdomain_map[elem->subdomain_id()].push_back(elem->id());
5145
5146 // Use mesh.n_elem() to access into the values vector rather than
5147 // the number of elements the Exodus writer thinks the mesh has,
5148 // which may not include inactive elements.
5150
5151 // Sanity check: we must have an entry in vars_active_subdomains for
5152 // each variable that we are potentially writing out.
5153 libmesh_assert_equal_to
5154 (vars_active_subdomains.size(),
5155 static_cast<unsigned>(num_elem_vars));
5156
5157 // For each variable, create a 'data' array which holds all the elemental variable
5158 // values *for a given block* on this processor, then write that data vector to file
5159 // before moving onto the next block.
5160 for (unsigned int var_id=0; var_id<static_cast<unsigned>(num_elem_vars); ++var_id)
5161 {
5162 // The size of the subdomain map is the number of blocks.
5163 auto it = subdomain_map.begin();
5164
5165 // Reference to the set of active subdomains for the current variable.
5166 const auto & active_subdomains
5167 = vars_active_subdomains[var_id];
5168
5169 for (unsigned int j=0; it!=subdomain_map.end(); ++it, ++j)
5170 {
5171 // Skip any variable/subdomain pairs that are inactive.
5172 // Note that if active_subdomains is empty, it is interpreted
5173 // as being active on *all* subdomains.
5174 if (!(active_subdomains.empty() || active_subdomains.count(it->first)))
5175 continue;
5176
5177 // Get reference to list of elem ids which are in the
5178 // current subdomain and count, allocate storage to hold
5179 // data that will be written to file.
5180 const auto & elem_nums = it->second;
5181 const unsigned int num_elems_this_block =
5182 cast_int<unsigned int>(elem_nums.size());
5183 std::vector<Real> data(num_elems_this_block);
5184
5185 // variable-major ordering is:
5186 // (u1, u2, u3, ..., uN), (v1, v2, v3, ..., vN), ...
5187 // where N is the number of elements.
5188 for (unsigned int k=0; k<num_elems_this_block; ++k)
5189 data[k] = values[var_id*n_elem + elem_nums[k]];
5190
5191 ex_err = exII::ex_put_var
5192 (ex_id,
5193 timestep,
5194 exII::EX_ELEM_BLOCK,
5195 var_id+1,
5196 this->get_block_id(j),
5197 num_elems_this_block,
5198 MappedOutputVector(data, _single_precision).data());
5199
5200 EX_CHECK_ERR(ex_err, "Error writing element values.");
5201 }
5202 }
5203
5204 this->update();
5205}
int get_block_id(int index)
Get the block number for the given block index.
virtual dof_id_type n_elem() const =0
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_block_id(), libMesh::DofObject::id(), mesh, libMesh::MeshBase::n_elem(), libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ParallelObject::processor_id(), libMesh::Elem::subdomain_id(), and libMesh::ExodusII_IO_Helper::update().

◆ write_element_values_element_major()

void libMesh::ExodusII_IO_Helper::write_element_values_element_major ( const MeshBase &  mesh,
const std::vector< Real > &  values,
int  timestep,
const std::vector< std::set< subdomain_id_type > > &  vars_active_subdomains,
const std::vector< std::string > &  derived_var_names,
const std::map< subdomain_id_type, std::vector< std::string > > &  subdomain_to_var_names 
)
inherited

Same as the function above, but assume the input 'values' vector is in element-major order, i.e.

{(u1,v1,w1), (u2,v2,w2), ... (uN,vN,wN)} This function is called by ExodusII_IO::write_element_data_from_discontinuous_nodal_data() because ES::build_discontinuous_solution_vector() builds the solution vector in this order.

Note
If some variables are subdomain-restricted, then the tuples will be of different lengths for each element, i.e. {(u1,v1,w1), (u2,v2), ... (uN,vN,wN)} if variable w is not active on element 2.

Definition at line 5209 of file exodusII_io_helper.C.

5216{
5217 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5218 return;
5219
5220 // Ask the file how many element vars it has, store it in the num_elem_vars variable.
5221 ex_err = exII::ex_get_variable_param(ex_id, exII::EX_ELEM_BLOCK, &num_elem_vars);
5222 EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
5223
5224 // We will eventually loop over the element blocks (subdomains) and
5225 // write the data one block (subdomain) at a time. Build a data
5226 // structure that keeps track of how many elements are in each
5227 // subdomain. This will allow us to reserve space in the data vector
5228 // we are going to write.
5229 std::map<subdomain_id_type, unsigned int> subdomain_to_n_elem;
5230 for (const auto & elem : mesh.active_element_ptr_range())
5231 subdomain_to_n_elem[elem->subdomain_id()] += 1;
5232
5233 // Sanity check: we must have an entry in vars_active_subdomains for
5234 // each variable that we are potentially writing out.
5235 libmesh_assert_equal_to
5236 (vars_active_subdomains.size(),
5237 static_cast<unsigned>(num_elem_vars));
5238
5239 // The size of the subdomain map is the number of blocks.
5240 auto subdomain_to_n_elem_iter = subdomain_to_n_elem.begin();
5241
5242 // Store range of active Elem pointers. We are going to loop over
5243 // the elements n_vars * n_subdomains times, so let's make sure
5244 // the predicated iterators aren't slowing us down too much.
5245 ConstElemRange elem_range
5246 (mesh.active_elements_begin(),
5247 mesh.active_elements_end());
5248
5249 for (unsigned int sbd_idx=0;
5250 subdomain_to_n_elem_iter != subdomain_to_n_elem.end();
5251 ++subdomain_to_n_elem_iter, ++sbd_idx)
5252 for (unsigned int var_id=0; var_id<static_cast<unsigned>(num_elem_vars); ++var_id)
5253 {
5254 // Reference to the set of active subdomains for the current variable.
5255 const auto & active_subdomains
5256 = vars_active_subdomains[var_id];
5257
5258 // If the vars_active_subdomains container passed to this function
5259 // has an empty entry, it means the variable really is not active on
5260 // _any_ subdomains, not that it is active on _all_ subdomains. This
5261 // is just due to the way that we build the vars_active_subdomains
5262 // container.
5263 if (!active_subdomains.count(subdomain_to_n_elem_iter->first))
5264 continue;
5265
5266 // Vector to hold values that will be written to Exodus file.
5267 std::vector<Real> data;
5268 data.reserve(subdomain_to_n_elem_iter->second);
5269
5270 unsigned int values_offset = 0;
5271 for (auto & elem : elem_range)
5272 {
5273 // We'll use the Elem's subdomain id in several places below.
5274 subdomain_id_type sbd_id = elem->subdomain_id();
5275
5276 // Get reference to the list of variable names defining
5277 // the indexing for the current Elem's subdomain.
5278 auto subdomain_to_var_names_iter =
5279 subdomain_to_var_names.find(sbd_id);
5280
5281 // It's possible, but unusual, for there to be an Elem
5282 // from a subdomain that has no active variables from the
5283 // set of variables we are currently writing. If that
5284 // happens, we can just go to the next Elem because we
5285 // don't need to advance the offset into the values
5286 // vector, etc.
5287 if (subdomain_to_var_names_iter == subdomain_to_var_names.end())
5288 continue;
5289
5290 const auto & var_names_this_sbd
5291 = subdomain_to_var_names_iter->second;
5292
5293 // Only extract values if Elem is in the current subdomain.
5294 if (sbd_id == subdomain_to_n_elem_iter->first)
5295 {
5296 // Location of current var_id in the list of all variables on this
5297 // subdomain. FIXME: linear search but it's over a typically relatively
5298 // short vector of active variable names on this subdomain. We could do
5299 // a nested std::map<string,index> instead of a std::vector where the
5300 // location of the string is implicitly the index..
5301 auto pos =
5302 std::find(var_names_this_sbd.begin(),
5303 var_names_this_sbd.end(),
5304 derived_var_names[var_id]);
5305
5306 libmesh_error_msg_if(pos == var_names_this_sbd.end(),
5307 "Derived name " << derived_var_names[var_id] << " not found!");
5308
5309 // Find the current variable's location in the list of all variable
5310 // names on the current Elem's subdomain.
5311 auto true_index =
5312 std::distance(var_names_this_sbd.begin(), pos);
5313
5314 data.push_back(values[values_offset + true_index]);
5315 }
5316
5317 // The "true" offset is how much we have to advance the index for each Elem
5318 // in this subdomain.
5319 auto true_offset = var_names_this_sbd.size();
5320
5321 // Increment to the next Elem's values
5322 values_offset += true_offset;
5323 } // for elem
5324
5325 // Now write 'data' to Exodus file, in single precision if requested.
5326 if (!data.empty())
5327 {
5328 ex_err = exII::ex_put_var
5329 (ex_id,
5330 timestep,
5331 exII::EX_ELEM_BLOCK,
5332 var_id+1,
5333 this->get_block_id(sbd_idx),
5334 data.size(),
5335 MappedOutputVector(data, _single_precision).data());
5336
5337 EX_CHECK_ERR(ex_err, "Error writing element values.");
5338 }
5339 } // for each var_id
5340
5341 this->update();
5342}
The StoredRange class defines a contiguous, divisible set of objects.

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_block_id(), mesh, libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ParallelObject::processor_id(), libMesh::Elem::subdomain_id(), and libMesh::ExodusII_IO_Helper::update().

◆ write_elements()

void libMesh::Nemesis_IO_Helper::write_elements ( const MeshBase &  mesh,
bool  use_discontinuous = false 
)
overridevirtual

This function is specialized to write the connectivity.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 2269 of file nemesis_io_helper.C.

2270{
2271 // Only write elements if there are elements blocks available.
2272 if (this->num_elem_blks_global > 0)
2273 {
2274 // Data structure to store element block names that will be used to
2275 // write the element block names to file.
2276 NamesData names_table(this->num_elem_blks_global, MAX_STR_LENGTH);
2277
2278 // Loop over all blocks, even if we don't have elements in each block.
2279 // If we don't have elements we need to write out a 0 for that block...
2280 for (auto i : make_range(this->num_elem_blks_global))
2281 {
2282 // Even if there are no elements for this block on the current
2283 // processor, we still want to write its name to file, if
2284 // possible. MeshBase::subdomain_name() will just return an
2285 // empty string if there is no name associated with the current
2286 // block.
2287 names_table.push_back_entry
2288 (mesh.subdomain_name(restrict_int<subdomain_id_type>(this->global_elem_blk_ids[i])));
2289
2290 // Search for the current global block ID in the map
2291 if (const auto it = this->block_id_to_elem_connectivity.find( this->global_elem_blk_ids[i] );
2292 it == this->block_id_to_elem_connectivity.end())
2293 {
2294 // If not found, write a zero to file....
2295 this->ex_err = exII::ex_put_elem_block(this->ex_id,
2296 this->global_elem_blk_ids[i],
2297 "Empty",
2298 0, /* n. elements in this block */
2299 0, /* n. nodes per element */
2300 0); /* number of attributes per element */
2301
2302 EX_CHECK_ERR(this->ex_err, "Error writing element block from Nemesis.");
2303 }
2304
2305 // Otherwise, write the actual block information and connectivity to file
2306 else
2307 {
2308 subdomain_id_type block =
2309 cast_int<subdomain_id_type>(it->first);
2310 const std::vector<int> & this_block_connectivity = it->second;
2311 std::vector<dof_id_type> & elements_in_this_block = subdomain_map[block];
2312
2313 // Use the first element in this block to get representative information.
2314 // Note that Exodus assumes all elements in a block are of the same type!
2315 // We are using that same assumption here!
2316 const auto & conv =
2317 get_conversion(mesh.elem_ref(elements_in_this_block[0]).type());
2318
2319 this->num_nodes_per_elem =
2320 mesh.elem_ref(elements_in_this_block[0]).n_nodes();
2321
2322 ex_err = exII::ex_put_elem_block(ex_id,
2323 block,
2324 conv.exodus_elem_type().c_str(),
2325 elements_in_this_block.size(),
2327 0);
2328 EX_CHECK_ERR(ex_err, "Error writing element block from Nemesis.");
2329
2330 ex_err = exII::ex_put_elem_conn(ex_id,
2331 block,
2332 this_block_connectivity.data());
2333 EX_CHECK_ERR(ex_err, "Error writing element connectivities from Nemesis.");
2334 }
2335 } // end loop over global block IDs
2336
2337 // Only call this once, not in the loop above!
2338 ex_err = exII::ex_put_elem_num_map(ex_id,
2339 exodus_elem_num_to_libmesh.empty() ? nullptr : exodus_elem_num_to_libmesh.data());
2340 EX_CHECK_ERR(ex_err, "Error writing element map");
2341
2342 // Write the element block names to file.
2343 ex_err = exII::ex_put_names(ex_id, exII::EX_ELEM_BLOCK, names_table.get_char_star_star());
2344 EX_CHECK_ERR(ex_err, "Error writing element block names");
2345 } // end if (this->num_elem_blks_global > 0)
2346}

References block_id_to_elem_connectivity, libMesh::MeshBase::elem_ref(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::exodus_elem_num_to_libmesh, libMesh::ExodusII_IO_Helper::NamesData::get_char_star_star(), libMesh::ExodusII_IO_Helper::get_conversion(), global_elem_blk_ids, libMesh::make_range(), mesh, libMesh::Elem::n_nodes(), num_elem_blks_global, libMesh::ExodusII_IO_Helper::num_nodes_per_elem, libMesh::ExodusII_IO_Helper::NamesData::push_back_entry(), and subdomain_map.

◆ write_elemset_data()

void libMesh::ExodusII_IO_Helper::write_elemset_data ( int  timestep,
const std::vector< std::string > &  var_names,
const std::vector< std::set< elemset_id_type > > &  elemset_ids_in,
const std::vector< std::map< std::pair< dof_id_type, elemset_id_type >, Real > > &  elemset_vals 
)
inherited

Write elemset data for the requested timestep.

Definition at line 4705 of file exodusII_io_helper.C.

4710{
4711 LOG_SCOPE("write_elemset_data()", "ExodusII_IO_Helper");
4712
4713 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4714 return;
4715
4716 // Write the elemset variable names to file. This function should
4717 // only be called once for ELEMSET variables, repeated calls to
4718 // write_var_names() overwrites/changes the order of names that were
4719 // there previously, and will mess up any data that has already been
4720 // written.
4721 this->write_var_names(ELEMSET, var_names);
4722
4723 // We now call the API to read the elemset info even though we are
4724 // in the middle of writing. This is a bit counter-intuitive, but it
4725 // seems to work provided that you have already written the mesh
4726 // itself... read_elemset_info() fills in the following data
4727 // members:
4728 // .) id_to_elemset_names
4729 // .) num_elems_per_set
4730 // .) num_elem_df_per_set
4731 // .) elemset_list
4732 // .) elemset_id_list
4733 // .) id_to_elemset_names
4734 this->read_elemset_info();
4735
4736 // The "truth" table for elemset variables. elemset_var_tab is a
4737 // logically (num_elem_sets x num_elemset_vars) integer array of 0s and
4738 // 1s indicating which elemsets a given elemset variable is defined
4739 // on.
4740 std::vector<int> elemset_var_tab(num_elem_sets * var_names.size());
4741
4742 int offset=0;
4743 for (int es=0; es<num_elem_sets; ++es)
4744 {
4745 // Debugging
4746 // libMesh::out << "Writing elemset variable values for elemset "
4747 // << es << ", elemset_id = " << elemset_ids[es]
4748 // << std::endl;
4749
4750 // We know num_elems_per_set because we called read_elemset_info() above.
4751 offset += (es > 0 ? num_elems_per_set[es-1] : 0);
4752 this->read_elemset(es, offset);
4753
4754 // For each variable in var_names, write the values for the
4755 // current elemset, if any.
4756 for (auto var : index_range(var_names))
4757 {
4758 // Debugging
4759 // libMesh::out << "Writing elemset variable values for var " << var << std::endl;
4760
4761 // If this var has no values on this elemset, go to the next one.
4762 if (!elemset_ids_in[var].count(elemset_ids[es]))
4763 continue;
4764
4765 // Otherwise, fill in this entry of the nodeset truth table.
4766 elemset_var_tab[es*var_names.size() + var] = 1;
4767
4768 // Data vector that will eventually be passed to exII::ex_put_var().
4769 std::vector<Real> elemset_var_vals(num_elems_per_set[es]);
4770
4771 // Get reference to the (elem_id, elemset_id) -> Real map for this variable.
4772 const auto & data_map = elemset_vals[var];
4773
4774 // Loop over entries in current elemset.
4775 for (int i=0; i<num_elems_per_set[es]; ++i)
4776 {
4777 // Here we convert Exodus elem ids to libMesh node ids
4778 // simply by subtracting 1. We should probably use the
4779 // exodus_elem_num_to_libmesh data structure for this,
4780 // but I don't think it is set up at the time when this
4781 // function is normally called.
4782 dof_id_type libmesh_elem_id = elemset_list[i + offset] - 1;
4783
4784 // Construct a key to look up values in data_map.
4785 std::pair<dof_id_type, elemset_id_type> key =
4786 std::make_pair(libmesh_elem_id, elemset_ids[es]);
4787
4788 // Debugging:
4789 // libMesh::out << "Searching for key = (" << key.first << ", " << key.second << ")" << std::endl;
4790
4791 // We require that the user provided either no values for
4792 // this (var, elemset) combination (in which case we don't
4793 // reach this point) or a value for _every_ elem in this
4794 // elemset for this var, so we use the libmesh_map_find()
4795 // macro to check for this.
4796 elemset_var_vals[i] = libmesh_map_find(data_map, key);
4797 } // end for (node in nodeset[ns])
4798
4799 // Write elemset values to Exodus file
4800 if (elemset_var_vals.size() > 0)
4801 {
4802 ex_err = exII::ex_put_var
4803 (ex_id,
4804 timestep,
4805 exII::EX_ELEM_SET,
4806 var + 1, // 1-based variable index of current variable
4807 elemset_ids[es],
4809 MappedOutputVector(elemset_var_vals, _single_precision).data());
4810 EX_CHECK_ERR(ex_err, "Error writing elemset vars.");
4811 }
4812 } // end for (var in var_names)
4813 } // end for (ns)
4814
4815 // Finally, write the elemset truth table to file.
4816 ex_err =
4817 exII::ex_put_truth_table(ex_id,
4818 exII::EX_ELEM_SET, // exII::ex_entity_type
4820 cast_int<int>(var_names.size()),
4821 elemset_var_tab.data());
4822 EX_CHECK_ERR(ex_err, "Error writing elemset var truth table.");
4823}
void read_elemset_info()
Reads information about all of the elemsets in the ExodusII mesh file.
void read_elemset(int id, int offset)
Reads information about elemset id and inserts it into the global elemset array at the position offse...

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ELEMSET, libMesh::ExodusII_IO_Helper::elemset_ids, libMesh::ExodusII_IO_Helper::elemset_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), libMesh::ExodusII_IO_Helper::num_elem_sets, libMesh::ExodusII_IO_Helper::num_elems_per_set, libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO_Helper::read_elemset(), libMesh::ExodusII_IO_Helper::read_elemset_info(), and libMesh::ExodusII_IO_Helper::write_var_names().

◆ write_elemsets()

void libMesh::ExodusII_IO_Helper::write_elemsets ( const MeshBase &  mesh)
inherited

Write elemsets stored on the Mesh to the exo file.

Definition at line 4212 of file exodusII_io_helper.C.

4213{
4214 LOG_SCOPE("write_elemsets()", "ExodusII_IO_Helper");
4215
4216 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4217 return;
4218
4219 // TODO: Add support for named elemsets
4220 // NamesData names_table(elemsets.size(), _max_name_length);
4221
4222 // We only need to write elemsets if the Mesh has an extra elem
4223 // integer called "elemset_code" defined on it.
4224 if (mesh.has_elem_integer("elemset_code"))
4225 {
4226 std::map<elemset_id_type, std::vector<int>> exodus_elemsets;
4227
4228 unsigned int elemset_index =
4229 mesh.get_elem_integer_index("elemset_code");
4230
4231 // Catch ids returned from MeshBase::get_elemsets() calls
4232 MeshBase::elemset_type set_ids;
4233 for (const auto & elem : mesh.element_ptr_range())
4234 {
4235 dof_id_type elemset_code =
4236 elem->get_extra_integer(elemset_index);
4237
4238 // Look up which element set ids (if any) this elemset_code corresponds to.
4239 mesh.get_elemsets(elemset_code, set_ids);
4240
4241 // Debugging
4242 // libMesh::out << "elemset_code = " << elemset_code << std::endl;
4243 // for (const auto & set_id : set_ids)
4244 // libMesh::out << set_id << " ";
4245 // libMesh::out << std::endl;
4246
4247 // Store this Elem id in every set to which it belongs.
4248 for (const auto & set_id : set_ids)
4249 exodus_elemsets[set_id].push_back(libmesh_elem_num_to_exodus[elem->id()]);
4250 }
4251
4252 // Debugging: print contents of exodus_elemsets map
4253 // for (const auto & [set_id, elem_ids] : exodus_elemsets)
4254 // {
4255 // libMesh::out << "elemset " << set_id << ": ";
4256 // for (const auto & elem_id : elem_ids)
4257 // libMesh::out << elem_id << " ";
4258 // libMesh::out << std::endl;
4259 // }
4260
4261 // Only continue if we actually had some elements in sets
4262 if (!exodus_elemsets.empty())
4263 {
4264 // Reserve space, loop over newly-created map, construct
4265 // exII::ex_set objects to be passed to exII::ex_put_sets(). Note:
4266 // we do non-const iteration since Exodus requires non-const pointers
4267 // to be passed to its APIs.
4268 std::vector<exII::ex_set> sets;
4269 sets.reserve(exodus_elemsets.size());
4270
4271 for (auto & [elem_set_id, ids_vec] : exodus_elemsets)
4272 {
4273 // TODO: Add support for named elemsets
4274 // names_table.push_back_entry(mesh.get_elemset_name(elem_set_id));
4275
4276 exII::ex_set & current_set = sets.emplace_back();
4277 current_set.id = elem_set_id;
4278 current_set.type = exII::EX_ELEM_SET;
4279 current_set.num_entry = ids_vec.size();
4280 current_set.num_distribution_factor = 0;
4281 current_set.entry_list = ids_vec.data();
4282 current_set.extra_list = nullptr; // extra_list is used for sidesets, not needed for elemsets
4283 current_set.distribution_factor_list = nullptr; // not used for elemsets
4284 }
4285
4286 // Sanity check: make sure the number of elemsets we already wrote to the header
4287 // matches the number of elemsets we just constructed by looping over the Mesh.
4288 libmesh_assert_msg(num_elem_sets == cast_int<int>(exodus_elemsets.size()),
4289 "Mesh has " << exodus_elemsets.size()
4290 << " elemsets, but header was written with num_elem_sets == " << num_elem_sets);
4291 libmesh_assert_msg(num_elem_sets == cast_int<int>(mesh.n_elemsets()),
4292 "mesh.n_elemsets() == " << mesh.n_elemsets()
4293 << ", but header was written with num_elem_sets == " << num_elem_sets);
4294
4295 ex_err = exII::ex_put_sets(ex_id, exodus_elemsets.size(), sets.data());
4296 EX_CHECK_ERR(ex_err, "Error writing elemsets");
4297
4298 // TODO: Add support for named elemsets
4299 // ex_err = exII::ex_put_names(ex_id, exII::EX_ELEM_SET, names_table.get_char_star_star());
4300 // EX_CHECK_ERR(ex_err, "Error writing elemset names");
4301 } // end if (!exodus_elemsets.empty())
4302 } // end if (mesh.has_elem_integer("elemset_code"))
4303}
unsigned int get_elem_integer_index(std::string_view name) const
Definition mesh_base.C:689
bool has_elem_integer(std::string_view name) const
Definition mesh_base.C:701
unsigned int n_elemsets() const
Returns the number of unique elemset ids which have been added via add_elemset_code(),...
Definition mesh_base.C:487
void get_elemsets(dof_id_type elemset_code, MeshBase::elemset_type &id_set_to_fill) const
Look up the element sets for a given elemset code and vice-versa.
Definition mesh_base.C:492
std::set< elemset_id_type > elemset_type
Typedef for the "set" container used to store elemset ids.
Definition mesh_base.h:463

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::MeshBase::get_elem_integer_index(), libMesh::MeshBase::get_elemsets(), libMesh::DofObject::get_extra_integer(), libMesh::MeshBase::has_elem_integer(), libMesh::DofObject::id(), libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, mesh, libMesh::MeshBase::n_elemsets(), libMesh::ExodusII_IO_Helper::num_elem_sets, and libMesh::ParallelObject::processor_id().

◆ write_exodus_initialization_info()

void libMesh::Nemesis_IO_Helper::write_exodus_initialization_info ( const MeshBase &  pmesh,
const std::string &  title 
)
private

This function writes exodus-specific initialization information.

This information is slightly different when you are working with Nemesis, as it depends on some global information being known.

Definition at line 919 of file nemesis_io_helper.C.

921{
922 this->num_elem = static_cast<unsigned int>(std::distance (pmesh.active_local_elements_begin(),
923 pmesh.active_local_elements_end()));
924
925 // Exodus will also use *global* number of side and node sets,
926 // though it will not write out entries for all of them...
927 this->num_side_sets =
928 cast_int<int>(this->global_sideset_ids.size());
929 this->num_node_sets =
930 cast_int<int>(this->global_nodeset_ids.size());
931
932 // We need to write the global number of blocks, even though this processor might not have
933 // elements in some of them!
935
936 ex_err = exII::ex_put_init(ex_id,
937 title_in.c_str(),
938 this->num_dim,
939 this->num_nodes,
940 this->num_elem,
941 this->num_elem_blk,
942 this->num_node_sets,
943 this->num_side_sets);
944
945 EX_CHECK_ERR(ex_err, "Error initializing new Nemesis file.");
946}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, global_nodeset_ids, global_sideset_ids, libMesh::ExodusII_IO_Helper::num_elem, libMesh::ExodusII_IO_Helper::num_elem_blk, num_elem_blks_global, libMesh::ExodusII_IO_Helper::num_node_sets, and libMesh::ExodusII_IO_Helper::num_side_sets.

Referenced by initialize().

◆ write_global_values()

void libMesh::ExodusII_IO_Helper::write_global_values ( const std::vector< Real > &  values,
int  timestep 
)
inherited

Writes the vector of global variables.

Definition at line 5413 of file exodusII_io_helper.C.

5414{
5415 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5416 return;
5417
5418 if (!values.empty())
5419 {
5420 ex_err = exII::ex_put_var
5421 (ex_id,
5422 timestep,
5423 exII::EX_GLOBAL,
5424 1, // var index
5425 0, // obj_id (not used)
5427 MappedOutputVector(values, _single_precision).data());
5428
5429 EX_CHECK_ERR(ex_err, "Error writing global values.");
5430
5431 this->update();
5432 }
5433}

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::update().

◆ write_information_records()

void libMesh::ExodusII_IO_Helper::write_information_records ( const std::vector< std::string > &  records)
inherited

Writes the vector of information records.

Definition at line 5375 of file exodusII_io_helper.C.

5376{
5377 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5378 return;
5379
5380 // There may already be information records in the file (for
5381 // example, if we're appending) and in that case, according to the
5382 // Exodus documentation, writing more information records is not
5383 // supported.
5384 int num_info = inquire(*this, exII::EX_INQ_INFO, "Error retrieving the number of information records from file!");
5385 if (num_info > 0)
5386 {
5387 libMesh::err << "Warning! The Exodus file already contains information records.\n"
5388 << "Exodus does not support writing additional records in this situation."
5389 << std::endl;
5390 return;
5391 }
5392
5393 int num_records = cast_int<int>(records.size());
5394
5395 if (num_records > 0)
5396 {
5397 NamesData info(num_records, MAX_LINE_LENGTH);
5398
5399 // If an entry is longer than MAX_LINE_LENGTH characters it's not an error, we just
5400 // write the first MAX_LINE_LENGTH characters to the file.
5401 for (const auto & record : records)
5402 info.push_back_entry(record);
5403
5404 ex_err = exII::ex_put_info(ex_id, num_records, info.get_char_star_star());
5405 EX_CHECK_ERR(ex_err, "Error writing global values.");
5406
5407 this->update();
5408 }
5409}
MPI_Info info

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::err, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::update().

◆ write_nodal_coordinates()

void libMesh::Nemesis_IO_Helper::write_nodal_coordinates ( const MeshBase &  mesh,
bool  use_discontinuous = false 
)
overridevirtual

This function is specialized from ExodusII_IO_Helper to write only the nodal coordinates stored on the local piece of the Mesh.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 2224 of file nemesis_io_helper.C.

2225{
2226 auto local_num_nodes = this->exodus_node_num_to_libmesh.size();
2227
2228 x.resize(local_num_nodes);
2229 y.resize(local_num_nodes);
2230 z.resize(local_num_nodes);
2231
2232 // Just loop over our list outputting the nodes the way we built the map
2233 for (auto i : make_range(local_num_nodes))
2234 {
2235 const Point & pt = mesh.point(this->exodus_node_num_to_libmesh[i]-1);
2236 x[i]=pt(0);
2237 y[i]=pt(1);
2238 z[i]=pt(2);
2239 }
2240
2241 if (local_num_nodes)
2242 {
2243 // Call Exodus API to write nodal coordinates...
2244 ex_err = exII::ex_put_coord
2245 (ex_id,
2246 x.empty() ? nullptr : MappedOutputVector(x, _single_precision).data(),
2247 y.empty() ? nullptr : MappedOutputVector(y, _single_precision).data(),
2248 z.empty() ? nullptr : MappedOutputVector(z, _single_precision).data());
2249 EX_CHECK_ERR(ex_err, "Error writing node coordinates");
2250
2251 // And write the nodal map we created for them
2252 ex_err = exII::ex_put_node_num_map(ex_id, this->exodus_node_num_to_libmesh.data());
2253 EX_CHECK_ERR(ex_err, "Error writing node num map");
2254 }
2255 else // Does the Exodus API want us to write empty nodal coordinates?
2256 {
2257 ex_err = exII::ex_put_coord(ex_id, nullptr, nullptr, nullptr);
2258 EX_CHECK_ERR(ex_err, "Error writing empty node coordinates");
2259
2260 ex_err = exII::ex_put_node_num_map(ex_id, nullptr);
2261 EX_CHECK_ERR(ex_err, "Error writing empty node num map");
2262 }
2263}

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::MappedOutputVector::data(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::make_range(), mesh, libMesh::ExodusII_IO_Helper::x, libMesh::ExodusII_IO_Helper::y, and libMesh::ExodusII_IO_Helper::z.

◆ write_nodal_solution() [1/3]

void libMesh::Nemesis_IO_Helper::write_nodal_solution ( const EquationSystems &  es,
const std::vector< std::pair< unsigned int, unsigned int > > &  var_nums,
int  timestep,
const std::vector< std::string > &  output_names 
)

Outputs EquationSystems current_local_solution nodal values.

Definition at line 2450 of file nemesis_io_helper.C.

2454{
2455 const MeshBase & mesh = es.get_mesh();
2456
2457 // FIXME - half this code might be replaceable with a call to
2458 // EquationSystems::build_parallel_solution_vector()...
2459
2460 // Vector-valued nodal variables (e.g. LAGRANGE_VEC, 1st-order
2461 // MONOMIAL_VEC) are decomposed into per-component names
2462 // (name+"_x", name+"_y", ...) by
2463 // EquationSystems::find_variable_numbers_by_predicate(), so we must
2464 // look up and write each component separately below.
2465 const std::vector<std::string> component_suffix = {"_x", "_y", "_z"};
2466
2467 for (auto [sys_num, var] : var_nums)
2468 {
2469 const System & sys = es.get_system(sys_num);
2470
2471 // Parallel formats like Nemesis skip
2472 // EquationSystems::build_solution_vector() (see
2473 // MeshOutput::write_equation_systems()), which is what normally
2474 // keeps System::current_local_solution in sync with
2475 // System::solution by calling System::update(). Since we read
2476 // directly from current_local_solution below, make sure it's up
2477 // to date first.
2478 {
2479 System & non_const_sys = const_cast<System &>(sys);
2480 if (!non_const_sys.solution->closed())
2481 non_const_sys.solution->close();
2482 non_const_sys.update();
2483 }
2484
2485 const std::string & name = sys.variable_name(var);
2486 const FEType type = sys.variable_type(var);
2487
2488 const bool is_vector = (FEInterface::field_type(type) == TYPE_VECTOR);
2489 const unsigned int n_comps =
2490 is_vector ? FEInterface::n_vec_dim(mesh, type) : 1;
2491
2492 for (unsigned int comp = 0; comp < n_comps; ++comp)
2493 {
2494 const std::string full_name =
2495 is_vector ? name + component_suffix[comp] : name;
2496
2497 auto pos = std::find(output_names.begin(), output_names.end(), full_name);
2498
2499 // Skip this name if it's not supposed to be output.
2500 if (pos == output_names.end())
2501 continue;
2502
2503 // Compute the (zero-based) index which determines which
2504 // variable this will be as far as Nemesis is concerned. This
2505 // will be used below in the write_nodal_values() call.
2506 int variable_name_position =
2507 cast_int<int>(std::distance(output_names.begin(), pos));
2508
2509 // Fill up a std::vector with the dofs for the current variable
2510 std::vector<numeric_index_type> required_indices(this->num_nodes);
2511
2512 // Get the dof values required to write just our local part of
2513 // the solution vector.
2514 std::vector<Number> local_soln;
2515
2516 if (type.family == SCALAR)
2517 {
2518 std::vector<numeric_index_type> scalar_indices;
2519 sys.get_dof_map().SCALAR_dof_indices(scalar_indices, var);
2520 for (int i=0; i<this->num_nodes; i++)
2521 required_indices[i] = scalar_indices[0];
2522 sys.current_local_solution->get(required_indices, local_soln);
2523 }
2524 else
2525 {
2526 // If we have DoFs at all nodes, e.g. for isoparametric
2527 // elements, this is easy:
2528 bool found_all_indices = true;
2529 for (int i=0; i<this->num_nodes; i++)
2530 {
2531 const Node & node = mesh.node_ref(this->exodus_node_num_to_libmesh[i]-1);
2532 if (node.n_comp(sys_num, var))
2533 required_indices[i] = node.dof_number(sys_num, var, comp);
2534 else
2535 {
2536 found_all_indices = false;
2537 break;
2538 }
2539 }
2540
2541 // The "hard way" below makes collective NumericVector
2542 // calls, so every processor must agree on which way to
2543 // go; a processor with no local nodes for this variable
2544 // (e.g. it owns no local elements at all) would
2545 // otherwise default to found_all_indices=true and skip
2546 // those collective calls, hanging the processors that
2547 // still need to make them.
2548 mesh.comm().min(found_all_indices);
2549
2550 if (found_all_indices)
2551 sys.current_local_solution->get(required_indices, local_soln);
2552 // Fine, we'll do it the hard way
2553 if (!found_all_indices)
2554 {
2555 // Elements sharing a node can disagree on the
2556 // element-local nodal_soln value there (e.g. for
2557 // Nedelec/Raviart-Thomas elements, which are not
2558 // vertex-continuous), so we accumulate contributions
2559 // from every element touching each node and average
2560 // them, matching
2561 // EquationSystems::build_parallel_solution_vector().
2562 //
2563 // A node can be touched by elements owned by
2564 // different processors (e.g. a node on a partition
2565 // boundary), so a plain local accumulation would only
2566 // see this processor's own contributions. Instead we
2567 // accumulate into distributed vectors indexed by
2568 // global node id and let NumericVector::close() sum
2569 // the cross-processor contributions, then localize()
2570 // just the values we need.
2571 const dof_id_type max_node_id = mesh.max_node_id();
2572 const dof_id_type n_local_nodes =
2573 cast_int<dof_id_type>(std::distance(mesh.local_nodes_begin(),
2574 mesh.local_nodes_end()));
2575
2576 std::unique_ptr<NumericVector<Number>> global_soln_ptr =
2578 NumericVector<Number> & global_soln = *global_soln_ptr;
2579 global_soln.init(max_node_id, n_local_nodes, false, PARALLEL);
2580
2581 std::unique_ptr<NumericVector<Number>> global_repeat_ptr =
2583 NumericVector<Number> & global_repeat = *global_repeat_ptr;
2584 global_repeat.init(max_node_id, n_local_nodes, false, PARALLEL);
2585 global_repeat.close();
2586
2587 const Variable & var_description = sys.variable(var);
2588 const DofMap & dof_map = sys.get_dof_map();
2589
2590 NumericVector<Number> & sys_soln(*sys.current_local_solution);
2591 std::vector<Number> elem_soln; // The finite element solution
2592 std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes
2593 std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
2594
2595 for (const auto & elem : mesh.active_local_element_ptr_range())
2596 if (var_description.active_on_subdomain(elem->subdomain_id()))
2597 {
2598 dof_map.dof_indices (elem, dof_indices, var);
2599 elem_soln.resize(dof_indices.size());
2600
2601 for (auto i : index_range(dof_indices))
2602 elem_soln[i] = sys_soln(dof_indices[i]);
2603
2604 FEInterface::nodal_soln (elem->dim(),
2605 type,
2606 elem,
2607 elem_soln,
2608 nodal_soln,
2609 /*add_p_level=*/true,
2610 is_vector ? elem->dim() : 1);
2611
2612 // infinite elements should be skipped...
2613 if (!elem->infinite())
2614 for (auto n : elem->node_index_range())
2615 {
2616 // For a vector variable, nodal_soln is
2617 // laid out as elem->dim() components per
2618 // node; skip components that don't exist
2619 // on lower-dimensional elements.
2620 if (is_vector && comp >= elem->dim())
2621 continue;
2622
2623 const dof_id_type node_id = elem->node_id(n);
2624 const Number value =
2625 is_vector ?
2626 nodal_soln[n*elem->dim() + comp] :
2627 nodal_soln[n];
2628
2629 global_soln.add(node_id, value);
2630 global_repeat.add(node_id, Number(1));
2631 }
2632 }
2633
2634 global_soln.close();
2635 global_repeat.close();
2636
2637 // Nodes with no contributions at all (e.g. gaps left
2638 // by a non-renumbered, coarsened mesh, or nodes where
2639 // this variable isn't active on any subdomain) would
2640 // otherwise cause a divide-by-zero; their (unused)
2641 // global_soln entry is already zero.
2642 for (numeric_index_type i = global_repeat.first_local_index();
2643 i < global_repeat.last_local_index(); ++i)
2644 if (global_repeat(i) == Number(0))
2645 global_repeat.set(i, Number(1));
2646 global_repeat.close();
2647
2648 global_soln /= global_repeat;
2649
2650 std::vector<numeric_index_type> required_node_ids(num_nodes);
2651 for (int i=0; i<num_nodes; ++i)
2652 required_node_ids[i] = this->exodus_node_num_to_libmesh[i]-1;
2653
2654 global_soln.localize(local_soln, required_node_ids);
2655 }
2656 }
2657
2658#ifndef LIBMESH_USE_COMPLEX_NUMBERS
2659 // Call the ExodusII_IO_Helper function to write the data.
2660 write_nodal_values(variable_name_position + 1, local_soln, timestep);
2661#else
2662 // We have the local (complex) values. Now extract the real,
2663 // imaginary, and magnitude values from them.
2664 std::vector<Real> real_parts(num_nodes);
2665 std::vector<Real> imag_parts(num_nodes);
2666 std::vector<Real> magnitudes(num_nodes);
2667
2668 for (int i=0; i<num_nodes; ++i)
2669 {
2670 real_parts[i] = local_soln[i].real();
2671 imag_parts[i] = local_soln[i].imag();
2672 magnitudes[i] = std::abs(local_soln[i]);
2673 }
2674
2675 // Write the real, imaginary, and magnitude values to file.
2676 write_nodal_values(3 * variable_name_position + 1, real_parts, timestep);
2677 write_nodal_values(3 * variable_name_position + 2, imag_parts, timestep);
2678 write_nodal_values(3 * variable_name_position + 3, magnitudes, timestep);
2679#endif
2680 } // end loop over vector components
2681 }
2682}
void write_nodal_values(int var_id, const std::vector< Real > &values, int timestep)
Writes the vector of values to a nodal variable.
static void nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln, const bool add_p_level=true, const unsigned int vdim=1)
Build the nodal soln from the element soln.
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
dof_id_type numeric_index_type
Definition id_types.h:99
template class LIBMESH_EXPORT NumericVector< Number >
static const bool value
Definition xdr_io.C:55

References libMesh::Variable::active_on_subdomain(), libMesh::NumericVector< T >::add(), libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::close(), libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), libMesh::DofObject::dof_number(), libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::FEType::family, libMesh::FEInterface::field_type(), libMesh::NumericVector< T >::first_local_index(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::NumericVector< T >::init(), libMesh::NumericVector< T >::last_local_index(), libMesh::NumericVector< T >::localize(), mesh, libMesh::DofObject::n_comp(), libMesh::FEInterface::n_vec_dim(), libMesh::FEInterface::nodal_soln(), libMesh::ExodusII_IO_Helper::num_nodes, libMesh::PARALLEL, libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::NumericVector< T >::set(), libMesh::System::solution, libMesh::TYPE_VECTOR, libMesh::System::update(), value, libMesh::System::variable(), libMesh::System::variable_name(), libMesh::System::variable_type(), and libMesh::ExodusII_IO_Helper::write_nodal_values().

◆ write_nodal_solution() [2/3]

void libMesh::Nemesis_IO_Helper::write_nodal_solution ( const NumericVector< Number > &  parallel_soln,
const std::vector< std::string > &  names,
int  timestep,
const std::vector< std::string > &  output_names 
)

Takes a parallel solution vector containing the node-major solution vector for all variables and outputs it to the files.

Parameters
parallel_soln
namesA vector containing the names of all variables in parallel_soln.
timestepTo be passed to the ExodusII_IO_Helper::write_nodal_values() function.
output_namesA vector containing the names of variables in parallel_soln that should actually be written (whitelist).
Note
This version of write_nodal_solution() is called by the parallel version of Nemesis_IO::write_nodal_data(), which is called by MeshOutput::write_equation_systems() for parallel I/O formats like Nemesis. The other version is still available to continue supporting things like NamebasedIO::write_nodal_data(), but this version should be preferred when running in parallel.

Definition at line 2390 of file nemesis_io_helper.C.

2394{
2395 int num_vars = cast_int<int>(names.size());
2396
2397 for (int c=0; c<num_vars; c++)
2398 {
2399 // Find the position of names[c] in the output_names vector, if it exists.
2400 auto pos = std::find(output_names.begin(), output_names.end(), names[c]);
2401
2402 // Skip names[c] if it's not supposed to be output.
2403 if (pos == output_names.end())
2404 continue;
2405
2406 // Compute the (zero-based) index which determines which
2407 // variable this will be as far as Nemesis is concerned. This
2408 // will be used below in the write_nodal_values() call.
2409 int variable_name_position =
2410 cast_int<int>(std::distance(output_names.begin(), pos));
2411
2412 // Fill up a std::vector with the dofs for the current variable
2413 std::vector<numeric_index_type> required_indices(this->num_nodes);
2414
2415 for (int i=0; i<this->num_nodes; i++)
2416 required_indices[i] = static_cast<dof_id_type>(this->exodus_node_num_to_libmesh[i]-1) * num_vars + c;
2417
2418 // Get the dof values required to write just our local part of
2419 // the solution vector.
2420 std::vector<Number> local_soln;
2421 parallel_soln.localize(local_soln, required_indices);
2422
2423#ifndef LIBMESH_USE_COMPLEX_NUMBERS
2424 // Call the ExodusII_IO_Helper function to write the data.
2425 write_nodal_values(variable_name_position + 1, local_soln, timestep);
2426#else
2427 // We have the local (complex) values. Now extract the real,
2428 // imaginary, and magnitude values from them.
2429 std::vector<Real> real_parts(num_nodes);
2430 std::vector<Real> imag_parts(num_nodes);
2431 std::vector<Real> magnitudes(num_nodes);
2432
2433 for (int i=0; i<num_nodes; ++i)
2434 {
2435 real_parts[i] = local_soln[i].real();
2436 imag_parts[i] = local_soln[i].imag();
2437 magnitudes[i] = std::abs(local_soln[i]);
2438 }
2439
2440 // Write the real, imaginary, and magnitude values to file.
2441 write_nodal_values(3 * variable_name_position + 1, real_parts, timestep);
2442 write_nodal_values(3 * variable_name_position + 2, imag_parts, timestep);
2443 write_nodal_values(3 * variable_name_position + 3, magnitudes, timestep);
2444#endif
2445 }
2446}
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.

References libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::NumericVector< T >::localize(), libMesh::ExodusII_IO_Helper::num_nodes, and libMesh::ExodusII_IO_Helper::write_nodal_values().

◆ write_nodal_solution() [3/3]

void libMesh::Nemesis_IO_Helper::write_nodal_solution ( const std::vector< Number > &  values,
const std::vector< std::string > &  names,
int  timestep 
)

Takes a solution vector containing the solution for all variables and outputs it to the files.

Definition at line 2352 of file nemesis_io_helper.C.

2355{
2356 int num_vars = cast_int<int>(names.size());
2357 //int num_values = values.size(); // Not used?
2358
2359 for (int c=0; c<num_vars; c++)
2360 {
2361#ifdef LIBMESH_USE_COMPLEX_NUMBERS
2362 std::vector<Real> real_parts(num_nodes);
2363 std::vector<Real> imag_parts(num_nodes);
2364 std::vector<Real> magnitudes(num_nodes);
2365
2366 for (int i=0; i<num_nodes; ++i)
2367 {
2368 Number value = values[(this->exodus_node_num_to_libmesh[i]-1)*num_vars + c];
2369 real_parts[i] = value.real();
2370 imag_parts[i] = value.imag();
2371 magnitudes[i] = std::abs(value);
2372 }
2373 write_nodal_values(3*c+1,real_parts,timestep);
2374 write_nodal_values(3*c+2,imag_parts,timestep);
2375 write_nodal_values(3*c+3,magnitudes,timestep);
2376#else
2377 std::vector<Number> cur_soln(this->num_nodes);
2378
2379 // Copy out this variable's solution
2380 for (int i=0; i<this->num_nodes; i++)
2381 cur_soln[i] = values[(this->exodus_node_num_to_libmesh[i]-1)*num_vars + c];
2382
2383 write_nodal_values(c+1,cur_soln,timestep);
2384#endif
2385 }
2386}

References libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::ExodusII_IO_Helper::num_nodes, value, and libMesh::ExodusII_IO_Helper::write_nodal_values().

◆ write_nodal_values()

void libMesh::ExodusII_IO_Helper::write_nodal_values ( int  var_id,
const std::vector< Real > &  values,
int  timestep 
)
inherited

Writes the vector of values to a nodal variable.

Definition at line 5347 of file exodusII_io_helper.C.

5350{
5351 if ((_run_only_on_proc0) && (this->processor_id() != 0))
5352 return;
5353
5354 if (!values.empty())
5355 {
5356 libmesh_assert_equal_to(values.size(), std::size_t(num_nodes));
5357
5358 ex_err = exII::ex_put_var
5359 (ex_id,
5360 timestep,
5361 exII::EX_NODAL,
5362 var_id,
5363 1, // exII::ex_entity_id, not sure exactly what this is but in the ex_put_nodal_var.c shim, they pass 1
5364 num_nodes,
5365 MappedOutputVector(values, _single_precision).data());
5366
5367 EX_CHECK_ERR(ex_err, "Error writing nodal values.");
5368
5369 this->update();
5370 }
5371}

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::update().

Referenced by write_nodal_solution(), write_nodal_solution(), and write_nodal_solution().

◆ write_nodeset_data()

void libMesh::ExodusII_IO_Helper::write_nodeset_data ( int  timestep,
const std::vector< std::string > &  var_names,
const std::vector< std::set< boundary_id_type > > &  node_boundary_ids,
const std::vector< std::map< BoundaryInfo::NodeBCTuple, Real > > &  bc_vals 
)
inherited

Write nodeset data for the requested timestep.

Definition at line 4600 of file exodusII_io_helper.C.

4605{
4606 LOG_SCOPE("write_nodeset_data()", "ExodusII_IO_Helper");
4607
4608 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4609 return;
4610
4611 // Write the nodeset variable names to file. This function should
4612 // only be called once for NODESET variables, repeated calls to
4613 // write_var_names() overwrites/changes the order of names that were
4614 // there previously, and will mess up any data that has already been
4615 // written.
4616 this->write_var_names(NODESET, var_names);
4617
4618 // For all nodesets, reads and fills in the arrays:
4619 // nodeset_ids
4620 // num_nodes_per_set
4621 // node_sets_node_index - starting index for each nodeset in the node_sets_node_list vector
4622 // node_sets_node_list
4623 // Note: we need these arrays so that we know what data to write
4624 this->read_all_nodesets();
4625
4626 // The "truth" table for nodeset variables. nset_var_tab is a
4627 // logically (num_node_sets x num_nset_var) integer array of 0s and
4628 // 1s indicating which nodesets a given nodeset variable is defined
4629 // on.
4630 std::vector<int> nset_var_tab(num_node_sets * var_names.size());
4631
4632 for (int ns=0; ns<num_node_sets; ++ns)
4633 {
4634 // The offset into the node_sets_node_list for the current nodeset
4635 int offset = node_sets_node_index[ns];
4636
4637 // For each variable in var_names, write the values for the
4638 // current nodeset, if any.
4639 for (auto var : index_range(var_names))
4640 {
4641 // If this var has no values on this nodeset, go to the next one.
4642 if (!node_boundary_ids[var].count(nodeset_ids[ns]))
4643 continue;
4644
4645 // Otherwise, fill in this entry of the nodeset truth table.
4646 nset_var_tab[ns*var_names.size() + var] = 1;
4647
4648 // Data vector that will eventually be passed to exII::ex_put_var().
4649 std::vector<Real> nset_var_vals(num_nodes_per_set[ns]);
4650
4651 // Get reference to the NodeBCTuple -> Real map for this variable.
4652 const auto & data_map = bc_vals[var];
4653
4654 // Loop over entries in current nodeset.
4655 for (int i=0; i<num_nodes_per_set[ns]; ++i)
4656 {
4657 // Here we convert Exodus node ids to libMesh node ids by
4658 // subtracting 1. We should probably use the
4659 // exodus_node_num_to_libmesh data structure for this, but
4660 // I don't think it is set up at the time when
4661 // write_nodeset_data() would normally be called.
4662 dof_id_type libmesh_node_id = node_sets_node_list[i + offset] - 1;
4663
4664 // Construct a key to look up values in data_map.
4666 std::make_tuple(libmesh_node_id, nodeset_ids[ns]);
4667
4668 // We require that the user provided either no values for
4669 // this (var, nodeset) combination (in which case we don't
4670 // reach this point) or a value for _every_ node in this
4671 // nodeset for this var, so we use the libmesh_map_find()
4672 // macro to check for this.
4673 nset_var_vals[i] = libmesh_map_find(data_map, key);
4674 } // end for (node in nodeset[ns])
4675
4676 // Write nodeset values to Exodus file
4677 if (nset_var_vals.size() > 0)
4678 {
4679 ex_err = exII::ex_put_var
4680 (ex_id,
4681 timestep,
4682 exII::EX_NODE_SET,
4683 var + 1, // 1-based variable index of current variable
4684 nodeset_ids[ns],
4686 MappedOutputVector(nset_var_vals, _single_precision).data());
4687 EX_CHECK_ERR(ex_err, "Error writing nodeset vars.");
4688 }
4689 } // end for (var in var_names)
4690 } // end for (ns)
4691
4692 // Finally, write the nodeset truth table.
4693 ex_err =
4694 exII::ex_put_truth_table(ex_id,
4695 exII::EX_NODE_SET,
4697 cast_int<int>(var_names.size()),
4698 nset_var_tab.data());
4699 EX_CHECK_ERR(ex_err, "Error writing nodeset var truth table.");
4700}
void read_all_nodesets()
New API that reads all nodesets simultaneously.

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::index_range(), libMesh::ExodusII_IO_Helper::node_sets_node_index, libMesh::ExodusII_IO_Helper::node_sets_node_list, libMesh::ExodusII_IO_Helper::NODESET, libMesh::ExodusII_IO_Helper::nodeset_ids, libMesh::ExodusII_IO_Helper::num_node_sets, libMesh::ExodusII_IO_Helper::num_nodes_per_set, libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO_Helper::read_all_nodesets(), and libMesh::ExodusII_IO_Helper::write_var_names().

◆ write_nodesets()

void libMesh::Nemesis_IO_Helper::write_nodesets ( const MeshBase &  mesh)
overridevirtual

Writes the nodesets for this processor.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 1934 of file nemesis_io_helper.C.

1935{
1936 // Write the nodesets. In Nemesis, the idea is to "create space" for the global
1937 // set of boundary nodesets, but to only write node IDs which are local to the current
1938 // processor. This is what is done in Nemesis files created by the "loadbal" script.
1939
1940 // Store a map of vectors for boundary node IDs on this processor.
1941 // Use a vector of int here so it can be passed directly to Exodus.
1942 std::map<boundary_id_type, std::vector<int>> local_node_boundary_id_lists;
1943
1944 // FIXME: We should build this list only one time!! We already built it above, but we
1945 // did not have the libmesh to exodus node mapping at that time... for now we'll just
1946 // build it here again, hopefully it's small relative to the size of the entire mesh.
1947
1948 // Build list of (node-id, bc-id) tuples.
1949 typedef std::tuple<dof_id_type, boundary_id_type> Tuple;
1950 std::vector<Tuple> bc_tuples = mesh.get_boundary_info().build_node_list();
1951
1952 if (verbose)
1953 {
1954 libMesh::out << "[" << this->processor_id() << "] boundary_node_list.size()="
1955 << bc_tuples.size() << std::endl;
1956 libMesh::out << "[" << this->processor_id() << "] (boundary_node_id, boundary_id) = ";
1957 for (const auto & t : bc_tuples)
1958 libMesh::out << "(" << std::get<0>(t) << ", " << std::get<1>(t) << ") ";
1959 libMesh::out << std::endl;
1960 }
1961
1962 // For each node in the node list, add it to the vector of node IDs for that
1963 // set for the local processor. This will be used later when writing Exodus
1964 // nodesets.
1965 for (const auto & t : bc_tuples)
1966 {
1967 // Don't try to grab a reference to the vector unless the current node is attached
1968 // to a local element. Otherwise, another processor will be responsible for writing it in its nodeset.
1969 if (const auto it = this->libmesh_node_num_to_exodus.find(std::get<0>(t));
1970 it != this->libmesh_node_num_to_exodus.end())
1971 {
1972 // Get reference to the vector where this node ID will be inserted. If it
1973 // doesn't yet exist, this will create it.
1974 std::vector<int> & current_id_set = local_node_boundary_id_lists[std::get<1>(t)];
1975
1976 // Push back Exodus-mapped node ID for this set
1977 // TODO: reserve space in these vectors somehow.
1978 current_id_set.push_back( it->second );
1979 }
1980 }
1981
1982 // See what we got
1983 if (verbose)
1984 {
1985 for (const auto & [bndry_id, set] : local_node_boundary_id_lists)
1986 {
1987 libMesh::out << "[" << this->processor_id() << "] ID: " << bndry_id << ", ";
1988
1989 // Libmesh node ID (Exodus Node ID)
1990 for (const auto & id : set)
1991 libMesh::out << id << ", ";
1992 libMesh::out << std::endl;
1993 }
1994 }
1995
1996 // Loop over *global* nodeset IDs, call the Exodus API. Note that some nodesets may be empty
1997 // for a given processor.
1998 if (global_nodeset_ids.size() > 0)
1999 {
2000 NamesData names_table(global_nodeset_ids.size(), MAX_STR_LENGTH);
2001
2002 for (const auto & nodeset_id : this->global_nodeset_ids)
2003 {
2004 const std::string & current_ns_name =
2005 mesh.get_boundary_info().get_nodeset_name
2006 (cast_int<boundary_id_type>(nodeset_id));
2007
2008 // Store this name in a data structure that will be used to
2009 // write sideset names to file.
2010 names_table.push_back_entry(current_ns_name);
2011
2012 if (verbose)
2013 {
2014 libMesh::out << "[" << this->processor_id()
2015 << "] Writing out Exodus nodeset info for ID: " << nodeset_id
2016 << ", Name: " << current_ns_name
2017 << std::endl;
2018 }
2019
2020 // Convert current global_nodeset_id into an exodus ID, which can't be zero...
2021 int exodus_id = nodeset_id;
2022
2023 /*
2024 // Exodus can't handle zero nodeset IDs (?) Use max short here since
2025 // when libmesh reads it back in, it will want to store it as a short...
2026 if (exodus_id==0)
2027 exodus_id = std::numeric_limits<short>::max();
2028 */
2029
2030 // Try to find this boundary ID in the local list we created
2031 if (const auto it = local_node_boundary_id_lists.find (cast_int<boundary_id_type>(nodeset_id));
2032 it == local_node_boundary_id_lists.end())
2033 {
2034 // No nodes found for this boundary ID on this processor
2035 if (verbose)
2036 libMesh::out << "[" << this->processor_id()
2037 << "] No nodeset data for ID: " << nodeset_id
2038 << " on this processor." << std::endl;
2039
2040 // Call the Exodus interface to write the parameters of this node set
2041 this->ex_err = exII::ex_put_node_set_param(this->ex_id,
2042 exodus_id,
2043 0, /* No nodes for this ID */
2044 0 /* No distribution factors */);
2045 EX_CHECK_ERR(this->ex_err, "Error writing nodeset parameters in Nemesis");
2046
2047 }
2048 else // Boundary ID *was* found in list
2049 {
2050 // Get reference to the vector of node IDs
2051 const std::vector<int> & current_nodeset_ids = it->second;
2052
2053 // Call the Exodus interface to write the parameters of this node set
2054 this->ex_err = exII::ex_put_node_set_param(this->ex_id,
2055 exodus_id,
2056 current_nodeset_ids.size(),
2057 0 /* No distribution factors */);
2058
2059 EX_CHECK_ERR(this->ex_err, "Error writing nodeset parameters in Nemesis");
2060
2061 // Call Exodus interface to write the actual node IDs for this boundary ID
2062 this->ex_err = exII::ex_put_node_set(this->ex_id,
2063 exodus_id,
2064 current_nodeset_ids.data());
2065
2066 EX_CHECK_ERR(this->ex_err, "Error writing nodesets in Nemesis");
2067
2068 }
2069 } // end loop over global nodeset IDs
2070
2071 // Write out the nodeset names
2072 ex_err = exII::ex_put_names(ex_id,
2073 exII::EX_NODE_SET,
2074 names_table.get_char_star_star());
2075 EX_CHECK_ERR(ex_err, "Error writing nodeset names");
2076 } // end for loop over global nodeset IDs
2077}

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::NamesData::get_char_star_star(), global_nodeset_ids, libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus, mesh, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO_Helper::NamesData::push_back_entry(), and libMesh::ExodusII_IO_Helper::verbose.

◆ write_sideset_data()

void libMesh::ExodusII_IO_Helper::write_sideset_data ( const MeshBase &  mesh,
int  timestep,
const std::vector< std::string > &  var_names,
const std::vector< std::set< boundary_id_type > > &  side_ids,
const std::vector< std::map< BoundaryInfo::BCTuple, Real > > &  bc_vals 
)
inherited

Write sideset data for the requested timestep.

Definition at line 4308 of file exodusII_io_helper.C.

4314{
4315 LOG_SCOPE("write_sideset_data()", "ExodusII_IO_Helper");
4316
4317 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4318 return;
4319
4320 // Write the sideset variable names to file. This function should
4321 // only be called once for SIDESET variables, repeated calls to
4322 // write_var_names overwrites/changes the order of names that were
4323 // there previously, and will mess up any data that has already been
4324 // written.
4325 this->write_var_names(SIDESET, var_names);
4326
4327 // I hope that we are allowed to call read_sideset_info() even
4328 // though we are in the middle of writing? It seems to work provided
4329 // that you have already written the mesh itself... read_sideset_info()
4330 // fills in the following data members:
4331 // .) num_side_sets
4332 // .) ss_ids
4333 this->read_sideset_info();
4334
4335 // Write "truth" table for sideset variables. The function
4336 // exII::ex_put_variable_param() must be called before
4337 // exII::ex_put_truth_table(). For us, this happens during the call
4338 // to ExodusII_IO_Helper::write_var_names(). sset_var_tab is a logically
4339 // (num_side_sets x num_sset_var) integer array of 0s and 1s
4340 // indicating which sidesets a given sideset variable is defined on.
4341 std::vector<int> sset_var_tab(num_side_sets * var_names.size());
4342
4343 // We now call read_sideset() once per sideset and write any sideset
4344 // variable values which are defined there.
4345 int offset=0;
4346 for (int ss=0; ss<num_side_sets; ++ss)
4347 {
4348 // We don't know num_sides_per_set for each set until we call
4349 // read_sideset(). The values for each sideset are stored (using
4350 // the offsets) into the 'elem_list' and 'side_list' arrays of
4351 // this class.
4352 offset += (ss > 0 ? num_sides_per_set[ss-1] : 0);
4353 this->read_sideset(ss, offset);
4354
4355 // For each variable in var_names, write the values for the
4356 // current sideset, if any.
4357 for (auto var : index_range(var_names))
4358 {
4359 // If this var has no values on this sideset, go to the next one.
4360 if (!side_ids[var].count(ss_ids[ss]))
4361 continue;
4362
4363 // Otherwise, fill in this entry of the sideset truth table.
4364 sset_var_tab[ss*var_names.size() + var] = 1;
4365
4366 // Data vector that will eventually be passed to exII::ex_put_var().
4367 std::vector<Real> sset_var_vals(num_sides_per_set[ss]);
4368
4369 // Get reference to the BCTuple -> Real map for this variable.
4370 const auto & data_map = bc_vals[var];
4371
4372 // Loop over elem_list, side_list entries in current sideset.
4373 for (int i=0; i<num_sides_per_set[ss]; ++i)
4374 {
4375 // Get elem_id and side_id from the respective lists that
4376 // are filled in by calling read_sideset().
4377 //
4378 // Note: these are Exodus-specific ids, so we have to convert them
4379 // to libmesh ids, as that is what will be in the bc_tuples.
4380 //
4381 // TODO: we should probably consult the exodus_elem_num_to_libmesh
4382 // mapping in order to figure out which libmesh element id 'elem_id'
4383 // actually corresponds to here, instead of just assuming it will be
4384 // off by one. Unfortunately that data structure does not seem to
4385 // be used at the moment. If we assume that write_sideset_data() is
4386 // always called following write(), then this should be a fairly safe
4387 // assumption...
4388 dof_id_type elem_id = elem_list[i + offset] - 1;
4389 unsigned int side_id = side_list[i + offset] - 1;
4390
4391 // Sanity check: make sure that the "off by one"
4392 // assumption we used above to set 'elem_id' is valid.
4393 libmesh_error_msg_if
4394 (libmesh_map_find(libmesh_elem_num_to_exodus, cast_int<int>(elem_id)) !=
4395 cast_int<dof_id_type>(elem_list[i + offset]),
4396 "Error mapping Exodus elem id to libmesh elem id.");
4397
4398 // Map from Exodus side ids to libmesh side ids.
4399 const auto & conv = get_conversion(mesh.elem_ptr(elem_id)->type());
4400
4401 // Map from Exodus side ids to libmesh side ids.
4402 unsigned int converted_side_id = conv.get_side_map(side_id);
4403
4404 // Construct a key so we can quickly see whether there is any
4405 // data for this variable in the map.
4406 BoundaryInfo::BCTuple key = std::make_tuple
4407 (elem_id,
4408 converted_side_id,
4409 ss_ids[ss]);
4410
4411 // Find the data for this (elem,side,id) tuple. Throw an
4412 // error if not found. Then store value in vector which
4413 // will be passed to Exodus.
4414 sset_var_vals[i] = libmesh_map_find(data_map, key);
4415 } // end for (i)
4416
4417 // As far as I can tell, there is no "concat" version of writing
4418 // sideset data, you have to call ex_put_sset_var() once per (variable,
4419 // sideset) pair.
4420 if (sset_var_vals.size() > 0)
4421 {
4422 ex_err = exII::ex_put_var
4423 (ex_id,
4424 timestep,
4425 exII::EX_SIDE_SET,
4426 var + 1, // 1-based variable index of current variable
4427 ss_ids[ss],
4429 MappedOutputVector(sset_var_vals, _single_precision).data());
4430 EX_CHECK_ERR(ex_err, "Error writing sideset vars.");
4431 }
4432 } // end for (var)
4433 } // end for (ss)
4434
4435 // Finally, write the sideset truth table.
4436 ex_err =
4437 exII::ex_put_truth_table(ex_id,
4438 exII::EX_SIDE_SET,
4440 cast_int<int>(var_names.size()),
4441 sset_var_tab.data());
4442 EX_CHECK_ERR(ex_err, "Error writing sideset var truth table.");
4443}
void read_sideset(int id, int offset)
Reads information about sideset id and inserts it into the global sideset array at the position offse...
void read_sideset_info()
Reads information about all of the sidesets in the ExodusII mesh file.
const boundary_id_type side_id

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::elem_list, libMesh::MeshBase::elem_ptr(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::index_range(), libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, mesh, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::ExodusII_IO_Helper::num_sides_per_set, libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO_Helper::read_sideset(), libMesh::ExodusII_IO_Helper::read_sideset_info(), side_id, libMesh::ExodusII_IO_Helper::side_list, libMesh::ExodusII_IO_Helper::SIDESET, libMesh::ExodusII_IO_Helper::ss_ids, libMesh::Elem::type(), and libMesh::ExodusII_IO_Helper::write_var_names().

◆ write_sidesets()

void libMesh::Nemesis_IO_Helper::write_sidesets ( const MeshBase &  mesh)
overridevirtual

Writes the sidesets for this processor.

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 2082 of file nemesis_io_helper.C.

2083{
2084 // Write the sidesets. In Nemesis, the idea is to "create space" for the global
2085 // set of boundary sidesets, but to only write sideset IDs which are local to the current
2086 // processor. This is what is done in Nemesis files created by the "loadbal" script.
2087 // See also: ExodusII_IO_Helper::write_sidesets()...
2088
2089
2090 // Store a map of vectors for boundary side IDs on this processor.
2091 // Use a vector of int here so it can be passed directly to Exodus.
2092 std::map<boundary_id_type, std::vector<int>> local_elem_boundary_id_lists;
2093 std::map<boundary_id_type, std::vector<int>> local_elem_boundary_id_side_lists;
2094
2095 // FIXME: We already built this list once, we should reuse that information!
2096 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> bndry_elem_side_id_list =
2097 mesh.get_boundary_info().build_side_list();
2098
2099 // Integer looping, skipping non-local elements
2100 for (const auto & t : bndry_elem_side_id_list)
2101 {
2102 // Get pointer to current Elem
2103 const Elem * elem = mesh.elem_ptr(std::get<0>(t));
2104
2105 std::vector<const Elem *> family;
2106#ifdef LIBMESH_ENABLE_AMR
2107 // We need to build up active elements if AMR is enabled and add
2108 // them to the exodus sidesets instead of the potentially inactive "parent" elements
2109 // Technically we don't need to "reset" the tree since the vector was just created.
2110 elem->active_family_tree_by_side(family, std::get<1>(t), /*reset tree=*/false);
2111#else
2112 // If AMR is not even enabled, just push back the element itself
2113 family.push_back( elem );
2114#endif
2115
2116 // Loop over all the elements in the family tree, store their converted IDs
2117 // and side IDs to the map's vectors. TODO: Somehow reserve enough space for these
2118 // push_back's...
2119 for (const auto & tree_elem : family)
2120 {
2121 const dof_id_type f_id = tree_elem->id();
2122 const Elem & f = mesh.elem_ref(f_id);
2123
2124 // If element is local, process it
2125 if (f.processor_id() == this->processor_id())
2126 {
2127 const auto & conv = get_conversion(f.type());
2128
2129 // Use the libmesh to exodus data structure map to get the proper sideset IDs
2130 // The data structure contains the "collapsed" contiguous ids.
2131 //
2132 // We know the parent element is local, but let's be absolutely sure that all the children have been
2133 // actually mapped to Exodus IDs before we blindly try to add them...
2134 local_elem_boundary_id_lists[ std::get<2>(t) ].push_back( libmesh_map_find(libmesh_elem_num_to_exodus, f_id) );
2135 local_elem_boundary_id_side_lists[ std::get<2>(t) ].push_back(conv.get_inverse_side_map( std::get<1>(t) ));
2136 }
2137 }
2138 }
2139
2140
2141 // Loop over *global* sideset IDs, call the Exodus API. Note that some sidesets may be empty
2142 // for a given processor.
2143 if (global_sideset_ids.size() > 0)
2144 {
2145 NamesData names_table(global_sideset_ids.size(), MAX_STR_LENGTH);
2146
2147 for (const auto & exodus_id : this->global_sideset_ids)
2148 {
2149 const std::string & current_ss_name =
2150 mesh.get_boundary_info().get_sideset_name
2151 (cast_int<boundary_id_type>(exodus_id));
2152
2153 // Store this name in a data structure that will be used to
2154 // write sideset names to file.
2155 names_table.push_back_entry(current_ss_name);
2156
2157 if (verbose)
2158 {
2159 libMesh::out << "[" << this->processor_id()
2160 << "] Writing out Exodus sideset info for ID: " << exodus_id
2161 << ", Name: " << current_ss_name
2162 << std::endl;
2163 }
2164
2165 // Try to find this boundary ID in the local list we created
2166 if (const auto it = local_elem_boundary_id_lists.find (cast_int<boundary_id_type>(exodus_id));
2167 it == local_elem_boundary_id_lists.end())
2168 {
2169 // No sides found for this boundary ID on this processor
2170 if (verbose)
2171 libMesh::out << "[" << this->processor_id()
2172 << "] No sideset data for ID: " << exodus_id
2173 << " on this processor." << std::endl;
2174
2175 // Call the Exodus interface to write the parameters of this side set
2176 this->ex_err = exII::ex_put_side_set_param(this->ex_id,
2177 exodus_id,
2178 0, /* No sides for this ID */
2179 0 /* No distribution factors */);
2180 EX_CHECK_ERR(this->ex_err, "Error writing sideset parameters in Nemesis");
2181
2182 }
2183 else // Boundary ID *was* found in list
2184 {
2185 // Get reference to the vector of elem IDs
2186 const std::vector<int> & current_sideset_elem_ids = it->second;
2187
2188 // Get reference to the vector of side IDs
2189 std::vector<int> & current_sideset_side_ids =
2190 libmesh_map_find(local_elem_boundary_id_side_lists,
2191 cast_int<boundary_id_type>(exodus_id));
2192
2193 // Call the Exodus interface to write the parameters of this side set
2194 this->ex_err = exII::ex_put_side_set_param(this->ex_id,
2195 exodus_id,
2196 current_sideset_elem_ids.size(),
2197 0 /* No distribution factors */);
2198
2199 EX_CHECK_ERR(this->ex_err, "Error writing sideset parameters in Nemesis");
2200
2201 // Call Exodus interface to write the actual side IDs for this boundary ID
2202 this->ex_err = exII::ex_put_side_set(this->ex_id,
2203 exodus_id,
2204 current_sideset_elem_ids.data(),
2205 current_sideset_side_ids.data());
2206
2207 EX_CHECK_ERR(this->ex_err, "Error writing sidesets in Nemesis");
2208 }
2209 } // end for loop over global sideset IDs
2210
2211 // Write sideset names to file. Some of these may be blank strings
2212 // if the current processor didn't have all the sideset names for
2213 // any reason...
2214 ex_err = exII::ex_put_names(this->ex_id,
2215 exII::EX_SIDE_SET,
2216 names_table.get_char_star_star());
2217 EX_CHECK_ERR(ex_err, "Error writing sideset names");
2218
2219 } // end if (global_sideset_ids.size() > 0)
2220}

References libMesh::Elem::active_family_tree_by_side(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::NamesData::get_char_star_star(), libMesh::ExodusII_IO_Helper::get_conversion(), global_sideset_ids, libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, mesh, libMesh::out, libMesh::DofObject::processor_id(), libMesh::ParallelObject::processor_id(), libMesh::ExodusII_IO_Helper::NamesData::push_back_entry(), libMesh::Elem::type(), and libMesh::ExodusII_IO_Helper::verbose.

◆ write_timestep()

void libMesh::ExodusII_IO_Helper::write_timestep ( int  timestep,
Real  time 
)
inherited

Writes the time for the timestep.

Definition at line 4189 of file exodusII_io_helper.C.

4190{
4191 if ((_run_only_on_proc0) && (this->processor_id() != 0))
4192 return;
4193
4195 {
4196 float cast_time = float(time);
4197 ex_err = exII::ex_put_time(ex_id, timestep, &cast_time);
4198 }
4199 else
4200 {
4201 double cast_time = double(time);
4202 ex_err = exII::ex_put_time(ex_id, timestep, &cast_time);
4203 }
4204 EX_CHECK_ERR(ex_err, "Error writing timestep.");
4205
4206 this->update();
4207}

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::update().

◆ write_var_names()

void libMesh::ExodusII_IO_Helper::write_var_names ( ExodusVarType  type,
const std::vector< std::string > &  names 
)
protectedinherited

Wraps calls to exII::ex_put_var_names() and exII::ex_put_var_param().

The enumeration controls whether nodal, elemental, or global variable names are read and which class members are filled in.

Definition at line 2326 of file exodusII_io_helper.C.

2328{
2329 switch (type)
2330 {
2331 case NODAL:
2332 this->write_var_names_impl("n", num_nodal_vars, names);
2333 break;
2334 case ELEMENTAL:
2335 this->write_var_names_impl("e", num_elem_vars, names);
2336 break;
2337 case GLOBAL:
2338 this->write_var_names_impl("g", num_global_vars, names);
2339 break;
2340 case SIDESET:
2341 {
2342 // Note: calling this function *sets* num_sideset_vars to the
2343 // number of entries in the 'names' vector, num_sideset_vars
2344 // does not already need to be set before calling this.
2345 this->write_var_names_impl("s", num_sideset_vars, names);
2346 break;
2347 }
2348 case NODESET:
2349 {
2350 this->write_var_names_impl("m", num_nodeset_vars, names);
2351 break;
2352 }
2353 case ELEMSET:
2354 {
2355 this->write_var_names_impl("t", num_elemset_vars, names);
2356 break;
2357 }
2358 default:
2359 libmesh_error_msg("Unrecognized ExodusVarType " << type);
2360 }
2361}
void write_var_names_impl(const char *var_type, int &count, const std::vector< std::string > &names)
write_var_names() dispatches to this function.

References libMesh::ExodusII_IO_Helper::ELEMENTAL, libMesh::ExodusII_IO_Helper::ELEMSET, libMesh::ExodusII_IO_Helper::GLOBAL, libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::NODESET, libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ExodusII_IO_Helper::num_elemset_vars, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ExodusII_IO_Helper::num_nodal_vars, libMesh::ExodusII_IO_Helper::num_nodeset_vars, libMesh::ExodusII_IO_Helper::num_sideset_vars, libMesh::ExodusII_IO_Helper::SIDESET, and libMesh::ExodusII_IO_Helper::write_var_names_impl().

Referenced by libMesh::ExodusII_IO_Helper::initialize_element_variables(), initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), and libMesh::ExodusII_IO_Helper::write_sideset_data().

◆ write_var_names_impl()

void libMesh::ExodusII_IO_Helper::write_var_names_impl ( const char *  var_type,
int &  count,
const std::vector< std::string > &  names 
)
privateinherited

write_var_names() dispatches to this function.

Definition at line 2366 of file exodusII_io_helper.C.

2369{
2370 // Update the count variable so that it's available to other parts of the class.
2371 count = cast_int<int>(names.size());
2372
2373 // Write that number of variables to the file.
2374 ex_err = exII::ex_put_var_param(ex_id, var_type, count);
2375 EX_CHECK_ERR(ex_err, "Error setting number of vars.");
2376
2377 // Nemesis doesn't like trying to write nodal variable names in
2378 // files with no nodes.
2379 if (!this->num_nodes)
2380 return;
2381
2382 if (count > 0)
2383 {
2384 NamesData names_table(count, _max_name_length);
2385
2386 // Store the input names in the format required by Exodus.
2387 for (int i=0; i != count; ++i)
2388 {
2389 if(names[i].length() > _max_name_length)
2390 libmesh_warning(
2391 "*** Warning, Exodus variable name \"" <<
2392 names[i] << "\" too long (current max " <<
2393 _max_name_length << "/" << libmesh_max_str_length <<
2394 " characters). Name will be truncated. ");
2395 names_table.push_back_entry(names[i]);
2396 }
2397
2398 if (verbose)
2399 {
2400 libMesh::out << "Writing variable name(s) to file: " << std::endl;
2401 for (int i=0; i != count; ++i)
2402 libMesh::out << names_table.get_char_star(i) << std::endl;
2403 }
2404
2405 ex_err = exII::ex_put_var_names(ex_id,
2406 var_type,
2407 count,
2408 names_table.get_char_star_star()
2409 );
2410
2411 EX_CHECK_ERR(ex_err, "Error writing variable names.");
2412 }
2413}

References libMesh::ExodusII_IO_Helper::_max_name_length, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::NamesData::get_char_star(), libMesh::ExodusII_IO_Helper::NamesData::get_char_star_star(), libMesh::ExodusII_IO_Helper::num_nodes, libMesh::out, libMesh::ExodusII_IO_Helper::NamesData::push_back_entry(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by libMesh::ExodusII_IO_Helper::write_var_names().

Member Data Documentation

◆ _add_sides

bool libMesh::ExodusII_IO_Helper::_add_sides = false
privateinherited

◆ _added_side_node_offsets

std::vector<dof_id_type> libMesh::ExodusII_IO_Helper::_added_side_node_offsets
protectedinherited

If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, _added_side_node_offsets[p] gives us the total solution vector offset to use on processor p+1 from the nodes on those previous ranks' sides.

Definition at line 1055 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::added_node_offset_on(), libMesh::ExodusII_IO_Helper::initialize(), and libMesh::ExodusII_IO_Helper::node_id_to_vec_id().

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _coordinate_offset

Point libMesh::ExodusII_IO_Helper::_coordinate_offset
protectedinherited

◆ _elem_vars_initialized

bool libMesh::ExodusII_IO_Helper::_elem_vars_initialized
protectedinherited

◆ _end_elem_id

int libMesh::ExodusII_IO_Helper::_end_elem_id
protectedinherited

◆ _global_vars_initialized

bool libMesh::ExodusII_IO_Helper::_global_vars_initialized
protectedinherited

◆ _max_name_length

unsigned int libMesh::ExodusII_IO_Helper::_max_name_length
protectedinherited

◆ _nodal_vars_initialized

bool libMesh::ExodusII_IO_Helper::_nodal_vars_initialized
protectedinherited

◆ _opened_by_create

bool libMesh::ExodusII_IO_Helper::_opened_by_create
protectedinherited

◆ _run_only_on_proc0

bool libMesh::ExodusII_IO_Helper::_run_only_on_proc0
protectedinherited

◆ _single_precision

bool libMesh::ExodusII_IO_Helper::_single_precision
protectedinherited

◆ _true_node_offsets

std::vector<dof_id_type> libMesh::ExodusII_IO_Helper::_true_node_offsets
protectedinherited

If we're adding "fake" sides to visualize SIDE_DISCONTINUOUS variables, we also need to know how many real nodes from previous ranks are taking up space in a solution vector.

Definition at line 1062 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::added_node_offset_on(), libMesh::ExodusII_IO_Helper::initialize(), and libMesh::ExodusII_IO_Helper::node_id_to_vec_id().

◆ _use_mesh_dimension_instead_of_spatial_dimension

bool libMesh::ExodusII_IO_Helper::_use_mesh_dimension_instead_of_spatial_dimension
protectedinherited

◆ _write_as_dimension

unsigned libMesh::ExodusII_IO_Helper::_write_as_dimension
protectedinherited

◆ _write_hdf5

bool libMesh::ExodusII_IO_Helper::_write_hdf5
protectedinherited

◆ bex_cv_conn

std::vector<std::vector<long unsigned int> > libMesh::ExodusII_IO_Helper::bex_cv_conn
inherited

◆ bex_dense_constraint_vecs

std::vector<std::vector<std::vector<Real> > > libMesh::ExodusII_IO_Helper::bex_dense_constraint_vecs
inherited

◆ bex_num_elem_cvs

unsigned int libMesh::ExodusII_IO_Helper::bex_num_elem_cvs
inherited

◆ block_id_to_elem_connectivity

std::map<int, std::vector<int> > libMesh::Nemesis_IO_Helper::block_id_to_elem_connectivity

This is the block connectivity, i.e.

for each subdomain (block) there is an element connectivity list. This map associates the block ID to that vector.

Definition at line 447 of file nemesis_io_helper.h.

Referenced by build_element_and_node_maps(), and write_elements().

◆ block_ids

std::vector<int> libMesh::ExodusII_IO_Helper::block_ids
inherited

◆ border_elem_ids

std::set<unsigned> libMesh::Nemesis_IO_Helper::border_elem_ids
private

A set of border elem IDs for this processor.

Definition at line 641 of file nemesis_io_helper.h.

Referenced by compute_element_maps(), and compute_internal_and_border_elems_and_internal_nodes().

◆ border_node_ids

std::set<unsigned> libMesh::Nemesis_IO_Helper::border_node_ids
private

The set which will eventually contain the IDs of "border nodes".

These are nodes that lie on the boundary between one or more processors.

Definition at line 604 of file nemesis_io_helper.h.

Referenced by compute_border_node_ids(), and compute_node_maps().

◆ c0polyhedron_face_connect

std::vector<std::vector<int> > libMesh::ExodusII_IO_Helper::c0polyhedron_face_connect
inherited

◆ connect

std::vector<int> libMesh::ExodusII_IO_Helper::connect
inherited

◆ conversion_map

std::map<int, std::map<ElemType, ExodusII_IO_Helper::Conversion> > libMesh::ExodusII_IO_Helper::conversion_map
privateinherited

Associates libMesh ElemTypes with node/face/edge/etc.

mappings of the corresponding Exodus element types.

We have to map based on both ElemType and mesh dimension, because Exodus treats "TRI" side numbering in two different ways depending on whether a triangle is embedded in a 2D or a 3D mesh.

Definition at line 1157 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::get_conversion(), and libMesh::ExodusII_IO_Helper::init_conversion_map().

◆ current_filename

std::string libMesh::ExodusII_IO_Helper::current_filename
inherited

◆ edge_block_ids

std::vector<int> libMesh::ExodusII_IO_Helper::edge_block_ids
inherited

◆ elem_cmap_elem_cnts

std::vector<int> libMesh::Nemesis_IO_Helper::elem_cmap_elem_cnts

◆ elem_cmap_elem_ids

std::vector<std::vector<int> > libMesh::Nemesis_IO_Helper::elem_cmap_elem_ids

3 vectors of vectors for storing element communication IDs for this processor.

There will be num_elem_cmaps rows, row i will have elem_cmap_elem_cnts[i] entries. To be used with Nemesis::ne_get_elem_cmap().

Definition at line 569 of file nemesis_io_helper.h.

Referenced by compute_elem_communication_maps(), get_elem_cmap(), and initialize().

◆ elem_cmap_ids

std::vector<int> libMesh::Nemesis_IO_Helper::elem_cmap_ids

◆ elem_cmap_proc_ids

std::vector<std::vector<int> > libMesh::Nemesis_IO_Helper::elem_cmap_proc_ids

Definition at line 571 of file nemesis_io_helper.h.

Referenced by compute_elem_communication_maps(), get_elem_cmap(), and initialize().

◆ elem_cmap_side_ids

std::vector<std::vector<int> > libMesh::Nemesis_IO_Helper::elem_cmap_side_ids

Definition at line 570 of file nemesis_io_helper.h.

Referenced by compute_elem_communication_maps(), get_elem_cmap(), and initialize().

◆ elem_face_counts

std::vector<int> libMesh::ExodusII_IO_Helper::elem_face_counts
inherited

◆ elem_list

std::vector<int> libMesh::ExodusII_IO_Helper::elem_list
inherited

◆ elem_mapb

std::vector<int> libMesh::Nemesis_IO_Helper::elem_mapb

Vector which stores border element IDs.

Will have length num_border_elems. To be used with Nemesis::ne_get_elem_map().

Definition at line 514 of file nemesis_io_helper.h.

Referenced by compute_element_maps(), get_elem_map(), and initialize().

◆ elem_mapi

std::vector<int> libMesh::Nemesis_IO_Helper::elem_mapi

Vector which stores internal element IDs.

Will have length num_internal_elems. To be used with Nemesis::ne_get_elem_map().

Definition at line 507 of file nemesis_io_helper.h.

Referenced by compute_element_maps(), get_elem_map(), and initialize().

◆ elem_node_counts

std::vector<int> libMesh::ExodusII_IO_Helper::elem_node_counts
inherited

◆ elem_num_map

std::vector<int> libMesh::ExodusII_IO_Helper::elem_num_map
inherited

◆ elem_type

std::vector<char> libMesh::ExodusII_IO_Helper::elem_type
inherited

◆ elem_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::elem_var_names
inherited

◆ elem_var_values

std::vector<Real> libMesh::ExodusII_IO_Helper::elem_var_values
inherited

Definition at line 895 of file exodusII_io_helper.h.

◆ element_equivalence_map

std::map<std::string, ElemType> libMesh::ExodusII_IO_Helper::element_equivalence_map
privateinherited

Defines equivalence classes of Exodus element types that map to libmesh ElemTypes.

Definition at line 1146 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::get_conversion(), and libMesh::ExodusII_IO_Helper::init_element_equivalence_map().

◆ elemset_id_list

std::vector<int> libMesh::ExodusII_IO_Helper::elemset_id_list
inherited

◆ elemset_ids

std::vector<int> libMesh::ExodusII_IO_Helper::elemset_ids
inherited

◆ elemset_list

std::vector<int> libMesh::ExodusII_IO_Helper::elemset_list
inherited

◆ elemset_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::elemset_var_names
inherited

◆ ex_err

int libMesh::ExodusII_IO_Helper::ex_err
inherited

Definition at line 680 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::close(), libMesh::ExodusII_IO_Helper::create(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), initialize_element_variables(), libMesh::ExodusII_IO_Helper::open(), libMesh::ExodusII_IO_Helper::read_all_nodesets(), libMesh::ExodusII_IO_Helper::read_and_store_header_info(), libMesh::ExodusII_IO_Helper::read_bex_cv_blocks(), libMesh::ExodusII_IO_Helper::read_block_info(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::ExodusII_IO_Helper::read_elem_in_block(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_elemental_var_values(), libMesh::ExodusII_IO_Helper::read_elemset(), libMesh::ExodusII_IO_Helper::read_elemset_data(), libMesh::ExodusII_IO_Helper::read_elemset_info(), libMesh::ExodusII_IO_Helper::read_face_blocks(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO_Helper::read_nodal_var_values(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::ExodusII_IO_Helper::read_nodes(), read_nodeset(), libMesh::ExodusII_IO_Helper::read_nodeset_data(), libMesh::ExodusII_IO_Helper::read_nodeset_info(), libMesh::ExodusII_IO_Helper::read_qa_records(), libMesh::ExodusII_IO_Helper::read_sideset(), libMesh::ExodusII_IO_Helper::read_sideset_data(), libMesh::ExodusII_IO_Helper::read_sideset_info(), libMesh::ExodusII_IO_Helper::read_time_steps(), libMesh::ExodusII_IO_Helper::read_var_names_impl(), libMesh::ExodusII_IO_Helper::update(), write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), write_exodus_initialization_info(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::ExodusII_IO_Helper::write_nodesets(), write_nodesets(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::ExodusII_IO_Helper::write_sidesets(), write_sidesets(), libMesh::ExodusII_IO_Helper::write_timestep(), libMesh::ExodusII_IO_Helper::write_var_names_impl(), and ~Nemesis_IO_Helper().

◆ ex_id

int libMesh::ExodusII_IO_Helper::ex_id
inherited

Definition at line 677 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::close(), libMesh::ExodusII_IO_Helper::create(), get_cmap_params(), get_eb_info_global(), get_elem_cmap(), get_elem_map(), get_init_global(), get_init_info(), get_loadbal_param(), get_node_cmap(), get_node_map(), get_ns_param_global(), get_ss_param_global(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), initialize_element_variables(), libMesh::ExodusII_IO_Helper::open(), put_cmap_params(), put_eb_info_global(), put_elem_cmap(), put_elem_map(), put_init_global(), put_init_info(), put_loadbal_param(), put_node_cmap(), put_node_map(), put_ns_param_global(), put_ss_param_global(), libMesh::ExodusII_IO_Helper::read_all_nodesets(), libMesh::ExodusII_IO_Helper::read_and_store_header_info(), libMesh::ExodusII_IO_Helper::read_bex_cv_blocks(), libMesh::ExodusII_IO_Helper::read_block_info(), libMesh::ExodusII_IO_Helper::read_edge_blocks(), libMesh::ExodusII_IO_Helper::read_elem_in_block(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_elemental_var_values(), libMesh::ExodusII_IO_Helper::read_elemset(), libMesh::ExodusII_IO_Helper::read_elemset_data(), libMesh::ExodusII_IO_Helper::read_elemset_info(), libMesh::ExodusII_IO_Helper::read_face_blocks(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO_Helper::read_header(), libMesh::ExodusII_IO_Helper::read_nodal_var_values(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::ExodusII_IO_Helper::read_nodes(), read_nodeset(), libMesh::ExodusII_IO_Helper::read_nodeset_data(), libMesh::ExodusII_IO_Helper::read_nodeset_info(), libMesh::ExodusII_IO_Helper::read_qa_records(), libMesh::ExodusII_IO_Helper::read_sideset(), libMesh::ExodusII_IO_Helper::read_sideset_data(), libMesh::ExodusII_IO_Helper::read_sideset_info(), libMesh::ExodusII_IO_Helper::read_time_steps(), libMesh::ExodusII_IO_Helper::read_var_names_impl(), libMesh::ExodusII_IO_Helper::update(), write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), write_exodus_initialization_info(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::ExodusII_IO_Helper::write_nodesets(), write_nodesets(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::ExodusII_IO_Helper::write_sidesets(), write_sidesets(), libMesh::ExodusII_IO_Helper::write_timestep(), libMesh::ExodusII_IO_Helper::write_var_names_impl(), and ~Nemesis_IO_Helper().

◆ exodus_elem_num_to_libmesh

std::vector<int> libMesh::ExodusII_IO_Helper::exodus_elem_num_to_libmesh
inherited

Definition at line 864 of file exodusII_io_helper.h.

Referenced by build_element_and_node_maps(), and write_elements().

◆ exodus_node_num_to_libmesh

std::vector<int> libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh
inherited

◆ ftype

char libMesh::Nemesis_IO_Helper::ftype

The type of file to be written.

Either 's', for a scalar load-balance file, or 'p' for a parallel file. To be used with Nemesis::ne_get_init_info().

Definition at line 396 of file nemesis_io_helper.h.

Referenced by get_init_info().

◆ global_elem_blk_cnts

std::vector<int> libMesh::Nemesis_IO_Helper::global_elem_blk_cnts

◆ global_elem_blk_ids

std::vector<int> libMesh::Nemesis_IO_Helper::global_elem_blk_ids

Read the global element block IDs and counts.

These vectors will eventually have num_elem_blks_global entries. To be used with Nemesis::ne_get_eb_info_global().

Definition at line 430 of file nemesis_io_helper.h.

Referenced by compute_num_global_elem_blocks(), get_eb_info_global(), initialize(), initialize_element_variables(), write_element_values(), and write_elements().

◆ global_nodeset_ids

std::vector<int> libMesh::Nemesis_IO_Helper::global_nodeset_ids

Containers for reading global nodeset information.

One vector entry per nodeset. Each vector will eventually have num_node_sets_global entries, and will be used in calls to Nemesis::ne_get_ns_param_global().

It's an error to call ne_get_ns_param_global when num_node_sets_global==0

Definition at line 420 of file nemesis_io_helper.h.

Referenced by compute_num_global_nodesets(), get_ns_param_global(), initialize(), put_ns_param_global(), write_exodus_initialization_info(), and write_nodesets().

◆ global_sideset_ids

std::vector<int> libMesh::Nemesis_IO_Helper::global_sideset_ids

Containers for reading global sideset (boundary conditions) information.

Each vector will eventually have num_side_sets_global entries, and be used in calls to Nemesis::ne_get_ss_param_global().

It's an error to call ne_get_ss_param_global when num_side_sets_global==0

Definition at line 408 of file nemesis_io_helper.h.

Referenced by compute_num_global_sidesets(), get_ss_param_global(), initialize(), put_ss_param_global(), write_exodus_initialization_info(), and write_sidesets().

◆ global_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::global_var_names
inherited

◆ header_info

ExodusHeaderInfo libMesh::ExodusII_IO_Helper::header_info
inherited

◆ id_list

std::vector<int> libMesh::ExodusII_IO_Helper::id_list
inherited

◆ id_to_block_names

std::map<int, std::string> libMesh::ExodusII_IO_Helper::id_to_block_names
inherited

◆ id_to_edge_block_names

std::map<int, std::string> libMesh::ExodusII_IO_Helper::id_to_edge_block_names
inherited

◆ id_to_elemset_names

std::map<int, std::string> libMesh::ExodusII_IO_Helper::id_to_elemset_names
inherited

◆ id_to_ns_names

std::map<int, std::string> libMesh::ExodusII_IO_Helper::id_to_ns_names
inherited

◆ id_to_ss_names

std::map<int, std::string> libMesh::ExodusII_IO_Helper::id_to_ss_names
inherited

◆ internal_elem_ids

std::set<unsigned> libMesh::Nemesis_IO_Helper::internal_elem_ids
private

A set of internal elem IDs for this processor.

Definition at line 636 of file nemesis_io_helper.h.

Referenced by compute_element_maps(), and compute_internal_and_border_elems_and_internal_nodes().

◆ internal_node_ids

std::set<unsigned> libMesh::Nemesis_IO_Helper::internal_node_ids
private

A set of internal node IDs for this processor.

Definition at line 631 of file nemesis_io_helper.h.

Referenced by compute_internal_and_border_elems_and_internal_nodes(), and compute_node_maps().

◆ libmesh_elem_num_to_exodus

std::map<dof_id_type, dof_id_type> libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus
inherited

◆ libmesh_node_num_to_exodus

std::map<dof_id_type, dof_id_type> libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus
inherited

◆ local_subdomain_counts

std::map<subdomain_id_type, unsigned> libMesh::Nemesis_IO_Helper::local_subdomain_counts
private

This map keeps track of the number of elements in each subdomain (block) for this processor.

Definition at line 598 of file nemesis_io_helper.h.

Referenced by build_element_and_node_maps(), and compute_num_global_elem_blocks().

◆ nemesis_err_flag

int libMesh::Nemesis_IO_Helper::nemesis_err_flag

◆ nodal_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::nodal_var_names
inherited

◆ nodal_var_values

std::map<dof_id_type, Real> libMesh::ExodusII_IO_Helper::nodal_var_values
inherited

◆ node_cmap_ids

std::vector<int> libMesh::Nemesis_IO_Helper::node_cmap_ids

Vectors for storing the communication map parameters.

Each will eventually have length num_node_cmaps OR num_elem_cmaps as appropriate. For use with Nemesis::ne_get_cmap_params().

Definition at line 546 of file nemesis_io_helper.h.

Referenced by compute_communication_map_parameters(), compute_node_communication_maps(), get_cmap_params(), get_node_cmap(), initialize(), and put_node_cmap().

◆ node_cmap_node_cnts

std::vector<int> libMesh::Nemesis_IO_Helper::node_cmap_node_cnts

◆ node_cmap_node_ids

std::vector<std::vector<int> > libMesh::Nemesis_IO_Helper::node_cmap_node_ids

2 vectors of vectors for storing the node communication IDs for this processor.

There will be num_node_cmaps rows, row i will have node_cmap_node_cnts[i] entries. To be used with Nemesis::ne_get_node_cmap().

Remark: node_cmap_proc_ids is a vector, all entries of which are = node_cmap_ids[i] Not sure what the point of that is...

Definition at line 560 of file nemesis_io_helper.h.

Referenced by compute_node_communication_maps(), get_node_cmap(), and initialize().

◆ node_cmap_proc_ids

std::vector<std::vector<int> > libMesh::Nemesis_IO_Helper::node_cmap_proc_ids

Definition at line 561 of file nemesis_io_helper.h.

Referenced by compute_node_communication_maps(), get_node_cmap(), and initialize().

◆ node_list

std::vector<int> libMesh::Nemesis_IO_Helper::node_list

Definition at line 399 of file nemesis_io_helper.h.

Referenced by read_nodeset().

◆ node_mapb

std::vector<int> libMesh::Nemesis_IO_Helper::node_mapb

Vector which stores border node IDs.

Will have length num_border_nodes. To be used with Nemesis::ne_get_node_map().

Definition at line 530 of file nemesis_io_helper.h.

Referenced by compute_node_maps(), get_node_map(), and initialize().

◆ node_mape

std::vector<int> libMesh::Nemesis_IO_Helper::node_mape

Vector which stores external node IDs.

Will have length num_external_nodes. To be used with Nemesis::ne_get_node_map().

Definition at line 537 of file nemesis_io_helper.h.

Referenced by compute_node_maps(), get_node_map(), and initialize().

◆ node_mapi

std::vector<int> libMesh::Nemesis_IO_Helper::node_mapi

Vector which stores internal node IDs.

Will have length num_internal_nodes. To be used with Nemesis::ne_get_node_map().

Definition at line 523 of file nemesis_io_helper.h.

Referenced by compute_node_maps(), get_node_map(), and initialize().

◆ node_num_map

std::vector<int> libMesh::ExodusII_IO_Helper::node_num_map
inherited

◆ node_sets_dist_fact

std::vector<Real> libMesh::ExodusII_IO_Helper::node_sets_dist_fact
inherited

◆ node_sets_dist_index

std::vector<int> libMesh::ExodusII_IO_Helper::node_sets_dist_index
inherited

◆ node_sets_node_index

std::vector<int> libMesh::ExodusII_IO_Helper::node_sets_node_index
inherited

◆ node_sets_node_list

std::vector<int> libMesh::ExodusII_IO_Helper::node_sets_node_list
inherited

◆ nodes_attached_to_local_elems

std::set<int> libMesh::Nemesis_IO_Helper::nodes_attached_to_local_elems

libMesh numbered node ids attached to local elems.

Definition at line 436 of file nemesis_io_helper.h.

Referenced by build_element_and_node_maps(), and compute_internal_and_border_elems_and_internal_nodes().

◆ nodeset_ids

std::vector<int> libMesh::ExodusII_IO_Helper::nodeset_ids
inherited

◆ nodeset_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::nodeset_var_names
inherited

◆ num_attr

int libMesh::ExodusII_IO_Helper::num_attr
inherited

◆ num_border_elems

int libMesh::Nemesis_IO_Helper::num_border_elems

The number of border FEM elements.

Elements local to this processor but whose FEM nodes reside on other processors as well. To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 484 of file nemesis_io_helper.h.

Referenced by compute_internal_and_border_elems_and_internal_nodes(), get_elem_map(), get_loadbal_param(), and initialize().

◆ num_border_nodes

int libMesh::Nemesis_IO_Helper::num_border_nodes

The number of FEM nodes local to a processor but residing in an element which also has FEM nodes on other processors.

To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 464 of file nemesis_io_helper.h.

Referenced by compute_border_node_ids(), compute_internal_and_border_elems_and_internal_nodes(), get_loadbal_param(), get_node_map(), and initialize().

◆ num_df_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_df_per_set
inherited

◆ num_dim

int& libMesh::ExodusII_IO_Helper::num_dim
inherited

◆ num_edge

int& libMesh::ExodusII_IO_Helper::num_edge
inherited

Definition at line 705 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::initialize().

◆ num_edge_blk

int& libMesh::ExodusII_IO_Helper::num_edge_blk
inherited

◆ num_elem

int& libMesh::ExodusII_IO_Helper::num_elem
inherited

◆ num_elem_all_elemsets

int libMesh::ExodusII_IO_Helper::num_elem_all_elemsets
inherited

◆ num_elem_all_sidesets

int libMesh::ExodusII_IO_Helper::num_elem_all_sidesets
inherited

◆ num_elem_blk

int& libMesh::ExodusII_IO_Helper::num_elem_blk
inherited

◆ num_elem_blks_global

int libMesh::Nemesis_IO_Helper::num_elem_blks_global

◆ num_elem_cmaps

int libMesh::Nemesis_IO_Helper::num_elem_cmaps

The number of elemental communication maps for this processor.

(One per neighboring proc?) To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 498 of file nemesis_io_helper.h.

Referenced by compute_communication_map_parameters(), compute_elem_communication_maps(), compute_internal_and_border_elems_and_internal_nodes(), get_cmap_params(), get_elem_cmap(), get_loadbal_param(), and initialize().

◆ num_elem_df_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_elem_df_per_set
inherited

◆ num_elem_sets

int& libMesh::ExodusII_IO_Helper::num_elem_sets
inherited

◆ num_elem_this_blk

int libMesh::ExodusII_IO_Helper::num_elem_this_blk
inherited

◆ num_elem_vars

int libMesh::ExodusII_IO_Helper::num_elem_vars
inherited

◆ num_elems_global

int libMesh::Nemesis_IO_Helper::num_elems_global

Definition at line 373 of file nemesis_io_helper.h.

Referenced by get_init_global().

◆ num_elems_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_elems_per_set
inherited

◆ num_elemset_vars

int libMesh::ExodusII_IO_Helper::num_elemset_vars
inherited

◆ num_external_nodes

int libMesh::Nemesis_IO_Helper::num_external_nodes

The number of FEM nodes that reside on another processor but whose element partially resides on the current processor.

To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 471 of file nemesis_io_helper.h.

Referenced by get_loadbal_param(), get_node_map(), and initialize().

◆ num_face

int& libMesh::ExodusII_IO_Helper::num_face
inherited

◆ num_face_blk

int& libMesh::ExodusII_IO_Helper::num_face_blk
inherited

◆ num_global_node_counts

std::vector<int> libMesh::Nemesis_IO_Helper::num_global_node_counts

◆ num_global_node_df_counts

std::vector<int> libMesh::Nemesis_IO_Helper::num_global_node_df_counts

Definition at line 422 of file nemesis_io_helper.h.

Referenced by get_ns_param_global(), and initialize().

◆ num_global_side_counts

std::vector<int> libMesh::Nemesis_IO_Helper::num_global_side_counts

◆ num_global_side_df_counts

std::vector<int> libMesh::Nemesis_IO_Helper::num_global_side_df_counts

Definition at line 410 of file nemesis_io_helper.h.

Referenced by get_ss_param_global(), and initialize().

◆ num_global_vars

int libMesh::ExodusII_IO_Helper::num_global_vars
inherited

◆ num_internal_elems

int libMesh::Nemesis_IO_Helper::num_internal_elems

The number of internal FEM elements.

Elements local to this processor. To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 477 of file nemesis_io_helper.h.

Referenced by compute_internal_and_border_elems_and_internal_nodes(), get_elem_map(), get_loadbal_param(), and initialize().

◆ num_internal_nodes

int libMesh::Nemesis_IO_Helper::num_internal_nodes

To be used with the Nemesis::ne_get_loadbal_param() routine.

The number of FEM nodes contained in FEM elements wholly owned by the current processor. To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 457 of file nemesis_io_helper.h.

Referenced by compute_internal_and_border_elems_and_internal_nodes(), get_loadbal_param(), get_node_map(), and initialize().

◆ num_nodal_vars

int libMesh::ExodusII_IO_Helper::num_nodal_vars
inherited

◆ num_node_cmaps

int libMesh::Nemesis_IO_Helper::num_node_cmaps

The number of nodal communication maps for this processor.

(One per neighboring proc?) To be used with the Nemesis::ne_get_loadbal_param() routine.

Definition at line 491 of file nemesis_io_helper.h.

Referenced by compute_border_node_ids(), compute_communication_map_parameters(), compute_node_communication_maps(), get_cmap_params(), get_loadbal_param(), get_node_cmap(), and initialize().

◆ num_node_df_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_node_df_per_set
inherited

◆ num_node_sets

int& libMesh::ExodusII_IO_Helper::num_node_sets
inherited

◆ num_node_sets_global

int libMesh::Nemesis_IO_Helper::num_node_sets_global

◆ num_nodes

int& libMesh::ExodusII_IO_Helper::num_nodes
inherited

◆ num_nodes_global

int libMesh::Nemesis_IO_Helper::num_nodes_global

Global initial information.

The names are self-explanatory for the most part. Used with Nemesis::ne_get_init_global().

Definition at line 372 of file nemesis_io_helper.h.

Referenced by get_init_global().

◆ num_nodes_per_elem

int libMesh::ExodusII_IO_Helper::num_nodes_per_elem
inherited

◆ num_nodes_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_nodes_per_set
inherited

◆ num_nodeset_vars

int libMesh::ExodusII_IO_Helper::num_nodeset_vars
inherited

◆ num_proc

int libMesh::Nemesis_IO_Helper::num_proc

The number of processors for which the NEMESIS I file was created.

To be used with Nemesis::ne_get_init_info().

Definition at line 382 of file nemesis_io_helper.h.

Referenced by get_init_info().

◆ num_proc_in_file

int libMesh::Nemesis_IO_Helper::num_proc_in_file

The number of processors for which the NEMESIS I file stores information.

This is generally equal to 1 (1 CPU/file) at least for the splitting Derek gave us. To be used with Nemesis::ne_get_init_info().

Definition at line 389 of file nemesis_io_helper.h.

Referenced by get_init_info().

◆ num_side_sets

int& libMesh::ExodusII_IO_Helper::num_side_sets
inherited

◆ num_side_sets_global

int libMesh::Nemesis_IO_Helper::num_side_sets_global

◆ num_sides_per_set

std::vector<int> libMesh::ExodusII_IO_Helper::num_sides_per_set
inherited

◆ num_sideset_vars

int libMesh::ExodusII_IO_Helper::num_sideset_vars
inherited

◆ num_time_steps

int libMesh::ExodusII_IO_Helper::num_time_steps
inherited

◆ opened_for_reading

bool libMesh::ExodusII_IO_Helper::opened_for_reading
inherited

◆ opened_for_writing

bool libMesh::ExodusII_IO_Helper::opened_for_writing
inherited

◆ proc_border_elem_sets

std::map<unsigned, std::set<std::pair<unsigned,unsigned> > > libMesh::Nemesis_IO_Helper::proc_border_elem_sets
private

Map between processor ID and (element,side) pairs bordering that processor ID.

Definition at line 621 of file nemesis_io_helper.h.

Referenced by compute_communication_map_parameters(), compute_elem_communication_maps(), and compute_internal_and_border_elems_and_internal_nodes().

◆ proc_nodes_touched_intersections

std::map<unsigned, std::set<unsigned> > libMesh::Nemesis_IO_Helper::proc_nodes_touched_intersections
private

Another map to store sets of intersections with each other processor (other than ourself, of course).

A node which appears in one of these vectors belongs to element owned by at least this processor and one other.

Definition at line 611 of file nemesis_io_helper.h.

Referenced by compute_border_node_ids(), compute_communication_map_parameters(), and compute_node_communication_maps().

◆ set_unique_ids_from_maps

bool libMesh::ExodusII_IO_Helper::set_unique_ids_from_maps
inherited

◆ side_list

std::vector<int> libMesh::ExodusII_IO_Helper::side_list
inherited

◆ sideset_var_names

std::vector<std::string> libMesh::ExodusII_IO_Helper::sideset_var_names
inherited

◆ ss_ids

std::vector<int> libMesh::ExodusII_IO_Helper::ss_ids
inherited

◆ subdomain_map

std::map<subdomain_id_type, std::vector<dof_id_type> > libMesh::Nemesis_IO_Helper::subdomain_map

Map of subdomains to element numbers.

Definition at line 441 of file nemesis_io_helper.h.

Referenced by build_element_and_node_maps(), write_element_values(), and write_elements().

◆ time_steps

std::vector<Real> libMesh::ExodusII_IO_Helper::time_steps
inherited

Definition at line 875 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::read_time_steps().

◆ title

std::vector<char>& libMesh::ExodusII_IO_Helper::title
inherited

◆ verbose

bool libMesh::ExodusII_IO_Helper::verbose
inherited

◆ w

std::vector<Real> libMesh::ExodusII_IO_Helper::w
inherited

Definition at line 846 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::read_nodes().

◆ write_complex_abs

bool libMesh::Nemesis_IO_Helper::write_complex_abs

By default, when complex numbers are enabled, for each variable we write out three values: the real part, "r_u" the imaginary part, "i_u", and the complex modulus, a_u := sqrt(r_u*r_u + i_u*i_u), which is also the value returned by std::abs(std::complex).

Since the modulus is not an independent quantity, we can set this flag to false and save some file space by not writing out.

Definition at line 582 of file nemesis_io_helper.h.

Referenced by write_element_values().

◆ x

std::vector<Real> libMesh::ExodusII_IO_Helper::x
inherited

◆ y

std::vector<Real> libMesh::ExodusII_IO_Helper::y
inherited

◆ z

std::vector<Real> libMesh::ExodusII_IO_Helper::z
inherited

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