libMesh
Public Types | 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 }
 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. More...
 
virtual ~Nemesis_IO_Helper ()
 Destructor. More...
 
void get_init_global ()
 Reading functions. More...
 
void get_ss_param_global ()
 Fills: global_sideset_ids, num_global_side_counts, num_global_side_df_counts Call after: get_init_global() More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void put_elem_map (std::vector< int > &elem_mapi, std::vector< int > &elem_mapb)
 Outputs IDs of internal and border elements. More...
 
void put_n_coord (unsigned start_node_num, unsigned num_nodes, std::vector< Real > &x_coor, std::vector< Real > &y_coor, std::vector< Real > &z_coor)
 Writes the specified number of coordinate values starting at the specified index. More...
 
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. More...
 
virtual void write_elements (const MeshBase &mesh, bool use_discontinuous=false) override
 This function is specialized to write the connectivity. More...
 
virtual void write_sidesets (const MeshBase &mesh) override
 Writes the sidesets for this processor. More...
 
virtual void write_nodesets (const MeshBase &mesh) override
 Writes the nodesets for this processor. More...
 
virtual void create (std::string filename) override
 This function is specialized from ExodusII_IO_Helper to create the nodal coordinates stored on the local piece of the Mesh. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
std::string construct_nemesis_filename (const std::string &base_filename)
 Given base_filename, foo.e, constructs the Nemesis filename foo.e.X.Y, where X=n. More...
 
const char * get_elem_type () const
 
void open (const char *filename, bool read_only)
 Opens an ExodusII mesh file named filename. More...
 
void read_header ()
 Reads an ExodusII mesh file header. More...
 
void read_qa_records ()
 Reads the QA records from an ExodusII file. More...
 
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. More...
 
void read_nodes ()
 Reads the nodal data (x,y,z coordinates) from the ExodusII mesh file. More...
 
void read_node_num_map ()
 Reads the optional node_num_map from the ExodusII mesh file. More...
 
void print_nodes (std::ostream &out=libMesh::out)
 Prints the nodal information, by default to libMesh::out. More...
 
void read_block_info ()
 Reads information for all of the blocks in the ExodusII mesh file. More...
 
int get_block_id (int index)
 Get the block number for the given block index. More...
 
std::string get_block_name (int index)
 Get the block name for the given block index if supplied in the mesh file. More...
 
int get_side_set_id (int index)
 Get the side set id for the given side set index. More...
 
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. More...
 
int get_node_set_id (int index)
 Get the node set id for the given node set index. More...
 
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. More...
 
void read_elem_in_block (int block)
 Reads all of the element connectivity for block block in the ExodusII mesh file. More...
 
void read_edge_blocks (MeshBase &mesh)
 Read in edge blocks, storing information in the BoundaryInfo object. More...
 
void read_elem_num_map ()
 Reads the optional node_num_map from the ExodusII mesh file. More...
 
void read_sideset_info ()
 Reads information about all of the sidesets in the ExodusII mesh file. More...
 
void read_nodeset_info ()
 Reads information about all of the nodesets in the ExodusII mesh file. More...
 
void read_sideset (int id, int offset)
 Reads information about sideset id and inserts it into the global sideset array at the position offset. More...
 
void read_nodeset (int id)
 Reads information about nodeset id and inserts it into the global nodeset array at the position offset. More...
 
void read_all_nodesets ()
 New API that reads all nodesets simultaneously. More...
 
void close ()
 Closes the ExodusII mesh file. More...
 
int inquire (int req_info, std::string error_msg="")
 
void read_time_steps ()
 Reads and stores the timesteps in the 'time_steps' array. More...
 
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. More...
 
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. More...
 
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. More...
 
void initialize_nodal_variables (std::vector< std::string > names)
 Sets up the nodal variables. More...
 
void initialize_global_variables (std::vector< std::string > names)
 Sets up the global variables. More...
 
void write_timestep (int timestep, Real time)
 Writes the time for the timestep. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void write_nodal_values (int var_id, const std::vector< Real > &values, int timestep)
 Writes the vector of values to a nodal variable. More...
 
void write_information_records (const std::vector< std::string > &records)
 Writes the vector of information records. More...
 
void write_global_values (const std::vector< Real > &values, int timestep)
 Writes the vector of global variables. More...
 
void read_global_values (std::vector< Real > &values, int timestep)
 Reads the vector of global variables. More...
 
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. More...
 
void write_as_dimension (unsigned dim)
 Sets the value of _write_as_dimension. More...
 
void set_coordinate_offset (Point p)
 Allows you to set a vector that is added to the coordinates of all of the nodes. More...
 
std::vector< std::string > get_complex_names (const std::vector< std::string > &names) const
 
std::vector< std::set< subdomain_id_type > > get_complex_vars_active_subdomains (const std::vector< std::set< subdomain_id_type >> &vars_active_subdomains) const
 returns a "tripled" copy of vars_active_subdomains, which is necessary in the complex-valued case. More...
 
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) 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. More...
 
void message (const std::string &msg)
 Prints the message defined in msg. More...
 
void message (const std::string &msg, int i)
 Prints the message defined in msg, and appends the number i to the end of the message. More...
 
void read_var_names (ExodusVarType type)
 
const ExodusII_IO_Helper::Conversionget_conversion (const ElemType type) const
 
const ExodusII_IO_Helper::Conversionget_conversion (std::string type_str) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Public Attributes

int nemesis_err_flag
 Member data. More...
 
int num_nodes_global
 Global initial information. More...
 
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. More...
 
int num_proc_in_file
 The number of processors for which the NEMESIS I file stores information. More...
 
char ftype
 The type of file to be written. More...
 
std::vector< intglobal_sideset_ids
 Containers for reading global sideset (boundary conditions) information. More...
 
std::vector< intnum_global_side_counts
 
std::vector< intnum_global_side_df_counts
 
std::vector< intglobal_nodeset_ids
 Containers for reading global nodeset information. More...
 
std::vector< intnum_global_node_counts
 
std::vector< intnum_global_node_df_counts
 
std::vector< intglobal_elem_blk_ids
 Read the global element block IDs and counts. More...
 
std::vector< intglobal_elem_blk_cnts
 
std::set< intnodes_attached_to_local_elems
 libMesh numbered node ids attached to local elems. More...
 
std::map< subdomain_id_type, std::vector< dof_id_type > > subdomain_map
 Map of subdomains to element numbers. More...
 
std::map< int, std::vector< int > > block_id_to_elem_connectivity
 This is the block connectivity, i.e. More...
 
int num_internal_nodes
 To be used with the Nemesis::ne_get_loadbal_param() routine. More...
 
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. More...
 
int num_external_nodes
 The number of FEM nodes that reside on another processor but whose element partially resides on the current processor. More...
 
int num_internal_elems
 The number of internal FEM elements. More...
 
int num_border_elems
 The number of border FEM elements. More...
 
int num_node_cmaps
 The number of nodal communication maps for this processor. More...
 
int num_elem_cmaps
 The number of elemental communication maps for this processor. More...
 
std::vector< intelem_mapi
 Vector which stores internal element IDs. More...
 
std::vector< intelem_mapb
 Vector which stores border element IDs. More...
 
std::vector< intnode_mapi
 Vector which stores internal node IDs. More...
 
std::vector< intnode_mapb
 Vector which stores border node IDs. More...
 
std::vector< intnode_mape
 Vector which stores external node IDs. More...
 
std::vector< intnode_cmap_ids
 Vectors for storing the communication map parameters. More...
 
std::vector< intnode_cmap_node_cnts
 
std::vector< intelem_cmap_ids
 
std::vector< intelem_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. More...
 
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. More...
 
std::vector< std::vector< int > > elem_cmap_side_ids
 
std::vector< std::vector< int > > elem_cmap_proc_ids
 
int ex_id
 
int ex_err
 
int num_dim
 
int num_global_vars
 
int num_sideset_vars
 
int num_nodes
 
int num_elem
 
int num_elem_blk
 
int num_edge
 
int num_edge_blk
 
int num_node_sets
 
int num_side_sets
 
int num_elem_this_blk
 
int num_nodes_per_elem
 
int num_attr
 
int num_elem_all_sidesets
 
std::vector< intblock_ids
 
std::vector< intedge_block_ids
 
std::vector< intconnect
 
std::vector< intss_ids
 
std::vector< intnodeset_ids
 
std::vector< intnum_sides_per_set
 
std::vector< intnum_nodes_per_set
 
std::vector< intnum_df_per_set
 
std::vector< intnum_node_df_per_set
 
std::vector< intnode_sets_node_index
 
std::vector< intnode_sets_dist_index
 
std::vector< intnode_sets_node_list
 
std::vector< Realnode_sets_dist_fact
 
std::vector< intelem_list
 
std::vector< intside_list
 
std::vector< intnode_list
 
std::vector< intid_list
 
std::vector< intnode_num_map
 
std::vector< intelem_num_map
 
std::vector< Realx
 
std::vector< Realy
 
std::vector< Realz
 
std::vector< char > title
 
std::vector< char > elem_type
 
std::map< int, intlibmesh_elem_num_to_exodus
 
std::vector< intexodus_elem_num_to_libmesh
 
std::map< int, intlibmesh_node_num_to_exodus
 
std::vector< intexodus_node_num_to_libmesh
 
int num_time_steps
 
std::vector< Realtime_steps
 
int num_nodal_vars
 
std::vector< std::string > nodal_var_names
 
std::vector< Realnodal_var_values
 
int num_elem_vars
 
std::vector< std::string > elem_var_names
 
std::vector< Realelem_var_values
 
std::vector< std::string > global_var_names
 
std::vector< std::string > sideset_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
 
bool verbose
 
bool opened_for_writing
 
bool opened_for_reading
 
std::string current_filename
 

Protected Member Functions

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. More...
 
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(). More...
 

Protected Attributes

bool _run_only_on_proc0
 
bool _elem_vars_initialized
 
bool _global_vars_initialized
 
bool _nodal_vars_initialized
 
bool _use_mesh_dimension_instead_of_spatial_dimension
 
unsigned _write_as_dimension
 
Point _coordinate_offset
 
bool _single_precision
 
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. More...
 
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. More...
 

Private Member Functions

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. More...
 
void compute_num_global_nodesets (const MeshBase &pmesh)
 This function uses global communication routines to determine the number of nodesets across the entire mesh. More...
 
void compute_num_global_sidesets (const MeshBase &pmesh)
 This function uses global communication routines to determine the number of sidesets across the entire mesh. More...
 
void build_element_and_node_maps (const MeshBase &pmesh)
 This function builds the libmesh -> exodus and exodus -> libmesh node and element maps. More...
 
void compute_border_node_ids (const MeshBase &pmesh)
 This function constructs the set of border node IDs present on the current mesh. More...
 
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. More...
 
void compute_communication_map_parameters ()
 This function determines the communication map parameters which will eventually be written to file. More...
 
void compute_node_communication_maps ()
 Compute the node communication maps (really just pack vectors) in preparation for writing them to file. More...
 
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. More...
 
void compute_elem_communication_maps ()
 This function computes element communication maps (really just packs vectors) in preparation for writing them to file. More...
 
void compute_element_maps ()
 This function computes element maps (really just packs vectors) which map the elements to internal and border elements. More...
 
void write_exodus_initialization_info (const MeshBase &pmesh, const std::string &title)
 This function writes exodus-specific initialization information. More...
 
void read_var_names_impl (const char *var_type, int &count, std::vector< std::string > &result)
 read_var_names() dispatches to this function. More...
 
void write_var_names_impl (const char *var_type, int &count, const std::vector< std::string > &names)
 write_var_names() dispatches to this function. More...
 
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. More...
 
std::set< unsigned > border_node_ids
 The set which will eventually contain the IDs of "border nodes". More...
 
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). More...
 
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. More...
 
std::set< unsigned > internal_node_ids
 A set of internal node IDs for this processor. More...
 
std::set< unsigned > internal_elem_ids
 A set of internal elem IDs for this processor. More...
 
std::set< unsigned > border_elem_ids
 A set of border elem IDs for this processor. More...
 
std::map< std::string, ElemTypeelement_equivalence_map
 Defines equivalence classes of Exodus element types that map to libmesh ElemTypes. More...
 
std::map< ElemType, ExodusII_IO_Helper::Conversionconversion_map
 Associates libMesh ElemTypes with node/face/edge/etc. More...
 

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
Date
2008

Definition at line 65 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 603 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 593 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, or global 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

Enumerator
NODAL 
ELEMENTAL 
GLOBAL 
SIDESET 

Definition at line 692 of file exodusII_io_helper.h.

692 {NODAL=0, ELEMENTAL=1, GLOBAL=2, SIDESET=3};

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 48 of file nemesis_io_helper.C.

49  :
50  ExodusII_IO_Helper(parent, verbose_in, /*run_only_on_proc0=*/false, /*single_precision=*/single_precision),
57  num_proc(0),
59  ftype('\0'),
65  num_node_cmaps(0),
67 {
68  // Warn about using untested code!
69  libmesh_experimental();
70 }

◆ ~Nemesis_IO_Helper()

libMesh::Nemesis_IO_Helper::~Nemesis_IO_Helper ( )
virtual

Destructor.

Definition at line 73 of file nemesis_io_helper.C.

74 {
75  // Our destructor is called from Nemesis_IO. We close the Exodus file here since we have
76  // responsibility for managing the file's lifetime. Only call ex_update() if the file was
77  // opened for writing!
78  if (this->opened_for_writing)
79  {
80  this->ex_err = exII::ex_update(this->ex_id);
81  EX_EXCEPTIONLESS_CHECK_ERR(ex_err, "Error flushing buffers to file.");
82  }
83  this->close();
84 }

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

◆ build_element_and_node_maps()

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

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 1667 of file nemesis_io_helper.C.

1668 {
1669  // If we don't have any local subdomains, it had better be because
1670  // we don't have any local elements
1671 #ifdef DEBUG
1672  if (local_subdomain_counts.empty())
1673  {
1674  libmesh_assert(pmesh.active_local_elements_begin() ==
1675  pmesh.active_local_elements_end());
1677  }
1678 #endif
1679 
1680  // Elements have to be numbered contiguously based on what block
1681  // number they are in. Therefore we have to do a bit of work to get
1682  // the block (ie subdomain) numbers first and store them off as
1683  // block_ids.
1684 
1685  // Make sure there is no leftover information in the subdomain_map, and reserve
1686  // enough space to store the elements we need.
1687  this->subdomain_map.clear();
1688  for (const auto & pr : local_subdomain_counts)
1689  {
1690  if (verbose)
1691  {
1692  libMesh::out << "[" << this->processor_id() << "] "
1693  << "local_subdomain_counts [" << static_cast<unsigned>(pr.first) << "]= "
1694  << pr.second
1695  << std::endl;
1696  }
1697 
1698  // pr.first is the subdomain ID, pr.second is the number of elements it contains
1699  this->subdomain_map[pr.first].reserve(pr.second);
1700  }
1701 
1702 
1703  // First loop over the elements to figure out which elements are in which subdomain
1704  for (const auto & elem : pmesh.active_local_element_ptr_range())
1705  {
1706  // Grab the nodes while we're here.
1707  for (auto n : elem->node_index_range())
1708  this->nodes_attached_to_local_elems.insert( elem->node_id(n) );
1709 
1710  subdomain_id_type cur_subdomain = elem->subdomain_id();
1711 
1712  this->subdomain_map[cur_subdomain].push_back(elem->id());
1713  }
1714 
1715  // Set num_nodes which is used by exodusII_io_helper
1716  this->num_nodes =
1717  cast_int<int>(this->nodes_attached_to_local_elems.size());
1718 
1719  // Now come up with a 1-based numbering for these nodes
1720  this->exodus_node_num_to_libmesh.clear(); // Make sure it's empty
1721  this->exodus_node_num_to_libmesh.reserve(this->nodes_attached_to_local_elems.size());
1722 
1723  // Also make sure there's no leftover information in the map which goes the
1724  // other direction.
1725  this->libmesh_node_num_to_exodus.clear();
1726 
1727  // Set the map for nodes
1728  for (const auto & id : nodes_attached_to_local_elems)
1729  {
1730  // I.e. given exodus_node_id,
1731  // exodus_node_num_to_libmesh[ exodus_node_id ] returns the libmesh ID for that node.
1732  // Note that even though most of Exodus is 1-based, this code will map an Exodus ID of
1733  // zero to some libmesh node ID. Is that a problem?
1734  this->exodus_node_num_to_libmesh.push_back(id);
1735 
1736  // Likewise, given libmesh_node_id,
1737  // libmesh_node_num_to_exodus[ libmesh_node_id ] returns the *Exodus* ID for that node.
1738  // Unlike the exodus_node_num_to_libmesh vector above, this one is a std::map
1739  this->libmesh_node_num_to_exodus[id] =
1740  cast_int<int>(this->exodus_node_num_to_libmesh.size()); // should never be zero...
1741  }
1742 
1743  // Now we're going to loop over the subdomain map and build a few things right
1744  // now that we'll use later.
1745 
1746  // First make sure our data structures don't have any leftover data...
1747  this->exodus_elem_num_to_libmesh.clear();
1748  this->block_ids.clear();
1749  this->libmesh_elem_num_to_exodus.clear();
1750 
1751  // Now loop over each subdomain and get a unique numbering for the elements
1752  for (auto & pr : subdomain_map)
1753  {
1754  block_ids.push_back(pr.first);
1755 
1756  // Vector of element IDs for this subdomain
1757  std::vector<dof_id_type> & elem_ids_this_subdomain = pr.second;
1758 
1759  // The code below assumes this subdomain block is not empty, make sure that's the case!
1760  if (elem_ids_this_subdomain.size() == 0)
1761  libmesh_error_msg("Error, no element IDs found in subdomain " << pr.first);
1762 
1763  // Use the first element in this block to get representative information.
1764  // Note that Exodus assumes all elements in a block are of the same type!
1765  // We are using that same assumption here!
1766  const auto & conv = get_conversion
1767  (pmesh.elem_ref(elem_ids_this_subdomain[0]).type());
1768  this->num_nodes_per_elem =
1769  pmesh.elem_ref(elem_ids_this_subdomain[0]).n_nodes();
1770 
1771  // Get a reference to the connectivity vector for this subdomain. This vector
1772  // is most likely empty, we are going to fill it up now.
1773  std::vector<int> & current_block_connectivity = this->block_id_to_elem_connectivity[pr.first];
1774 
1775  // Just in case it's not already empty...
1776  current_block_connectivity.clear();
1777  current_block_connectivity.resize(elem_ids_this_subdomain.size() * this->num_nodes_per_elem);
1778 
1779  for (auto i : index_range(elem_ids_this_subdomain))
1780  {
1781  auto elem_id = elem_ids_this_subdomain[i];
1782 
1783  // Set the number map for elements
1784  this->exodus_elem_num_to_libmesh.push_back(elem_id);
1785  this->libmesh_elem_num_to_exodus[elem_id] =
1786  cast_int<int>(this->exodus_elem_num_to_libmesh.size());
1787 
1788  const Elem & elem = pmesh.elem_ref(elem_id);
1789 
1790  // Exodus/Nemesis want every block to have the same element type
1791  // libmesh_assert_equal_to (elem->type(), conv.libmesh_elem_type());
1792 
1793  // But we can get away with writing e.g. HEX8 and INFHEX8 in
1794  // the same block...
1795  libmesh_assert_equal_to (elem.n_nodes(), Elem::build(conv.libmesh_elem_type(), nullptr)->n_nodes());
1796 
1797  for (auto j : IntRange<int>(0, this->num_nodes_per_elem))
1798  {
1799  const unsigned int connect_index = (i*this->num_nodes_per_elem)+j;
1800  const unsigned int elem_node_index = conv.get_node_map(j);
1801 
1802  current_block_connectivity[connect_index] =
1803  libmesh_map_find(libmesh_node_num_to_exodus,
1804  elem.node_id(elem_node_index));
1805  }
1806  } // End loop over elems in this subdomain
1807  } // end loop over subdomain_map
1808 }

References libMesh::MeshBase::active_local_element_ptr_range(), libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), 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, n_nodes, libMesh::Elem::n_nodes(), 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 2522 of file exodusII_io_helper.C.

2525 {
2526  // There may already be global variables in the file (for example,
2527  // if we're appending) and in that case, we
2528  // 1.) Cannot initialize them again.
2529  // 2.) Should check to be sure that the global variable names are the same.
2530 
2531  // Fills up names_from_file for us
2532  this->read_var_names(type);
2533 
2534  // Both the number of variables and their names (up to the first
2535  // MAX_STR_LENGTH characters) must match for the names we are
2536  // planning to write and the names already in the file.
2537  bool match =
2538  std::equal(names.begin(), names.end(),
2539  names_from_file.begin(),
2540  [](const std::string & a,
2541  const std::string & b) -> bool
2542  {
2543  return a.compare(/*pos=*/0, /*len=*/MAX_STR_LENGTH, b) == 0;
2544  });
2545 
2546  if (!match)
2547  {
2548  libMesh::err << "Error! The Exodus file already contains the variables:" << std::endl;
2549  for (const auto & name : names_from_file)
2550  libMesh::err << name << std::endl;
2551 
2552  libMesh::err << "And you asked to write:" << std::endl;
2553  for (const auto & name : names)
2554  libMesh::err << name << std::endl;
2555 
2556  libmesh_error_msg("Cannot overwrite existing variables in Exodus II file.");
2557  }
2558 }

References equal(), libMesh::err, libMesh::Quality::name(), 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 ( )
inherited

Closes the ExodusII mesh file.

Definition at line 1228 of file exodusII_io_helper.C.

1229 {
1230  // Always call close on processor 0.
1231  // If we're running on multiple processors, i.e. as one of several Nemesis files,
1232  // we call close on all processors...
1233  if ((this->processor_id() == 0) || (!_run_only_on_proc0))
1234  {
1235  // Don't close the file if it was never opened, this raises an Exodus error
1237  {
1238  ex_err = exII::ex_close(ex_id);
1239  EX_CHECK_ERR(ex_err, "Error closing Exodus file.");
1240  message("Exodus file closed successfully.");
1241  }
1242  }
1243 }

References 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 ~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 94 of file parallel_object.h.

95  { return _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::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), 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::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DynaIO::add_spline_constraints(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::Generation::build_extrusion(), 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::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), 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::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), 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::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), 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::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), 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_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::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_preconditioner_apply(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_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::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::DofMap::n_constrained_dofs(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::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(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), SystemsTest::testBlockRestrictedVarNDofs(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), CheckpointIOTest::testSplitter(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::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 1814 of file nemesis_io_helper.C.

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

References libMesh::MeshBase::active_element_ptr_range(), 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 1147 of file nemesis_io_helper.C.

1148 {
1149  // For the nodes, these are the number of entries in the sets in proc_nodes_touched_intersections
1150  // map computed above. Note: this map does not contain self-intersections so we can loop over it
1151  // directly.
1152  this->node_cmap_node_cnts.clear(); // Make sure we don't have any leftover information...
1153  this->node_cmap_ids.clear(); // Make sure we don't have any leftover information...
1154  this->node_cmap_node_cnts.resize(this->num_node_cmaps);
1155  this->node_cmap_ids.resize(this->num_node_cmaps);
1156 
1157  {
1158  unsigned cnt=0; // Index into the vector
1160  it = this->proc_nodes_touched_intersections.begin(),
1161  end = this->proc_nodes_touched_intersections.end();
1162 
1163  for (; it != end; ++it)
1164  {
1165  this->node_cmap_ids[cnt] = it->first; // The ID of the proc we communicate with
1166  this->node_cmap_node_cnts[cnt] = cast_int<int>(it->second.size()); // The number of nodes we communicate
1167  cnt++; // increment vector index!
1168  }
1169  }
1170 
1171  // Print the packed vectors we just filled
1172  if (verbose)
1173  {
1174  libMesh::out << "[" << this->processor_id() << "] node_cmap_node_cnts = ";
1175  for (const auto & node_cnt : node_cmap_node_cnts)
1176  libMesh::out << node_cnt << ", ";
1177  libMesh::out << std::endl;
1178 
1179  libMesh::out << "[" << this->processor_id() << "] node_cmap_ids = ";
1180  for (const auto & node_id : node_cmap_ids)
1181  libMesh::out << node_id << ", ";
1182  libMesh::out << std::endl;
1183  }
1184 
1185  // For the elements, we have not yet computed all this information..
1186  this->elem_cmap_elem_cnts.clear(); // Make sure we don't have any leftover information...
1187  this->elem_cmap_ids.clear(); // Make sure we don't have any leftover information...
1188  this->elem_cmap_elem_cnts.resize(this->num_elem_cmaps);
1189  this->elem_cmap_ids.resize(this->num_elem_cmaps);
1190 
1191  // Pack the elem_cmap_ids and elem_cmap_elem_cnts vectors
1192  {
1193  unsigned cnt=0; // Index into the vectors we're filling
1195  it = this->proc_border_elem_sets.begin(),
1196  end = this->proc_border_elem_sets.end();
1197 
1198  for (; it != end; ++it)
1199  {
1200  this->elem_cmap_ids[cnt] = it->first; // The ID of the proc we communicate with
1201  this->elem_cmap_elem_cnts[cnt] = cast_int<int>(it->second.size()); // The number of elems we communicate to/from that proc
1202  cnt++; // increment vector index!
1203  }
1204  }
1205 
1206  // Print the packed vectors we just filled
1207  if (verbose)
1208  {
1209  libMesh::out << "[" << this->processor_id() << "] elem_cmap_elem_cnts = ";
1210  for (const auto & elem_cnt : elem_cmap_elem_cnts)
1211  libMesh::out << elem_cnt << ", ";
1212  libMesh::out << std::endl;
1213 
1214  libMesh::out << "[" << this->processor_id() << "] elem_cmap_ids = ";
1215  for (const auto & elem_id : elem_cmap_ids)
1216  libMesh::out << elem_id << ", ";
1217  libMesh::out << std::endl;
1218  }
1219 }

References elem_cmap_elem_cnts, elem_cmap_ids, end, 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 995 of file nemesis_io_helper.C.

996 {
997  // Make sure there is no leftover information
998  this->elem_cmap_elem_ids.clear();
999  this->elem_cmap_side_ids.clear();
1000  this->elem_cmap_proc_ids.clear();
1001 
1002  // Allocate enough space for all our element maps
1003  this->elem_cmap_elem_ids.resize(this->num_elem_cmaps);
1004  this->elem_cmap_side_ids.resize(this->num_elem_cmaps);
1005  this->elem_cmap_proc_ids.resize(this->num_elem_cmaps);
1006  {
1007  unsigned cnt=0; // Index into vectors
1009  it = this->proc_border_elem_sets.begin(),
1010  end = this->proc_border_elem_sets.end();
1011 
1012  for (; it != end; ++it)
1013  {
1014  // Make sure the current elem_cmap_id matches the index in our map of node intersections
1015  libmesh_assert_equal_to (static_cast<unsigned>(this->elem_cmap_ids[cnt]), it->first);
1016 
1017  // Get reference to the set of IDs to be packed into the vector
1018  std::set<std::pair<unsigned,unsigned>> & elem_set = it->second;
1019 
1020  // Resize the vectors to receive their payload
1021  this->elem_cmap_elem_ids[cnt].resize(elem_set.size());
1022  this->elem_cmap_side_ids[cnt].resize(elem_set.size());
1023  this->elem_cmap_proc_ids[cnt].resize(elem_set.size());
1024 
1025  std::set<std::pair<unsigned,unsigned>>::iterator elem_set_iter = elem_set.begin();
1026 
1027  // Pack the vectors with elem IDs, side IDs, and processor IDs.
1028  for (std::size_t j=0, eceis=this->elem_cmap_elem_ids[cnt].size(); j<eceis; ++j, ++elem_set_iter)
1029  {
1030  this->elem_cmap_elem_ids[cnt][j] =
1031  libmesh_map_find(libmesh_elem_num_to_exodus, elem_set_iter->first);
1032  this->elem_cmap_side_ids[cnt][j] = elem_set_iter->second; // Side ID, this has already been converted above
1033  this->elem_cmap_proc_ids[cnt][j] = it->first; // All have the same processor ID
1034  }
1035 
1036  // increment vector index to go to next processor
1037  cnt++;
1038  }
1039  } // end scope for packing
1040 }

References elem_cmap_elem_ids, elem_cmap_ids, elem_cmap_proc_ids, elem_cmap_side_ids, end, 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 970 of file nemesis_io_helper.C.

971 {
972  // Make sure we don't have any leftover info
973  this->elem_mapi.clear();
974  this->elem_mapb.clear();
975 
976  // Copy set contents into vectors
977  this->elem_mapi.resize(this->internal_elem_ids.size());
978  this->elem_mapb.resize(this->border_elem_ids.size());
979 
980  {
981  unsigned cnt = 0;
982  for (const auto & id : this->internal_elem_ids)
983  this->elem_mapi[cnt++] = libmesh_map_find(libmesh_elem_num_to_exodus, id);
984  }
985 
986  {
987  unsigned cnt = 0;
988  for (const auto & id : this->border_elem_ids)
989  this->elem_mapb[cnt++] = libmesh_map_find(libmesh_elem_num_to_exodus, id);
990  }
991 }

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 1225 of file nemesis_io_helper.C.

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

References libMesh::MeshBase::active_local_element_ptr_range(), border_elem_ids, border_node_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 1075 of file nemesis_io_helper.C.

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

References end, 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 1046 of file nemesis_io_helper.C.

1047 {
1048  // Make sure we don't have any leftover information
1049  this->node_mapi.clear();
1050  this->node_mapb.clear();
1051  this->node_mape.clear();
1052 
1053  // Make sure there's enough space to hold all our node IDs
1054  this->node_mapi.resize(this->internal_node_ids.size());
1055  this->node_mapb.resize(this->border_node_ids.size());
1056 
1057  // Copy set contents into vectors
1058  {
1059  unsigned cnt = 0;
1060  for (const auto & id : this->internal_node_ids)
1061  this->node_mapi[cnt++] = libmesh_map_find(libmesh_node_num_to_exodus, id);
1062  }
1063 
1064  {
1065  unsigned cnt=0;
1066  for (const auto & id : this->border_node_ids)
1067  this->node_mapb[cnt++] = libmesh_map_find(libmesh_node_num_to_exodus, id);
1068  }
1069 }

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)
private

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

Definition at line 1567 of file nemesis_io_helper.C.

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

References libMesh::MeshBase::active_local_element_ptr_range(), libMesh::ParallelObject::comm(), global_elem_blk_cnts, global_elem_blk_ids, local_subdomain_counts, num_elem_blks_global, libMesh::out, libMesh::ParallelObject::processor_id(), 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 1456 of file nemesis_io_helper.C.

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

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::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), swap(), 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 1363 of file nemesis_io_helper.C.

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

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::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), swap(), and libMesh::ExodusII_IO_Helper::verbose.

Referenced by initialize().

◆ construct_nemesis_filename()

std::string libMesh::Nemesis_IO_Helper::construct_nemesis_filename ( const std::string &  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 2663 of file nemesis_io_helper.C.

2664 {
2665  // Build a filename for this processor. This code is cut-n-pasted from the read function
2666  // and should probably be put into a separate function...
2667  std::ostringstream file_oss;
2668 
2669  // We have to be a little careful here: Nemesis left pads its file
2670  // numbers based on the number of processors, so for example on 10
2671  // processors, we'd have:
2672  // mesh.e.10.00
2673  // mesh.e.10.01
2674  // mesh.e.10.02
2675  // ...
2676  // mesh.e.10.09
2677 
2678  // And on 100 you'd have:
2679  // mesh.e.100.000
2680  // mesh.e.100.001
2681  // ...
2682  // mesh.e.128.099
2683 
2684  // Find the length of the highest processor ID
2685  file_oss << (this->n_processors());
2686  unsigned int field_width = cast_int<unsigned int>(file_oss.str().size());
2687 
2688  if (verbose)
2689  libMesh::out << "field_width=" << field_width << std::endl;
2690 
2691  file_oss.str(""); // reset the string stream
2692  file_oss << base_filename
2693  << '.' << this->n_processors()
2694  << '.' << std::setfill('0') << std::setw(field_width) << this->processor_id();
2695 
2696  // Return the resulting string
2697  return file_oss.str();
2698 }

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

◆ create()

void libMesh::Nemesis_IO_Helper::create ( std::string  filename)
overridevirtual

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

Reimplemented from libMesh::ExodusII_IO_Helper.

Definition at line 730 of file nemesis_io_helper.C.

731 {
732  // Fall back on double precision when necessary since ExodusII
733  // doesn't seem to support long double
734  int
735  comp_ws = 0,
736  io_ws = 0;
737 
738  if (_single_precision)
739  {
740  comp_ws = sizeof(float);
741  io_ws = sizeof(float);
742  }
743  else
744  {
745  comp_ws = cast_int<int>(std::min(sizeof(Real), sizeof(double)));
746  io_ws = cast_int<int>(std::min(sizeof(Real), sizeof(double)));
747  }
748 
749  this->ex_id = exII::ex_create(filename.c_str(), EX_CLOBBER, &comp_ws, &io_ws);
750 
751  EX_CHECK_ERR(ex_id, "Error creating Nemesis mesh file.");
752 
753  if (verbose)
754  libMesh::out << "File created successfully." << std::endl;
755 
756  this->opened_for_writing = true;
757 }

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::opened_for_writing, libMesh::out, libMesh::Real, and libMesh::ExodusII_IO_Helper::verbose.

◆ 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 742 of file exodusII_io_helper.C.

743 {
744  libmesh_assert_less (index, block_ids.size());
745 
746  return block_ids[index];
747 }

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 751 of file exodusII_io_helper.C.

752 {
753  libmesh_assert_less (index, block_ids.size());
754 
755  return id_to_block_names[block_ids[index]];
756 }

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 325 of file nemesis_io_helper.C.

326 {
331 
333  Nemesis::ne_get_cmap_params(ex_id,
334  node_cmap_ids.empty() ? nullptr : node_cmap_ids.data(),
335  node_cmap_node_cnts.empty() ? nullptr : node_cmap_node_cnts.data(),
336  elem_cmap_ids.empty() ? nullptr : elem_cmap_ids.data(),
337  elem_cmap_elem_cnts.empty() ? nullptr : elem_cmap_elem_cnts.data(),
338  this->processor_id());
339  EX_CHECK_ERR(nemesis_err_flag, "Error reading cmap parameters!");
340 
341 
342  if (verbose)
343  {
344  libMesh::out << "[" << this->processor_id() << "] ";
345  for (auto i : index_range(node_cmap_ids))
346  libMesh::out << "node_cmap_ids[" << i << "]=" << node_cmap_ids[i] << " ";
347  libMesh::out << std::endl;
348 
349  libMesh::out << "[" << this->processor_id() << "] ";
350  for (auto i : index_range(node_cmap_node_cnts))
351  libMesh::out << "node_cmap_node_cnts[" << i << "]=" << node_cmap_node_cnts[i] << " ";
352  libMesh::out << std::endl;
353 
354  libMesh::out << "[" << this->processor_id() << "] ";
355  for (auto i : index_range(elem_cmap_ids))
356  libMesh::out << "elem_cmap_ids[" << i << "]=" << elem_cmap_ids[i] << " ";
357  libMesh::out << std::endl;
358 
359  libMesh::out << "[" << this->processor_id() << "] ";
360  for (auto i : index_range(elem_cmap_elem_cnts))
361  libMesh::out << "elem_cmap_elem_cnts[" << i << "]=" << elem_cmap_elem_cnts[i] << " ";
362  libMesh::out << std::endl;
363  }
364 }

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) const
inherited
Returns
A vector with three copies of each element in the provided name vector, starting with r_, i_ and a_ respectively.

Definition at line 3188 of file exodusII_io_helper.C.

3189 {
3190  std::vector<std::string> complex_names;
3191 
3192  // This will loop over all names and create new "complex" names
3193  // (i.e. names that start with r_, i_ or a_
3194  for (const auto & name : names)
3195  {
3196  complex_names.push_back("r_" + name);
3197  complex_names.push_back("i_" + name);
3198  complex_names.push_back("a_" + name);
3199  }
3200 
3201  return complex_names;
3202 }

References libMesh::Quality::name().

◆ 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) 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 3227 of file exodusII_io_helper.C.

3229 {
3230  // Eventual return value
3231  std::map<subdomain_id_type, std::vector<std::string>> ret;
3232 
3233  for (const auto & pr : subdomain_to_var_names)
3234  {
3235  // Initialize entry for current subdomain
3236  auto & vec = ret[pr.first];
3237 
3238  // Get list of non-complex variable names active on this subdomain.
3239  const auto & varnames = pr.second;
3240 
3241  // Allocate space for 3x the number of entries
3242  vec.reserve(3 * varnames.size());
3243 
3244  // For each varname in the input map, write three variable names
3245  // to the output formed by prepending "r_", "i_", and "a_",
3246  // respectively.
3247  for (const auto & varname : varnames)
3248  {
3249  vec.push_back("r_" + varname);
3250  vec.push_back("i_" + varname);
3251  vec.push_back("a_" + varname);
3252  }
3253  }
3254  return ret;
3255 }

◆ 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) const
inherited

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

Definition at line 3206 of file exodusII_io_helper.C.

3208 {
3209  std::vector<std::set<subdomain_id_type>> complex_vars_active_subdomains;
3210 
3211  for (auto & s : vars_active_subdomains)
3212  {
3213  // Push back the same data three times to match the tripling of the variables
3214  // for the real, imag, and modulus for the complex-valued solution.
3215  complex_vars_active_subdomains.push_back(s);
3216  complex_vars_active_subdomains.push_back(s);
3217  complex_vars_active_subdomains.push_back(s);
3218  }
3219 
3220  return complex_vars_active_subdomains;
3221 }

◆ 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 389 of file exodusII_io_helper.C.

390 {
391  // Do only upper-case comparisons
392  std::transform(type_str.begin(), type_str.end(), type_str.begin(), ::toupper);
393  return get_conversion (libmesh_map_find(element_equivalence_map, type_str));
394 }

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 179 of file nemesis_io_helper.C.

180 {
183 
184  if (num_elem_blks_global > 0)
185  {
187  Nemesis::ne_get_eb_info_global(ex_id,
188  global_elem_blk_ids.data(),
189  global_elem_blk_cnts.data());
190  EX_CHECK_ERR(nemesis_err_flag, "Error reading global element block info!");
191  }
192 
193  if (verbose)
194  {
195  libMesh::out << "[" << this->processor_id() << "] " << "Global Element Block IDs and Counts:" << std::endl;
196  for (auto bn : index_range(global_elem_blk_ids))
197  {
198  libMesh::out << " [" << this->processor_id() << "] "
199  << "global_elem_blk_ids[" << bn << "]=" << global_elem_blk_ids[bn]
200  << ", global_elem_blk_cnts[" << bn << "]=" << global_elem_blk_cnts[bn]
201  << std::endl;
202  }
203  }
204 }

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 410 of file nemesis_io_helper.C.

411 {
415 
416  for (auto i : index_range(elem_cmap_elem_ids))
417  {
421 
422  if (elem_cmap_elem_cnts[i] > 0)
423  {
425  Nemesis::ne_get_elem_cmap(ex_id,
426  elem_cmap_ids[i],
430  this->processor_id());
431  EX_CHECK_ERR(nemesis_err_flag, "Error reading elem cmap elem, side, and processor ids!");
432  }
433 
434  if (verbose)
435  {
436  libMesh::out << "[" << this->processor_id() << "] elem_cmap_elem_ids[" << i << "]=";
437  for (const auto & dof : elem_cmap_elem_ids[i])
438  libMesh::out << dof << " ";
439  libMesh::out << std::endl;
440 
441  // These must be the (local) side IDs (in the ExodusII face numbering scheme)
442  // of the sides shared across processors.
443  libMesh::out << "[" << this->processor_id() << "] elem_cmap_side_ids[" << i << "]=";
444  for (const auto & dof : elem_cmap_side_ids[i])
445  libMesh::out << dof << " ";
446  libMesh::out << std::endl;
447 
448  // This is basically a vector, all entries of which are = elem_cmap_ids[i]
449  // Not sure if it's always guaranteed to be that or what...
450  libMesh::out << "[" << this->processor_id() << "] elem_cmap_proc_ids[" << i << "]=";
451  for (const auto & dof : elem_cmap_proc_ids[i])
452  libMesh::out << dof << " ";
453  libMesh::out << std::endl;
454  }
455  }
456 }

References data, 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 257 of file nemesis_io_helper.C.

258 {
260  elem_mapb.resize(num_border_elems);
261 
263  Nemesis::ne_get_elem_map(ex_id,
264  elem_mapi.empty() ? nullptr : elem_mapi.data(),
265  elem_mapb.empty() ? nullptr : elem_mapb.data(),
266  this->processor_id()
267  );
268  EX_CHECK_ERR(nemesis_err_flag, "Error reading element maps!");
269 
270 
271  if (verbose)
272  {
273  libMesh::out << "[" << this->processor_id() << "] elem_mapi[i] = ";
274  for (auto i : IntRange<int>(0, num_internal_elems-1))
275  libMesh::out << elem_mapi[i] << ", ";
276  libMesh::out << "... " << elem_mapi.back() << std::endl;
277 
278  libMesh::out << "[" << this->processor_id() << "] elem_mapb[i] = ";
279  for (auto i : IntRange<int>(0, std::min(10, num_border_elems-1)))
280  libMesh::out << elem_mapb[i] << ", ";
281  libMesh::out << "... " << elem_mapb.back() << std::endl;
282  }
283 }

References elem_mapb, elem_mapi, libMesh::ExodusII_IO_Helper::ex_id, 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 396 of file exodusII_io_helper.C.

397 {
398  return elem_type.data();
399 }

References libMesh::ExodusII_IO_Helper::elem_type.

◆ get_init_global()

void libMesh::Nemesis_IO_Helper::get_init_global ( )

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... Fills: num_nodes_global, num_elems_global, num_elem_blks_global, num_node_sets_global, num_side_sets_global Call after: read_header() Call before: Any other get_* function from this class

Definition at line 88 of file nemesis_io_helper.C.

89 {
91  Nemesis::ne_get_init_global(ex_id,
97  EX_CHECK_ERR(nemesis_err_flag, "Error reading initial global data!");
98 
99  if (verbose)
100  {
101  libMesh::out << "[" << this->processor_id() << "] " << "num_nodes_global=" << num_nodes_global << std::endl;
102  libMesh::out << "[" << this->processor_id() << "] " << "num_elems_global=" << num_elems_global << std::endl;
103  libMesh::out << "[" << this->processor_id() << "] " << "num_elem_blks_global=" << num_elem_blks_global << std::endl;
104  libMesh::out << "[" << this->processor_id() << "] " << "num_node_sets_global=" << num_node_sets_global << std::endl;
105  libMesh::out << "[" << this->processor_id() << "] " << "num_side_sets_global=" << num_side_sets_global << std::endl;
106  }
107 }

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 208 of file nemesis_io_helper.C.

209 {
211  Nemesis::ne_get_init_info(ex_id,
212  &num_proc,
214  &ftype);
215  EX_CHECK_ERR(nemesis_err_flag, "Error reading initial info!");
216 
217  if (verbose)
218  {
219  libMesh::out << "[" << this->processor_id() << "] " << "num_proc=" << num_proc << std::endl;
220  libMesh::out << "[" << this->processor_id() << "] " << "num_proc_in_file=" << num_proc_in_file << std::endl;
221  libMesh::out << "[" << this->processor_id() << "] " << "ftype=" << ftype << std::endl;
222  }
223 }

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_loadbal_param()

void libMesh::Nemesis_IO_Helper::get_loadbal_param ( )

Definition at line 227 of file nemesis_io_helper.C.

228 {
230  Nemesis::ne_get_loadbal_param(ex_id,
238  this->processor_id() // The ID of the processor for which info is to be read
239  );
240  EX_CHECK_ERR(nemesis_err_flag, "Error reading load balance parameters!");
241 
242 
243  if (verbose)
244  {
245  libMesh::out << "[" << this->processor_id() << "] " << "num_internal_nodes=" << num_internal_nodes << std::endl;
246  libMesh::out << "[" << this->processor_id() << "] " << "num_border_nodes=" << num_border_nodes << std::endl;
247  libMesh::out << "[" << this->processor_id() << "] " << "num_external_nodes=" << num_external_nodes << std::endl;
248  libMesh::out << "[" << this->processor_id() << "] " << "num_internal_elems=" << num_internal_elems << std::endl;
249  libMesh::out << "[" << this->processor_id() << "] " << "num_border_elems=" << num_border_elems << std::endl;
250  libMesh::out << "[" << this->processor_id() << "] " << "num_node_cmaps=" << num_node_cmaps << std::endl;
251  libMesh::out << "[" << this->processor_id() << "] " << "num_elem_cmaps=" << num_elem_cmaps << std::endl;
252  }
253 }

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 368 of file nemesis_io_helper.C.

369 {
372 
373  for (auto i : index_range(node_cmap_node_ids))
374  {
377 
378  // Don't call ne_get_node_cmap() if there is nothing there to
379  // get, Nemesis throws an error in this case.
380  if (node_cmap_node_cnts[i] > 0)
381  {
383  Nemesis::ne_get_node_cmap(ex_id,
384  node_cmap_ids[i],
387  this->processor_id());
388  EX_CHECK_ERR(nemesis_err_flag, "Error reading node cmap node and processor ids!");
389  }
390 
391  if (verbose)
392  {
393  libMesh::out << "[" << this->processor_id() << "] node_cmap_node_ids[" << i << "]=";
394  for (const auto & dof : node_cmap_node_ids[i])
395  libMesh::out << dof << " ";
396  libMesh::out << std::endl;
397 
398  // This is basically a vector, all entries of which are = node_cmap_ids[i]
399  // Not sure if it's always guaranteed to be that or what...
400  libMesh::out << "[" << this->processor_id() << "] node_cmap_proc_ids[" << i << "]=";
401  for (const auto & dof : node_cmap_proc_ids[i])
402  libMesh::out << dof << " ";
403  libMesh::out << std::endl;
404  }
405  }
406 }

References data, 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 288 of file nemesis_io_helper.C.

289 {
291  node_mapb.resize(num_border_nodes);
293 
295  Nemesis::ne_get_node_map(ex_id,
296  node_mapi.empty() ? nullptr : node_mapi.data(),
297  node_mapb.empty() ? nullptr : node_mapb.data(),
298  node_mape.empty() ? nullptr : node_mape.data(),
299  this->processor_id()
300  );
301  EX_CHECK_ERR(nemesis_err_flag, "Error reading node maps!");
302 
303  if (verbose)
304  {
305  // Remark: The Exodus/Nemesis node numbering is always (?) 1-based! This means the first interior node id will
306  // always be == 1.
307  libMesh::out << "[" << this->processor_id() << "] " << "first interior node id=" << node_mapi[0] << std::endl;
308  libMesh::out << "[" << this->processor_id() << "] " << "last interior node id=" << node_mapi.back() << std::endl;
309 
310  libMesh::out << "[" << this->processor_id() << "] " << "first boundary node id=" << node_mapb[0] << std::endl;
311  libMesh::out << "[" << this->processor_id() << "] " << "last boundary node id=" << node_mapb.back() << std::endl;
312 
313  // The number of external nodes is sometimes zero, don't try to access
314  // node_mape.back() in this case!
315  if (num_external_nodes > 0)
316  {
317  libMesh::out << "[" << this->processor_id() << "] " << "first external node id=" << node_mape[0] << std::endl;
318  libMesh::out << "[" << this->processor_id() << "] " << "last external node id=" << node_mape.back() << std::endl;
319  }
320  }
321 }

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 778 of file exodusII_io_helper.C.

779 {
780  libmesh_assert_less (index, nodeset_ids.size());
781 
782  return nodeset_ids[index];
783 }

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 787 of file exodusII_io_helper.C.

788 {
789  libmesh_assert_less (index, nodeset_ids.size());
790 
791  return id_to_ns_names[nodeset_ids[index]];
792 }

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

◆ get_ns_param_global()

void libMesh::Nemesis_IO_Helper::get_ns_param_global ( )

Definition at line 147 of file nemesis_io_helper.C.

148 {
149  if (num_node_sets_global > 0)
150  {
154 
156  Nemesis::ne_get_ns_param_global(ex_id,
157  global_nodeset_ids.data(),
158  num_global_node_counts.data(),
160  EX_CHECK_ERR(nemesis_err_flag, "Error reading global nodeset parameters!");
161 
162  if (verbose)
163  {
164  libMesh::out << "[" << this->processor_id() << "] " << "Global Nodeset IDs, Node Counts, and DF counts:" << std::endl;
165  for (auto bn : index_range(global_nodeset_ids))
166  {
167  libMesh::out << " [" << this->processor_id() << "] "
168  << "global_nodeset_ids["<<bn<<"]=" << global_nodeset_ids[bn]
169  << ", num_global_node_counts["<<bn<<"]=" << num_global_node_counts[bn]
170  << ", num_global_node_df_counts["<<bn<<"]=" << num_global_node_df_counts[bn]
171  << std::endl;
172  }
173  }
174  }
175 }

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 760 of file exodusII_io_helper.C.

761 {
762  libmesh_assert_less (index, ss_ids.size());
763 
764  return ss_ids[index];
765 }

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 769 of file exodusII_io_helper.C.

770 {
771  libmesh_assert_less (index, ss_ids.size());
772 
773  return id_to_ss_names[ss_ids[index]];
774 }

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

◆ 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 111 of file nemesis_io_helper.C.

112 {
113  if (num_side_sets_global > 0)
114  {
117 
118  // df = "distribution factor", not really sure what that is. I don't yet have a file
119  // which has distribution factors so I guess we'll worry about it later...
121 
123  Nemesis::ne_get_ss_param_global(ex_id,
124  global_sideset_ids.data(),
125  num_global_side_counts.data(),
127  EX_CHECK_ERR(nemesis_err_flag, "Error reading global sideset parameters!");
128 
129  if (verbose)
130  {
131  libMesh::out << "[" << this->processor_id() << "] " << "Global Sideset IDs, Side Counts, and DF counts:" << std::endl;
132  for (auto bn : index_range(global_sideset_ids))
133  {
134  libMesh::out << " [" << this->processor_id() << "] "
135  << "global_sideset_ids["<<bn<<"]=" << global_sideset_ids[bn]
136  << ", num_global_side_counts["<<bn<<"]=" << num_global_side_counts[bn]
137  << ", num_global_side_df_counts["<<bn<<"]=" << num_global_side_df_counts[bn]
138  << std::endl;
139  }
140  }
141  }
142 }

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 146 of file exodusII_io_helper.C.

147 {
148  {
149  auto & conv = conversion_map[NODEELEM];
150  conv.libmesh_type = NODEELEM;
151  conv.exodus_type = "SPHERE";
152  }
153  {
154  auto & conv = conversion_map[EDGE2];
155  conv.libmesh_type = EDGE2;
156  conv.exodus_type = "EDGE2";
157  }
158  {
159  auto & conv = conversion_map[EDGE3];
160  conv.libmesh_type = EDGE3;
161  conv.exodus_type = "EDGE3";
162  }
163  {
164  auto & conv = conversion_map[QUAD4];
165  conv.libmesh_type = QUAD4;
166  conv.exodus_type = "QUAD4";
167  }
168  {
169  auto & conv = conversion_map[QUADSHELL4];
170  conv.inverse_side_map = &quadshell4_inverse_edge_map;
171  conv.shellface_index_offset = 2;
172  conv.libmesh_type = QUADSHELL4;
173  conv.exodus_type = "SHELL4";
174  }
175  {
176  auto & conv = conversion_map[QUAD8];
177  conv.libmesh_type = QUAD8;
178  conv.exodus_type = "QUAD8";
179  }
180  {
181  auto & conv = conversion_map[QUADSHELL8];
182  conv.inverse_side_map = &quadshell4_inverse_edge_map;
183  conv.shellface_index_offset = 2;
184  conv.libmesh_type = QUADSHELL8;
185  conv.exodus_type = "SHELL8";
186  }
187  {
188  auto & conv = conversion_map[QUAD9];
189  conv.libmesh_type = QUAD9;
190  conv.exodus_type = "QUAD9";
191  }
192  {
193  auto & conv = conversion_map[TRI3];
194  conv.libmesh_type = TRI3;
195  conv.exodus_type = "TRI3";
196  }
197  {
198  auto & conv = conversion_map[TRISHELL3];
199  conv.inverse_side_map = &trishell3_inverse_edge_map;
200  conv.shellface_index_offset = 2;
201  conv.libmesh_type = TRISHELL3;
202  conv.exodus_type = "TRISHELL3";
203  }
204  {
205  auto & conv = conversion_map[TRI3SUBDIVISION];
206  conv.libmesh_type = TRI3SUBDIVISION;
207  conv.exodus_type = "TRI3";
208  }
209  {
210  auto & conv = conversion_map[TRI6];
211  conv.libmesh_type = TRI6;
212  conv.exodus_type = "TRI6";
213  }
214  {
215  auto & conv = conversion_map[HEX8];
216  conv.side_map = &hex_face_map;
217  conv.inverse_side_map = &hex_inverse_face_map;
218  conv.libmesh_type = HEX8;
219  conv.exodus_type = "HEX8";
220  }
221  {
222  auto & conv = conversion_map[HEX20];
223  conv.side_map = &hex_face_map;
224  conv.inverse_side_map = &hex_inverse_face_map;
225  conv.libmesh_type = HEX20;
226  conv.exodus_type = "HEX20";
227  }
228  {
229  auto & conv = conversion_map[HEX27];
230  conv.node_map = &hex27_node_map;
231  conv.inverse_node_map = &hex27_inverse_node_map;
232  conv.side_map = &hex_face_map;
233  conv.inverse_side_map = &hex_inverse_face_map;
234  conv.libmesh_type = HEX27;
235  conv.exodus_type = "HEX27";
236  }
237  {
238  auto & conv = conversion_map[TET4];
239  conv.side_map = &tet_face_map;
240  conv.inverse_side_map = &tet_inverse_face_map;
241  conv.libmesh_type = TET4;
242  conv.exodus_type = "TETRA4";
243  }
244  {
245  auto & conv = conversion_map[TET10];
246  conv.side_map = &tet_face_map;
247  conv.inverse_side_map = &tet_inverse_face_map;
248  conv.libmesh_type = TET10;
249  conv.exodus_type = "TETRA10";
250  }
251  {
252  auto & conv = conversion_map[PRISM6];
253  conv.side_map = &prism_face_map;
254  conv.inverse_side_map = &prism_inverse_face_map;
255  conv.libmesh_type = PRISM6;
256  conv.exodus_type = "WEDGE";
257  }
258  {
259  auto & conv = conversion_map[PRISM15];
260  conv.side_map = &prism_face_map;
261  conv.inverse_side_map = &prism_inverse_face_map;
262  conv.libmesh_type = PRISM15;
263  conv.exodus_type = "WEDGE15";
264  }
265  {
266  auto & conv = conversion_map[PRISM18];
267  conv.side_map = &prism_face_map;
268  conv.inverse_side_map = &prism_inverse_face_map;
269  conv.libmesh_type = PRISM18;
270  conv.exodus_type = "WEDGE18";
271  }
272  {
273  auto & conv = conversion_map[PYRAMID5];
274  conv.libmesh_type = PYRAMID5;
275  conv.exodus_type = "PYRAMID5";
276  }
277  {
278  auto & conv = conversion_map[PYRAMID13];
279  conv.libmesh_type = PYRAMID13;
280  conv.exodus_type = "PYRAMID13";
281  }
282  {
283  auto & conv = conversion_map[PYRAMID14];
284  conv.libmesh_type = PYRAMID14;
285  conv.exodus_type = "PYRAMID14";
286  }
287 }

References libMesh::ExodusII_IO_Helper::conversion_map, libMesh::EDGE2, libMesh::EDGE3, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI3SUBDIVISION, libMesh::TRI6, 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 293 of file exodusII_io_helper.C.

294 {
295  // We use an ExodusII SPHERE element to represent a NodeElem
296  element_equivalence_map["SPHERE"] = NODEELEM;
297 
298  // EDGE2 equivalences
299  element_equivalence_map["EDGE"] = EDGE2;
300  element_equivalence_map["EDGE2"] = EDGE2;
301  element_equivalence_map["TRUSS"] = EDGE2;
302  element_equivalence_map["BEAM"] = EDGE2;
304  element_equivalence_map["TRUSS2"] = EDGE2;
305  element_equivalence_map["BEAM2"] = EDGE2;
306  element_equivalence_map["BAR2"] = EDGE2;
307 
308  // EDGE3 equivalences
309  element_equivalence_map["EDGE3"] = EDGE3;
310  element_equivalence_map["TRUSS3"] = EDGE3;
311  element_equivalence_map["BEAM3"] = EDGE3;
312  element_equivalence_map["BAR3"] = EDGE3;
313 
314  // QUAD4 equivalences
315  element_equivalence_map["QUAD"] = QUAD4;
316  element_equivalence_map["QUAD4"] = QUAD4;
317 
318  // QUADSHELL4 equivalences
321 
322  // QUAD8 equivalences
323  element_equivalence_map["QUAD8"] = QUAD8;
324 
325  // QUADSHELL8 equivalences
327 
328  // QUAD9 equivalences
329  element_equivalence_map["QUAD9"] = QUAD9;
330  // element_equivalence_map["SHELL9"] = QUAD9;
331 
332  // TRI3 equivalences
333  element_equivalence_map["TRI"] = TRI3;
334  element_equivalence_map["TRI3"] = TRI3;
335  element_equivalence_map["TRIANGLE"] = TRI3;
336 
337  // TRISHELL3 equivalences
338  element_equivalence_map["TRISHELL"] = TRISHELL3;
339  element_equivalence_map["TRISHELL3"] = TRISHELL3;
340 
341  // TRI6 equivalences
342  element_equivalence_map["TRI6"] = TRI6;
343  // element_equivalence_map["TRISHELL6"] = TRI6;
344 
345  // HEX8 equivalences
346  element_equivalence_map["HEX"] = HEX8;
347  element_equivalence_map["HEX8"] = HEX8;
348 
349  // HEX20 equivalences
350  element_equivalence_map["HEX20"] = HEX20;
351 
352  // HEX27 equivalences
353  element_equivalence_map["HEX27"] = HEX27;
354 
355  // TET4 equivalences
356  element_equivalence_map["TETRA"] = TET4;
357  element_equivalence_map["TETRA4"] = TET4;
358 
359  // TET10 equivalences
360  element_equivalence_map["TETRA10"] = TET10;
361 
362  // PRISM6 equivalences
363  element_equivalence_map["WEDGE"] = PRISM6;
364 
365  // PRISM15 equivalences
366  element_equivalence_map["WEDGE15"] = PRISM15;
367 
368  // PRISM18 equivalences
369  element_equivalence_map["WEDGE18"] = PRISM18;
370 
371  // PYRAMID5 equivalences
372  element_equivalence_map["PYRAMID"] = PYRAMID5;
373  element_equivalence_map["PYRAMID5"] = PYRAMID5;
374 
375  // PYRAMID13 equivalences
376  element_equivalence_map["PYRAMID13"] = PYRAMID13;
377 
378  // PYRAMID14 equivalences
379  element_equivalence_map["PYRAMID14"] = PYRAMID14;
380 }

References libMesh::EDGE2, libMesh::EDGE3, libMesh::ExodusII_IO_Helper::element_equivalence_map, libMesh::HEX20, libMesh::HEX27, libMesh::HEX8, libMesh::NODEELEM, libMesh::PRISM15, libMesh::PRISM18, libMesh::PRISM6, libMesh::PYRAMID13, libMesh::PYRAMID14, libMesh::PYRAMID5, libMesh::QUAD4, libMesh::QUAD8, libMesh::QUAD9, libMesh::QUADSHELL4, libMesh::QUADSHELL8, libMesh::TET10, libMesh::TET4, libMesh::TRI3, libMesh::TRI6, 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 766 of file nemesis_io_helper.C.

767 {
768  // Make sure that the reference passed in is really a DistributedMesh
769  // const DistributedMesh & pmesh = cast_ref<const DistributedMesh &>(mesh);
770  const MeshBase & pmesh = mesh;
771 
772  // According to Nemesis documentation, first call when writing should be to
773  // ne_put_init_info(). Our reader doesn't actually call this, but we should
774  // strive to be as close to a normal nemesis file as possible...
775  this->put_init_info(this->n_processors(), 1, "p");
776 
777 
778  // Gather global "initial" information for Nemesis. This consists of
779  // three parts labeled I, II, and III below...
780 
781  //
782  // I.) Need to compute the number of global element blocks. To be consistent with
783  // Exodus, we also incorrectly associate the number of element blocks with the
784  // number of libmesh subdomains...
785  //
786  this->compute_num_global_elem_blocks(pmesh);
787 
788  //
789  // II.) Determine the global number of nodesets by communication.
790  // This code relies on BoundaryInfo storing side and node
791  // boundary IDs separately at the time they are added to the
792  // BoundaryInfo object.
793  //
794  this->compute_num_global_nodesets(pmesh);
795 
796  //
797  // III.) Need to compute the global number of sidesets by communication:
798  // This code relies on BoundaryInfo storing side and node
799  // boundary IDs separately at the time they are added to the
800  // BoundaryInfo object.
801  //
802  this->compute_num_global_sidesets(pmesh);
803 
804  // Now write the global data obtained in steps I, II, and III to the Nemesis file
805  this->put_init_global(pmesh.parallel_n_nodes(),
806  pmesh.parallel_n_elem(),
807  this->num_elem_blks_global, /* I. */
808  this->num_node_sets_global, /* II. */
809  this->num_side_sets_global /* III. */
810  );
811 
812  // Next, we'll write global element block information to the file. This was already
813  // gathered in step I. above
815  this->global_elem_blk_cnts);
816 
817 
818  // Next, write global nodeset information to the file. This was already gathered in
819  // step II. above.
820  this->num_global_node_df_counts.clear();
821  this->num_global_node_df_counts.resize(this->global_nodeset_ids.size()); // distribution factors all zero...
825 
826 
827  // Next, write global sideset information to the file. This was already gathered in
828  // step III. above.
829  this->num_global_side_df_counts.clear();
830  this->num_global_side_df_counts.resize(this->global_sideset_ids.size()); // distribution factors all zero...
834 
835 
836  // Before we go any further we need to derive consistent node and
837  // element numbering schemes for all local elems and nodes connected
838  // to local elements.
839  //
840  // Must be called *after* the local_subdomain_counts map has been constructed
841  // by the compute_num_global_elem_blocks() function!
842  this->build_element_and_node_maps(pmesh);
843 
844  // Next step is to write "load balance" parameters. Several things need to
845  // be computed first though...
846 
847  // First we'll collect IDs of border nodes.
848  this->compute_border_node_ids(pmesh);
849 
850  // Next we'll collect numbers of internal and border elements, and internal nodes.
851  // Note: "A border node does not a border element make...", that is, just because one
852  // of an element's nodes has been identified as a border node, the element is not
853  // necessarily a border element. It must have a side on the boundary between processors,
854  // i.e. have a face neighbor with a different processor id...
856 
857  // Finally we are ready to write the loadbal information to the file
859  this->num_border_nodes,
860  this->num_external_nodes,
861  this->num_internal_elems,
862  this->num_border_elems,
863  this->num_node_cmaps,
864  this->num_elem_cmaps);
865 
866 
867  // Now we need to compute the "communication map" parameters. These are basically
868  // lists of nodes and elements which need to be communicated between different processors
869  // when the mesh file is read back in.
871 
872  // Do we have communication maps to write? Note that
873  // ne_put_cmap_params expects us to have either *both* node and elem
874  // cmaps or *neither*
875  if (!this->node_cmap_ids.empty() &&
876  !this->node_cmap_node_cnts.empty() &&
877  !this->elem_cmap_ids.empty() &&
878  !this->elem_cmap_elem_cnts.empty())
879  {
880  // Write communication map parameters to file.
881  this->put_cmap_params(this->node_cmap_ids,
882  this->node_cmap_node_cnts,
883  this->elem_cmap_ids,
884  this->elem_cmap_elem_cnts);
885 
886  // Ready the node communication maps. The node IDs which
887  // are communicated are the ones currently stored in
888  // proc_nodes_touched_intersections.
890 
891  // Write the packed node communication vectors to file.
892  this->put_node_cmap(this->node_cmap_node_ids,
893  this->node_cmap_proc_ids);
894 
895  // Ready the node maps. These have nothing to do with communication, they map
896  // the nodes to internal, border, and external nodes in the file.
897  this->compute_node_maps();
898 
899  // Call the Nemesis API to write the node maps to file.
900  this->put_node_map(this->node_mapi,
901  this->node_mapb,
902  this->node_mape);
903 
904  // Ready the element communication maps. This includes border
905  // element IDs, sides which are on the border, and the processors to which
906  // they are to be communicated...
908 
909  // Call the Nemesis API to write the packed element communication maps vectors to file
910  this->put_elem_cmap(this->elem_cmap_elem_ids,
911  this->elem_cmap_side_ids,
912  this->elem_cmap_proc_ids);
913  }
914 
915 
916  // Ready the Nemesis element maps (internal and border) for writing to file.
917  this->compute_element_maps();
918 
919  // Call the Nemesis API to write the internal and border element IDs.
920  this->put_elem_map(this->elem_mapi,
921  this->elem_mapb);
922 
923  // Now write Exodus-specific initialization information, some of which is
924  // different when you are using Nemesis.
925  this->write_exodus_initialization_info(pmesh, title_in);
926 } // end initialize()

References 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::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, num_elem_blks_global, 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, num_node_sets_global, num_side_sets_global, 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 2548 of file nemesis_io_helper.C.

2550 {
2551  // Quick return if there are no element variables to write
2552  if (names.size() == 0)
2553  return;
2554 
2555  // Quick return if we have already called this function
2557  return;
2558 
2559  // Be sure that variables in the file match what we are asking for
2560  if (num_elem_vars > 0)
2561  {
2562  this->check_existing_vars(ELEMENTAL, names, this->elem_var_names);
2563  return;
2564  }
2565 
2566  // Set the flag so we can skip this stuff on subsequent calls to
2567  // initialize_element_variables()
2568  _elem_vars_initialized = true;
2569 
2570  this->write_var_names(ELEMENTAL, names);
2571 
2572  // Create a truth table from global_elem_blk_ids and the information
2573  // in vars_active_subdomains. Create a truth table of
2574  // size global_elem_blk_ids.size() * names.size().
2575  std::vector<int> truth_tab(global_elem_blk_ids.size() * names.size());
2576  for (auto blk : index_range(global_elem_blk_ids))
2577  for (auto var : index_range(names))
2578  if (vars_active_subdomains[var].empty() ||
2579  vars_active_subdomains[var].count(cast_int<subdomain_id_type>(global_elem_blk_ids[blk])))
2580  truth_tab[names.size() * blk + var] = 1;
2581 
2582  // Write truth table to file.
2583  if (truth_tab.size())
2584  {
2585  ex_err = exII::ex_put_elem_var_tab(ex_id,
2586  cast_int<int>(global_elem_blk_ids.size()),
2587  cast_int<int>(names.size()),
2588  truth_tab.data());
2589  EX_CHECK_ERR(ex_err, "Error writing element truth table.");
2590  }
2591 }

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 2496 of file exodusII_io_helper.C.

2497 {
2498  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2499  return;
2500 
2501  // Quick return if there are no global variables to write
2502  if (names.size() == 0)
2503  return;
2504 
2506  return;
2507 
2508  // Be sure that variables in the file match what we are asking for
2509  if (num_global_vars > 0)
2510  {
2511  this->check_existing_vars(GLOBAL, names, this->global_var_names);
2512  return;
2513  }
2514 
2515  _global_vars_initialized = true;
2516 
2517  this->write_var_names(GLOBAL, names);
2518 }

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 2468 of file exodusII_io_helper.C.

2469 {
2470  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2471  return;
2472 
2473  // Quick return if there are no nodal variables to write
2474  if (names.size() == 0)
2475  return;
2476 
2477  // Quick return if we have already called this function
2479  return;
2480 
2481  // Be sure that variables in the file match what we are asking for
2482  if (num_nodal_vars > 0)
2483  {
2484  this->check_existing_vars(NODAL, names, this->nodal_var_names);
2485  return;
2486  }
2487 
2488  // Set the flag so we can skip the rest of this function on subsequent calls.
2489  _nodal_vars_initialized = true;
2490 
2491  this->write_var_names(NODAL, names);
2492 }

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().

◆ inquire()

int libMesh::ExodusII_IO_Helper::inquire ( int  req_info,
std::string  error_msg = "" 
)
inherited
Returns
The value obtained from a generic exII::ex_inquire() call.

Definition at line 1247 of file exodusII_io_helper.C.

1248 {
1249  int ret_int = 0;
1250  char ret_char = 0;
1251  float ret_float = 0.;
1252 
1253  ex_err = exII::ex_inquire(ex_id,
1254  req_info_in,
1255  &ret_int,
1256  &ret_float,
1257  &ret_char);
1258 
1259  EX_CHECK_ERR(ex_err, error_msg);
1260 
1261  return ret_int;
1262 }

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

Referenced by libMesh::ExodusII_IO_Helper::read_all_nodesets(), libMesh::ExodusII_IO_Helper::read_num_time_steps(), libMesh::ExodusII_IO_Helper::read_qa_records(), libMesh::ExodusII_IO_Helper::read_sideset_info(), and libMesh::ExodusII_IO_Helper::write_information_records().

◆ message() [1/2]

void libMesh::ExodusII_IO_Helper::message ( const std::string &  msg)
inherited

◆ message() [2/2]

void libMesh::ExodusII_IO_Helper::message ( const std::string &  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 410 of file exodusII_io_helper.C.

411 {
412  if (verbose) libMesh::out << msg << i << "." << std::endl;
413 }

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 100 of file parallel_object.h.

101  { return cast_int<processor_id_type>(_communicator.size()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), compute_border_node_ids(), construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), initialize(), libMesh::DistributedMesh::insert_elem(), 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::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::partition(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::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(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), 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().

◆ 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 492 of file exodusII_io_helper.C.

493 {
494  // Version of Exodus you are using
495  float ex_version = 0.;
496 
497  int comp_ws = 0;
498 
499  if (_single_precision)
500  comp_ws = cast_int<int>(sizeof(float));
501 
502  // Fall back on double precision when necessary since ExodusII
503  // doesn't seem to support long double
504  else
505  comp_ws = cast_int<int>(std::min(sizeof(Real), sizeof(double)));
506 
507  // Word size in bytes of the floating point data as they are stored
508  // in the ExodusII file. "If this argument is 0, the word size of the
509  // floating point data already stored in the file is returned"
510  int io_ws = 0;
511 
512  ex_id = exII::ex_open(filename,
513  read_only ? EX_READ : EX_WRITE,
514  &comp_ws,
515  &io_ws,
516  &ex_version);
517 
518  std::string err_msg = std::string("Error opening ExodusII mesh file: ") + std::string(filename);
519  EX_CHECK_ERR(ex_id, err_msg);
520  if (verbose) libMesh::out << "File opened successfully." << std::endl;
521 
522  if (read_only)
523  opened_for_reading = true;
524  else
525  opened_for_writing = true;
526 
527  current_filename = std::string(filename);
528 }

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::current_filename, 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 625 of file exodusII_io_helper.C.

626 {
627  if (verbose)
628  libMesh::out << "Title: \t" << title.data() << std::endl
629  << "Mesh Dimension: \t" << num_dim << std::endl
630  << "Number of Nodes: \t" << num_nodes << std::endl
631  << "Number of elements: \t" << num_elem << std::endl
632  << "Number of elt blocks: \t" << num_elem_blk << std::endl
633  << "Number of node sets: \t" << num_node_sets << std::endl
634  << "Number of side sets: \t" << num_side_sets << std::endl;
635 }

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_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 = libMesh::out)
inherited

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

Definition at line 684 of file exodusII_io_helper.C.

685 {
686  for (int i=0; i<num_nodes; i++)
687  out_stream << "(" << x[i] << ", " << y[i] << ", " << z[i] << ")" << std::endl;
688 }

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 106 of file parallel_object.h.

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

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), 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_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), get_cmap_params(), get_eb_info_global(), get_elem_cmap(), get_elem_map(), libMesh::DofMap::get_info(), get_init_global(), get_init_info(), get_loadbal_param(), libMesh::DofMap::get_local_constraints(), get_node_cmap(), get_node_map(), get_ns_param_global(), get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), 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::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), 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(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), put_cmap_params(), put_elem_cmap(), put_elem_map(), put_loadbal_param(), put_node_cmap(), put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::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(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_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::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::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), 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(), write_sidesets(), libMesh::ExodusII_IO_Helper::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 576 of file nemesis_io_helper.C.

580 {
581  libmesh_assert(!node_cmap_ids_in.empty());
582  libmesh_assert(!node_cmap_node_cnts_in.empty());
583  libmesh_assert(!elem_cmap_ids_in.empty());
584  libmesh_assert(!elem_cmap_elem_cnts_in.empty());
585 
587  Nemesis::ne_put_cmap_params(ex_id,
588  node_cmap_ids_in.data(),
589  node_cmap_node_cnts_in.data(),
590  elem_cmap_ids_in.data(),
591  elem_cmap_elem_cnts_in.data(),
592  this->processor_id());
593 
594  EX_CHECK_ERR(nemesis_err_flag, "Error writing cmap parameters!");
595 }

References libMesh::ExodusII_IO_Helper::ex_id, libMesh::libmesh_assert(), 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 496 of file nemesis_io_helper.C.

498 {
500  Nemesis::ne_put_eb_info_global(ex_id,
501  global_elem_blk_ids_in.data(),
502  global_elem_blk_cnts_in.data());
503 
504  EX_CHECK_ERR(nemesis_err_flag, "Error writing global element block information!");
505 }

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 662 of file nemesis_io_helper.C.

665 {
666  for (auto i : index_range(elem_cmap_ids))
667  {
669  Nemesis::ne_put_elem_cmap(ex_id,
670  this->elem_cmap_ids[i],
671  elem_cmap_elem_ids_in[i].data(),
672  elem_cmap_side_ids_in[i].data(),
673  elem_cmap_proc_ids_in[i].data(),
674  this->processor_id());
675 
676  EX_CHECK_ERR(nemesis_err_flag, "Error writing elem communication map to file!");
677  }
678 }

References data, 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 683 of file nemesis_io_helper.C.

685 {
687  Nemesis::ne_put_elem_map(ex_id,
688  elem_mapi_in.empty() ? nullptr : elem_mapi_in.data(),
689  elem_mapb_in.empty() ? nullptr : elem_mapb_in.data(),
690  this->processor_id());
691 
692  EX_CHECK_ERR(nemesis_err_flag, "Error writing Nemesis internal and border element maps to file!");
693 }

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 477 of file nemesis_io_helper.C.

482 {
484  Nemesis::ne_put_init_global(ex_id,
485  num_nodes_global_in,
486  num_elems_global_in,
487  num_elem_blks_global_in,
488  num_node_sets_global_in,
489  num_side_sets_global_in);
490 
491  EX_CHECK_ERR(nemesis_err_flag, "Error writing initial global data!");
492 }

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 461 of file nemesis_io_helper.C.

464 {
466  Nemesis::ne_put_init_info(ex_id,
467  num_proc_in,
468  num_proc_in_file_in,
469  const_cast<char *>(ftype_in));
470 
471  EX_CHECK_ERR(nemesis_err_flag, "Error writing initial information!");
472 }

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 550 of file nemesis_io_helper.C.

557 {
559  Nemesis::ne_put_loadbal_param(ex_id,
560  num_internal_nodes_in,
561  num_border_nodes_in,
562  num_external_nodes_in,
563  num_internal_elems_in,
564  num_border_elems_in,
565  num_node_cmaps_in,
566  num_elem_cmaps_in,
567  this->processor_id());
568 
569  EX_CHECK_ERR(nemesis_err_flag, "Error writing loadbal parameters!");
570 }

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

Referenced by initialize().

◆ put_n_coord()

void libMesh::Nemesis_IO_Helper::put_n_coord ( unsigned  start_node_num,
unsigned  num_nodes,
std::vector< Real > &  x_coor,
std::vector< Real > &  y_coor,
std::vector< Real > &  z_coor 
)

Writes the specified number of coordinate values starting at the specified index.

Definition at line 700 of file nemesis_io_helper.C.

705 {
706  if (num_nodes_in)
707  {
709  Nemesis::ne_put_n_coord(ex_id,
710  start_node_num,
711  num_nodes_in,
712  x_coor.empty() ? nullptr : x_coor.data(),
713  y_coor.empty() ? nullptr : y_coor.data(),
714  z_coor.empty() ? nullptr : z_coor.data());
715 
716  EX_CHECK_ERR(nemesis_err_flag, "Error writing coords to file!");
717  }
718 }

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

◆ 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 600 of file nemesis_io_helper.C.

602 {
603 
604  // Print to screen what we are about to print to Nemesis file
605  if (verbose)
606  {
607  for (auto i : index_range(node_cmap_node_ids_in))
608  {
609  libMesh::out << "[" << this->processor_id() << "] put_node_cmap() : nodes communicated to proc "
610  << this->node_cmap_ids[i]
611  << " = ";
612  for (const auto & node_id : node_cmap_node_ids_in[i])
613  libMesh::out << node_id << " ";
614  libMesh::out << std::endl;
615  }
616 
617  for (auto i : index_range(node_cmap_node_ids_in))
618  {
619  libMesh::out << "[" << this->processor_id() << "] put_node_cmap() : processor IDs = ";
620  for (const auto & proc_id : node_cmap_proc_ids_in[i])
621  libMesh::out << proc_id << " ";
622  libMesh::out << std::endl;
623  }
624  }
625 
626  for (auto i : index_range(node_cmap_node_ids_in))
627  {
628  int * node_ids_ptr = node_cmap_node_ids_in[i].empty() ?
629  nullptr : node_cmap_node_ids_in[i].data();
630  int * proc_ids_ptr = node_cmap_proc_ids_in[i].empty() ?
631  nullptr : node_cmap_proc_ids_in[i].data();
632 
634  Nemesis::ne_put_node_cmap(ex_id, this->node_cmap_ids[i],
635  node_ids_ptr, proc_ids_ptr,
636  this->processor_id());
637 
638  EX_CHECK_ERR(nemesis_err_flag, "Error writing node communication map to file!");
639  }
640 }

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 645 of file nemesis_io_helper.C.

648 {
650  Nemesis::ne_put_node_map(ex_id,
651  node_mapi_in.empty() ? nullptr : node_mapi_in.data(),
652  node_mapb_in.empty() ? nullptr : node_mapb_in.data(),
653  node_mape_in.empty() ? nullptr : node_mape_in.data(),
654  this->processor_id());
655 
656  EX_CHECK_ERR(nemesis_err_flag, "Error writing Nemesis internal and border node maps to file!");
657 }

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 510 of file nemesis_io_helper.C.

513 {
514  // Only add nodesets if there are some
515  if (global_nodeset_ids.size())
516  {
518  Nemesis::ne_put_ns_param_global(ex_id,
519  global_nodeset_ids_in.data(),
520  num_global_node_counts_in.data(),
521  num_global_node_df_counts_in.data());
522  }
523 
524  EX_CHECK_ERR(nemesis_err_flag, "Error writing global nodeset parameters!");
525 }

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 530 of file nemesis_io_helper.C.

533 {
534  // Only add sidesets if there are some
535  if (global_sideset_ids.size())
536  {
538  Nemesis::ne_put_ss_param_global(ex_id,
539  global_sideset_ids_in.data(),
540  num_global_side_counts_in.data(),
541  num_global_side_df_counts_in.data());
542  }
543 
544  EX_CHECK_ERR(nemesis_err_flag, "Error writing global sideset parameters!");
545 }

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 1164 of file exodusII_io_helper.C.

1165 {
1166  // Figure out how many nodesets there are in the file so we can
1167  // properly resize storage as necessary.
1168  num_node_sets =
1169  this->inquire
1170  (exII::EX_INQ_NODE_SETS,
1171  "Error retrieving number of node sets");
1172 
1173  // Figure out how many nodes there are in all the nodesets.
1174  int total_nodes_in_all_sets =
1175  this->inquire
1176  (exII::EX_INQ_NS_NODE_LEN,
1177  "Error retrieving number of nodes in all node sets.");
1178 
1179  // Figure out how many distribution factors there are in all the nodesets.
1180  int total_df_in_all_sets =
1181  this->inquire
1182  (exII::EX_INQ_NS_DF_LEN,
1183  "Error retrieving number of distribution factors in all node sets.");
1184 
1185  // If there are no nodesets, there's nothing to read in.
1186  if (num_node_sets == 0)
1187  return;
1188 
1189  // Allocate space to read all the nodeset data.
1190  // Use existing class members where possible to avoid shadowing
1191  nodeset_ids.clear(); nodeset_ids.resize(num_node_sets);
1196  node_sets_node_list.clear(); node_sets_node_list.resize(total_nodes_in_all_sets);
1197  node_sets_dist_fact.clear(); node_sets_dist_fact.resize(total_df_in_all_sets);
1198 
1199  ex_err = exII::ex_get_concat_node_sets
1200  (ex_id,
1201  nodeset_ids.data(),
1202  num_nodes_per_set.data(),
1203  num_node_df_per_set.data(),
1204  node_sets_node_index.data(),
1205  node_sets_dist_index.data(),
1206  node_sets_node_list.data(),
1207  total_df_in_all_sets ?
1208  MappedInputVector(node_sets_dist_fact, _single_precision).data() : nullptr);
1209 
1210  EX_CHECK_ERR(ex_err, "Error reading concatenated nodesets");
1211 
1212  // Read the nodeset names from file!
1213  char name_buffer[MAX_STR_LENGTH+1];
1214  for (int i=0; i<num_node_sets; ++i)
1215  {
1216  ex_err = exII::ex_get_name
1217  (ex_id,
1218  exII::EX_NODE_SET,
1219  nodeset_ids[i],
1220  name_buffer);
1221  EX_CHECK_ERR(ex_err, "Error getting node set name.");
1222  id_to_ns_names[nodeset_ids[i]] = name_buffer;
1223  }
1224 }

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::inquire(), 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.

◆ 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 692 of file exodusII_io_helper.C.

693 {
694  if (num_elem_blk)
695  {
696  // Read all element block IDs.
697  block_ids.resize(num_elem_blk);
698  ex_err = exII::ex_get_ids(ex_id,
699  exII::EX_ELEM_BLOCK,
700  block_ids.data());
701 
702  EX_CHECK_ERR(ex_err, "Error getting block IDs.");
703  message("All block IDs retrieved successfully.");
704 
705  char name_buffer[MAX_STR_LENGTH+1];
706  for (int i=0; i<num_elem_blk; ++i)
707  {
708  ex_err = exII::ex_get_name(ex_id, exII::EX_ELEM_BLOCK,
709  block_ids[i], name_buffer);
710  EX_CHECK_ERR(ex_err, "Error getting block name.");
711  id_to_block_names[block_ids[i]] = name_buffer;
712  }
713  message("All block names retrieved successfully.");
714  }
715 
716  if (num_edge_blk)
717  {
718  // Read all edge block IDs.
720  ex_err = exII::ex_get_ids(ex_id,
721  exII::EX_EDGE_BLOCK,
722  edge_block_ids.data());
723 
724  EX_CHECK_ERR(ex_err, "Error getting edge block IDs.");
725  message("All edge block IDs retrieved successfully.");
726 
727  // Read in edge block names
728  char name_buffer[MAX_STR_LENGTH+1];
729  for (int i=0; i<num_edge_blk; ++i)
730  {
731  ex_err = exII::ex_get_name(ex_id, exII::EX_EDGE_BLOCK,
732  edge_block_ids[i], name_buffer);
733  EX_CHECK_ERR(ex_err, "Error getting block name.");
734  id_to_edge_block_names[edge_block_ids[i]] = name_buffer;
735  }
736  message("All edge block names retrieved successfully.");
737  }
738 }

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 852 of file exodusII_io_helper.C.

853 {
854  // Check for quick return if there are no edge blocks.
855  if (num_edge_blk == 0)
856  return;
857 
858  // Build data structure that we can quickly search for edges
859  // and then add required BoundaryInfo information. This is a
860  // map from edge->key() to a list of (elem_id, edge_id) pairs
861  // for the Edge in question. Since edge->key() is edge orientation
862  // invariant, this map does not distinguish different orientations
863  // of the same Edge.
864  typedef std::pair<dof_id_type, unsigned int> ElemEdgePair;
865  std::unordered_map<dof_id_type, std::vector<ElemEdgePair>> edge_map;
866  for (const auto & elem : mesh.element_ptr_range())
867  for (auto e : elem->edge_index_range())
868  {
869  // TODO: Make various Elem::compute_key() functions
870  // unprotected, this would allow us to avoid calling
871  // build_edge_ptr() repeatedly in case that turns out to be
872  // a bottleneck.
873  std::unique_ptr<Elem> edge = elem->build_edge_ptr(e);
874  dof_id_type edge_key = edge->key();
875 
876  // Creates vector if not already there
877  auto & vec = edge_map[edge_key];
878  vec.push_back(std::make_pair(elem->id(), e));
879  }
880 
881  // Get reference to the mesh's BoundaryInfo object, as we will be
882  // adding edges to this below.
883  BoundaryInfo & bi = mesh.get_boundary_info();
884 
885  for (const auto & edge_block_id : edge_block_ids)
886  {
887  // exII::ex_get_block() output parameters. Unlike the other
888  // "extended" APIs, exII::ex_get_block() does not use a
889  // parameter struct.
890  int num_edge_this_blk = 0;
891  int num_nodes_per_edge = 0;
892  int num_edges_per_edge = 0;
893  int num_faces_per_edge = 0;
894  int num_attr_per_edge = 0;
895  ex_err = exII::ex_get_block(ex_id,
896  exII::EX_EDGE_BLOCK,
897  edge_block_id,
898  elem_type.data(),
899  &num_edge_this_blk,
900  &num_nodes_per_edge,
901  &num_edges_per_edge, // 0 or -1 for edge blocks
902  &num_faces_per_edge, // 0 or -1 for edge blocks
903  &num_attr_per_edge);
904 
905  EX_CHECK_ERR(ex_err, "Error getting edge block info.");
906  message("Info retrieved successfully for block: ", edge_block_id);
907 
908  // Read in the connectivity of the edges of this block,
909  // watching out for the case where we actually have no
910  // elements in this block (possible with parallel files)
911  connect.resize(num_nodes_per_edge * num_edge_this_blk);
912 
913  if (!connect.empty())
914  {
915  ex_err = exII::ex_get_conn(ex_id,
916  exII::EX_EDGE_BLOCK,
917  edge_block_id,
918  connect.data(), // node_conn
919  nullptr, // elem_edge_conn (unused)
920  nullptr); // elem_face_conn (unused)
921 
922  EX_CHECK_ERR(ex_err, "Error reading block connectivity.");
923  message("Connectivity retrieved successfully for block: ", edge_block_id);
924 
925  // All edge types have an identity mapping from the corresponding
926  // Exodus type, so we don't need to bother with mapping ids, but
927  // we do need to know what kind of elements to build.
928  const auto & conv = get_conversion(std::string(elem_type.data()));
929 
930  // Loop over indices in connectivity array, build edge elements,
931  // look them up in the edge_map.
932  for (unsigned int i=0, sz=connect.size(); i<sz; i+=num_nodes_per_edge)
933  {
934  auto edge = Elem::build(conv.libmesh_elem_type());
935  for (int n=0; n<num_nodes_per_edge; ++n)
936  {
937  int exodus_node_id = connect[i+n];
938  int exodus_node_id_zero_based = exodus_node_id - 1;
939  int libmesh_node_id = node_num_map[exodus_node_id_zero_based] - 1;
940 
941  edge->set_node(n) = mesh.node_ptr(libmesh_node_id);
942  }
943 
944  // Compute key for the edge Elem we just built.
945  dof_id_type edge_key = edge->key();
946 
947  // If this key is not found in the edge_map, which is
948  // supposed to include every edge in the Mesh, then we
949  // need to throw an error.
950  auto & elem_edge_pair_vec =
951  libmesh_map_find(edge_map, edge_key);
952 
953  for (const auto & elem_edge_pair : elem_edge_pair_vec)
954  {
955  // We only want to match edges which have the same
956  // orientation (node ordering) to the one in the
957  // Exodus file, otherwise we ignore this elem_edge_pair.
958  //
959  // Note: this also handles the situation where two
960  // edges have the same key (hash collision) as then
961  // this check avoids a false positive.
962 
963  // Build edge indicated by elem_edge_pair
964  auto candidate_edge =
965  mesh.elem_ptr(elem_edge_pair.first)->
966  build_edge_ptr(elem_edge_pair.second);
967 
968  // Determine whether this candidate edge is a "real" match,
969  // i.e. also has the same orientation.
970  bool is_match = true;
971  for (int n=0; n<num_nodes_per_edge; ++n)
972  if (candidate_edge->node_id(n) != edge->node_id(n))
973  {
974  is_match = false;
975  break;
976  }
977 
978  if (is_match)
979  {
980  // Add this (elem, edge, id) combo to the BoundaryInfo object.
981  bi.add_edge(elem_edge_pair.first,
982  elem_edge_pair.second,
983  edge_block_id);
984  }
985  } // end loop over elem_edge_pairs
986  } // end loop over connectivity array
987 
988  // Set edgeset name in the BoundaryInfo object.
989  bi.edgeset_name(edge_block_id) = id_to_edge_block_names[edge_block_id];
990  } // end if !connect.empty()
991  } // end for edge_block_id : edge_block_ids
992 }

References libMesh::BoundaryInfo::add_edge(), libMesh::Elem::build(), libMesh::ExodusII_IO_Helper::connect, libMesh::ExodusII_IO_Helper::edge_block_ids, libMesh::BoundaryInfo::edgeset_name(), 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::ExodusII_IO_Helper::id_to_edge_block_names, mesh, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::node_num_map, 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 797 of file exodusII_io_helper.C.

798 {
799  libmesh_assert_less (block, block_ids.size());
800 
801  // Unlike the other "extended" APIs, this one does not use a parameter struct.
802  int num_edges_per_elem = 0;
803  int num_faces_per_elem = 0;
804  ex_err = exII::ex_get_block(ex_id,
805  exII::EX_ELEM_BLOCK,
806  block_ids[block],
807  elem_type.data(),
810  &num_edges_per_elem, // 0 or -1 if no "extended" block info
811  &num_faces_per_elem, // 0 or -1 if no "extended" block info
812  &num_attr);
813 
814  EX_CHECK_ERR(ex_err, "Error getting block info.");
815  message("Info retrieved successfully for block: ", block);
816 
817  // Warn that we don't currently support reading blocks with extended info.
818  // Note: the docs say -1 will be returned for this but I found that it was
819  // actually 0, so not sure which it will be in general.
820  if (!(num_edges_per_elem == 0) && !(num_edges_per_elem == -1))
821  libmesh_warning("Exodus files with extended edge connectivity not currently supported.");
822  if (!(num_faces_per_elem == 0) && !(num_faces_per_elem == -1))
823  libmesh_warning("Exodus files with extended face connectivity not currently supported.");
824 
825  if (verbose)
826  libMesh::out << "Read a block of " << num_elem_this_blk
827  << " " << elem_type.data() << "(s)"
828  << " having " << num_nodes_per_elem
829  << " nodes per element." << std::endl;
830 
831  // Read in the connectivity of the elements of this block,
832  // watching out for the case where we actually have no
833  // elements in this block (possible with parallel files)
835 
836  if (!connect.empty())
837  {
838  ex_err = exII::ex_get_conn(ex_id,
839  exII::EX_ELEM_BLOCK,
840  block_ids[block],
841  connect.data(), // node_conn
842  nullptr, // elem_edge_conn (unused)
843  nullptr); // elem_face_conn (unused)
844 
845  EX_CHECK_ERR(ex_err, "Error reading block connectivity.");
846  message("Connectivity retrieved successfully for block: ", block);
847  }
848 }

References libMesh::ExodusII_IO_Helper::block_ids, libMesh::ExodusII_IO_Helper::connect, libMesh::ExodusII_IO_Helper::elem_type, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_attr, libMesh::ExodusII_IO_Helper::num_elem_this_blk, libMesh::ExodusII_IO_Helper::num_nodes_per_elem, libMesh::out, 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 996 of file exodusII_io_helper.C.

997 {
998  elem_num_map.resize(num_elem);
999 
1000  // Note: we cannot use the exII::ex_get_num_map() here because it
1001  // (apparently) does not behave like ex_get_elem_num_map() when
1002  // there is no elem number map in the file: it throws an error
1003  // instead of returning a default identity array (1,2,3,...).
1004  ex_err = exII::ex_get_elem_num_map
1005  (ex_id, elem_num_map.empty() ? nullptr : elem_num_map.data());
1006 
1007  EX_CHECK_ERR(ex_err, "Error retrieving element number map.");
1008  message("Element numbering map retrieved successfully.");
1009 
1010 
1011  if (verbose)
1012  {
1013  libMesh::out << "[" << this->processor_id() << "] elem_num_map[i] = ";
1014  for (unsigned int i=0; i<static_cast<unsigned int>(std::min(10, num_elem-1)); ++i)
1015  libMesh::out << elem_num_map[i] << ", ";
1016  libMesh::out << "... " << elem_num_map.back() << std::endl;
1017  }
1018 }

References 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 1476 of file exodusII_io_helper.C.

1479 {
1480  this->read_var_names(ELEMENTAL);
1481 
1482  // See if we can find the variable we are looking for
1483  unsigned int var_index = 0;
1484  bool found = false;
1485 
1486  // Do a linear search for elem_var_name in elemental_var_names
1487  for (; var_index != elem_var_names.size(); ++var_index)
1488  if (elem_var_names[var_index] == elemental_var_name)
1489  {
1490  found = true;
1491  break;
1492  }
1493 
1494  if (!found)
1495  {
1496  libMesh::err << "Available variables: " << std::endl;
1497  for (const auto & var_name : elem_var_names)
1498  libMesh::err << var_name << std::endl;
1499 
1500  libmesh_error_msg("Unable to locate variable named: " << elemental_var_name);
1501  }
1502 
1503  // Sequential index which we can use to look up the element ID in the elem_num_map.
1504  unsigned ex_el_num = 0;
1505 
1506  // Element variable truth table
1507  std::vector<int> var_table(block_ids.size() * elem_var_names.size());
1508  exII::ex_get_var_tab(ex_id, "e", block_ids.size(), elem_var_names.size(), var_table.data());
1509 
1510  for (unsigned i=0; i<static_cast<unsigned>(num_elem_blk); i++)
1511  {
1512  ex_err = exII::ex_get_elem_block(ex_id,
1513  block_ids[i],
1514  nullptr,
1516  nullptr,
1517  nullptr);
1518  EX_CHECK_ERR(ex_err, "Error getting number of elements in block.");
1519 
1520  // If the current variable isn't active on this subdomain, advance
1521  // the index by the number of elements on this block and go to the
1522  // next loop iteration.
1523  if (!var_table[elem_var_names.size()*i + var_index])
1524  {
1525  ex_el_num += num_elem_this_blk;
1526  continue;
1527  }
1528 
1529  std::vector<Real> block_elem_var_values(num_elem_this_blk);
1530 
1531  ex_err = exII::ex_get_elem_var
1532  (ex_id,
1533  time_step,
1534  var_index+1,
1535  block_ids[i],
1537  MappedInputVector(block_elem_var_values, _single_precision).data());
1538  EX_CHECK_ERR(ex_err, "Error getting elemental values.");
1539 
1540  for (unsigned j=0; j<static_cast<unsigned>(num_elem_this_blk); j++)
1541  {
1542  // Use the elem_num_map to obtain the ID of this element in the Exodus file,
1543  // and remember to subtract 1 since libmesh is zero-based and Exodus is 1-based.
1544  unsigned mapped_elem_id = this->elem_num_map[ex_el_num] - 1;
1545 
1546  // Store the elemental value in the map.
1547  elem_var_value_map[mapped_elem_id] = block_elem_var_values[j];
1548 
1549  // Go to the next sequential element ID.
1550  ex_el_num++;
1551  }
1552  }
1553 }

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::block_ids, data, libMesh::ExodusII_IO_Helper::elem_num_map, 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::num_elem_blk, libMesh::ExodusII_IO_Helper::num_elem_this_blk, and libMesh::ExodusII_IO_Helper::read_var_names().

◆ 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 3151 of file exodusII_io_helper.C.

3152 {
3153  if ((_run_only_on_proc0) && (this->processor_id() != 0))
3154  return;
3155 
3156  values.clear();
3157  values.resize(num_global_vars);
3158  ex_err = exII::ex_get_glob_vars
3159  (ex_id, timestep, num_global_vars,
3160  MappedInputVector(values, _single_precision).data());
3161 
3162  EX_CHECK_ERR(ex_err, "Error reading global values.");
3163 }

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, data, 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()

void libMesh::ExodusII_IO_Helper::read_header ( )
inherited

Reads an ExodusII mesh file header.

Definition at line 532 of file exodusII_io_helper.C.

533 {
534  // Read init params using newer API that reads into a struct. For
535  // backwards compatibility, assign local member values from struct
536  // afterwards. Note: using the new API allows us to automatically
537  // read edge and face block/set information if it's present in the
538  // file.
539  exII::ex_init_params params = {};
540  ex_err = exII::ex_get_init_ext(ex_id, &params);
541  EX_CHECK_ERR(ex_err, "Error retrieving header info.");
542 
543  // "title" has MAX_LINE_LENGTH+1 characters, but the last one is reserved
544  // for null termination so we only copy MAX_LINE_LENGTH chars.
545  title.assign(params.title, params.title + MAX_LINE_LENGTH);
546  num_dim = params.num_dim;
547  num_nodes = params.num_nodes;
548  num_elem = params.num_elem;
549  num_elem_blk = params.num_elem_blk;
550  num_node_sets = params.num_node_sets;
551  num_side_sets = params.num_side_sets;
552  num_edge_blk = params.num_edge_blk;
553  num_edge = params.num_edge;
554 
555  this->read_num_time_steps();
556 
557  ex_err = exII::ex_get_var_param(ex_id, "n", &num_nodal_vars);
558  EX_CHECK_ERR(ex_err, "Error reading number of nodal variables.");
559 
560  ex_err = exII::ex_get_var_param(ex_id, "e", &num_elem_vars);
561  EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
562 
563  ex_err = exII::ex_get_var_param(ex_id, "g", &num_global_vars);
564  EX_CHECK_ERR(ex_err, "Error reading number of global variables.");
565 
566  ex_err = exII::ex_get_var_param(ex_id, "s", &num_sideset_vars);
567  EX_CHECK_ERR(ex_err, "Error reading number of sideset variables.");
568 
569  message("Exodus header info retrieved successfully.");
570 }

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::num_dim, libMesh::ExodusII_IO_Helper::num_edge, libMesh::ExodusII_IO_Helper::num_edge_blk, libMesh::ExodusII_IO_Helper::num_elem, libMesh::ExodusII_IO_Helper::num_elem_blk, libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ExodusII_IO_Helper::num_nodal_vars, libMesh::ExodusII_IO_Helper::num_node_sets, libMesh::ExodusII_IO_Helper::num_nodes, libMesh::ExodusII_IO_Helper::num_side_sets, libMesh::ExodusII_IO_Helper::num_sideset_vars, libMesh::ExodusII_IO_Helper::read_num_time_steps(), and libMesh::ExodusII_IO_Helper::title.

◆ 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 1291 of file exodusII_io_helper.C.

1292 {
1293  // Read the nodal variable names from file, so we can see if we have the one we're looking for
1294  this->read_var_names(NODAL);
1295 
1296  // See if we can find the variable we are looking for
1297  unsigned int var_index = 0;
1298  bool found = false;
1299 
1300  // Do a linear search for nodal_var_name in nodal_var_names
1301  for (; var_index<nodal_var_names.size(); ++var_index)
1302  {
1303  found = (nodal_var_names[var_index] == nodal_var_name);
1304  if (found)
1305  break;
1306  }
1307 
1308  if (!found)
1309  {
1310  libMesh::err << "Available variables: " << std::endl;
1311  for (const auto & var_name : nodal_var_names)
1312  libMesh::err << var_name << std::endl;
1313 
1314  libmesh_error_msg("Unable to locate variable named: " << nodal_var_name);
1315  }
1316 
1317  // Allocate enough space to store the nodal variable values
1318  nodal_var_values.resize(num_nodes);
1319 
1320  std::vector<Real> unmapped_nodal_var_values(num_nodes);
1321 
1322  // Call the Exodus API to read the nodal variable values
1323  ex_err = exII::ex_get_nodal_var
1324  (ex_id,
1325  time_step,
1326  var_index+1,
1327  num_nodes,
1328  MappedInputVector(unmapped_nodal_var_values, _single_precision).data());
1329  EX_CHECK_ERR(ex_err, "Error reading nodal variable values!");
1330 
1331  for (unsigned i=0; i<static_cast<unsigned>(num_nodes); i++)
1332  {
1333  // Use the node_num_map to obtain the ID of this node in the Exodus file,
1334  // and remember to subtract 1 since libmesh is zero-based and Exodus is 1-based.
1335  unsigned mapped_node_id = this->node_num_map[i] - 1;
1336 
1337  // Store the nodal value in the map.
1338  nodal_var_values[mapped_node_id] = unmapped_nodal_var_values[i];
1339  }
1340 }

References libMesh::ExodusII_IO_Helper::_single_precision, data, libMesh::err, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::nodal_var_names, libMesh::ExodusII_IO_Helper::nodal_var_values, libMesh::ExodusII_IO_Helper::node_num_map, 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 660 of file exodusII_io_helper.C.

661 {
662  node_num_map.resize(num_nodes);
663 
664  // Note: we cannot use the exII::ex_get_num_map() here because it
665  // (apparently) does not behave like ex_get_node_num_map() when
666  // there is no node number map in the file: it throws an error
667  // instead of returning a default identity array (1,2,3,...).
668  ex_err = exII::ex_get_node_num_map
669  (ex_id, node_num_map.empty() ? nullptr : node_num_map.data());
670 
671  EX_CHECK_ERR(ex_err, "Error retrieving nodal number map.");
672  message("Nodal numbering map retrieved successfully.");
673 
674  if (verbose)
675  {
676  libMesh::out << "[" << this->processor_id() << "] node_num_map[i] = ";
677  for (unsigned int i=0; i<static_cast<unsigned int>(std::min(10, num_nodes-1)); ++i)
678  libMesh::out << node_num_map[i] << ", ";
679  libMesh::out << "... " << node_num_map.back() << std::endl;
680  }
681 }

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 639 of file exodusII_io_helper.C.

640 {
641  x.resize(num_nodes);
642  y.resize(num_nodes);
643  z.resize(num_nodes);
644 
645  if (num_nodes)
646  {
647  ex_err = exII::ex_get_coord
648  (ex_id,
649  MappedInputVector(x, _single_precision).data(),
650  MappedInputVector(y, _single_precision).data(),
651  MappedInputVector(z, _single_precision).data());
652 
653  EX_CHECK_ERR(ex_err, "Error retrieving nodal data.");
654  message("Nodal data retrieved successfully.");
655  }
656 }

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

◆ read_nodeset()

void libMesh::ExodusII_IO_Helper::read_nodeset ( int  id)
inherited

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

Definition at line 1131 of file exodusII_io_helper.C.

1132 {
1133  libmesh_assert_less (id, nodeset_ids.size());
1134  libmesh_assert_less (id, num_nodes_per_set.size());
1135  libmesh_assert_less (id, num_node_df_per_set.size());
1136 
1137  ex_err = exII::ex_get_set_param(ex_id,
1138  exII::EX_NODE_SET,
1139  nodeset_ids[id],
1140  &num_nodes_per_set[id],
1141  &num_node_df_per_set[id]);
1142  EX_CHECK_ERR(ex_err, "Error retrieving nodeset parameters.");
1143  message("Parameters retrieved successfully for nodeset: ", id);
1144 
1145  node_list.resize(num_nodes_per_set[id]);
1146 
1147  // Don't call ex_get_set unless there are actually nodes there to get.
1148  // Exodus prints an annoying warning message in DEBUG mode otherwise...
1149  if (num_nodes_per_set[id] > 0)
1150  {
1151  ex_err = exII::ex_get_set(ex_id,
1152  exII::EX_NODE_SET,
1153  nodeset_ids[id],
1154  node_list.data(),
1155  nullptr); // set_extra_list, ignored for node sets
1156 
1157  EX_CHECK_ERR(ex_err, "Error retrieving nodeset data.");
1158  message("Data retrieved successfully for nodeset: ", id);
1159  }
1160 }

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::message(), libMesh::ExodusII_IO_Helper::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_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 1057 of file exodusII_io_helper.C.

1058 {
1059  nodeset_ids.resize(num_node_sets);
1060  if (num_node_sets > 0)
1061  {
1062  ex_err = exII::ex_get_ids(ex_id,
1063  exII::EX_NODE_SET,
1064  nodeset_ids.data());
1065  EX_CHECK_ERR(ex_err, "Error retrieving nodeset information.");
1066  message("All nodeset information retrieved successfully.");
1067 
1068  // Resize appropriate data structures -- only do this once outnode the loop
1071  }
1072 
1073  char name_buffer[MAX_STR_LENGTH+1];
1074  for (int i=0; i<num_node_sets; ++i)
1075  {
1076  ex_err = exII::ex_get_name(ex_id, exII::EX_NODE_SET,
1077  nodeset_ids[i], name_buffer);
1078  EX_CHECK_ERR(ex_err, "Error getting node set name.");
1079  id_to_ns_names[nodeset_ids[i]] = name_buffer;
1080  }
1081  message("All node set names retrieved successfully.");
1082 }

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 1283 of file exodusII_io_helper.C.

1284 {
1285  num_time_steps =
1286  this->inquire(exII::EX_INQ_TIME, "Error retrieving number of time steps");
1287 }

References libMesh::ExodusII_IO_Helper::inquire(), and libMesh::ExodusII_IO_Helper::num_time_steps.

Referenced by libMesh::ExodusII_IO_Helper::read_header(), 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 575 of file exodusII_io_helper.C.

576 {
577  // The QA records are four MAX_STR_LENGTH-byte character strings.
578  int num_qa_rec =
579  this->inquire(exII::EX_INQ_QA, "Error retrieving number of QA records");
580 
581  if (verbose)
582  libMesh::out << "Found "
583  << num_qa_rec
584  << " QA record(s) in the Exodus file."
585  << std::endl;
586 
587  if (num_qa_rec > 0)
588  {
589  // How to dynamically allocate an array of fixed-size char * arrays in C++.
590  // http://stackoverflow.com/questions/8529359/creating-a-dynamic-sized-array-of-fixed-sized-int-arrays-in-c
591  typedef char * inner_array_t[4];
592  inner_array_t * qa_record = new inner_array_t[num_qa_rec];
593 
594  for (int i=0; i<num_qa_rec; i++)
595  for (int j=0; j<4; j++)
596  qa_record[i][j] = new char[MAX_STR_LENGTH+1];
597 
598  ex_err = exII::ex_get_qa (ex_id, qa_record);
599  EX_CHECK_ERR(ex_err, "Error reading the QA records.");
600 
601  // Print the QA records
602  if (verbose)
603  {
604  for (int i=0; i<num_qa_rec; i++)
605  {
606  libMesh::out << "QA Record: " << i << std::endl;
607  for (int j=0; j<4; j++)
608  libMesh::out << qa_record[i][j] << std::endl;
609  }
610  }
611 
612 
613  // Clean up dynamically-allocated memory
614  for (int i=0; i<num_qa_rec; i++)
615  for (int j=0; j<4; j++)
616  delete [] qa_record[i][j];
617 
618  delete [] qa_record;
619  }
620 }

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::inquire(), 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 1086 of file exodusII_io_helper.C.

1087 {
1088  libmesh_assert_less (id, ss_ids.size());
1089  libmesh_assert_less (id, num_sides_per_set.size());
1090  libmesh_assert_less (id, num_df_per_set.size());
1091  libmesh_assert_less_equal (offset, elem_list.size());
1092  libmesh_assert_less_equal (offset, side_list.size());
1093 
1094  ex_err = exII::ex_get_set_param(ex_id,
1095  exII::EX_SIDE_SET,
1096  ss_ids[id],
1097  &num_sides_per_set[id],
1098  &num_df_per_set[id]);
1099  EX_CHECK_ERR(ex_err, "Error retrieving sideset parameters.");
1100  message("Parameters retrieved successfully for sideset: ", id);
1101 
1102 
1103  // It's OK for offset==elem_list.size() as long as num_sides_per_set[id]==0
1104  // because in that case we don't actually read anything...
1105 #ifdef DEBUG
1106  if (static_cast<unsigned int>(offset) == elem_list.size() ||
1107  static_cast<unsigned int>(offset) == side_list.size() )
1108  libmesh_assert_equal_to (num_sides_per_set[id], 0);
1109 #endif
1110 
1111 
1112  // Don't call ex_get_set unless there are actually sides there to get.
1113  // Exodus prints an annoying warning in DEBUG mode otherwise...
1114  if (num_sides_per_set[id] > 0)
1115  {
1116  ex_err = exII::ex_get_set(ex_id,
1117  exII::EX_SIDE_SET,
1118  ss_ids[id],
1119  &elem_list[offset],
1120  &side_list[offset]);
1121  EX_CHECK_ERR(ex_err, "Error retrieving sideset data.");
1122  message("Data retrieved successfully for sideset: ", id);
1123 
1124  for (int i=0; i<num_sides_per_set[id]; i++)
1125  id_list[i+offset] = ss_ids[id];
1126  }
1127 }

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 2736 of file exodusII_io_helper.C.

2741 {
2742  // This reads the sideset variable names into the local
2743  // sideset_var_names data structure.
2744  this->read_var_names(SIDESET);
2745 
2746  if (num_sideset_vars)
2747  {
2748  // Read the sideset data truth table
2749  std::vector<int> sset_var_tab(num_side_sets * num_sideset_vars);
2750  ex_err = exII::ex_get_sset_var_tab
2751  (ex_id,
2752  num_side_sets,
2754  sset_var_tab.data());
2755  EX_CHECK_ERR(ex_err, "Error reading sideset variable truth table.");
2756 
2757  // Set up/allocate space in incoming data structures.
2758  var_names = sideset_var_names;
2759  side_ids.resize(num_sideset_vars);
2760  bc_vals.resize(num_sideset_vars);
2761 
2762  // Read the sideset data.
2763  //
2764  // Note: we assume that read_sideset() has already been called
2765  // for each sideset, so the required values in elem_list and
2766  // side_list are already present.
2767  //
2768  // TODO: As a future optimization, we could read only the values
2769  // requested by the user by looking at the input parameter
2770  // var_names and checking whether it already has entries in
2771  // it. We could do the same thing with the input side_ids
2772  // container and only read values for requested sidesets.
2773  int offset=0;
2774  for (int ss=0; ss<num_side_sets; ++ss)
2775  {
2776  offset += (ss > 0 ? num_sides_per_set[ss-1] : 0);
2777  for (int var=0; var<num_sideset_vars; ++var)
2778  {
2779  int is_present = sset_var_tab[num_sideset_vars*ss + var];
2780 
2781  if (is_present)
2782  {
2783  // Record the fact that this variable is defined on this sideset.
2784  side_ids[var].insert(ss_ids[ss]);
2785 
2786  // Note: the assumption here is that a previous call
2787  // to this->read_sideset_info() has already set the
2788  // values of num_sides_per_set, so we just use those values here.
2789  std::vector<Real> sset_var_vals(num_sides_per_set[ss]);
2790  ex_err = exII::ex_get_sset_var
2791  (ex_id,
2792  timestep,
2793  var + 1, // 1-based sideset variable index!
2794  ss_ids[ss],
2795  num_sides_per_set[ss],
2796  MappedInputVector(sset_var_vals, _single_precision).data());
2797  EX_CHECK_ERR(ex_err, "Error reading sideset variable.");
2798 
2799  // Debugging:
2800  // libMesh::out << "Variable " << sideset_var_names[var]
2801  // << " is defined on side set " << ss_ids[ss]
2802  // << " and has values: " << std::endl;
2803  // for (int i=0; i<num_sides_per_set[ss]; ++i)
2804  // libMesh::out << sset_var_vals[i] << " ";
2805  // libMesh::out << std::endl;
2806 
2807  for (int i=0; i<num_sides_per_set[ss]; ++i)
2808  {
2809  dof_id_type exodus_elem_id = elem_list[i + offset];
2810  unsigned int exodus_side_id = side_list[i + offset];
2811 
2812  // FIXME: We should use exodus_elem_num_to_libmesh for this,
2813  // but it apparently is never set up, so just
2814  // subtract 1 from the Exodus elem id.
2815  dof_id_type converted_elem_id = exodus_elem_id - 1;
2816 
2817  // Map Exodus side id to libmesh side id.
2818  // Map from Exodus side ids to libmesh side ids.
2819  const auto & conv = get_conversion(mesh.elem_ptr(converted_elem_id)->type());
2820 
2821  // Map from Exodus side id to libmesh side id.
2822  // Note: the mapping is defined on 0-based indices, so subtract
2823  // 1 before doing the mapping.
2824  unsigned int converted_side_id = conv.get_side_map(exodus_side_id - 1);
2825 
2826  // Debugging:
2827  // libMesh::out << "exodus_elem_id = " << exodus_elem_id
2828  // << "\n"
2829  // << "converted_elem_id = " << converted_elem_id
2830  // << "\n\n"
2831  // << "exodus_side_id = " << exodus_side_id
2832  // << "\n"
2833  // << "converted_side_id = " << converted_side_id
2834  // << std::endl;
2835 
2836  // Make a BCTuple key from the converted information.
2837  BoundaryInfo::BCTuple key = std::make_tuple
2838  (converted_elem_id,
2839  converted_side_id,
2840  ss_ids[ss]);
2841 
2842  // Store (elem, side, b_id) tuples in bc_vals[var]
2843  bc_vals[var].insert(std::make_pair(key, sset_var_vals[i]));
2844  } // end for (i)
2845  } // end if (present)
2846  } // end for (var)
2847  } // end for (ss)
2848  } // end if (num_sideset_vars)
2849 }

References libMesh::ExodusII_IO_Helper::_single_precision, data, libMesh::ExodusII_IO_Helper::elem_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::ExodusII_IO_Helper::Conversion::get_side_map(), 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, and libMesh::ExodusII_IO_Helper::ss_ids.

◆ 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 1022 of file exodusII_io_helper.C.

1023 {
1024  ss_ids.resize(num_side_sets);
1025  if (num_side_sets > 0)
1026  {
1027  ex_err = exII::ex_get_ids(ex_id,
1028  exII::EX_SIDE_SET,
1029  ss_ids.data());
1030  EX_CHECK_ERR(ex_err, "Error retrieving sideset information.");
1031  message("All sideset information retrieved successfully.");
1032 
1033  // Resize appropriate data structures -- only do this once outside the loop
1035  num_df_per_set.resize(num_side_sets);
1036 
1037  // Inquire about the length of the concatenated side sets element list
1038  num_elem_all_sidesets = inquire(exII::EX_INQ_SS_ELEM_LEN, "Error retrieving length of the concatenated side sets element list!");
1039 
1042  id_list.resize (num_elem_all_sidesets);
1043  }
1044 
1045  char name_buffer[MAX_STR_LENGTH+1];
1046  for (int i=0; i<num_side_sets; ++i)
1047  {
1048  ex_err = exII::ex_get_name(ex_id, exII::EX_SIDE_SET,
1049  ss_ids[i], name_buffer);
1050  EX_CHECK_ERR(ex_err, "Error getting side set name.");
1051  id_to_ss_names[ss_ids[i]] = name_buffer;
1052  }
1053  message("All side set names retrieved successfully.");
1054 }

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::inquire(), 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 1266 of file exodusII_io_helper.C.

1267 {
1268  // Make sure we have an up-to-date count of the number of time steps in the file.
1269  this->read_num_time_steps();
1270 
1271  if (num_time_steps > 0)
1272  {
1273  time_steps.resize(num_time_steps);
1274  ex_err = exII::ex_get_all_times
1275  (ex_id,
1276  MappedInputVector(time_steps, _single_precision).data());
1277  EX_CHECK_ERR(ex_err, "Error reading timesteps!");
1278  }
1279 }

References libMesh::ExodusII_IO_Helper::_single_precision, data, 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

◆ read_var_names_impl()

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

read_var_names() dispatches to this function.

Definition at line 1367 of file exodusII_io_helper.C.

1370 {
1371  // First read and store the number of names we have
1372  ex_err = exII::ex_get_var_param(ex_id, var_type, &count);
1373  EX_CHECK_ERR(ex_err, "Error reading number of variables.");
1374 
1375  // Do nothing if no variables are detected
1376  if (count == 0)
1377  return;
1378 
1379  // Second read the actual names and convert them into a format we can use
1380  NamesData names_table(count, MAX_STR_LENGTH);
1381 
1382  ex_err = exII::ex_get_var_names(ex_id,
1383  var_type,
1384  count,
1385  names_table.get_char_star_star()
1386  );
1387  EX_CHECK_ERR(ex_err, "Error reading variable names!");
1388 
1389  if (verbose)
1390  {
1391  libMesh::out << "Read the variable(s) from the file:" << std::endl;
1392  for (int i=0; i<count; i++)
1393  libMesh::out << names_table.get_char_star(i) << std::endl;
1394  }
1395 
1396  // Allocate enough space for our variable name strings.
1397  result.resize(count);
1398 
1399  // Copy the char buffers into strings.
1400  for (int i=0; i<count; i++)
1401  result[i] = names_table.get_char_star(i); // calls string::op=(const char *)
1402 }

References 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::out, and libMesh::ExodusII_IO_Helper::verbose.

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

◆ 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 3181 of file exodusII_io_helper.C.

3182 {
3183  _coordinate_offset = p;
3184 }

References libMesh::ExodusII_IO_Helper::_coordinate_offset.

◆ 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 3167 of file exodusII_io_helper.C.

3168 {
3170 }

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 3174 of file exodusII_io_helper.C.

3175 {
3177 }

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

◆ 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 2596 of file nemesis_io_helper.C.

2601 {
2602  // For each variable in names,
2603  // For each subdomain in subdomain_map,
2604  // If this (subdomain, variable) combination is active
2605  // Extract our values into local_soln (localize is a collective)
2606  // Write local_soln to file
2607  for (auto v : index_range(var_nums))
2608  {
2609  // Get list of active subdomains for variable v
2610  const auto & active_subdomains = vars_active_subdomains[v];
2611 
2612  for (const int sbd_id_int : global_elem_blk_ids)
2613  {
2614  const subdomain_id_type sbd_id =
2615  cast_int<subdomain_id_type>(sbd_id_int);
2616  auto it = subdomain_map.find(sbd_id);
2617  const std::vector<dof_id_type> empty_vec;
2618  const std::vector<dof_id_type> & elem_ids =
2619  (it == subdomain_map.end()) ? empty_vec : it->second;
2620 
2621  // Possibly skip this (variable, subdomain) combination
2622  if (active_subdomains.empty() || active_subdomains.count(sbd_id))
2623  {
2624  std::vector<numeric_index_type> required_indices;
2625  required_indices.reserve(elem_ids.size());
2626 
2627  const unsigned int sys_num = var_nums[v].first;
2628 
2629  for (const auto & id : elem_ids)
2630  required_indices.push_back
2631  (mesh.elem_ref(id).dof_number
2632  (sys_num, var_nums[v].second, 0));
2633 
2634  std::vector<Number> local_soln;
2635  es.get_system(sys_num).current_local_solution->get
2636  (required_indices, local_soln);
2637 
2638  // It's possible that there's nothing for us to write:
2639  // we may not be responsible for any elements on the
2640  // current subdomain. We did still have to participate
2641  // in the localize() call above, however, since it is a
2642  // collective.
2643  if (local_soln.size())
2644  {
2645  ex_err = exII::ex_put_elem_var(ex_id,
2646  timestep,
2647  static_cast<int>(v+1),
2648  static_cast<int>(sbd_id),
2649  static_cast<int>(local_soln.size()),
2650  local_soln.data());
2651  EX_CHECK_ERR(ex_err, "Error writing element values.");
2652  }
2653  }
2654  }
2655  } // end loop over vars
2656 
2657  ex_err = exII::ex_update(ex_id);
2658  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
2659 }

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::EquationSystems::get_system(), global_elem_blk_ids, libMesh::if(), libMesh::index_range(), mesh, and subdomain_map.

◆ 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 2854 of file exodusII_io_helper.C.

2858 {
2859  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2860  return;
2861 
2862  // Ask the file how many element vars it has, store it in the num_elem_vars variable.
2863  ex_err = exII::ex_get_var_param(ex_id, "e", &num_elem_vars);
2864  EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
2865 
2866  // We will eventually loop over the element blocks (subdomains) and
2867  // write the data one block at a time. Build a data structure that
2868  // maps each subdomain to a list of element ids it contains.
2869  std::map<subdomain_id_type, std::vector<unsigned int>> subdomain_map;
2870  for (const auto & elem : mesh.active_element_ptr_range())
2871  subdomain_map[elem->subdomain_id()].push_back(elem->id());
2872 
2873  // Use mesh.n_elem() to access into the values vector rather than
2874  // the number of elements the Exodus writer thinks the mesh has,
2875  // which may not include inactive elements.
2876  dof_id_type n_elem = mesh.n_elem();
2877 
2878  // Sanity check: we must have an entry in vars_active_subdomains for
2879  // each variable that we are potentially writing out.
2880  libmesh_assert_equal_to
2881  (vars_active_subdomains.size(),
2882  static_cast<unsigned>(num_elem_vars));
2883 
2884  // For each variable, create a 'data' array which holds all the elemental variable
2885  // values *for a given block* on this processor, then write that data vector to file
2886  // before moving onto the next block.
2887  for (unsigned int var_id=0; var_id<static_cast<unsigned>(num_elem_vars); ++var_id)
2888  {
2889  // The size of the subdomain map is the number of blocks.
2890  auto it = subdomain_map.begin();
2891 
2892  // Reference to the set of active subdomains for the current variable.
2893  const auto & active_subdomains
2894  = vars_active_subdomains[var_id];
2895 
2896  for (unsigned int j=0; it!=subdomain_map.end(); ++it, ++j)
2897  {
2898  // Skip any variable/subdomain pairs that are inactive.
2899  // Note that if active_subdomains is empty, it is interpreted
2900  // as being active on *all* subdomains.
2901  if (!(active_subdomains.empty() || active_subdomains.count(it->first)))
2902  continue;
2903 
2904  // Get reference to list of elem ids which are in the
2905  // current subdomain and count, allocate storage to hold
2906  // data that will be written to file.
2907  const auto & elem_nums = it->second;
2908  const unsigned int num_elems_this_block =
2909  cast_int<unsigned int>(elem_nums.size());
2910  std::vector<Real> data(num_elems_this_block);
2911 
2912  // variable-major ordering is:
2913  // (u1, u2, u3, ..., uN), (v1, v2, v3, ..., vN), ...
2914  // where N is the number of elements.
2915  for (unsigned int k=0; k<num_elems_this_block; ++k)
2916  data[k] = values[var_id*n_elem + elem_nums[k]];
2917 
2918  ex_err = exII::ex_put_elem_var
2919  (ex_id,
2920  timestep,
2921  var_id+1,
2922  this->get_block_id(j),
2923  num_elems_this_block,
2924  MappedOutputVector(data, _single_precision).data());
2925 
2926  EX_CHECK_ERR(ex_err, "Error writing element values.");
2927  }
2928  }
2929 
2930  ex_err = exII::ex_update(ex_id);
2931  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
2932 }

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, data, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_block_id(), mesh, libMesh::MeshTools::n_elem(), libMesh::ExodusII_IO_Helper::num_elem_vars, and libMesh::ParallelObject::processor_id().

◆ 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 2937 of file exodusII_io_helper.C.

2943 {
2944  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2945  return;
2946 
2947  // Ask the file how many element vars it has, store it in the num_elem_vars variable.
2948  ex_err = exII::ex_get_var_param(ex_id, "e", &num_elem_vars);
2949  EX_CHECK_ERR(ex_err, "Error reading number of elemental variables.");
2950 
2951  // We will eventually loop over the element blocks (subdomains) and
2952  // write the data one block (subdomain) at a time. Build a data
2953  // structure that keeps track of how many elements are in each
2954  // subdomain. This will allow us to reserve space in the data vector
2955  // we are going to write.
2956  std::map<subdomain_id_type, unsigned int> subdomain_to_n_elem;
2957  for (const auto & elem : mesh.active_element_ptr_range())
2958  subdomain_to_n_elem[elem->subdomain_id()] += 1;
2959 
2960  // Sanity check: we must have an entry in vars_active_subdomains for
2961  // each variable that we are potentially writing out.
2962  libmesh_assert_equal_to
2963  (vars_active_subdomains.size(),
2964  static_cast<unsigned>(num_elem_vars));
2965 
2966  // The size of the subdomain map is the number of blocks.
2967  auto subdomain_to_n_elem_iter = subdomain_to_n_elem.begin();
2968 
2969  // Store range of active Elem pointers. We are going to loop over
2970  // the elements n_vars * n_subdomains times, so let's make sure
2971  // the predicated iterators aren't slowing us down too much.
2972  ConstElemRange elem_range
2973  (mesh.active_elements_begin(),
2974  mesh.active_elements_end());
2975 
2976  for (unsigned int sbd_idx=0;
2977  subdomain_to_n_elem_iter != subdomain_to_n_elem.end();
2978  ++subdomain_to_n_elem_iter, ++sbd_idx)
2979  for (unsigned int var_id=0; var_id<static_cast<unsigned>(num_elem_vars); ++var_id)
2980  {
2981  // Reference to the set of active subdomains for the current variable.
2982  const auto & active_subdomains
2983  = vars_active_subdomains[var_id];
2984 
2985  // If the vars_active_subdomains container passed to this function
2986  // has an empty entry, it means the variable really is not active on
2987  // _any_ subdomains, not that it is active on _all_ subdomains. This
2988  // is just due to the way that we build the vars_active_subdomains
2989  // container.
2990  if (!active_subdomains.count(subdomain_to_n_elem_iter->first))
2991  continue;
2992 
2993  // Vector to hold values that will be written to Exodus file.
2994  std::vector<Real> data;
2995  data.reserve(subdomain_to_n_elem_iter->second);
2996 
2997  unsigned int values_offset = 0;
2998  for (auto & elem : elem_range)
2999  {
3000  // We'll use the Elem's subdomain id in several places below.
3001  subdomain_id_type sbd_id = elem->subdomain_id();
3002 
3003  // Get reference to the list of variable names defining
3004  // the indexing for the current Elem's subdomain.
3005  auto subdomain_to_var_names_iter =
3006  subdomain_to_var_names.find(sbd_id);
3007 
3008  // It's possible, but unusual, for there to be an Elem
3009  // from a subdomain that has no active variables from the
3010  // set of variables we are currently writing. If that
3011  // happens, we can just go to the next Elem because we
3012  // don't need to advance the offset into the values
3013  // vector, etc.
3014  if (subdomain_to_var_names_iter == subdomain_to_var_names.end())
3015  continue;
3016 
3017  const auto & var_names_this_sbd
3018  = subdomain_to_var_names_iter->second;
3019 
3020  // Only extract values if Elem is in the current subdomain.
3021  if (sbd_id == subdomain_to_n_elem_iter->first)
3022  {
3023  // Location of current var_id in the list of all variables on this
3024  // subdomain. FIXME: linear search but it's over a typically relatively
3025  // short vector of active variable names on this subdomain. We could do
3026  // a nested std::map<string,index> instead of a std::vector where the
3027  // location of the string is implicitly the index..
3028  auto pos =
3029  std::find(var_names_this_sbd.begin(),
3030  var_names_this_sbd.end(),
3031  derived_var_names[var_id]);
3032 
3033  if (pos == var_names_this_sbd.end())
3034  libmesh_error_msg("Derived name " << derived_var_names[var_id] << " not found!");
3035 
3036  // Find the current variable's location in the list of all variable
3037  // names on the current Elem's subdomain.
3038  auto true_index =
3039  std::distance(var_names_this_sbd.begin(), pos);
3040 
3041  data.push_back(values[values_offset + true_index]);
3042  }
3043 
3044  // The "true" offset is how much we have to advance the index for each Elem
3045  // in this subdomain.
3046  auto true_offset = var_names_this_sbd.size();
3047 
3048  // Increment to the next Elem's values
3049  values_offset += true_offset;
3050  } // for elem
3051 
3052  // Now write 'data' to Exodus file, in single precision if requested.
3053  if (!data.empty())
3054  {
3055  ex_err = exII::ex_put_elem_var
3056  (ex_id, timestep, var_id+1, this->get_block_id(sbd_idx), data.size(),
3057  MappedOutputVector(data, _single_precision).data());
3058 
3059  EX_CHECK_ERR(ex_err, "Error writing element values.");
3060  }
3061  } // for each var_id
3062 
3063  ex_err = exII::ex_update(ex_id);
3064  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
3065 }

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, data, libMesh::ExodusII_IO_Helper::MappedOutputVector::data(), distance(), 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, and libMesh::ParallelObject::processor_id().

◆ 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 2287 of file nemesis_io_helper.C.

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

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, 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_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 933 of file nemesis_io_helper.C.

935 {
936  // This follows the convention of Exodus: we always write out the mesh as LIBMESH_DIM-dimensional,
937  // even if it is 2D...
938  this->num_dim = LIBMESH_DIM;
939 
940  this->num_elem = static_cast<unsigned int>(std::distance (pmesh.active_local_elements_begin(),
941  pmesh.active_local_elements_end()));
942 
943  // Exodus will also use *global* number of side and node sets,
944  // though it will not write out entries for all of them...
945  this->num_side_sets =
946  cast_int<int>(this->global_sideset_ids.size());
947  this->num_node_sets =
948  cast_int<int>(this->global_nodeset_ids.size());
949 
950  // We need to write the global number of blocks, even though this processor might not have
951  // elements in some of them!
952  this->num_elem_blk = this->num_elem_blks_global;
953 
954  ex_err = exII::ex_put_init(ex_id,
955  title_in.c_str(),
956  this->num_dim,
957  this->num_nodes,
958  this->num_elem,
959  this->num_elem_blk,
960  this->num_node_sets,
961  this->num_side_sets);
962 
963  EX_CHECK_ERR(ex_err, "Error initializing new Nemesis file.");
964 }

References libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), distance(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, global_nodeset_ids, global_sideset_ids, libMesh::ExodusII_IO_Helper::num_dim, libMesh::ExodusII_IO_Helper::num_elem, libMesh::ExodusII_IO_Helper::num_elem_blk, num_elem_blks_global, libMesh::ExodusII_IO_Helper::num_node_sets, libMesh::ExodusII_IO_Helper::num_nodes, 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 3131 of file exodusII_io_helper.C.

3132 {
3133  if ((_run_only_on_proc0) && (this->processor_id() != 0))
3134  return;
3135 
3136  if (!values.empty())
3137  {
3138  ex_err = exII::ex_put_glob_vars
3139  (ex_id, timestep, num_global_vars,
3140  MappedOutputVector(values, _single_precision).data());
3141 
3142  EX_CHECK_ERR(ex_err, "Error writing global values.");
3143 
3144  ex_err = exII::ex_update(ex_id);
3145  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
3146  }
3147 }

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

◆ 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 3092 of file exodusII_io_helper.C.

3093 {
3094  if ((_run_only_on_proc0) && (this->processor_id() != 0))
3095  return;
3096 
3097  // There may already be information records in the file (for
3098  // example, if we're appending) and in that case, according to the
3099  // Exodus documentation, writing more information records is not
3100  // supported.
3101  int num_info = inquire(exII::EX_INQ_INFO, "Error retrieving the number of information records from file!");
3102  if (num_info > 0)
3103  {
3104  libMesh::err << "Warning! The Exodus file already contains information records.\n"
3105  << "Exodus does not support writing additional records in this situation."
3106  << std::endl;
3107  return;
3108  }
3109 
3110  int num_records = cast_int<int>(records.size());
3111 
3112  if (num_records > 0)
3113  {
3114  NamesData info(num_records, MAX_LINE_LENGTH);
3115 
3116  // If an entry is longer than MAX_LINE_LENGTH characters it's not an error, we just
3117  // write the first MAX_LINE_LENGTH characters to the file.
3118  for (const auto & record : records)
3119  info.push_back_entry(record);
3120 
3121  ex_err = exII::ex_put_info(ex_id, num_records, info.get_char_star_star());
3122  EX_CHECK_ERR(ex_err, "Error writing global values.");
3123 
3124  ex_err = exII::ex_update(ex_id);
3125  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
3126  }
3127 }

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::err, 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::inquire(), libMesh::ParallelObject::processor_id(), and libMesh::ExodusII_IO_Helper::NamesData::push_back_entry().

◆ 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 2228 of file nemesis_io_helper.C.

2229 {
2230  auto local_num_nodes = this->exodus_node_num_to_libmesh.size();
2231 
2232  x.resize(local_num_nodes);
2233  y.resize(local_num_nodes);
2234  z.resize(local_num_nodes);
2235 
2236  // Just loop over our list outputting the nodes the way we built the map
2237  for (auto i : IntRange<int>(0, local_num_nodes))
2238  {
2239  const Point & pt = mesh.point(this->exodus_node_num_to_libmesh[i]);
2240  x[i]=pt(0);
2241  y[i]=pt(1);
2242  z[i]=pt(2);
2243  }
2244 
2245  if (local_num_nodes)
2246  {
2247  if (_single_precision)
2248  {
2249  std::vector<float>
2250  x_single(x.begin(), x.end()),
2251  y_single(y.begin(), y.end()),
2252  z_single(z.begin(), z.end());
2253 
2254  ex_err = exII::ex_put_coord(ex_id,
2255  x_single.data(),
2256  y_single.data(),
2257  z_single.data());
2258  }
2259  else
2260  {
2261  // Call Exodus API to write nodal coordinates...
2262  ex_err = exII::ex_put_coord(ex_id,
2263  x.data(),
2264  y.data(),
2265  z.data());
2266  }
2267  EX_CHECK_ERR(ex_err, "Error writing node coordinates");
2268 
2269  // And write the nodal map we created for them
2270  ex_err = exII::ex_put_node_num_map(ex_id, this->exodus_node_num_to_libmesh.data());
2271  EX_CHECK_ERR(ex_err, "Error writing node num map");
2272  }
2273  else // Does the Exodus API want us to write empty nodal coordinates?
2274  {
2275  ex_err = exII::ex_put_coord(ex_id, nullptr, nullptr, nullptr);
2276  EX_CHECK_ERR(ex_err, "Error writing empty node coordinates");
2277 
2278  ex_err = exII::ex_put_node_num_map(ex_id, nullptr);
2279  EX_CHECK_ERR(ex_err, "Error writing empty node num map");
2280  }
2281 }

References libMesh::ExodusII_IO_Helper::_single_precision, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, 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 2470 of file nemesis_io_helper.C.

2474 {
2475  const MeshBase & mesh = es.get_mesh();
2476 
2477  for (auto & var_num : var_nums)
2478  {
2479  const unsigned int sys_num = var_num.first;
2480  const unsigned int var = var_num.second;
2481 
2482  const System & sys = es.get_system(sys_num);
2483  const std::string & name = sys.variable_name(var);
2484 
2485  auto pos = std::find(output_names.begin(), output_names.end(), name);
2486 
2487  // Skip this name if it's not supposed to be output.
2488  if (pos == output_names.end())
2489  continue;
2490 
2491  // Compute the (zero-based) index which determines which
2492  // variable this will be as far as Nemesis is concerned. This
2493  // will be used below in the write_nodal_values() call.
2494  int variable_name_position =
2495  cast_int<int>(std::distance(output_names.begin(), pos));
2496 
2497  // Fill up a std::vector with the dofs for the current variable
2498  std::vector<numeric_index_type> required_indices(num_nodes);
2499 
2500  const FEType type = sys.variable_type(var);
2501  if (type.family == SCALAR)
2502  {
2503  std::vector<numeric_index_type> scalar_indices;
2504  sys.get_dof_map().SCALAR_dof_indices(scalar_indices, var);
2505  for (int i=0; i<num_nodes; i++)
2506  required_indices[i] = scalar_indices[0];
2507  }
2508  else
2509  for (int i=0; i<num_nodes; i++)
2510  {
2511  const Node & node = mesh.node_ref(this->exodus_node_num_to_libmesh[i]);
2512  required_indices[i] = node.dof_number(sys_num, var, 0);
2513  }
2514 
2515  // Get the dof values required to write just our local part of
2516  // the solution vector.
2517  std::vector<Number> local_soln;
2518  sys.current_local_solution->get(required_indices, local_soln);
2519 
2520 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
2521  // Call the ExodusII_IO_Helper function to write the data.
2522  write_nodal_values(variable_name_position + 1, local_soln, timestep);
2523 #else
2524  // We have the local (complex) values. Now extract the real,
2525  // imaginary, and magnitude values from them.
2526  std::vector<Real> real_parts(num_nodes);
2527  std::vector<Real> imag_parts(num_nodes);
2528  std::vector<Real> magnitudes(num_nodes);
2529 
2530  for (int i=0; i<num_nodes; ++i)
2531  {
2532  real_parts[i] = local_soln[i].real();
2533  imag_parts[i] = local_soln[i].imag();
2534  magnitudes[i] = std::abs(local_soln[i]);
2535  }
2536 
2537  // Write the real, imaginary, and magnitude values to file.
2538  write_nodal_values(3 * variable_name_position + 1, real_parts, timestep);
2539  write_nodal_values(3 * variable_name_position + 2, imag_parts, timestep);
2540  write_nodal_values(3 * variable_name_position + 3, magnitudes, timestep);
2541 #endif
2542  }
2543 }

References std::abs(), libMesh::System::current_local_solution, distance(), libMesh::DofObject::dof_number(), libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh, libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), mesh, libMesh::Quality::name(), libMesh::ExodusII_IO_Helper::num_nodes, libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), 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 2410 of file nemesis_io_helper.C.

2414 {
2415  int num_vars = cast_int<int>(names.size());
2416 
2417  for (int c=0; c<num_vars; c++)
2418  {
2419  // Find the position of names[c] in the output_names vector, if it exists.
2420  auto pos = std::find(output_names.begin(), output_names.end(), names[c]);
2421 
2422  // Skip names[c] if it's not supposed to be output.
2423  if (pos == output_names.end())
2424  continue;
2425 
2426  // Compute the (zero-based) index which determines which
2427  // variable this will be as far as Nemesis is concerned. This
2428  // will be used below in the write_nodal_values() call.
2429  int variable_name_position =
2430  cast_int<int>(std::distance(output_names.begin(), pos));
2431 
2432  // Fill up a std::vector with the dofs for the current variable
2433  std::vector<numeric_index_type> required_indices(num_nodes);
2434 
2435  for (int i=0; i<num_nodes; i++)
2436  required_indices[i] = static_cast<dof_id_type>(this->exodus_node_num_to_libmesh[i]) * num_vars + c;
2437 
2438  // Get the dof values required to write just our local part of
2439  // the solution vector.
2440  std::vector<Number> local_soln;
2441  parallel_soln.localize(local_soln, required_indices);
2442 
2443 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
2444  // Call the ExodusII_IO_Helper function to write the data.
2445  write_nodal_values(variable_name_position + 1, local_soln, timestep);
2446 #else
2447  // We have the local (complex) values. Now extract the real,
2448  // imaginary, and magnitude values from them.
2449  std::vector<Real> real_parts(num_nodes);
2450  std::vector<Real> imag_parts(num_nodes);
2451  std::vector<Real> magnitudes(num_nodes);
2452 
2453  for (int i=0; i<num_nodes; ++i)
2454  {
2455  real_parts[i] = local_soln[i].real();
2456  imag_parts[i] = local_soln[i].imag();
2457  magnitudes[i] = std::abs(local_soln[i]);
2458  }
2459 
2460  // Write the real, imaginary, and magnitude values to file.
2461  write_nodal_values(3 * variable_name_position + 1, real_parts, timestep);
2462  write_nodal_values(3 * variable_name_position + 2, imag_parts, timestep);
2463  write_nodal_values(3 * variable_name_position + 3, magnitudes, timestep);
2464 #endif
2465  }
2466 }

References std::abs(), distance(), 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 2372 of file nemesis_io_helper.C.

2375 {
2376  int num_vars = cast_int<int>(names.size());
2377  //int num_values = values.size(); // Not used?
2378 
2379  for (int c=0; c<num_vars; c++)
2380  {
2381 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
2382  std::vector<Real> real_parts(num_nodes);
2383  std::vector<Real> imag_parts(num_nodes);
2384  std::vector<Real> magnitudes(num_nodes);
2385 
2386  for (int i=0; i<num_nodes; ++i)
2387  {
2388  Number value = values[this->exodus_node_num_to_libmesh[i]*num_vars + c];
2389  real_parts[i] = value.real();
2390  imag_parts[i] = value.imag();
2391  magnitudes[i] = std::abs(value);
2392  }
2393  write_nodal_values(3*c+1,real_parts,timestep);
2394  write_nodal_values(3*c+2,imag_parts,timestep);
2395  write_nodal_values(3*c+3,magnitudes,timestep);
2396 #else
2397  std::vector<Number> cur_soln(num_nodes);
2398 
2399  // Copy out this variable's solution
2400  for (int i=0; i<num_nodes; i++)
2401  cur_soln[i] = values[this->exodus_node_num_to_libmesh[i]*num_vars + c];
2402 
2403  write_nodal_values(c+1,cur_soln,timestep);
2404 #endif
2405  }
2406 }

References std::abs(), 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 3070 of file exodusII_io_helper.C.

3073 {
3074  if ((_run_only_on_proc0) && (this->processor_id() != 0))
3075  return;
3076 
3077  if (!values.empty())
3078  {
3079  ex_err = exII::ex_put_nodal_var
3080  (ex_id, timestep, var_id, num_nodes,
3081  MappedOutputVector(values, _single_precision).data());
3082 
3083  EX_CHECK_ERR(ex_err, "Error writing nodal values.");
3084 
3085  ex_err = exII::ex_update(ex_id);
3086  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
3087  }
3088 }

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

Referenced by write_nodal_solution().

◆ 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 1933 of file nemesis_io_helper.C.

1934 {
1935  // Write the nodesets. In Nemesis, the idea is to "create space" for the global
1936  // set of boundary nodesets, but to only write node IDs which are local to the current
1937  // processor. This is what is done in Nemesis files created by the "loadbal" script.
1938 
1939  // Store a map of vectors for boundary node IDs on this processor.
1940  // Use a vector of int here so it can be passed directly to Exodus.
1941  std::map<boundary_id_type, std::vector<int>> local_node_boundary_id_lists;
1942 
1943  // FIXME: We should build this list only one time!! We already built it above, but we
1944  // did not have the libmesh to exodus node mapping at that time... for now we'll just
1945  // build it here again, hopefully it's small relative to the size of the entire mesh.
1946 
1947  // Build list of (node-id, bc-id) tuples.
1948  typedef std::tuple<dof_id_type, boundary_id_type> Tuple;
1949  std::vector<Tuple> bc_tuples = mesh.get_boundary_info().build_node_list();
1950 
1951  if (verbose)
1952  {
1953  libMesh::out << "[" << this->processor_id() << "] boundary_node_list.size()="
1954  << bc_tuples.size() << std::endl;
1955  libMesh::out << "[" << this->processor_id() << "] (boundary_node_id, boundary_id) = ";
1956  for (const auto & t : bc_tuples)
1957  libMesh::out << "(" << std::get<0>(t) << ", " << std::get<1>(t) << ") ";
1958  libMesh::out << std::endl;
1959  }
1960 
1961  // For each node in the node list, add it to the vector of node IDs for that
1962  // set for the local processor. This will be used later when writing Exodus
1963  // nodesets.
1964  for (const auto & t : bc_tuples)
1965  {
1966  // Don't try to grab a reference to the vector unless the current node is attached
1967  // to a local element. Otherwise, another processor will be responsible for writing it in its nodeset.
1968  std::map<int, int>::iterator it = this->libmesh_node_num_to_exodus.find(std::get<0>(t));
1969 
1970  if (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 & pr : local_node_boundary_id_lists)
1986  {
1987  libMesh::out << "[" << this->processor_id() << "] ID: " << pr.first << ", ";
1988 
1989  // Libmesh node ID (Exodus Node ID)
1990  for (const auto & id : pr.second)
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  auto it =
2032  local_node_boundary_id_lists.find (cast_int<boundary_id_type>(nodeset_id));
2033 
2034  // No nodes found for this boundary ID on this processor
2035  if (it == local_node_boundary_id_lists.end())
2036  {
2037  if (verbose)
2038  libMesh::out << "[" << this->processor_id()
2039  << "] No nodeset data for ID: " << nodeset_id
2040  << " on this processor." << std::endl;
2041 
2042  // Call the Exodus interface to write the parameters of this node set
2043  this->ex_err = exII::ex_put_node_set_param(this->ex_id,
2044  exodus_id,
2045  0, /* No nodes for this ID */
2046  0 /* No distribution factors */);
2047  EX_CHECK_ERR(this->ex_err, "Error writing nodeset parameters in Nemesis");
2048 
2049  }
2050  else // Boundary ID *was* found in list
2051  {
2052  // Get reference to the vector of node IDs
2053  std::vector<int> & current_nodeset_ids = it->second;
2054 
2055  // Call the Exodus interface to write the parameters of this node set
2056  this->ex_err = exII::ex_put_node_set_param(this->ex_id,
2057  exodus_id,
2058  current_nodeset_ids.size(),
2059  0 /* No distribution factors */);
2060 
2061  EX_CHECK_ERR(this->ex_err, "Error writing nodeset parameters in Nemesis");
2062 
2063  // Call Exodus interface to write the actual node IDs for this boundary ID
2064  this->ex_err = exII::ex_put_node_set(this->ex_id,
2065  exodus_id,
2066  current_nodeset_ids.data());
2067 
2068  EX_CHECK_ERR(this->ex_err, "Error writing nodesets in Nemesis");
2069 
2070  }
2071  } // end loop over global nodeset IDs
2072 
2073  // Write out the nodeset names
2074  ex_err = exII::ex_put_names(ex_id,
2075  exII::EX_NODE_SET,
2076  names_table.get_char_star_star());
2077  EX_CHECK_ERR(ex_err, "Error writing nodeset names");
2078  } // end for loop over global nodeset IDs
2079 }

References libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, global_nodeset_ids, libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus, mesh, libMesh::out, libMesh::ParallelObject::processor_id(), 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 2587 of file exodusII_io_helper.C.

2592 {
2593  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2594  return;
2595 
2596  // Write the sideset variable names to file. This function should
2597  // only be called once for SIDESET variables, repeated calls to
2598  // write_var_names overwrites/changes the order of names that were
2599  // there previously, and will mess up any data that has already been
2600  // written.
2601  this->write_var_names(SIDESET, var_names);
2602 
2603  // I hope that we are allowed to call read_sideset_info() even
2604  // though we are in the middle of writing? It seems to work provided
2605  // that you have already written the mesh itself... read_sideset_info()
2606  // fills in the following data members:
2607  // .) num_side_sets
2608  // .) ss_ids
2609  this->read_sideset_info();
2610 
2611  // Debugging:
2612  // libMesh::out << "File has " << num_side_sets << " side sets." << std::endl;
2613 
2614  // Write "truth" table for sideset variables. The function
2615  // exII::ex_put_var_param() must be called before
2616  // exII::ex_put_sset_var_tab(). For us, this happens during the call
2617  // to ExodusII_IO_Helper::write_var_names(). sset_var_tab is a logically
2618  // (num_side_sets x num_sset_var) integer array of 0s and 1s
2619  // indicating which sidesets a given sideset variable is defined on.
2620  std::vector<int> sset_var_tab(num_side_sets * var_names.size());
2621 
2622  // We now call read_sideset() once per sideset and write any sideset
2623  // variable values which are defined there.
2624  int offset=0;
2625  for (int ss=0; ss<num_side_sets; ++ss)
2626  {
2627  // We don't know num_sides_per_set for each set until we call
2628  // read_sideset(). The values for each sideset are stored (using
2629  // the offsets) into the 'elem_list' and 'side_list' arrays of
2630  // this class.
2631  offset += (ss > 0 ? num_sides_per_set[ss-1] : 0);
2632  this->read_sideset(ss, offset);
2633 
2634  // Debugging:
2635  // libMesh::out << "Sideset " << ss_ids[ss]
2636  // << " has " << num_sides_per_set[ss]
2637  // << " entries."
2638  // << std::endl;
2639 
2640  // For each variable in var_names, write the values for the
2641  // current sideset, if any.
2642  for (auto var : index_range(var_names))
2643  {
2644  // If this var has no values on this sideset, go to the next one.
2645  if (!side_ids[var].count(ss_ids[ss]))
2646  continue;
2647 
2648  // Otherwise, fill in this entry of the sideset truth table.
2649  sset_var_tab[ss*var_names.size() + var] = 1;
2650 
2651  // Data vector that will eventually be passed to exII::ex_put_sset_var().
2652  std::vector<Real> sset_var_vals(num_sides_per_set[ss]);
2653 
2654  // Get reference to the BCTuple -> Real map for this variable.
2655  const auto & data_map = bc_vals[var];
2656 
2657  // Loop over elem_list, side_list entries in current sideset.
2658  for (int i=0; i<num_sides_per_set[ss]; ++i)
2659  {
2660  // Get elem_id and side_id from the respective lists that
2661  // are filled in by calling read_sideset().
2662  //
2663  // Note: these are Exodus-specific ids, so we have to convert them
2664  // to libmesh ids, as that is what will be in the bc_tuples.
2665  //
2666  // TODO: we should probably consult the exodus_elem_num_to_libmesh
2667  // mapping in order to figure out which libmesh element id 'elem_id'
2668  // actually corresponds to here, instead of just assuming it will be
2669  // off by one. Unfortunately that data structure does not seem to
2670  // be used at the moment. If we assume that write_sideset_data() is
2671  // always called following write(), then this should be a fairly safe
2672  // assumption...
2673  dof_id_type elem_id = elem_list[i + offset] - 1;
2674  unsigned int side_id = side_list[i + offset] - 1;
2675 
2676  // Sanity check: make sure that the "off by one"
2677  // assumption we used above to set 'elem_id' is valid.
2678  if (libmesh_map_find(libmesh_elem_num_to_exodus, cast_int<int>(elem_id))
2679  != elem_list[i + offset])
2680  libmesh_error_msg("Error mapping Exodus elem id to libmesh elem id.");
2681 
2682  // Map from Exodus side ids to libmesh side ids.
2683  const auto & conv = get_conversion(mesh.elem_ptr(elem_id)->type());
2684 
2685  // Map from Exodus side ids to libmesh side ids.
2686  unsigned int converted_side_id = conv.get_side_map(side_id);
2687 
2688  // Debugging:
2689  // libMesh::out << "side_id=" << side_id
2690  // << ", converted_side_id=" << converted_side_id
2691  // << std::endl;
2692 
2693  // Construct a key so we can quickly see whether there is any
2694  // data for this variable in the map.
2695  BoundaryInfo::BCTuple key = std::make_tuple
2696  (elem_id,
2697  converted_side_id,
2698  ss_ids[ss]);
2699 
2700  // Find the data for this (elem,side,id) tuple. Throw an
2701  // error if not found. Then store value in vector which
2702  // will be passed to Exodus.
2703  sset_var_vals[i] = libmesh_map_find(data_map, key);
2704  } // end for (i)
2705 
2706  // As far as I can tell, there is no "concat" version of writing
2707  // sideset data, you have to call ex_put_sset_var() once per (variable,
2708  // sideset) pair.
2709  if (sset_var_vals.size() > 0)
2710  {
2711  ex_err = exII::ex_put_sset_var
2712  (ex_id,
2713  timestep,
2714  var + 1, // 1-based variable index of current variable
2715  ss_ids[ss],
2716  num_sides_per_set[ss],
2717  MappedOutputVector(sset_var_vals, _single_precision).data());
2718  EX_CHECK_ERR(ex_err, "Error writing sideset vars.");
2719  }
2720  } // end for (var)
2721  } // end for (ss)
2722 
2723  // Finally, write the sideset truth table.
2724  ex_err =
2725  exII::ex_put_sset_var_tab(ex_id,
2726  num_side_sets,
2727  cast_int<int>(var_names.size()),
2728  sset_var_tab.data());
2729  EX_CHECK_ERR(ex_err, "Error writing sideset var truth table.");
2730 }

References libMesh::ExodusII_IO_Helper::_run_only_on_proc0, libMesh::ExodusII_IO_Helper::_single_precision, data, libMesh::ExodusII_IO_Helper::elem_list, libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), libMesh::ExodusII_IO_Helper::Conversion::get_side_map(), 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(), libMesh::ExodusII_IO_Helper::side_list, libMesh::ExodusII_IO_Helper::SIDESET, libMesh::ExodusII_IO_Helper::ss_ids, 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 2084 of file nemesis_io_helper.C.

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

References libMesh::Elem::active_family_tree_by_side(), libMesh::ExodusII_IO_Helper::ex_err, libMesh::ExodusII_IO_Helper::ex_id, libMesh::ExodusII_IO_Helper::get_conversion(), global_sideset_ids, libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus, mesh, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), 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 2562 of file exodusII_io_helper.C.

2563 {
2564  if ((_run_only_on_proc0) && (this->processor_id() != 0))
2565  return;
2566 
2567  if (_single_precision)
2568  {
2569  float cast_time = float(time);
2570  ex_err = exII::ex_put_time(ex_id, timestep, &cast_time);
2571  }
2572  else
2573  {
2574  double cast_time = double(time);
2575  ex_err = exII::ex_put_time(ex_id, timestep, &cast_time);
2576  }
2577  EX_CHECK_ERR(ex_err, "Error writing timestep.");
2578 
2579  ex_err = exII::ex_update(ex_id);
2580  EX_CHECK_ERR(ex_err, "Error flushing buffers to file.");
2581 }

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, and libMesh::ParallelObject::processor_id().

◆ 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 1408 of file exodusII_io_helper.C.

1410 {
1411  switch (type)
1412  {
1413  case NODAL:
1414  this->write_var_names_impl("n", num_nodal_vars, names);
1415  break;
1416  case ELEMENTAL:
1417  this->write_var_names_impl("e", num_elem_vars, names);
1418  break;
1419  case GLOBAL:
1420  this->write_var_names_impl("g", num_global_vars, names);
1421  break;
1422  case SIDESET:
1423  {
1424  // Note: calling this function *sets* num_sideset_vars to the
1425  // number of entries in the 'names' vector, num_sideset_vars
1426  // does not already need to be set before calling this.
1427  this->write_var_names_impl("s", num_sideset_vars, names);
1428  break;
1429  }
1430  default:
1431  libmesh_error_msg("Unrecognized ExodusVarType " << type);
1432  }
1433 }

References libMesh::ExodusII_IO_Helper::ELEMENTAL, libMesh::ExodusII_IO_Helper::GLOBAL, libMesh::ExodusII_IO_Helper::NODAL, libMesh::ExodusII_IO_Helper::num_elem_vars, libMesh::ExodusII_IO_Helper::num_global_vars, libMesh::ExodusII_IO_Helper::num_nodal_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(), 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 1438 of file exodusII_io_helper.C.

1441 {
1442  // Update the count variable so that it's available to other parts of the class.
1443  count = cast_int<int>(names.size());
1444 
1445  // Write that number of variables to the file.
1446  ex_err = exII::ex_put_var_param(ex_id, var_type, count);
1447  EX_CHECK_ERR(ex_err, "Error setting number of vars.");
1448 
1449  if (count > 0)
1450  {
1451  NamesData names_table(count, MAX_STR_LENGTH);
1452 
1453  // Store the input names in the format required by Exodus.
1454  for (int i=0; i != count; ++i)
1455  names_table.push_back_entry(names[i]);
1456 
1457  if (verbose)
1458  {
1459  libMesh::out << "Writing variable name(s) to file: " << std::endl;
1460  for (int i=0; i != count; ++i)
1461  libMesh::out << names_table.get_char_star(i) << std::endl;
1462  }
1463 
1464  ex_err = exII::ex_put_var_names(ex_id,
1465  var_type,
1466  count,
1467  names_table.get_char_star_star()
1468  );
1469 
1470  EX_CHECK_ERR(ex_err, "Error writing variable names.");
1471  }
1472 }

References 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::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

◆ _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

◆ _global_vars_initialized

bool libMesh::ExodusII_IO_Helper::_global_vars_initialized
protectedinherited

◆ _nodal_vars_initialized

bool libMesh::ExodusII_IO_Helper::_nodal_vars_initialized
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

◆ _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

◆ 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 443 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 618 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 581 of file nemesis_io_helper.h.

Referenced by compute_border_node_ids(), compute_internal_and_border_elems_and_internal_nodes(), and compute_node_maps().

◆ connect

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

◆ conversion_map

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.

Definition at line 823 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 565 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 567 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 566 of file nemesis_io_helper.h.

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

◆ 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 510 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 503 of file nemesis_io_helper.h.

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

◆ 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 648 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 816 of file exodusII_io_helper.h.

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

◆ ex_err

int libMesh::ExodusII_IO_Helper::ex_err
inherited

Definition at line 495 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::close(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), initialize_element_variables(), libMesh::ExodusII_IO_Helper::inquire(), libMesh::ExodusII_IO_Helper::read_all_nodesets(), 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_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(), libMesh::ExodusII_IO_Helper::read_nodeset(), 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(), write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), write_elements(), libMesh::ExodusII_IO_Helper::write_elements(), write_exodus_initialization_info(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO_Helper::write_information_records(), write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_values(), write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_sideset_data(), write_sidesets(), libMesh::ExodusII_IO_Helper::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 492 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::close(), libMesh::ExodusII_IO_Helper::create(), 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::inquire(), 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_n_coord(), 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_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_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(), libMesh::ExodusII_IO_Helper::read_nodeset(), 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(), write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), write_elements(), libMesh::ExodusII_IO_Helper::write_elements(), write_exodus_initialization_info(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO_Helper::write_information_records(), write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO_Helper::write_nodal_values(), write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_sideset_data(), write_sidesets(), libMesh::ExodusII_IO_Helper::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 619 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 395 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 426 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 416 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 404 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

◆ 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_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 613 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 608 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<int, int> libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus
inherited

◆ libmesh_node_num_to_exodus

std::map<int, int> 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 575 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::vector<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 542 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 556 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 557 of file nemesis_io_helper.h.

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

◆ node_list

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

Definition at line 590 of file exodusII_io_helper.h.

Referenced by libMesh::ExodusII_IO_Helper::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 526 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 533 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 519 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 432 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

◆ 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 480 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 460 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

◆ 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_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 494 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_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 372 of file nemesis_io_helper.h.

Referenced by get_init_global().

◆ 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 467 of file nemesis_io_helper.h.

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

◆ 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 418 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 406 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 473 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 453 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 487 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 371 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_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 381 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 388 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 598 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 588 of file nemesis_io_helper.h.

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

◆ 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 437 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 630 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

◆ 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:
libMesh::ExodusII_IO_Helper::ExodusII_IO_Helper
ExodusII_IO_Helper(const ParallelObject &parent, bool v=false, bool run_only_on_proc0=true, bool single_precision=false)
Constructor.
Definition: exodusII_io_helper.C:98
libMesh::ExodusII_IO_Helper::opened_for_writing
bool opened_for_writing
Definition: exodusII_io_helper.h:667
libMesh::Nemesis_IO_Helper::num_node_sets_global
int num_node_sets_global
Definition: nemesis_io_helper.h:374
libMesh::ExodusII_IO_Helper::id_to_ss_names
std::map< int, std::string > id_to_ss_names
Definition: exodusII_io_helper.h:659
libMesh::ExodusII_IO_Helper::get_block_id
int get_block_id(int index)
Get the block number for the given block index.
Definition: exodusII_io_helper.C:742
libMesh::HEX20
Definition: enum_elem_type.h:48
libMesh::ExodusII_IO_Helper::global_var_names
std::vector< std::string > global_var_names
Definition: exodusII_io_helper.h:651
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::Nemesis_IO_Helper::num_internal_nodes
int num_internal_nodes
To be used with the Nemesis::ne_get_loadbal_param() routine.
Definition: nemesis_io_helper.h:453
libMesh::PRISM6
Definition: enum_elem_type.h:50
libMesh::subdomain_id_type
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
libMesh::ExodusII_IO_Helper::get_conversion
const ExodusII_IO_Helper::Conversion & get_conversion(const ElemType type) const
Definition: exodusII_io_helper.C:383
libMesh::ExodusII_IO_Helper::node_num_map
std::vector< int > node_num_map
Definition: exodusII_io_helper.h:596
libMesh::ExodusII_IO_Helper::_single_precision
bool _single_precision
Definition: exodusII_io_helper.h:740
libMesh::ExodusII_IO_Helper::node_sets_dist_index
std::vector< int > node_sets_dist_index
Definition: exodusII_io_helper.h:573
libMesh::Nemesis_IO_Helper::num_side_sets_global
int num_side_sets_global
Definition: nemesis_io_helper.h:375
libMesh::ExodusII_IO_Helper::libmesh_node_num_to_exodus
std::map< int, int > libmesh_node_num_to_exodus
Definition: exodusII_io_helper.h:623
libMesh::Nemesis_IO_Helper::put_cmap_params
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.
Definition: nemesis_io_helper.C:576
libMesh::Nemesis_IO_Helper::node_cmap_node_cnts
std::vector< int > node_cmap_node_cnts
Definition: nemesis_io_helper.h:543
libMesh::ExodusII_IO_Helper::current_filename
std::string current_filename
Definition: exodusII_io_helper.h:681
libMesh::MeshTools::n_elem
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).
Definition: mesh_tools.C:705
libMesh::Nemesis_IO_Helper::elem_cmap_proc_ids
std::vector< std::vector< int > > elem_cmap_proc_ids
Definition: nemesis_io_helper.h:567
libMesh::ExodusII_IO_Helper::side_list
std::vector< int > side_list
Definition: exodusII_io_helper.h:587
libMesh::ExodusII_IO_Helper::check_existing_vars
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 ...
Definition: exodusII_io_helper.C:2522
libMesh::Nemesis_IO_Helper::num_proc
int num_proc
The number of processors for which the NEMESIS I file was created.
Definition: nemesis_io_helper.h:381
libMesh::Nemesis_IO_Helper::compute_num_global_sidesets
void compute_num_global_sidesets(const MeshBase &pmesh)
This function uses global communication routines to determine the number of sidesets across the entir...
Definition: nemesis_io_helper.C:1363
libMesh::ExodusII_IO_Helper::y
std::vector< Real > y
Definition: exodusII_io_helper.h:605
libMesh::ExodusII_IO_Helper::write_var_names
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().
Definition: exodusII_io_helper.C:1408
libMesh::Nemesis_IO_Helper::elem_cmap_elem_cnts
std::vector< int > elem_cmap_elem_cnts
Definition: nemesis_io_helper.h:545
libMesh::Nemesis_IO_Helper::elem_cmap_side_ids
std::vector< std::vector< int > > elem_cmap_side_ids
Definition: nemesis_io_helper.h:566
libMesh::HEX8
Definition: enum_elem_type.h:47
libMesh::Nemesis_IO_Helper::compute_element_maps
void compute_element_maps()
This function computes element maps (really just packs vectors) which map the elements to internal an...
Definition: nemesis_io_helper.C:970
libMesh::ExodusII_IO_Helper::nodal_var_names
std::vector< std::string > nodal_var_names
Definition: exodusII_io_helper.h:636
libMesh::Nemesis_IO_Helper::num_elems_global
int num_elems_global
Definition: nemesis_io_helper.h:372
libMesh::ExodusII_IO_Helper::num_nodal_vars
int num_nodal_vars
Definition: exodusII_io_helper.h:633
libMesh::Nemesis_IO_Helper::global_sideset_ids
std::vector< int > global_sideset_ids
Containers for reading global sideset (boundary conditions) information.
Definition: nemesis_io_helper.h:404
libMesh::ExodusII_IO_Helper::block_ids
std::vector< int > block_ids
Definition: exodusII_io_helper.h:541
libMesh::Nemesis_IO_Helper::put_elem_cmap
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.
Definition: nemesis_io_helper.C:662
libMesh::Nemesis_IO_Helper::proc_nodes_touched_iterator
std::map< unsigned, std::set< unsigned > >::iterator proc_nodes_touched_iterator
Typedef for an iterator into the data structure above.
Definition: nemesis_io_helper.h:593
libMesh::Nemesis_IO_Helper::num_external_nodes
int num_external_nodes
The number of FEM nodes that reside on another processor but whose element partially resides on the c...
Definition: nemesis_io_helper.h:467
libMesh::Nemesis_IO_Helper::compute_border_node_ids
void compute_border_node_ids(const MeshBase &pmesh)
This function constructs the set of border node IDs present on the current mesh.
Definition: nemesis_io_helper.C:1814
libMesh::ExodusII_IO_Helper::libmesh_elem_num_to_exodus
std::map< int, int > libmesh_elem_num_to_exodus
Definition: exodusII_io_helper.h:618
libMesh::ExodusII_IO_Helper::edge_block_ids
std::vector< int > edge_block_ids
Definition: exodusII_io_helper.h:544
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh::Nemesis_IO_Helper::compute_num_global_nodesets
void compute_num_global_nodesets(const MeshBase &pmesh)
This function uses global communication routines to determine the number of nodesets across the entir...
Definition: nemesis_io_helper.C:1456
libMesh::Nemesis_IO_Helper::put_elem_map
void put_elem_map(std::vector< int > &elem_mapi, std::vector< int > &elem_mapb)
Outputs IDs of internal and border elements.
Definition: nemesis_io_helper.C:683
libMesh::ExodusII_IO_Helper::num_nodes_per_elem
int num_nodes_per_elem
Definition: exodusII_io_helper.h:532
libMesh::TET10
Definition: enum_elem_type.h:46
libMesh::ExodusII_IO_Helper::num_node_df_per_set
std::vector< int > num_node_df_per_set
Definition: exodusII_io_helper.h:565
libMesh::ExodusII_IO_Helper::num_sides_per_set
std::vector< int > num_sides_per_set
Definition: exodusII_io_helper.h:556
end
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition: variant_filter_iterator.h:343
libMesh::ExodusII_IO_Helper::_run_only_on_proc0
bool _run_only_on_proc0
Definition: exodusII_io_helper.h:716
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
equal
bool equal(const variant_filter_iterator &other) const
Forwards to the equal() function defined for the IterBase pointer.
Definition: variant_filter_iterator.h:470
libMesh::Nemesis_IO_Helper::border_elem_ids
std::set< unsigned > border_elem_ids
A set of border elem IDs for this processor.
Definition: nemesis_io_helper.h:618
libMesh::ExodusII_IO_Helper::opened_for_reading
bool opened_for_reading
Definition: exodusII_io_helper.h:671
libMesh::ExodusII_IO_Helper::num_global_vars
int num_global_vars
Definition: exodusII_io_helper.h:501
libMesh::Nemesis_IO_Helper::elem_mapb
std::vector< int > elem_mapb
Vector which stores border element IDs.
Definition: nemesis_io_helper.h:510
libMesh::Nemesis_IO_Helper::node_mapi
std::vector< int > node_mapi
Vector which stores internal node IDs.
Definition: nemesis_io_helper.h:519
libMesh::ExodusII_IO_Helper::_coordinate_offset
Point _coordinate_offset
Definition: exodusII_io_helper.h:737
libMesh::ExodusII_IO_Helper::num_nodes
int num_nodes
Definition: exodusII_io_helper.h:507
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::Nemesis_IO_Helper::global_elem_blk_ids
std::vector< int > global_elem_blk_ids
Read the global element block IDs and counts.
Definition: nemesis_io_helper.h:426
libMesh::Nemesis_IO_Helper::num_border_nodes
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...
Definition: nemesis_io_helper.h:460
libMesh::if
if(subdm)
Definition: petsc_dm_wrapper.C:77
libMesh::ExodusII_IO_Helper::num_side_sets
int num_side_sets
Definition: exodusII_io_helper.h:526
libMesh::Nemesis_IO_Helper::put_node_map
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.
Definition: nemesis_io_helper.C:645
libMesh::ExodusII_IO_Helper::id_to_ns_names
std::map< int, std::string > id_to_ns_names
Definition: exodusII_io_helper.h:660
libMesh::ExodusII_IO_Helper::conversion_map
std::map< ElemType, ExodusII_IO_Helper::Conversion > conversion_map
Associates libMesh ElemTypes with node/face/edge/etc.
Definition: exodusII_io_helper.h:823
libMesh::Nemesis_IO_Helper::put_ns_param_global
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.
Definition: nemesis_io_helper.C:510
libMesh::Nemesis_IO_Helper::compute_communication_map_parameters
void compute_communication_map_parameters()
This function determines the communication map parameters which will eventually be written to file.
Definition: nemesis_io_helper.C:1147
libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes
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 ...
Definition: nemesis_io_helper.C:1225
libMesh::Nemesis_IO_Helper::num_proc_in_file
int num_proc_in_file
The number of processors for which the NEMESIS I file stores information.
Definition: nemesis_io_helper.h:388
libMesh::ExodusII_IO_Helper::_global_vars_initialized
bool _global_vars_initialized
Definition: exodusII_io_helper.h:722
libMesh::Nemesis_IO_Helper::write_exodus_initialization_info
void write_exodus_initialization_info(const MeshBase &pmesh, const std::string &title)
This function writes exodus-specific initialization information.
Definition: nemesis_io_helper.C:933
libMesh::Nemesis_IO_Helper::num_global_node_counts
std::vector< int > num_global_node_counts
Definition: nemesis_io_helper.h:417
libMesh::ExodusII_IO_Helper::read_sideset
void read_sideset(int id, int offset)
Reads information about sideset id and inserts it into the global sideset array at the position offse...
Definition: exodusII_io_helper.C:1086
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::ExodusII_IO_Helper::node_sets_node_list
std::vector< int > node_sets_node_list
Definition: exodusII_io_helper.h:577
libMesh::ExodusII_IO_Helper::read_num_time_steps
void read_num_time_steps()
Reads the number of timesteps currently stored in the Exodus file and stores it in the num_time_steps...
Definition: exodusII_io_helper.C:1283
libMesh::TET4
Definition: enum_elem_type.h:45
libMesh::Nemesis_IO_Helper::compute_elem_communication_maps
void compute_elem_communication_maps()
This function computes element communication maps (really just packs vectors) in preparation for writ...
Definition: nemesis_io_helper.C:995
libMesh::PRISM15
Definition: enum_elem_type.h:51
libMesh::ExodusII_IO_Helper::num_dim
int num_dim
Definition: exodusII_io_helper.h:498
libMesh::Nemesis_IO_Helper::ftype
char ftype
The type of file to be written.
Definition: nemesis_io_helper.h:395
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::Nemesis_IO_Helper::global_nodeset_ids
std::vector< int > global_nodeset_ids
Containers for reading global nodeset information.
Definition: nemesis_io_helper.h:416
libMesh::Nemesis_IO_Helper::elem_cmap_elem_ids
std::vector< std::vector< int > > elem_cmap_elem_ids
3 vectors of vectors for storing element communication IDs for this processor.
Definition: nemesis_io_helper.h:565
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::HEX27
Definition: enum_elem_type.h:49
libMesh::NumericVector::localize
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
libMesh::Nemesis_IO_Helper::global_elem_blk_cnts
std::vector< int > global_elem_blk_cnts
Definition: nemesis_io_helper.h:427
libMesh::Nemesis_IO_Helper::num_elem_cmaps
int num_elem_cmaps
The number of elemental communication maps for this processor.
Definition: nemesis_io_helper.h:494
libMesh::ExodusII_IO_Helper::ss_ids
std::vector< int > ss_ids
Definition: exodusII_io_helper.h:550
libMesh::Nemesis_IO_Helper::node_mape
std::vector< int > node_mape
Vector which stores external node IDs.
Definition: nemesis_io_helper.h:533
libMesh::ExodusII_IO_Helper::elem_var_names
std::vector< std::string > elem_var_names
Definition: exodusII_io_helper.h:645
libMesh::ParallelObject::n_processors
processor_id_type n_processors() const
Definition: parallel_object.h:100
libMesh::Nemesis_IO_Helper::node_cmap_proc_ids
std::vector< std::vector< int > > node_cmap_proc_ids
Definition: nemesis_io_helper.h:557
libMesh::ExodusII_IO_Helper::num_edge_blk
int num_edge_blk
Definition: exodusII_io_helper.h:520
libMesh::Nemesis_IO_Helper::proc_nodes_touched_intersections
std::map< unsigned, std::set< unsigned > > proc_nodes_touched_intersections
Another map to store sets of intersections with each other processor (other than ourself,...
Definition: nemesis_io_helper.h:588
libMesh::Nemesis_IO_Helper::internal_elem_ids
std::set< unsigned > internal_elem_ids
A set of internal elem IDs for this processor.
Definition: nemesis_io_helper.h:613
libMesh::ExodusII_IO_Helper::num_sideset_vars
int num_sideset_vars
Definition: exodusII_io_helper.h:504
libMesh::ExodusII_IO_Helper::title
std::vector< char > title
Definition: exodusII_io_helper.h:611
libMesh::Nemesis_IO_Helper::put_node_cmap
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.
Definition: nemesis_io_helper.C:600
node_set
std::unordered_set< const Node * > & node_set
Definition: mesh_tools.C:2135
libMesh::ExodusII_IO_Helper::nodeset_ids
std::vector< int > nodeset_ids
Definition: exodusII_io_helper.h:553
libMesh::Nemesis_IO_Helper::elem_mapi
std::vector< int > elem_mapi
Vector which stores internal element IDs.
Definition: nemesis_io_helper.h:503
libMesh::Nemesis_IO_Helper::put_ss_param_global
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.
Definition: nemesis_io_helper.C:530
libMesh::ExodusII_IO_Helper::_use_mesh_dimension_instead_of_spatial_dimension
bool _use_mesh_dimension_instead_of_spatial_dimension
Definition: exodusII_io_helper.h:730
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::ExodusII_IO_Helper::write_var_names_impl
void write_var_names_impl(const char *var_type, int &count, const std::vector< std::string > &names)
write_var_names() dispatches to this function.
Definition: exodusII_io_helper.C:1438
libMesh::ExodusII_IO_Helper::_elem_vars_initialized
bool _elem_vars_initialized
Definition: exodusII_io_helper.h:719
libMesh::ExodusII_IO_Helper::id_to_edge_block_names
std::map< int, std::string > id_to_edge_block_names
Definition: exodusII_io_helper.h:658
libMesh::ExodusII_IO_Helper::num_df_per_set
std::vector< int > num_df_per_set
Definition: exodusII_io_helper.h:562
libMesh::QUAD4
Definition: enum_elem_type.h:41
libMesh::ExodusII_IO_Helper::Conversion::get_side_map
int get_side_map(int i) const
Definition: exodusII_io_helper.C:3281
libMesh::ParallelObject::_communicator
const Parallel::Communicator & _communicator
Definition: parallel_object.h:112
libMesh::ConstElemRange
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
libMesh::TRI3
Definition: enum_elem_type.h:39
libMesh::ExodusII_IO_Helper::num_elem_this_blk
int num_elem_this_blk
Definition: exodusII_io_helper.h:529
libMesh::Nemesis_IO_Helper::node_cmap_ids
std::vector< int > node_cmap_ids
Vectors for storing the communication map parameters.
Definition: nemesis_io_helper.h:542
libMesh::ExodusII_IO_Helper::num_node_sets
int num_node_sets
Definition: exodusII_io_helper.h:523
libMesh::ExodusII_IO_Helper::num_elem
int num_elem
Definition: exodusII_io_helper.h:510
libMesh::ExodusII_IO_Helper::exodus_elem_num_to_libmesh
std::vector< int > exodus_elem_num_to_libmesh
Definition: exodusII_io_helper.h:619
libMesh::Nemesis_IO_Helper::compute_node_maps
void compute_node_maps()
Compute the node maps (really just pack vectors) which map the nodes to internal, border,...
Definition: nemesis_io_helper.C:1046
libMesh::Nemesis_IO_Helper::elem_cmap_ids
std::vector< int > elem_cmap_ids
Definition: nemesis_io_helper.h:544
libMesh::ExodusII_IO_Helper::_write_as_dimension
unsigned _write_as_dimension
Definition: exodusII_io_helper.h:734
libMesh::Nemesis_IO_Helper::num_nodes_global
int num_nodes_global
Global initial information.
Definition: nemesis_io_helper.h:371
libMesh::ExodusII_IO_Helper::num_attr
int num_attr
Definition: exodusII_io_helper.h:535
n_nodes
const dof_id_type n_nodes
Definition: tecplot_io.C:68
libMesh::ExodusII_IO_Helper::elem_type
std::vector< char > elem_type
Definition: exodusII_io_helper.h:614
libMesh::Nemesis_IO_Helper::num_elem_blks_global
int num_elem_blks_global
Definition: nemesis_io_helper.h:373
libMesh::ExodusII_IO_Helper::element_equivalence_map
std::map< std::string, ElemType > element_equivalence_map
Defines equivalence classes of Exodus element types that map to libmesh ElemTypes.
Definition: exodusII_io_helper.h:816
libMesh::ExodusII_IO_Helper::read_sideset_info
void read_sideset_info()
Reads information about all of the sidesets in the ExodusII mesh file.
Definition: exodusII_io_helper.C:1022
libMesh::Nemesis_IO_Helper::local_subdomain_counts
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.
Definition: nemesis_io_helper.h:575
libMesh::Nemesis_IO_Helper::node_mapb
std::vector< int > node_mapb
Vector which stores border node IDs.
Definition: nemesis_io_helper.h:526
libMesh::ExodusII_IO_Helper::NODAL
Definition: exodusII_io_helper.h:692
libMesh::Nemesis_IO_Helper::nemesis_err_flag
int nemesis_err_flag
Member data.
Definition: nemesis_io_helper.h:365
libMesh::ExodusII_IO_Helper::id_list
std::vector< int > id_list
Definition: exodusII_io_helper.h:593
libMesh::ExodusII_IO_Helper::write_nodal_values
void write_nodal_values(int var_id, const std::vector< Real > &values, int timestep)
Writes the vector of values to a nodal variable.
Definition: exodusII_io_helper.C:3070
libMesh::ExodusII_IO_Helper::num_time_steps
int num_time_steps
Definition: exodusII_io_helper.h:627
libMesh::ExodusII_IO_Helper::close
void close()
Closes the ExodusII mesh file.
Definition: exodusII_io_helper.C:1228
libMesh::Nemesis_IO_Helper::proc_border_elem_sets
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.
Definition: nemesis_io_helper.h:598
libMesh::ExodusII_IO_Helper::SIDESET
Definition: exodusII_io_helper.h:692
libMesh::Nemesis_IO_Helper::nodes_attached_to_local_elems
std::set< int > nodes_attached_to_local_elems
libMesh numbered node ids attached to local elems.
Definition: nemesis_io_helper.h:432
libMesh::Nemesis_IO_Helper::border_node_ids
std::set< unsigned > border_node_ids
The set which will eventually contain the IDs of "border nodes".
Definition: nemesis_io_helper.h:581
libMesh::ExodusII_IO_Helper::read_var_names
void read_var_names(ExodusVarType type)
Definition: exodusII_io_helper.C:1344
libMesh::ExodusII_IO_Helper::ELEMENTAL
Definition: exodusII_io_helper.h:692
libMesh::ExodusII_IO_Helper::exodus_node_num_to_libmesh
std::vector< int > exodus_node_num_to_libmesh
Definition: exodusII_io_helper.h:624
libMesh::TRI6
Definition: enum_elem_type.h:40
distance
Real distance(const Point &p)
Definition: subdomains_ex3.C:50
libMesh::ExodusII_IO_Helper::z
std::vector< Real > z
Definition: exodusII_io_helper.h:608
libMesh::Nemesis_IO_Helper::put_init_info
void put_init_info(unsigned num_proc, unsigned num_proc_in_file, const char *ftype)
Writing functions.
Definition: nemesis_io_helper.C:461
libMesh::Nemesis_IO_Helper::proc_border_elem_sets_iterator
std::map< unsigned, std::set< std::pair< unsigned, unsigned > > >::iterator proc_border_elem_sets_iterator
Typedef for an iterator into the data structure above.
Definition: nemesis_io_helper.h:603
swap
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
Definition: variant_filter_iterator.h:478
libMesh::ExodusII_IO_Helper::num_nodes_per_set
std::vector< int > num_nodes_per_set
Definition: exodusII_io_helper.h:559
libMesh::ExodusII_IO_Helper::id_to_block_names
std::map< int, std::string > id_to_block_names
Definition: exodusII_io_helper.h:657
libMesh::ExodusII_IO_Helper::num_elem_blk
int num_elem_blk
Definition: exodusII_io_helper.h:513
libMesh::Nemesis_IO_Helper::num_global_side_counts
std::vector< int > num_global_side_counts
Definition: nemesis_io_helper.h:405
value
static const bool value
Definition: xdr_io.C:56
libMesh::Nemesis_IO_Helper::num_node_cmaps
int num_node_cmaps
The number of nodal communication maps for this processor.
Definition: nemesis_io_helper.h:487
libMesh::QUADSHELL8
Definition: enum_elem_type.h:73
libMesh::PYRAMID5
Definition: enum_elem_type.h:53
libMesh::ExodusII_IO_Helper::elem_list
std::vector< int > elem_list
Definition: exodusII_io_helper.h:584
libMesh::Nemesis_IO_Helper::internal_node_ids
std::set< unsigned > internal_node_ids
A set of internal node IDs for this processor.
Definition: nemesis_io_helper.h:608
libMesh::ExodusII_IO_Helper::verbose
bool verbose
Definition: exodusII_io_helper.h:663
libMesh::EDGE3
Definition: enum_elem_type.h:36
libMesh::ExodusII_IO_Helper::node_sets_node_index
std::vector< int > node_sets_node_index
Definition: exodusII_io_helper.h:569
libMesh::QUADSHELL4
Definition: enum_elem_type.h:72
libMesh::ExodusII_IO_Helper::nodal_var_values
std::vector< Real > nodal_var_values
Definition: exodusII_io_helper.h:639
libMesh::Nemesis_IO_Helper::put_loadbal_param
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...
Definition: nemesis_io_helper.C:550
libMesh::ExodusII_IO_Helper::num_elem_vars
int num_elem_vars
Definition: exodusII_io_helper.h:642
libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks
void compute_num_global_elem_blocks(const MeshBase &pmesh)
This function uses global communication routines to determine the number of element blocks across the...
Definition: nemesis_io_helper.C:1567
libMesh::Nemesis_IO_Helper::put_init_global
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 ....
Definition: nemesis_io_helper.C:477
libMesh::NODEELEM
Definition: enum_elem_type.h:66
data
IterBase * data
Ideally this private member data should have protected access.
Definition: variant_filter_iterator.h:337
libMesh::Nemesis_IO_Helper::num_internal_elems
int num_internal_elems
The number of internal FEM elements.
Definition: nemesis_io_helper.h:473
libMesh::ExodusII_IO_Helper::message
void message(const std::string &msg)
Prints the message defined in msg.
Definition: exodusII_io_helper.C:403
libMesh::QUAD9
Definition: enum_elem_type.h:43
libMesh::ExodusII_IO_Helper::sideset_var_names
std::vector< std::string > sideset_var_names
Definition: exodusII_io_helper.h:654
libMesh::err
OStreamProxy err
libMesh::ExodusII_IO_Helper::GLOBAL
Definition: exodusII_io_helper.h:692
libMesh::ExodusII_IO_Helper::node_list
std::vector< int > node_list
Definition: exodusII_io_helper.h:590
libMesh::ExodusII_IO_Helper::connect
std::vector< int > connect
Definition: exodusII_io_helper.h:547
libMesh::SCALAR
Definition: enum_fe_family.h:58
libMesh::Nemesis_IO_Helper::compute_node_communication_maps
void compute_node_communication_maps()
Compute the node communication maps (really just pack vectors) in preparation for writing them to fil...
Definition: nemesis_io_helper.C:1075
libMesh::TRI3SUBDIVISION
Definition: enum_elem_type.h:69
libMesh::ExodusII_IO_Helper::node_sets_dist_fact
std::vector< Real > node_sets_dist_fact
Definition: exodusII_io_helper.h:581
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::Nemesis_IO_Helper::num_global_side_df_counts
std::vector< int > num_global_side_df_counts
Definition: nemesis_io_helper.h:406
libMesh::ExodusII_IO_Helper::inquire
int inquire(int req_info, std::string error_msg="")
Definition: exodusII_io_helper.C:1247
libMesh::PRISM18
Definition: enum_elem_type.h:52
libMesh::Nemesis_IO_Helper::subdomain_map
std::map< subdomain_id_type, std::vector< dof_id_type > > subdomain_map
Map of subdomains to element numbers.
Definition: nemesis_io_helper.h:437
libMesh::TRISHELL3
Definition: enum_elem_type.h:71
libMesh::Elem::build
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:246
libMesh::ExodusII_IO_Helper::num_edge
int num_edge
Definition: exodusII_io_helper.h:516
libMesh::out
OStreamProxy out
libMesh::ExodusII_IO_Helper::time_steps
std::vector< Real > time_steps
Definition: exodusII_io_helper.h:630
libMesh::Nemesis_IO_Helper::node_cmap_node_ids
std::vector< std::vector< int > > node_cmap_node_ids
2 vectors of vectors for storing the node communication IDs for this processor.
Definition: nemesis_io_helper.h:556
libMesh::ExodusII_IO_Helper::x
std::vector< Real > x
Definition: exodusII_io_helper.h:602
libMesh::Nemesis_IO_Helper::num_global_node_df_counts
std::vector< int > num_global_node_df_counts
Definition: nemesis_io_helper.h:418
libMesh::Nemesis_IO_Helper::block_id_to_elem_connectivity
std::map< int, std::vector< int > > block_id_to_elem_connectivity
This is the block connectivity, i.e.
Definition: nemesis_io_helper.h:443
libMesh::ExodusII_IO_Helper::_nodal_vars_initialized
bool _nodal_vars_initialized
Definition: exodusII_io_helper.h:725
libMesh::ExodusII_IO_Helper::ex_err
int ex_err
Definition: exodusII_io_helper.h:495
libMesh::ExodusII_IO_Helper::num_elem_all_sidesets
int num_elem_all_sidesets
Definition: exodusII_io_helper.h:538
libMesh::Nemesis_IO_Helper::put_eb_info_global
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...
Definition: nemesis_io_helper.C:496
libMesh::Nemesis_IO_Helper::build_element_and_node_maps
void build_element_and_node_maps(const MeshBase &pmesh)
This function builds the libmesh -> exodus and exodus -> libmesh node and element maps.
Definition: nemesis_io_helper.C:1667
libMesh::ExodusII_IO_Helper::read_var_names_impl
void read_var_names_impl(const char *var_type, int &count, std::vector< std::string > &result)
read_var_names() dispatches to this function.
Definition: exodusII_io_helper.C:1367
libMesh::PYRAMID13
Definition: enum_elem_type.h:54
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::PYRAMID14
Definition: enum_elem_type.h:55
libMesh::EDGE2
Definition: enum_elem_type.h:35
libMesh::BoundaryInfo::BCTuple
std::tuple< dof_id_type, unsigned short int, boundary_id_type > BCTuple
As above, but the library creates and fills in a vector of (elem-id, side-id, bc-id) triplets and ret...
Definition: boundary_info.h:704
libMesh::QUAD8
Definition: enum_elem_type.h:42
libMesh::ExodusII_IO_Helper::ex_id
int ex_id
Definition: exodusII_io_helper.h:492
libMesh::ExodusII_IO_Helper::elem_num_map
std::vector< int > elem_num_map
Definition: exodusII_io_helper.h:599
libMesh::Nemesis_IO_Helper::num_border_elems
int num_border_elems
The number of border FEM elements.
Definition: nemesis_io_helper.h:480