Poster of Linux kernelThe best gift for a Linux geek
ExodusII_IO_Helper

ExodusII_IO_Helper

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

ExodusII_IO_Helper -  

SYNOPSIS


#include <exodusII_io_helper.h>

Inherited by Nemesis_IO_Helper.  

Classes


class Conversion

class ElementMaps
 

Public Member Functions


ExodusII_IO_Helper (bool v=false)

virtual ~ExodusII_IO_Helper ()

bool created ()

void verbose (bool set_verbosity)

int get_num_dim () const

int get_num_nodes () const

int get_num_elem () const

int get_num_elem_blk () const

int get_num_elem_this_blk () const

int get_num_nodes_per_elem () const

int get_num_side_sets () const

int get_num_node_sets () const

int get_connect (int i) const

int get_num_sides_per_set (int i) const

int get_num_nodes_per_set (int i) const

const std::vector< int > & get_elem_list () const

const std::vector< int > & get_side_list () const

const std::vector< int > & get_node_list () const

int get_nodeset_id (unsigned int i) const

const std::vector< int > & get_id_list () const

const char * get_elem_type () const

double get_x (int i) const

double get_y (int i) const

double get_z (int i) const

void open (const char *filename)

void read_header ()

void print_header ()

void read_nodes ()

void read_node_num_map ()

void print_nodes ()

void read_block_info ()

int get_block_id (int block)

void read_elem_in_block (int block)

void read_elem_num_map ()

void read_sideset_info ()

void read_nodeset_info ()

void read_sideset (int id, int offset)

void read_nodeset (int id)

void print_sideset_info ()

void print_nodeset_info ()

void close ()

int inquire (int req_info, std::string error_msg='')

const std::vector< double > & get_time_steps ()

int get_num_nodal_vars ()

const std::vector< std::string > & get_nodal_var_names ()

const std::vector< double > & get_nodal_var_values (std::string nodal_var_name, int time_step)

void create (std::string filename)

void initialize (std::string title, const MeshBase &mesh)

void write_nodal_coordinates (const MeshBase &mesh)

void write_elements (const MeshBase &mesh)

void write_sidesets (const MeshBase &mesh)

void write_nodesets (const MeshBase &mesh)

void initialize_nodal_variables (std::vector< std::string > names)

void write_timestep (int timestep, double time)

void write_nodal_values (int var_id, const std::vector< Number > &values, int timestep)

void check_err (const int error, const std::string msg)

void message (const std::string msg)

void message (const std::string msg, int i)
 

Public Attributes


int comp_ws

int io_ws

int ex_id

int ex_err

int num_dim

int num_nodes

int num_elem

int num_elem_blk

int num_node_sets

int num_side_sets

int num_elem_this_blk

int num_nodes_per_elem

int num_attr

int req_info

int ret_int

int num_elem_all_sidesets

std::vector< int > block_ids

std::vector< int > connect

std::vector< int > ss_ids

std::vector< int > nodeset_ids

std::vector< int > num_sides_per_set

std::vector< int > num_nodes_per_set

std::vector< int > num_df_per_set

std::vector< int > num_node_df_per_set

std::vector< int > elem_list

std::vector< int > side_list

std::vector< int > node_list

std::vector< int > id_list

std::vector< int > node_num_map

std::vector< int > elem_num_map

float ex_version

float ret_float

std::vector< double > x

std::vector< double > y

std::vector< double > z

char ret_char

std::vector< char > title

std::vector< char > elem_type

std::map< int, int > libmesh_elem_num_to_exodus

int num_time_steps

std::vector< double > time_steps

int num_nodal_vars

std::vector< std::string > nodal_var_names

std::vector< double > nodal_var_values

std::vector< std::vector< char > > vvc

std::vector< char * > strings
 

Protected Attributes


bool _created

bool _verbose
 

Detailed Description

This is the ExodusII_IO_Helper class. This class hides the implementation details of interfacing with the Exodus binary format.

Author:

Johw W. Peterson, 2002.

Definition at line 46 of file exodusII_io_helper.h.  

Constructor & Destructor Documentation

 

ExodusII_IO_Helper::ExodusII_IO_Helper (boolv = false) [inline]Constructor. Automatically initializes all the private members of the class. Also allows you to set the verbosity level to v=1 (on) or v=0 (off).

Definition at line 55 of file exodusII_io_helper.h.

References elem_type, and title.

                                   : 
    comp_ws(sizeof(double)),
    io_ws(0),
    ex_id(0),
    ex_err(0),
    num_dim(0),
    num_nodes(0),
    num_elem(0),
    num_elem_blk(0),
    num_node_sets(0),
    num_side_sets(0),
    num_elem_this_blk(0),
    num_nodes_per_elem(0),
    num_attr(0),
    req_info(0),
    ret_int(0),
    num_elem_all_sidesets(0),
    ex_version(0.0),
    ret_float(0.0),
    ret_char(0),
    num_time_steps(0),
    _created(false),
    _verbose(v)

  {
    title.resize(MAX_LINE_LENGTH+1);
    elem_type.resize(MAX_STR_LENGTH);
  }
 

ExodusII_IO_Helper::~ExodusII_IO_Helper () [virtual]Destructor. The only memory allocated is for title and elem_type. This memory is freed in the destructor.

Definition at line 105 of file exodusII_io_helper.C.

{
}
 

Member Function Documentation

 

void ExodusII_IO_Helper::check_err (const interror, const std::stringmsg)All of the ExodusII API functions return an int error value. This function checks to see if the error has been set, and if it has, prints the error message contained in msg.

Definition at line 116 of file exodusII_io_helper.C.

Referenced by close(), create(), Nemesis_IO_Helper::get_cmap_params(), Nemesis_IO_Helper::get_eb_info_global(), Nemesis_IO_Helper::get_elem_cmap(), Nemesis_IO_Helper::get_elem_map(), Nemesis_IO_Helper::get_init_global(), Nemesis_IO_Helper::get_init_info(), Nemesis_IO_Helper::get_loadbal_param(), Nemesis_IO_Helper::get_node_cmap(), Nemesis_IO_Helper::get_node_map(), Nemesis_IO_Helper::get_ns_param_global(), Nemesis_IO_Helper::get_ss_param_global(), initialize(), initialize_nodal_variables(), inquire(), open(), read_block_info(), read_elem_in_block(), read_elem_num_map(), read_header(), read_node_num_map(), read_nodes(), read_nodeset(), read_nodeset_info(), read_sideset(), read_sideset_info(), write_elements(), write_nodal_coordinates(), write_nodal_values(), write_nodesets(), write_sidesets(), and write_timestep().

{
  if (err < 0)
    {
      std::cout << msg << std::endl;
      libmesh_error();
    }
}
 

void ExodusII_IO_Helper::close ()Closes the ExodusII mesh file.

Definition at line 435 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, and message().

Referenced by ExodusII_IO::~ExodusII_IO().

{
  ex_err = exII::ex_close(ex_id);
  check_err(ex_err, 'Error closing Exodus file.');
  message('Exodus file closed successfully.'); 
}
 

void ExodusII_IO_Helper::create (std::stringfilename)Opens an ExodusII mesh file named filename for writing.

Definition at line 538 of file exodusII_io_helper.C.

References _created, _verbose, check_err(), comp_ws, ex_id, ex_version, and io_ws.

{
  //Store things as doubles
  comp_ws = 8;
  io_ws = 8;
    
  ex_id = exII::ex_create(filename.c_str(), EX_CLOBBER, &comp_ws, &io_ws);
    
  ex_id = exII::ex_open(filename.c_str(),
                        EX_WRITE,
                        &comp_ws,
                        &io_ws,
                        &ex_version);
  
  check_err(ex_id, 'Error creating ExodusII mesh file.');
  if (_verbose) std::cout << 'File created successfully.' << std::endl;

  _created = true;
}
 

bool ExodusII_IO_Helper::created ()Returns true once create() has been successfully called, and false otherwise.

Definition at line 819 of file exodusII_io_helper.C.

References _created.

{
  return _created;
}
 

int ExodusII_IO_Helper::get_block_id (intblock)Get's the block number for the given block.

Definition at line 256 of file exodusII_io_helper.C.

References block_ids.

Referenced by ExodusII_IO::read().

{
  libmesh_assert (static_cast<unsigned int>(block) < block_ids.size());
    
  return block_ids[block];
}
 

int ExodusII_IO_Helper::get_connect (inti) const [inline]Returns:

the number of elements in all the sidesets. Effectively returns the total number of elements on the ExodusII mesh boundary.

the $ i^{th} $ node number in the element connectivity list for a given element.

Definition at line 174 of file exodusII_io_helper.h.

References connect.

Referenced by ExodusII_IO::read().

{ return connect[i]; }
 

const std::vector<int>& ExodusII_IO_Helper::get_elem_list () const [inline]Returns:

the $ i^{th} $ entry in the element list. The element list contains the numbers of all elements on the boundary.

a constant reference to the elem_list.

Definition at line 202 of file exodusII_io_helper.h.

References elem_list.

Referenced by ExodusII_IO::read().

{ return elem_list; }
 

const char* ExodusII_IO_Helper::get_elem_type () const [inline]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 249 of file exodusII_io_helper.h.

References elem_type.

Referenced by ExodusII_IO::read().

{ return &elem_type[0]; }
 

const std::vector<int>& ExodusII_IO_Helper::get_id_list () const [inline]Returns:

the $ i^{th} $ entry in the id list. This is the id for the ith face on the boundary.

a constant reference to the id_list.

Definition at line 239 of file exodusII_io_helper.h.

References id_list.

Referenced by ExodusII_IO::read().

{ return id_list; }
 

const std::vector< std::string > & ExodusII_IO_Helper::get_nodal_var_names ()

Definition at line 464 of file exodusII_io_helper.C.

References _verbose, ex_id, nodal_var_names, num_nodal_vars, strings, and vvc.

Referenced by get_nodal_var_values().

{
  // Allocate enough space for our variable name strings.
  nodal_var_names.resize(num_nodal_vars);
    
  // Use the vvc and strings objects to emulate the behavior of
  // a char** object.
  vvc.resize(num_nodal_vars);
  strings.resize(num_nodal_vars);
  for (int i=0;i<num_nodal_vars;i++)
    vvc[i].resize(MAX_STR_LENGTH+1);

  for (int i=0;i<num_nodal_vars;i++)
    strings[i]=&(vvc[i][0]); // set pointer into vvc only *after* all resizing is complete
    
  exII::ex_get_var_names(ex_id,
                         'n',
                         num_nodal_vars,
                         &strings[0]//var_names
                         );

  if (_verbose)
    {
      std::cout << 'Read the variable(s) from the file:' << std::endl;
      for (int i=0; i<num_nodal_vars; i++)
        std::cout << 'strings[' << i << ']=' << strings[i] << std::endl;
    }

  
  // Copy the char buffers into strings.  
  for (int i=0;i<num_nodal_vars;i++)
    nodal_var_names[i]=strings[i]; // calls string::op=(const char*)

  
  return nodal_var_names;
}
 

const std::vector< double > & ExodusII_IO_Helper::get_nodal_var_values (std::stringnodal_var_name, inttime_step)

Definition at line 504 of file exodusII_io_helper.C.

References ex_id, get_nodal_var_names(), nodal_var_names, nodal_var_values, and num_nodes.

{
  nodal_var_values.resize(num_nodes);
    
  this->get_nodal_var_names();

  //See if we can find the variable we are looking for
  unsigned int var_index = 0;
  bool found = false;

  found = nodal_var_names[var_index] == nodal_var_name;
    
  while(!found && var_index < nodal_var_names.size())
    {
      var_index++;
      found = nodal_var_names[var_index] == nodal_var_name;
    }

  if(!found)
    {
      std::cerr << 'Unable to locate variable named: ' << nodal_var_name << std::endl;
      return nodal_var_values;
    }

  exII::ex_get_nodal_var(ex_id, time_step, var_index+1, num_nodes, &nodal_var_values[0]);
  
  return nodal_var_values;
}
 

const std::vector<int>& ExodusII_IO_Helper::get_node_list () const [inline]Returns:

a constant reference to the node_list.

Definition at line 222 of file exodusII_io_helper.h.

References node_list.

Referenced by ExodusII_IO::read().

{ return node_list; }
 

int ExodusII_IO_Helper::get_nodeset_id (unsigned inti) const [inline]Returns:

the nodeset id corresponding to the ith nodeset.

Definition at line 227 of file exodusII_io_helper.h.

References nodeset_ids.

Referenced by ExodusII_IO::read().

{ return nodeset_ids[i]; }
 

int ExodusII_IO_Helper::get_num_dim () const [inline]Returns:

the ExodusII mesh dimension.

Definition at line 107 of file exodusII_io_helper.h.

References num_dim.

{ return num_dim; }
 

int ExodusII_IO_Helper::get_num_elem () const [inline]Returns:

the total number of elements in the ExodusII mesh.

Definition at line 120 of file exodusII_io_helper.h.

References num_elem.

Referenced by ExodusII_IO::read().

{ return num_elem; }
 

int ExodusII_IO_Helper::get_num_elem_blk () const [inline]Returns:

the total number of element blocks in the ExodusII mesh.

Definition at line 127 of file exodusII_io_helper.h.

References num_elem_blk.

Referenced by ExodusII_IO::read().

{ return num_elem_blk; }
 

int ExodusII_IO_Helper::get_num_elem_this_blk () const [inline]For a given block, returns the total number of elements.

Definition at line 134 of file exodusII_io_helper.h.

References num_elem_this_blk.

Referenced by ExodusII_IO::read().

{ return num_elem_this_blk; }
 

int ExodusII_IO_Helper::get_num_nodal_vars () [inline]

Definition at line 407 of file exodusII_io_helper.h.

References num_nodal_vars.

{ return num_nodal_vars; }
 

int ExodusII_IO_Helper::get_num_node_sets () const [inline]Returns:

the total number of nodesets in the ExodusII mesh.

Definition at line 157 of file exodusII_io_helper.h.

References num_node_sets.

Referenced by ExodusII_IO::read().

{ return num_node_sets; }
 

int ExodusII_IO_Helper::get_num_nodes () const [inline]Returns:

the total number of nodes in the ExodusII mesh.

Definition at line 113 of file exodusII_io_helper.h.

References num_nodes.

Referenced by ExodusII_IO::read().

{ return num_nodes; }
 

int ExodusII_IO_Helper::get_num_nodes_per_elem () const [inline]Returns:

the number of nodes per element in a given block. e.g. for HEX27 it returns 27.

Definition at line 142 of file exodusII_io_helper.h.

References num_nodes_per_elem.

Referenced by ExodusII_IO::read().

{ return num_nodes_per_elem; }
 

int ExodusII_IO_Helper::get_num_nodes_per_set (inti) const [inline]For a single nodeset, returns the total number of nodes in the nodeset.

Definition at line 188 of file exodusII_io_helper.h.

References num_nodes_per_set.

{ return num_nodes_per_set[i]; }
 

int ExodusII_IO_Helper::get_num_side_sets () const [inline]Returns:

the total number of sidesets in the ExodusII mesh. Each sideset contains only one type of element.

Definition at line 150 of file exodusII_io_helper.h.

References num_side_sets.

Referenced by ExodusII_IO::read().

{ return num_side_sets; }
 

int ExodusII_IO_Helper::get_num_sides_per_set (inti) const [inline]For a single sideset, returns the total number of elements in the sideset.

Definition at line 181 of file exodusII_io_helper.h.

References num_sides_per_set.

Referenced by ExodusII_IO::read().

{ return num_sides_per_set[i]; }
 

const std::vector<int>& ExodusII_IO_Helper::get_side_list () const [inline]Returns:

the $ i^{th} $ entry in the side list. This is effectively the 'side' (face in 3D or edge in 2D) number which lies on the boundary.

a constant reference to the side_list.

Definition at line 217 of file exodusII_io_helper.h.

References side_list.

Referenced by ExodusII_IO::read().

{ return side_list; }
 

const std::vector< double > & ExodusII_IO_Helper::get_time_steps ()

Definition at line 455 of file exodusII_io_helper.C.

References ex_id, num_time_steps, and time_steps.

{
  time_steps.resize(num_time_steps);
  exII::ex_get_all_times(ex_id, time_steps.empty() ? NULL : &time_steps[0]);
  return time_steps;
}
 

double ExodusII_IO_Helper::get_x (inti) const [inline]Returns:

the $ i^{th} $ node's x-coordinate.

Definition at line 255 of file exodusII_io_helper.h.

References x.

Referenced by ExodusII_IO::read().

{ return x[i]; }
 

double ExodusII_IO_Helper::get_y (inti) const [inline]Returns:

the $ i^{th} $ node's y-coordinate.

Definition at line 261 of file exodusII_io_helper.h.

References y.

Referenced by ExodusII_IO::read().

{ return y[i]; }
 

double ExodusII_IO_Helper::get_z (inti) const [inline]Returns:

the $ i^{th} $ node's z-coordinate.

Definition at line 267 of file exodusII_io_helper.h.

References z.

Referenced by ExodusII_IO::read().

{ return z[i]; }
 

void ExodusII_IO_Helper::initialize (std::stringtitle, const MeshBase &mesh)Initializes the Exodus file

Definition at line 560 of file exodusII_io_helper.C.

References MeshBase::boundary_info, check_err(), MeshBase::elem(), ex_err, ex_id, DofObject::id(), MeshBase::n_elem(), MeshBase::n_nodes(), num_dim, num_elem, num_elem_blk, num_node_sets, num_nodes, num_side_sets, MeshBase::spatial_dimension(), and Elem::subdomain_id().

{
  num_dim = mesh.spatial_dimension();
  num_nodes = mesh.n_nodes();
  num_elem = mesh.n_elem();

  std::vector<short int> unique_side_boundaries;
  std::vector<short int> unique_node_boundaries;

  mesh.boundary_info->build_side_boundary_ids(unique_side_boundaries);
  mesh.boundary_info->build_node_boundary_ids(unique_node_boundaries);

  num_side_sets = unique_side_boundaries.size();
  num_node_sets = unique_node_boundaries.size();
  
  //loop through element and map between block and element vector
  std::map<subdomain_id_type, std::vector<unsigned int>  > subdomain_map;
  for(int i=0;i<num_elem;i++)
    {
      Elem * elem = mesh.elem(i);
      subdomain_id_type cur_subdomain = elem->subdomain_id();
     
      subdomain_map[cur_subdomain].push_back(elem->id());
    }
  num_elem_blk = subdomain_map.size();

  std::cout<<'Num elem block: '<<num_elem_blk<<std::endl;

  ex_err = exII::ex_put_init(ex_id,
                             str_title.c_str(),
                             num_dim,
                             num_nodes,
                             num_elem,
                             num_elem_blk,
                             num_node_sets,
                             num_side_sets);
    
  check_err(ex_err, 'Error initializing new Exodus file.');
}
 

void ExodusII_IO_Helper::initialize_nodal_variables (std::vector< std::string >names)Sets up the nodal variables

Definition at line 762 of file exodusII_io_helper.C.

References _verbose, check_err(), ex_err, ex_id, num_nodal_vars, strings, and vvc.

{
  num_nodal_vars = names.size();

  ex_err = exII::ex_put_var_param(ex_id, 'n', num_nodal_vars);
  check_err(ex_err, 'Error setting number of nodal vars.');

  // Use the vvc and strings objects to emulate the behavior of
  // a char** object.
  vvc.resize(num_nodal_vars);
  strings.resize(num_nodal_vars);

  // For each string in names, allocate enough space in vvc and copy from
  // the C++ string into vvc for passing to the C interface.
  for (int i=0; i<num_nodal_vars; i++)
    {
      vvc[i].resize(names[i].size()+1);
      std::strcpy(&(vvc[i][0]), names[i].c_str());
    }

  for (int i=0; i<num_nodal_vars; i++)
    strings[i] = &(vvc[i][0]); // set pointer into vvc only *after* all resizing is complete

  if (_verbose)
    {
      std::cout << 'Writing variable name(s) to file: ' << std::endl;
      for (int i=0;i<num_nodal_vars;i++)
        std::cout << 'strings[' << i << ']=' << strings[i] << std::endl;
    }
    
  ex_err = exII::ex_put_var_names(ex_id,
                                  'n',
                                  num_nodal_vars,
                                  &strings[0]//var_names
                                  );
    
  check_err(ex_err, 'Error setting nodal variable names.');
}
 

int ExodusII_IO_Helper::inquire (intreq_info, std::stringerror_msg = '')Generic inquiry, returns the value

Definition at line 442 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, ret_char, ret_float, and ret_int.

Referenced by read_header().

{
  ex_err = exII::ex_inquire(ex_id,
                            req_info,
                            &ret_int,
                            &ret_float,
                            &ret_char);
    
  check_err(ex_err, error_msg);

  return ret_int;
}
 

void ExodusII_IO_Helper::message (const std::stringmsg)Prints the message defined in msg to std::cout. Can be turned off if verbosity is set to 0.

Definition at line 127 of file exodusII_io_helper.C.

References _verbose.

Referenced by close(), read_block_info(), read_elem_in_block(), read_elem_num_map(), read_header(), read_node_num_map(), read_nodes(), read_nodeset(), read_nodeset_info(), read_sideset(), and read_sideset_info().

{
  if (_verbose) std::cout << msg << std::endl;
}
 

void ExodusII_IO_Helper::message (const std::stringmsg, inti)Prints the message defined in msg to std::cout 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 134 of file exodusII_io_helper.C.

References _verbose.

{
  if (_verbose) std::cout << msg << i << '.' << std::endl;
}
 

void ExodusII_IO_Helper::open (const char *filename)Opens an ExodusII mesh file named filename for reading.

Definition at line 141 of file exodusII_io_helper.C.

References _verbose, check_err(), comp_ws, ex_id, ex_version, and io_ws.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  ex_id = exII::ex_open(filename,
                        EX_READ,
                        &comp_ws,
                        &io_ws,
                        &ex_version);
  
  check_err(ex_id, 'Error opening ExodusII mesh file.');
  if (_verbose) std::cout << 'File opened successfully.' << std::endl;
}
 

void ExodusII_IO_Helper::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

Definition at line 178 of file exodusII_io_helper.C.

References _verbose, num_dim, num_elem, num_elem_blk, num_node_sets, num_nodes, num_side_sets, and title.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  if (_verbose)
    std::cout << 'Title: 	' << &title[0] << std::endl
              << 'Mesh Dimension: 	'   << num_dim << std::endl
              << 'Number of Nodes: 	' << num_nodes << std::endl
              << 'Number of elements: 	' << num_elem << std::endl
              << 'Number of elt blocks: 	' << num_elem_blk << std::endl
              << 'Number of node sets: 	' << num_node_sets << std::endl
              << 'Number of side sets: 	' << num_side_sets << std::endl;
}
 

void ExodusII_IO_Helper::print_nodes ()Prints the nodal information to std::cout.

Definition at line 229 of file exodusII_io_helper.C.

References num_nodes, x, y, and z.

{
  for (int i=0; i<num_nodes; i++)
    {
      std::cout << '(' << x[i] << ', ' << y[i] << ', ' << z[i] << ')' << std::endl;
    }
}
 

void ExodusII_IO_Helper::print_nodeset_info ()Prints information about all the nodesets.

 

void ExodusII_IO_Helper::print_sideset_info ()Prints information about all the sidesets.

Definition at line 425 of file exodusII_io_helper.C.

References elem_list, num_elem_all_sidesets, and side_list.

{
  for (int i=0; i<num_elem_all_sidesets; i++)
    {
      std::cout << elem_list[i] << ' ' << side_list[i] << std::endl;
    }
}
 

void ExodusII_IO_Helper::read_block_info ()Reads information for all of the blocks in the ExodusII mesh file.

Definition at line 239 of file exodusII_io_helper.C.

References block_ids, check_err(), ex_err, ex_id, message(), and num_elem_blk.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  block_ids.resize(num_elem_blk);
  // Get all element block IDs.
  ex_err = exII::ex_get_elem_blk_ids(ex_id,
                                     block_ids.empty() ? NULL : &block_ids[0]);
  // Usually, there is only one
  // block since there is only
  // one type of element.
  // However, there could be more.

  check_err(ex_err, 'Error getting block IDs.');
  message('All block IDs retrieved successfully.'); 
}
 

void ExodusII_IO_Helper::read_elem_in_block (intblock)Reads all of the element connectivity for block block in the ExodusII mesh file.

Definition at line 265 of file exodusII_io_helper.C.

References _verbose, block_ids, check_err(), connect, elem_type, ex_err, ex_id, message(), num_attr, num_elem_this_blk, and num_nodes_per_elem.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  libmesh_assert (static_cast<unsigned int>(block) < block_ids.size());
  
  ex_err = exII::ex_get_elem_block(ex_id,
                                   block_ids[block],
                                   &elem_type[0],
                                   &num_elem_this_blk,
                                   &num_nodes_per_elem,
                                   &num_attr);
  if (_verbose)
    std::cout << 'Reading a block of ' << num_elem_this_blk
              << ' ' << &elem_type[0] << '(s)'
              << ' having ' << num_nodes_per_elem
              << ' nodes per element.' << std::endl;
      
  check_err(ex_err, 'Error getting block info.');
  message('Info retrieved successfully for block: ', block); 
  
  
  
  // Read in the connectivity of the elements of this block,
  // watching out for the case where we actually have no
  // elements in this block (possible with parallel files)
  connect.resize(num_nodes_per_elem*num_elem_this_blk);

  if (!connect.empty())
    {
      ex_err = exII::ex_get_elem_conn(ex_id,
                                      block_ids[block],
                                      &connect[0]);
  
      check_err(ex_err, 'Error reading block connectivity.');
      message('Connectivity retrieved successfully for block: ', block);
    }
}
 

void ExodusII_IO_Helper::read_elem_num_map ()Reads the optional node_num_map from the ExodusII mesh file.

Definition at line 304 of file exodusII_io_helper.C.

References _verbose, check_err(), elem_num_map, ex_err, ex_id, message(), std::min(), num_elem, and libMesh::processor_id().

Referenced by Nemesis_IO::read().

{
  elem_num_map.resize(num_elem);

  ex_err = exII::ex_get_elem_num_map (ex_id,
                                      elem_num_map.empty() ? NULL : &elem_num_map[0]);
                                      
  check_err(ex_err, 'Error retrieving element number map.');
  message('Element numbering map retrieved successfully.'); 


  if (_verbose)
    {
      std::cout << '[' << libMesh::processor_id() << '] elem_num_map[i] = ';
      for (unsigned int i=0; i< static_cast<unsigned int>(std::min(10, num_elem-1)); ++i)
        std::cout << elem_num_map[i] << ', ';
      std::cout << '... ' << elem_num_map.back() << std::endl;
    }
}
 

void ExodusII_IO_Helper::read_header ()Reads an ExodusII mesh file header.

Definition at line 155 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, inquire(), message(), num_dim, num_elem, num_elem_blk, num_nodal_vars, num_node_sets, num_nodes, num_side_sets, num_time_steps, and title.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  ex_err = exII::ex_get_init(ex_id,
                             title.empty() ? NULL : &title[0],
                             &num_dim,
                             &num_nodes,
                             &num_elem,
                             &num_elem_blk,
                             &num_node_sets,
                             &num_side_sets);

  check_err(ex_err, 'Error retrieving header info.');

  num_time_steps = inquire(exII::EX_INQ_TIME, 'Error retrieving time steps');

  exII::ex_get_var_param(ex_id, 'n', &num_nodal_vars);

  message('Exodus header info retrieved successfully.');
}
 

void ExodusII_IO_Helper::read_node_num_map ()Reads the optional node_num_map from the ExodusII mesh file.

Definition at line 209 of file exodusII_io_helper.C.

References _verbose, check_err(), ex_err, ex_id, message(), std::min(), node_num_map, num_nodes, and libMesh::processor_id().

Referenced by Nemesis_IO::read().

{
  node_num_map.resize(num_nodes);

  ex_err = exII::ex_get_node_num_map (ex_id,
                                      node_num_map.empty() ? NULL : &node_num_map[0]);
                                      
  check_err(ex_err, 'Error retrieving nodal number map.');
  message('Nodal numbering map retrieved successfully.'); 

  if (_verbose)
    {
      std::cout << '[' << libMesh::processor_id() << '] node_num_map[i] = ';
      for (unsigned int i=0; i< static_cast<unsigned int>(std::min(10, num_nodes-1)); ++i)
        std::cout << node_num_map[i] << ', ';
      std::cout << '... ' << node_num_map.back() << std::endl;
    }
}
 

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

Definition at line 192 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, message(), num_nodes, x, y, and z.

Referenced by Nemesis_IO::read(), and ExodusII_IO::read().

{
  x.resize(num_nodes);
  y.resize(num_nodes); 
  z.resize(num_nodes); 

  ex_err = exII::ex_get_coord(ex_id,
                              static_cast<void*>(&x[0]),
                              static_cast<void*>(&y[0]),
                              static_cast<void*>(&z[0]));
  
  check_err(ex_err, 'Error retrieving nodal data.');
  message('Nodal data retrieved successfully.'); 
}
 

void ExodusII_IO_Helper::read_nodeset (intid)Reads information about nodeset id and inserts it into the global nodeset array at the position offset.

Definition at line 401 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, message(), node_list, nodeset_ids, num_node_df_per_set, and num_nodes_per_set.

Referenced by ExodusII_IO::read().

{
  libmesh_assert (static_cast<unsigned int>(id) < nodeset_ids.size());
  libmesh_assert (static_cast<unsigned int>(id) < num_nodes_per_set.size());
  libmesh_assert (static_cast<unsigned int>(id) < num_node_df_per_set.size());
  
  ex_err = exII::ex_get_node_set_param(ex_id,
                                       nodeset_ids[id],
                                       &num_nodes_per_set[id],
                                       &num_node_df_per_set[id]);
  check_err(ex_err, 'Error retrieving nodeset parameters.');
  message('Parameters retrieved successfully for nodeset: ', id);

  node_list.resize(num_nodes_per_set[id]);

  ex_err = exII::ex_get_node_set(ex_id,
                                 nodeset_ids[id],
                                 &node_list[0]);
  
  check_err(ex_err, 'Error retrieving nodeset data.');
  message('Data retrieved successfully for nodeset: ', id);
}
 

void ExodusII_IO_Helper::read_nodeset_info ()Reads information about all of the nodesets in the ExodusII mesh file.

Definition at line 358 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, message(), nodeset_ids, num_node_df_per_set, num_node_sets, and num_nodes_per_set.

Referenced by ExodusII_IO::read().

{
  nodeset_ids.resize(num_node_sets);
  if (num_node_sets > 0)
    {
      ex_err = exII::ex_get_node_set_ids(ex_id,
                                         &nodeset_ids[0]);
      check_err(ex_err, 'Error retrieving nodeset information.');
      message('All nodeset information retrieved successfully.'); 

      // Resize appropriate data structures -- only do this once outnode the loop
      num_nodes_per_set.resize(num_node_sets);
      num_node_df_per_set.resize(num_node_sets);
    }
}
 

void ExodusII_IO_Helper::read_sideset (intid, intoffset)Reads information about sideset id and inserts it into the global sideset array at the position offset.

Definition at line 375 of file exodusII_io_helper.C.

References check_err(), elem_list, ex_err, ex_id, id_list, message(), num_df_per_set, num_sides_per_set, side_list, and ss_ids.

Referenced by ExodusII_IO::read().

{
  libmesh_assert (static_cast<unsigned int>(id) < ss_ids.size());
  libmesh_assert (static_cast<unsigned int>(id) < num_sides_per_set.size());
  libmesh_assert (static_cast<unsigned int>(id) < num_df_per_set.size());
  libmesh_assert (static_cast<unsigned int>(offset) < elem_list.size());
  libmesh_assert (static_cast<unsigned int>(offset) < side_list.size());
  
  ex_err = exII::ex_get_side_set_param(ex_id,
                                       ss_ids[id],
                                       &num_sides_per_set[id],
                                       &num_df_per_set[id]);
  check_err(ex_err, 'Error retrieving sideset parameters.');
  message('Parameters retrieved successfully for sideset: ', id);

  ex_err = exII::ex_get_side_set(ex_id,
                                 ss_ids[id],
                                 &elem_list[offset],
                                 &side_list[offset]);
  check_err(ex_err, 'Error retrieving sideset data.');
  message('Data retrieved successfully for sideset: ', id);

  for (int i=0; i<num_sides_per_set[id]; i++)
    id_list[i+offset] = ss_ids[id];
}
 

void ExodusII_IO_Helper::read_sideset_info ()Reads information about all of the sidesets in the ExodusII mesh file.

Definition at line 326 of file exodusII_io_helper.C.

References check_err(), elem_list, ex_err, ex_id, id_list, message(), num_df_per_set, num_elem_all_sidesets, num_side_sets, num_sides_per_set, req_info, ret_char, ret_float, ret_int, side_list, and ss_ids.

Referenced by ExodusII_IO::read().

{
  ss_ids.resize(num_side_sets);
  if (num_side_sets > 0)
    {
      ex_err = exII::ex_get_side_set_ids(ex_id,
                                         &ss_ids[0]);
      check_err(ex_err, 'Error retrieving sideset information.');
      message('All sideset information retrieved successfully.'); 

      // Resize appropriate data structures -- only do this once outside the loop
      num_sides_per_set.resize(num_side_sets);
      num_df_per_set.resize(num_side_sets);

      // Inquire about the length of the
      // concatenated side sets element list
      req_info = exII::EX_INQ_SS_ELEM_LEN; 
      ex_err = exII::ex_inquire(ex_id,
                                req_info,
                                &ret_int,
                                &ret_float,
                                &ret_char);
      check_err(ex_err, 'Error inquiring about side set element list length.');

      //std::cout << 'Value returned by ex_inquire was: ' << ret_int << std::endl;
      num_elem_all_sidesets = ret_int;  
      elem_list.resize (num_elem_all_sidesets);
      side_list.resize (num_elem_all_sidesets);
      id_list.resize   (num_elem_all_sidesets);
    }
}
 

void ExodusII_IO_Helper::verbose (boolset_verbosity)Get/set flag telling whether message printing is on or off.

Definition at line 109 of file exodusII_io_helper.C.

References _verbose.

Referenced by Nemesis_IO::verbose(), and ExodusII_IO::verbose().

{
  _verbose = set_verbosity;
}
 

void ExodusII_IO_Helper::write_elements (const MeshBase &mesh)Writes the elements contained in 'mesh' FIXME: This only works for Mesh's having a single type of element!

Definition at line 623 of file exodusII_io_helper.C.

References _verbose, Elem::active(), ExodusII_IO_Helper::ElementMaps::assign_conversion(), check_err(), connect, MeshBase::elem(), elem_num_map, ex_err, ex_id, ExodusII_IO_Helper::Conversion::exodus_elem_type(), ExodusII_IO_Helper::Conversion::get_node_map(), DofObject::id(), libmesh_elem_num_to_exodus, Elem::n_nodes(), Elem::node(), num_elem, num_nodes_per_elem, Elem::subdomain_id(), and Elem::type().

{
  std::map<unsigned int, std::vector<unsigned int>  > subdomain_map;
  
  //loop through element and map between block and element vector
  for(unsigned int i=0; i<static_cast<unsigned int>(num_elem); i++)
    {
      Elem * elem = mesh.elem(i);

      //Only write out the active elements
      if(elem->active())
      {
        unsigned int cur_subdomain = elem->subdomain_id();
     
        subdomain_map[cur_subdomain].push_back(elem->id());
      }
    }

  std::vector<int> elem_num_map;

  std::map<unsigned int, std::vector<unsigned int>  >::iterator it;
  
  for(it = subdomain_map.begin() ; it != subdomain_map.end(); it++)
    {
      std::vector<unsigned int> & tmp_vec = (*it).second;

      ExodusII_IO_Helper::ElementMaps em;

      //Use the first element in this block to get representative information.
      //Note that Exodus assumes all elements in a block are of the same type!
      //We are using that same assumption here!
      const ExodusII_IO_Helper::Conversion conv = em.assign_conversion(mesh.elem(tmp_vec[0])->type());
      num_nodes_per_elem = mesh.elem(tmp_vec[0])->n_nodes();
    
      ex_err = exII::ex_put_elem_block(ex_id, (*it).first, conv.exodus_elem_type().c_str(), tmp_vec.size(),num_nodes_per_elem,0);
    
      check_err(ex_err, 'Error writing element block.');
  
      connect.resize(tmp_vec.size()*num_nodes_per_elem);

      for (unsigned int i=0; i<tmp_vec.size(); i++)
        {
          unsigned int elem_id = tmp_vec[i];
          elem_num_map.push_back(elem_id);
          libmesh_elem_num_to_exodus[elem_id] = elem_num_map.size();
          
          Elem * elem = mesh.elem(elem_id);
          
          for (unsigned int j=0; j < static_cast<unsigned int>(num_nodes_per_elem); j++)
            {  
              const unsigned int connect_index   = (i*num_nodes_per_elem)+j;
              const unsigned int elem_node_index = conv.get_node_map(j);
              if (_verbose)
                {
                  std::cout << 'Exodus node index: ' << j
                            << '=LibMesh node index ' << elem_node_index << std::endl;
                }
              connect[connect_index] = elem->node(elem_node_index)+1;
            }
        }
    ex_err = exII::ex_put_elem_conn(ex_id, (*it).first, &connect[0]);
    check_err(ex_err, 'Error writing element connectivities');
  }

//  ex_err = exII::ex_put_elem_num_map(ex_id, &elem_num_map[0]);
  check_err(ex_err, 'Error writing element connectivities');
}
 

void ExodusII_IO_Helper::write_nodal_coordinates (const MeshBase &mesh)Writes the nodal coordinates contained in 'mesh'

Definition at line 600 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, MeshBase::node_ptr(), num_nodes, x, y, and z.

{
  x.resize(num_nodes);
  y.resize(num_nodes);
  z.resize(num_nodes);

  for (/* unsigned */ int i=0; i<num_nodes; ++i)
    {
      x[i]=(*mesh.node_ptr(i))(0);
      y[i]=(*mesh.node_ptr(i))(1);
      z[i]=(*mesh.node_ptr(i))(2);
    }

  ex_err = exII::ex_put_coord(ex_id,
                              x.empty() ? NULL : &x[0],
                              y.empty() ? NULL : &y[0],
                              z.empty() ? NULL : &z[0]);

  check_err(ex_err, 'Error writing coordinates to Exodus file.');
}
 

void ExodusII_IO_Helper::write_nodal_values (intvar_id, const std::vector< Number > &values, inttimestep)Writes the vector of values to a nodal variable.

Definition at line 811 of file exodusII_io_helper.C.

References check_err(), ex_err, ex_id, and num_nodes.

{
  ex_err = exII::ex_put_nodal_var(ex_id, timestep, var_id, num_nodes, &values[0]);
  check_err(ex_err, 'Error writing nodal values.');
}  
 

void ExodusII_IO_Helper::write_nodesets (const MeshBase &mesh)Writes the nodesets contained in 'mesh'

Definition at line 730 of file exodusII_io_helper.C.

References MeshBase::boundary_info, check_err(), ex_err, and ex_id.

{
  ExodusII_IO_Helper::ElementMaps em;

  std::vector< unsigned int > nl;
  std::vector< short int > il;
      
  mesh.boundary_info->build_node_list(nl, il);

  //Maps from nodeset id to the nodes
  std::map<short int, std::vector<int> > node;

  //Accumulate the vectors to pass into ex_put_node_set
  for(unsigned int i = 0; i < nl.size(); i++)
    node[il[i]].push_back(nl[i]);    
  
  std::vector<short int> node_boundary_ids;
  mesh.boundary_info->build_node_boundary_ids(node_boundary_ids);
  
  for(unsigned int i = 0; i < node_boundary_ids.size(); i++)
  {
    int nodeset_id = node_boundary_ids[i];

    ex_err = exII::ex_put_node_set_param(ex_id, nodeset_id, node[nodeset_id].size(), 0);
    check_err(ex_err, 'Error writing nodeset parameters');

    ex_err = exII::ex_put_node_set(ex_id, nodeset_id, &node[nodeset_id][0]);
    check_err(ex_err, 'Error writing nodesets');
  }
}
 

void ExodusII_IO_Helper::write_sidesets (const MeshBase &mesh)Writes the sidesets contained in 'mesh'

Definition at line 691 of file exodusII_io_helper.C.

References ExodusII_IO_Helper::ElementMaps::assign_conversion(), MeshBase::boundary_info, check_err(), MeshBase::elem(), ex_err, ex_id, ExodusII_IO_Helper::Conversion::get_inverse_side_map(), and Elem::type().

{
  ExodusII_IO_Helper::ElementMaps em;

  std::vector< unsigned int > el;
  std::vector< unsigned short int > sl;
  std::vector< short int > il;
      
  mesh.boundary_info->build_side_list(el, sl, il);

  //Maps from sideset id to the element and sides
  std::map<int, std::vector<int> > elem;
  std::map<int, std::vector<int> > side;

  //Accumulate the vectors to pass into ex_put_side_set
  for(unsigned int i = 0; i < el.size(); i++)
  {
    const ExodusII_IO_Helper::Conversion conv = em.assign_conversion(mesh.elem(el[i])->type());

    elem[il[i]].push_back(el[i]+1);
    side[il[i]].push_back(conv.get_inverse_side_map(sl[i]));    
  }
  
  std::vector<short int> side_boundary_ids;
  mesh.boundary_info->build_side_boundary_ids(side_boundary_ids);
  
  for(unsigned int i = 0; i < side_boundary_ids.size(); i++)
  {
    int ss_id = side_boundary_ids[i];

    ex_err = exII::ex_put_side_set_param(ex_id, ss_id, elem[ss_id].size(), 4);
    check_err(ex_err, 'Error writing sideset parameters');
    
    ex_err = exII::ex_put_side_set(ex_id, ss_id, &elem[ss_id][0], &side[ss_id][0]);
    check_err(ex_err, 'Error writing sidesets');
  }
}
 

void ExodusII_IO_Helper::write_timestep (inttimestep, doubletime)Writes the time for the timestep

Definition at line 803 of file exodusII_io_helper.C.

References check_err(), ex_err, and ex_id.

{
  ex_err = exII::ex_put_time(ex_id, timestep, &time);
  check_err(ex_err, 'Error writing timestep.');
}
 

Member Data Documentation

 

bool ExodusII_IO_Helper::_created [protected]

Definition at line 581 of file exodusII_io_helper.h.

Referenced by create(), and created().  

bool ExodusII_IO_Helper::_verbose [protected]

Definition at line 582 of file exodusII_io_helper.h.

Referenced by create(), Nemesis_IO_Helper::get_cmap_params(), Nemesis_IO_Helper::get_eb_info_global(), Nemesis_IO_Helper::get_elem_cmap(), Nemesis_IO_Helper::get_elem_map(), Nemesis_IO_Helper::get_init_global(), Nemesis_IO_Helper::get_init_info(), Nemesis_IO_Helper::get_loadbal_param(), get_nodal_var_names(), Nemesis_IO_Helper::get_node_cmap(), Nemesis_IO_Helper::get_node_map(), Nemesis_IO_Helper::get_ns_param_global(), Nemesis_IO_Helper::get_ss_param_global(), initialize_nodal_variables(), message(), open(), print_header(), read_elem_in_block(), read_elem_num_map(), read_node_num_map(), verbose(), and write_elements().  

std::vector<int> ExodusII_IO_Helper::block_ids

Definition at line 539 of file exodusII_io_helper.h.

Referenced by get_block_id(), Nemesis_IO::read(), read_block_info(), and read_elem_in_block().  

int ExodusII_IO_Helper::comp_ws

Definition at line 523 of file exodusII_io_helper.h.

Referenced by create(), and open().  

std::vector<int> ExodusII_IO_Helper::connect

Definition at line 540 of file exodusII_io_helper.h.

Referenced by get_connect(), Nemesis_IO::read(), read_elem_in_block(), and write_elements().  

std::vector<int> ExodusII_IO_Helper::elem_list

Definition at line 547 of file exodusII_io_helper.h.

Referenced by get_elem_list(), print_sideset_info(), read_sideset(), and read_sideset_info().  

std::vector<int> ExodusII_IO_Helper::elem_num_map

Definition at line 552 of file exodusII_io_helper.h.

Referenced by read_elem_num_map(), and write_elements().  

std::vector<char> ExodusII_IO_Helper::elem_type

Definition at line 561 of file exodusII_io_helper.h.

Referenced by ExodusII_IO_Helper(), get_elem_type(), Nemesis_IO::read(), and read_elem_in_block().  

int ExodusII_IO_Helper::ex_err

Definition at line 526 of file exodusII_io_helper.h.

Referenced by close(), initialize(), initialize_nodal_variables(), inquire(), read_block_info(), read_elem_in_block(), read_elem_num_map(), read_header(), read_node_num_map(), read_nodes(), read_nodeset(), read_nodeset_info(), read_sideset(), read_sideset_info(), write_elements(), write_nodal_coordinates(), write_nodal_values(), write_nodesets(), write_sidesets(), and write_timestep().  

int ExodusII_IO_Helper::ex_id

Definition at line 525 of file exodusII_io_helper.h.

Referenced by close(), create(), Nemesis_IO_Helper::get_cmap_params(), Nemesis_IO_Helper::get_eb_info_global(), Nemesis_IO_Helper::get_elem_cmap(), Nemesis_IO_Helper::get_elem_map(), Nemesis_IO_Helper::get_init_global(), Nemesis_IO_Helper::get_init_info(), Nemesis_IO_Helper::get_loadbal_param(), get_nodal_var_names(), get_nodal_var_values(), Nemesis_IO_Helper::get_node_cmap(), Nemesis_IO_Helper::get_node_map(), Nemesis_IO_Helper::get_ns_param_global(), Nemesis_IO_Helper::get_ss_param_global(), get_time_steps(), initialize(), initialize_nodal_variables(), inquire(), open(), read_block_info(), read_elem_in_block(), read_elem_num_map(), read_header(), read_node_num_map(), read_nodes(), read_nodeset(), read_nodeset_info(), read_sideset(), read_sideset_info(), write_elements(), write_nodal_coordinates(), write_nodal_values(), write_nodesets(), write_sidesets(), and write_timestep().  

float ExodusII_IO_Helper::ex_version

Definition at line 553 of file exodusII_io_helper.h.

Referenced by create(), and open().  

std::vector<int> ExodusII_IO_Helper::id_list

Definition at line 550 of file exodusII_io_helper.h.

Referenced by get_id_list(), read_sideset(), and read_sideset_info().  

int ExodusII_IO_Helper::io_ws

Definition at line 524 of file exodusII_io_helper.h.

Referenced by create(), and open().  

std::map<int, int> ExodusII_IO_Helper::libmesh_elem_num_to_exodus

Definition at line 565 of file exodusII_io_helper.h.

Referenced by write_elements().  

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

Definition at line 571 of file exodusII_io_helper.h.

Referenced by get_nodal_var_names(), and get_nodal_var_values().  

std::vector<double> ExodusII_IO_Helper::nodal_var_values

Definition at line 572 of file exodusII_io_helper.h.

Referenced by get_nodal_var_values().  

std::vector<int> ExodusII_IO_Helper::node_list

Definition at line 549 of file exodusII_io_helper.h.

Referenced by get_node_list(), and read_nodeset().  

std::vector<int> ExodusII_IO_Helper::node_num_map

Definition at line 551 of file exodusII_io_helper.h.

Referenced by Nemesis_IO::read(), and read_node_num_map().  

std::vector<int> ExodusII_IO_Helper::nodeset_ids

Definition at line 542 of file exodusII_io_helper.h.

Referenced by get_nodeset_id(), read_nodeset(), and read_nodeset_info().  

int ExodusII_IO_Helper::num_attr

Definition at line 535 of file exodusII_io_helper.h.

Referenced by read_elem_in_block().  

std::vector<int> ExodusII_IO_Helper::num_df_per_set

Definition at line 545 of file exodusII_io_helper.h.

Referenced by read_sideset(), and read_sideset_info().  

int ExodusII_IO_Helper::num_dim

Definition at line 527 of file exodusII_io_helper.h.

Referenced by get_num_dim(), initialize(), print_header(), Nemesis_IO::read(), and read_header().  

int ExodusII_IO_Helper::num_elem

Definition at line 529 of file exodusII_io_helper.h.

Referenced by get_num_elem(), initialize(), print_header(), Nemesis_IO::read(), read_elem_num_map(), read_header(), and write_elements().  

int ExodusII_IO_Helper::num_elem_all_sidesets

Definition at line 538 of file exodusII_io_helper.h.

Referenced by print_sideset_info(), and read_sideset_info().  

int ExodusII_IO_Helper::num_elem_blk

Definition at line 530 of file exodusII_io_helper.h.

Referenced by get_num_elem_blk(), initialize(), print_header(), Nemesis_IO::read(), read_block_info(), and read_header().  

int ExodusII_IO_Helper::num_elem_this_blk

Definition at line 533 of file exodusII_io_helper.h.

Referenced by get_num_elem_this_blk(), Nemesis_IO::read(), and read_elem_in_block().  

int ExodusII_IO_Helper::num_nodal_vars

Definition at line 570 of file exodusII_io_helper.h.

Referenced by get_nodal_var_names(), get_num_nodal_vars(), initialize_nodal_variables(), and read_header().  

std::vector<int> ExodusII_IO_Helper::num_node_df_per_set

Definition at line 546 of file exodusII_io_helper.h.

Referenced by read_nodeset(), and read_nodeset_info().  

int ExodusII_IO_Helper::num_node_sets

Definition at line 531 of file exodusII_io_helper.h.

Referenced by get_num_node_sets(), initialize(), print_header(), read_header(), and read_nodeset_info().  

int ExodusII_IO_Helper::num_nodes

Definition at line 528 of file exodusII_io_helper.h.

Referenced by get_nodal_var_values(), get_num_nodes(), initialize(), print_header(), print_nodes(), Nemesis_IO::read(), read_header(), read_node_num_map(), read_nodes(), write_nodal_coordinates(), and write_nodal_values().  

int ExodusII_IO_Helper::num_nodes_per_elem

Definition at line 534 of file exodusII_io_helper.h.

Referenced by get_num_nodes_per_elem(), Nemesis_IO::read(), read_elem_in_block(), and write_elements().  

std::vector<int> ExodusII_IO_Helper::num_nodes_per_set

Definition at line 544 of file exodusII_io_helper.h.

Referenced by get_num_nodes_per_set(), read_nodeset(), and read_nodeset_info().  

int ExodusII_IO_Helper::num_side_sets

Definition at line 532 of file exodusII_io_helper.h.

Referenced by get_num_side_sets(), initialize(), print_header(), read_header(), and read_sideset_info().  

std::vector<int> ExodusII_IO_Helper::num_sides_per_set

Definition at line 543 of file exodusII_io_helper.h.

Referenced by get_num_sides_per_set(), read_sideset(), and read_sideset_info().  

int ExodusII_IO_Helper::num_time_steps

Definition at line 568 of file exodusII_io_helper.h.

Referenced by get_time_steps(), and read_header().  

int ExodusII_IO_Helper::req_info

Definition at line 536 of file exodusII_io_helper.h.

Referenced by read_sideset_info().  

char ExodusII_IO_Helper::ret_char

Definition at line 558 of file exodusII_io_helper.h.

Referenced by inquire(), and read_sideset_info().  

float ExodusII_IO_Helper::ret_float

Definition at line 554 of file exodusII_io_helper.h.

Referenced by inquire(), and read_sideset_info().  

int ExodusII_IO_Helper::ret_int

Definition at line 537 of file exodusII_io_helper.h.

Referenced by inquire(), and read_sideset_info().  

std::vector<int> ExodusII_IO_Helper::side_list

Definition at line 548 of file exodusII_io_helper.h.

Referenced by get_side_list(), print_sideset_info(), read_sideset(), and read_sideset_info().  

std::vector<int> ExodusII_IO_Helper::ss_ids

Definition at line 541 of file exodusII_io_helper.h.

Referenced by read_sideset(), and read_sideset_info().  

std::vector<char*> ExodusII_IO_Helper::strings

Definition at line 578 of file exodusII_io_helper.h.

Referenced by get_nodal_var_names(), and initialize_nodal_variables().  

std::vector<double> ExodusII_IO_Helper::time_steps

Definition at line 569 of file exodusII_io_helper.h.

Referenced by get_time_steps().  

std::vector<char> ExodusII_IO_Helper::title

Definition at line 560 of file exodusII_io_helper.h.

Referenced by ExodusII_IO_Helper(), print_header(), and read_header().  

std::vector<std::vector<char> > ExodusII_IO_Helper::vvc

Definition at line 577 of file exodusII_io_helper.h.

Referenced by get_nodal_var_names(), and initialize_nodal_variables().  

std::vector<double> ExodusII_IO_Helper::x

Definition at line 555 of file exodusII_io_helper.h.

Referenced by get_x(), print_nodes(), Nemesis_IO::read(), read_nodes(), and write_nodal_coordinates().  

std::vector<double> ExodusII_IO_Helper::y

Definition at line 556 of file exodusII_io_helper.h.

Referenced by get_y(), print_nodes(), Nemesis_IO::read(), read_nodes(), and write_nodal_coordinates().  

std::vector<double> ExodusII_IO_Helper::z

Definition at line 557 of file exodusII_io_helper.h.

Referenced by get_z(), print_nodes(), Nemesis_IO::read(), read_nodes(), and write_nodal_coordinates().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Classes
Public Member Functions
Public Attributes
Protected Attributes
Detailed Description
Constructor & Destructor Documentation
ExodusII_IO_Helper::ExodusII_IO_Helper (boolv = false) [inline]Constructor. Automatically initializes all the private members of the class. Also allows you to set the verbosity level to v=1 (on) or v=0 (off).
ExodusII_IO_Helper::~ExodusII_IO_Helper () [virtual]Destructor. The only memory allocated is for title and elem_type. This memory is freed in the destructor.
Member Function Documentation
void ExodusII_IO_Helper::check_err (const interror, const std::stringmsg)All of the ExodusII API functions return an int error value. This function checks to see if the error has been set, and if it has, prints the error message contained in msg.
void ExodusII_IO_Helper::close ()Closes the ExodusII mesh file.
void ExodusII_IO_Helper::create (std::stringfilename)Opens an ExodusII mesh file named filename for writing.
bool ExodusII_IO_Helper::created ()Returns true once create() has been successfully called, and false otherwise.
int ExodusII_IO_Helper::get_block_id (intblock)Get's the block number for the given block.
int ExodusII_IO_Helper::get_connect (inti) const [inline]Returns:
const std::vector<int>& ExodusII_IO_Helper::get_elem_list () const [inline]Returns:
const char* ExodusII_IO_Helper::get_elem_type () const [inline]Returns:
const std::vector<int>& ExodusII_IO_Helper::get_id_list () const [inline]Returns:
const std::vector< std::string > & ExodusII_IO_Helper::get_nodal_var_names ()
const std::vector< double > & ExodusII_IO_Helper::get_nodal_var_values (std::stringnodal_var_name, inttime_step)
const std::vector<int>& ExodusII_IO_Helper::get_node_list () const [inline]Returns:
int ExodusII_IO_Helper::get_nodeset_id (unsigned inti) const [inline]Returns:
int ExodusII_IO_Helper::get_num_dim () const [inline]Returns:
int ExodusII_IO_Helper::get_num_elem () const [inline]Returns:
int ExodusII_IO_Helper::get_num_elem_blk () const [inline]Returns:
int ExodusII_IO_Helper::get_num_elem_this_blk () const [inline]For a given block, returns the total number of elements.
int ExodusII_IO_Helper::get_num_nodal_vars () [inline]
int ExodusII_IO_Helper::get_num_node_sets () const [inline]Returns:
int ExodusII_IO_Helper::get_num_nodes () const [inline]Returns:
int ExodusII_IO_Helper::get_num_nodes_per_elem () const [inline]Returns:
int ExodusII_IO_Helper::get_num_nodes_per_set (inti) const [inline]For a single nodeset, returns the total number of nodes in the nodeset.
int ExodusII_IO_Helper::get_num_side_sets () const [inline]Returns:
int ExodusII_IO_Helper::get_num_sides_per_set (inti) const [inline]For a single sideset, returns the total number of elements in the sideset.
const std::vector<int>& ExodusII_IO_Helper::get_side_list () const [inline]Returns:
const std::vector< double > & ExodusII_IO_Helper::get_time_steps ()
double ExodusII_IO_Helper::get_x (inti) const [inline]Returns:
double ExodusII_IO_Helper::get_y (inti) const [inline]Returns:
double ExodusII_IO_Helper::get_z (inti) const [inline]Returns:
void ExodusII_IO_Helper::initialize (std::stringtitle, const MeshBase &mesh)Initializes the Exodus file
void ExodusII_IO_Helper::initialize_nodal_variables (std::vector< std::string >names)Sets up the nodal variables
int ExodusII_IO_Helper::inquire (intreq_info, std::stringerror_msg = '')Generic inquiry, returns the value
void ExodusII_IO_Helper::message (const std::stringmsg)Prints the message defined in msg to std::cout. Can be turned off if verbosity is set to 0.
void ExodusII_IO_Helper::message (const std::stringmsg, inti)Prints the message defined in msg to std::cout 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.
void ExodusII_IO_Helper::open (const char *filename)Opens an ExodusII mesh file named filename for reading.
void ExodusII_IO_Helper::print_header ()Prints the ExodusII mesh file header, which includes the mesh title, the number of nodes, number of elements, mesh dimension, number of sidesets, and number of nodesets
void ExodusII_IO_Helper::print_nodes ()Prints the nodal information to std::cout.
void ExodusII_IO_Helper::print_nodeset_info ()Prints information about all the nodesets.
void ExodusII_IO_Helper::print_sideset_info ()Prints information about all the sidesets.
void ExodusII_IO_Helper::read_block_info ()Reads information for all of the blocks in the ExodusII mesh file.
void ExodusII_IO_Helper::read_elem_in_block (intblock)Reads all of the element connectivity for block block in the ExodusII mesh file.
void ExodusII_IO_Helper::read_elem_num_map ()Reads the optional node_num_map from the ExodusII mesh file.
void ExodusII_IO_Helper::read_header ()Reads an ExodusII mesh file header.
void ExodusII_IO_Helper::read_node_num_map ()Reads the optional node_num_map from the ExodusII mesh file.
void ExodusII_IO_Helper::read_nodes ()Reads the nodal data (x,y,z coordinates) from the ExodusII mesh file.
void ExodusII_IO_Helper::read_nodeset (intid)Reads information about nodeset id and inserts it into the global nodeset array at the position offset.
void ExodusII_IO_Helper::read_nodeset_info ()Reads information about all of the nodesets in the ExodusII mesh file.
void ExodusII_IO_Helper::read_sideset (intid, intoffset)Reads information about sideset id and inserts it into the global sideset array at the position offset.
void ExodusII_IO_Helper::read_sideset_info ()Reads information about all of the sidesets in the ExodusII mesh file.
void ExodusII_IO_Helper::verbose (boolset_verbosity)Get/set flag telling whether message printing is on or off.
void ExodusII_IO_Helper::write_elements (const MeshBase &mesh)Writes the elements contained in 'mesh' FIXME: This only works for Mesh's having a single type of element!
void ExodusII_IO_Helper::write_nodal_coordinates (const MeshBase &mesh)Writes the nodal coordinates contained in 'mesh'
void ExodusII_IO_Helper::write_nodal_values (intvar_id, const std::vector< Number > &values, inttimestep)Writes the vector of values to a nodal variable.
void ExodusII_IO_Helper::write_nodesets (const MeshBase &mesh)Writes the nodesets contained in 'mesh'
void ExodusII_IO_Helper::write_sidesets (const MeshBase &mesh)Writes the sidesets contained in 'mesh'
void ExodusII_IO_Helper::write_timestep (inttimestep, doubletime)Writes the time for the timestep
Member Data Documentation
bool ExodusII_IO_Helper::_created [protected]
bool ExodusII_IO_Helper::_verbose [protected]
std::vector<int> ExodusII_IO_Helper::block_ids
int ExodusII_IO_Helper::comp_ws
std::vector<int> ExodusII_IO_Helper::connect
std::vector<int> ExodusII_IO_Helper::elem_list
std::vector<int> ExodusII_IO_Helper::elem_num_map
std::vector<char> ExodusII_IO_Helper::elem_type
int ExodusII_IO_Helper::ex_err
int ExodusII_IO_Helper::ex_id
float ExodusII_IO_Helper::ex_version
std::vector<int> ExodusII_IO_Helper::id_list
int ExodusII_IO_Helper::io_ws
std::map<int, int> ExodusII_IO_Helper::libmesh_elem_num_to_exodus
std::vector<std::string> ExodusII_IO_Helper::nodal_var_names
std::vector<double> ExodusII_IO_Helper::nodal_var_values
std::vector<int> ExodusII_IO_Helper::node_list
std::vector<int> ExodusII_IO_Helper::node_num_map
std::vector<int> ExodusII_IO_Helper::nodeset_ids
int ExodusII_IO_Helper::num_attr
std::vector<int> ExodusII_IO_Helper::num_df_per_set
int ExodusII_IO_Helper::num_dim
int ExodusII_IO_Helper::num_elem
int ExodusII_IO_Helper::num_elem_all_sidesets
int ExodusII_IO_Helper::num_elem_blk
int ExodusII_IO_Helper::num_elem_this_blk
int ExodusII_IO_Helper::num_nodal_vars
std::vector<int> ExodusII_IO_Helper::num_node_df_per_set
int ExodusII_IO_Helper::num_node_sets
int ExodusII_IO_Helper::num_nodes
int ExodusII_IO_Helper::num_nodes_per_elem
std::vector<int> ExodusII_IO_Helper::num_nodes_per_set
int ExodusII_IO_Helper::num_side_sets
std::vector<int> ExodusII_IO_Helper::num_sides_per_set
int ExodusII_IO_Helper::num_time_steps
int ExodusII_IO_Helper::req_info
char ExodusII_IO_Helper::ret_char
float ExodusII_IO_Helper::ret_float
int ExodusII_IO_Helper::ret_int
std::vector<int> ExodusII_IO_Helper::side_list
std::vector<int> ExodusII_IO_Helper::ss_ids
std::vector<char*> ExodusII_IO_Helper::strings
std::vector<double> ExodusII_IO_Helper::time_steps
std::vector<char> ExodusII_IO_Helper::title
std::vector<std::vector<char> > ExodusII_IO_Helper::vvc
std::vector<double> ExodusII_IO_Helper::x
std::vector<double> ExodusII_IO_Helper::y
std::vector<double> ExodusII_IO_Helper::z
Author

This document was created by man2html, using the manual pages.
Time: 21:45:45 GMT, April 16, 2011