libMesh::ExodusII_IO Class Reference
#include <exodusII_io.h>

Public Member Functions | |
| ExodusII_IO (MeshBase &mesh) | |
| virtual | ~ExodusII_IO () |
| virtual void | read (const std::string &name) |
| virtual void | write (const std::string &fname) |
| void | verbose (bool set_verbosity) |
| const std::vector< Real > & | get_time_steps () |
| void | copy_nodal_solution (System &system, std::string var_name, unsigned int timestep=1) |
| void | copy_nodal_solution (System &es, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1) |
| void | write_discontinuous_exodusII (const std::string &name, const EquationSystems &es) |
| void | write_element_data (const EquationSystems &es) |
| void | write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
| void | write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
| void | write_global_data (const std::vector< Number > &, const std::vector< std::string > &) |
| void | write_information_records (const std::vector< std::string > &) |
| void | write_timestep (const std::string &fname, const EquationSystems &es, const int timestep, const Real time) |
| void | set_output_variables (const std::vector< std::string > &output_variables) |
| void | use_mesh_dimension_instead_of_spatial_dimension (bool val) |
| virtual void | write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=NULL) |
| unsigned int & | ascii_precision () |
Protected Member Functions | |
| MeshBase & | mesh () |
| void | skip_comment_lines (std::istream &in, const char comment_start) |
| const MeshBase & | mesh () const |
Protected Attributes | |
| std::vector< bool > | elems_of_dimension |
| const bool | _is_parallel_format |
Private Attributes | |
| ExodusII_IO_Helper * | exio_helper |
| int | _timestep |
| bool | _verbose |
| std::vector< std::string > | _output_variables |
Detailed Description
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs. By default, LibMesh expects ExodusII files to have a ".exd" or ".e" file extension.
Definition at line 51 of file exodusII_io.h.
Constructor & Destructor Documentation
| libMesh::ExodusII_IO::ExodusII_IO | ( | MeshBase & | mesh | ) | [explicit] |
Constructor. Takes a writeable reference to a mesh object. This is the constructor required to read a mesh.
Definition at line 44 of file exodusII_io.C.
00044 : 00045 MeshInput<MeshBase> (mesh), 00046 MeshOutput<MeshBase> (mesh), 00047 #ifdef LIBMESH_HAVE_EXODUS_API 00048 exio_helper(new ExodusII_IO_Helper), 00049 #endif 00050 _timestep(1), 00051 _verbose (false) 00052 { 00053 }
| libMesh::ExodusII_IO::~ExodusII_IO | ( | ) | [virtual] |
Destructor.
Definition at line 57 of file exodusII_io.C.
References libMesh::ExodusII_IO_Helper::close(), libMesh::err, and exio_helper.
00058 { 00059 #ifndef LIBMESH_HAVE_EXODUS_API 00060 00061 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00062 << std::endl; 00063 libmesh_error(); 00064 00065 #else 00066 00067 exio_helper->close(); 00068 00069 delete exio_helper; 00070 00071 #endif 00072 }
Member Function Documentation
| unsigned int& libMesh::MeshOutput< MeshBase >::ascii_precision | ( | ) | [inherited] |
Return/set the precision to use when writing ASCII files.
By default we use numeric_limits<Real>::digits10 + 2, which should be enough to write out to ASCII and get the exact same Real back when reading in.
Referenced by libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), and libMesh::GMVIO::write_ascii_old_impl().
| void libMesh::ExodusII_IO::copy_nodal_solution | ( | System & | es, | |
| std::string | system_var_name, | |||
| std::string | exodus_var_name, | |||
| unsigned int | timestep = 1 | |||
| ) |
If we read in a nodal solution while reading in a mesh, we can attempt to copy that nodal solution into an EquationSystems object.
Definition at line 314 of file exodusII_io.C.
References libMesh::err.
00315 { 00316 00317 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00318 << std::endl; 00319 libmesh_error(); 00320 }
| void libMesh::ExodusII_IO::copy_nodal_solution | ( | System & | system, | |
| std::string | var_name, | |||
| unsigned int | timestep = 1 | |||
| ) |
Backward compatibility version of function that takes a single variable name
Definition at line 304 of file exodusII_io.C.
00305 { 00306 libmesh_deprecated(); 00307 copy_nodal_solution(system, var_name, var_name, timestep); 00308 }
| const std::vector< Real > & libMesh::ExodusII_IO::get_time_steps | ( | ) |
Returns an array containing the timesteps in the file
Definition at line 285 of file exodusII_io.C.
References libMesh::err.
00286 { 00287 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00288 << std::endl; 00289 libmesh_error(); 00290 }
| const MeshBase & libMesh::MeshOutput< MeshBase >::mesh | ( | ) | const [protected, inherited] |
Returns the object as a read-only reference.
Referenced by libMesh::PostscriptIO::write(), libMesh::FroIO::write(), libMesh::EnsightIO::write(), libMesh::DivaIO::write(), libMesh::TecplotIO::write_ascii(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::write_binary(), libMesh::EnsightIO::write_geometry_ascii(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::GnuPlotIO::write_solution(), libMesh::DivaIO::write_stream(), and libMesh::EnsightIO::write_vector_ascii().
| MeshBase & libMesh::MeshInput< MeshBase >::mesh | ( | ) | [protected, inherited] |
Returns the object as a writeable reference.
Referenced by libMesh::GMVIO::_read_materials(), libMesh::GMVIO::_read_nodes(), libMesh::GMVIO::_read_one_cell(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::VTKIO::cells_to_vtk(), libMesh::GMVIO::copy_nodal_solution(), libMesh::UNVIO::element_in(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::element_out(), libMesh::UNVIO::node_in(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::node_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::XdrIO::read(), libMesh::VTKIO::read(), libMesh::TetGenIO::read(), libMesh::Nemesis_IO::read(), libMesh::GMVIO::read(), read(), libMesh::AbaqusIO::read(), libMesh::LegacyXdrIO::read_ascii(), libMesh::AbaqusIO::read_elements(), libMesh::UNVIO::read_implementation(), libMesh::UCDIO::read_implementation(), libMesh::LegacyXdrIO::read_mesh(), libMesh::GmshIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::XdrIO::read_serialized_bcs(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::XdrIO::write(), libMesh::TetGenIO::write(), libMesh::Nemesis_IO::write(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::UNVIO::write_implementation(), libMesh::UCDIO::write_implementation(), libMesh::LegacyXdrIO::write_mesh(), libMesh::GmshIO::write_mesh(), libMesh::UCDIO::write_nodal_data(), libMesh::Nemesis_IO::write_nodal_data(), write_nodal_data_discontinuous(), libMesh::XdrIO::write_parallel(), libMesh::GmshIO::write_post(), libMesh::XdrIO::write_serialized_bcs(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::LegacyXdrIO::write_soln().
| void libMesh::ExodusII_IO::read | ( | const std::string & | name | ) | [virtual] |
This method implements reading a mesh from a specified file. Open the file named name and read the mesh in Sandia National Lab's ExodusII format. This is the method to use for reading in meshes generated by cubit. Works in 2D for TRIs, TRI6s, QUAD s, and QUAD9s. Works in 3D for TET4s, TET10s, HEX8s, and HEX27s.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 98 of file exodusII_io.C.
References libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::ExodusII_IO_Helper::ElementMaps::assign_conversion(), libMesh::MeshBase::boundary_info, libMesh::Elem::build(), libMesh::MeshBase::clear(), libMesh::Elem::dim(), libMesh::MeshBase::elem(), libMesh::MeshInput< MeshBase >::elems_of_dimension, libMesh::err, exio_helper, libMesh::ExodusII_IO_Helper::get_block_id(), libMesh::ExodusII_IO_Helper::get_block_name(), libMesh::ExodusII_IO_Helper::get_connect(), libMesh::ExodusII_IO_Helper::get_elem_list(), libMesh::ExodusII_IO_Helper::get_elem_type(), libMesh::ExodusII_IO_Helper::get_id_list(), libMesh::ExodusII_IO_Helper::get_node_list(), libMesh::ExodusII_IO_Helper::get_node_set_name(), libMesh::ExodusII_IO_Helper::get_nodeset_id(), libMesh::ExodusII_IO_Helper::get_num_elem(), libMesh::ExodusII_IO_Helper::get_num_elem_blk(), libMesh::ExodusII_IO_Helper::get_num_elem_this_blk(), libMesh::ExodusII_IO_Helper::get_num_node_sets(), libMesh::ExodusII_IO_Helper::get_num_nodes(), libMesh::ExodusII_IO_Helper::get_num_nodes_per_elem(), libMesh::ExodusII_IO_Helper::get_num_side_sets(), libMesh::ExodusII_IO_Helper::get_num_sides_per_set(), libMesh::ExodusII_IO_Helper::get_side_list(), libMesh::ExodusII_IO_Helper::Conversion::get_side_map(), libMesh::ExodusII_IO_Helper::get_side_set_id(), libMesh::ExodusII_IO_Helper::get_side_set_name(), libMesh::ExodusII_IO_Helper::get_x(), libMesh::ExodusII_IO_Helper::get_y(), libMesh::ExodusII_IO_Helper::get_z(), libMesh::DofObject::id(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem(), libMesh::MeshBase::n_nodes(), libMesh::MeshBase::node_ptr(), libMesh::ExodusII_IO_Helper::open(), libMesh::ExodusII_IO_Helper::print_header(), libMesh::ExodusII_IO_Helper::read_block_info(), libMesh::ExodusII_IO_Helper::read_elem_in_block(), libMesh::ExodusII_IO_Helper::read_header(), libMesh::ExodusII_IO_Helper::read_nodes(), libMesh::ExodusII_IO_Helper::read_nodeset(), libMesh::ExodusII_IO_Helper::read_nodeset_info(), libMesh::ExodusII_IO_Helper::read_sideset(), libMesh::ExodusII_IO_Helper::read_sideset_info(), libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::MeshBase::set_mesh_dimension(), libMesh::Elem::set_node(), libMesh::Elem::subdomain_id(), libMesh::MeshBase::subdomain_name(), libMesh::Elem::type(), and verbose().
00099 { 00100 // This is a serial-only process for now; 00101 // the Mesh should be read on processor 0 and 00102 // broadcast later 00103 // libmesh_assert_equal_to (libMesh::processor_id(), 0); 00104 00105 #ifndef LIBMESH_HAVE_EXODUS_API 00106 00107 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00108 << "Input file " << fname << " cannot be read" 00109 << std::endl; 00110 libmesh_error(); 00111 00112 #else 00113 00114 // Get a reference to the mesh we are reading 00115 MeshBase& mesh = MeshInput<MeshBase>::mesh(); 00116 00117 // Clear any existing mesh data 00118 mesh.clear(); 00119 00120 // Keep track of what kinds of elements this file contains 00121 elems_of_dimension.clear(); 00122 elems_of_dimension.resize(4, false); 00123 00124 #ifdef DEBUG 00125 this->verbose(true); 00126 #endif 00127 00128 00129 ExodusII_IO_Helper::ElementMaps em; // Instantiate the ElementMaps interface 00130 00131 exio_helper->open(fname.c_str()); // Open the exodus file, if possible 00132 exio_helper->read_header(); // Get header information from exodus file 00133 exio_helper->print_header(); // Print header information 00134 00135 //assertion fails due to inconsistent mesh dimension 00136 // libmesh_assert_equal_to (static_cast<unsigned int>(exio_helper->get_num_dim()), mesh.mesh_dimension()); // Be sure number of dimensions 00137 // is equal to the number of 00138 // dimensions in the mesh supplied. 00139 00140 exio_helper->read_nodes(); // Read nodes from the exodus file 00141 mesh.reserve_nodes(exio_helper->get_num_nodes()); // Reserve space for the nodes. 00142 00143 // Loop over the nodes, create Nodes with local processor_id 0. 00144 for (int i=0; i<exio_helper->get_num_nodes(); i++) 00145 mesh.add_point (Point(exio_helper->get_x(i), 00146 exio_helper->get_y(i), 00147 exio_helper->get_z(i)), i); 00148 00149 libmesh_assert_equal_to (static_cast<unsigned int>(exio_helper->get_num_nodes()), mesh.n_nodes()); 00150 00151 exio_helper->read_block_info(); // Get information about all the blocks 00152 mesh.reserve_elem(exio_helper->get_num_elem()); // Reserve space for the elements 00153 00154 00155 // Read in the element connectivity for each block. 00156 int nelem_last_block = 0; 00157 00158 std::map<int, dof_id_type> exodus_id_to_mesh_id; 00159 00160 // Loop over all the blocks 00161 for (int i=0; i<exio_helper->get_num_elem_blk(); i++) 00162 { 00163 // Read the information for block i 00164 exio_helper->read_elem_in_block (i); 00165 int subdomain_id = exio_helper->get_block_id(i); 00166 00167 // populate the map of names 00168 mesh.subdomain_name(static_cast<subdomain_id_type>(subdomain_id)) = 00169 exio_helper->get_block_name(i); 00170 00171 // Set any relevant node/edge maps for this element 00172 const std::string type_str (exio_helper->get_elem_type()); 00173 const ExodusII_IO_Helper::Conversion conv = em.assign_conversion(type_str); 00174 //if (_verbose) 00175 //libMesh::out << "Reading a block of " << type_str << " elements." << std::endl; 00176 00177 // Loop over all the faces in this block 00178 int jmax = nelem_last_block+exio_helper->get_num_elem_this_blk(); 00179 for (int j=nelem_last_block; j<jmax; j++) 00180 { 00181 Elem* elem = Elem::build (conv.get_canonical_type()).release(); 00182 libmesh_assert (elem); 00183 elem->subdomain_id() = static_cast<subdomain_id_type>(subdomain_id) ; 00184 //elem->set_id(j);// Don't try to second guess the Element ID setting scheme! 00185 00186 elems_of_dimension[elem->dim()] = true; 00187 00188 elem = mesh.add_elem (elem); // Catch the Elem pointer that the Mesh throws back 00189 00190 exodus_id_to_mesh_id[j+1] = elem->id(); 00191 00192 // Set all the nodes for this element 00193 for (int k=0; k<exio_helper->get_num_nodes_per_elem(); k++) 00194 { 00195 int gi = (j-nelem_last_block)*exio_helper->get_num_nodes_per_elem() + conv.get_node_map(k); // global index 00196 int node_number = exio_helper->get_connect(gi); // Global node number (1-based) 00197 elem->set_node(k) = mesh.node_ptr((node_number-1)); // Set node number 00198 // Subtract 1 since 00199 // exodus is internally 1-based 00200 } 00201 } 00202 00203 // running sum of # of elements per block, 00204 // (should equal total number of elements in the end) 00205 nelem_last_block += exio_helper->get_num_elem_this_blk(); 00206 } 00207 libmesh_assert_equal_to (static_cast<unsigned int>(nelem_last_block), mesh.n_elem()); 00208 00209 // Set the mesh dimension to the largest encountered for an element 00210 for (unsigned int i=0; i!=4; ++i) 00211 if (elems_of_dimension[i]) 00212 mesh.set_mesh_dimension(i); 00213 00214 // Read in sideset information -- this is useful for applying boundary conditions 00215 { 00216 exio_helper->read_sideset_info(); // Get basic information about ALL sidesets 00217 int offset=0; 00218 for (int i=0; i<exio_helper->get_num_side_sets(); i++) 00219 { 00220 offset += (i > 0 ? exio_helper->get_num_sides_per_set(i-1) : 0); // Compute new offset 00221 exio_helper->read_sideset (i, offset); 00222 00223 mesh.boundary_info->sideset_name(exio_helper->get_side_set_id(i)) = 00224 exio_helper->get_side_set_name(i); 00225 } 00226 00227 const std::vector<int>& elem_list = exio_helper->get_elem_list(); 00228 const std::vector<int>& side_list = exio_helper->get_side_list(); 00229 const std::vector<int>& id_list = exio_helper->get_id_list(); 00230 00231 for (unsigned int e=0; e<elem_list.size(); e++) 00232 { 00233 // Set any relevant node/edge maps for this element 00234 00235 Elem * elem = mesh.elem(exodus_id_to_mesh_id[elem_list[e]]); 00236 00237 const ExodusII_IO_Helper::Conversion conv = 00238 em.assign_conversion(elem->type()); 00239 00240 mesh.boundary_info->add_side (exodus_id_to_mesh_id[elem_list[e]], 00241 conv.get_side_map(side_list[e]-1), 00242 id_list[e]); 00243 } 00244 } 00245 00246 // Read nodeset info 00247 { 00248 exio_helper->read_nodeset_info(); 00249 00250 for (int nodeset=0; nodeset<exio_helper->get_num_node_sets(); nodeset++) 00251 { 00252 int nodeset_id = exio_helper->get_nodeset_id(nodeset); 00253 00254 mesh.boundary_info->nodeset_name(nodeset_id) = 00255 exio_helper->get_node_set_name(nodeset); 00256 00257 exio_helper->read_nodeset(nodeset); 00258 00259 const std::vector<int>& node_list = exio_helper->get_node_list(); 00260 00261 for(unsigned int node=0; node<node_list.size(); node++) 00262 mesh.boundary_info->add_node(node_list[node]-1, nodeset_id); 00263 } 00264 } 00265 00266 #if LIBMESH_DIM < 3 00267 if (mesh.mesh_dimension() > LIBMESH_DIM) 00268 { 00269 libMesh::err << "Cannot open dimension " << 00270 mesh.mesh_dimension() << 00271 " mesh file when configured without " << 00272 mesh.mesh_dimension() << "D support." << 00273 std::endl; 00274 libmesh_error(); 00275 } 00276 #endif 00277 00278 #endif 00279 }
| void libMesh::ExodusII_IO::set_output_variables | ( | const std::vector< std::string > & | output_variables | ) | [inline] |
Sets the list of variable names to be included in the output. This is _optional_. If this is never called then all variables will be present.
Definition at line 156 of file exodusII_io.h.
References _output_variables.
00156 { _output_variables = output_variables; }
| void libMesh::MeshInput< MeshBase >::skip_comment_lines | ( | std::istream & | in, | |
| const char | comment_start | |||
| ) | [protected, inherited] |
Reads input from in, skipping all the lines that start with the character comment_start.
Referenced by libMesh::TetGenIO::read(), and libMesh::UCDIO::read_implementation().
| void libMesh::ExodusII_IO::use_mesh_dimension_instead_of_spatial_dimension | ( | bool | val | ) |
In the general case, meshes containing 2D elements can be manifolds living in 3D space, thus by default we write all meshes with the Exodus dimension set to LIBMESH_DIM = mesh.spatial_dimension().
In certain cases, however, the user may know his 2D mesh actually lives in the z=0 plane, and therefore wants to write a truly 2D Exodus mesh. In such a case, he should call this function with val=true.
Definition at line 89 of file exodusII_io.C.
References exio_helper, and libMesh::ExodusII_IO_Helper::use_mesh_dimension_instead_of_spatial_dimension().
00090 { 00091 #ifdef LIBMESH_HAVE_EXODUS_API 00092 exio_helper->use_mesh_dimension_instead_of_spatial_dimension(val); 00093 #endif 00094 }
| void libMesh::ExodusII_IO::verbose | ( | bool | set_verbosity | ) |
Set the flag indicating if we should be verbose.
Definition at line 76 of file exodusII_io.C.
References _verbose, exio_helper, and libMesh::ExodusII_IO_Helper::verbose().
Referenced by read().
00077 { 00078 _verbose = set_verbosity; 00079 00080 #ifdef LIBMESH_HAVE_EXODUS_API 00081 // Set the verbose flag in the helper object 00082 // as well. 00083 exio_helper->verbose(_verbose); 00084 #endif 00085 }
| void libMesh::ExodusII_IO::write | ( | const std::string & | fname | ) | [virtual] |
This method implements writing a mesh to a specified file.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 632 of file exodusII_io.C.
References libMesh::err.
Referenced by libMesh::ErrorVector::plot_error().
00633 { 00634 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00635 << std::endl; 00636 libmesh_error(); 00637 }
| void libMesh::ExodusII_IO::write_discontinuous_exodusII | ( | const std::string & | name, | |
| const EquationSystems & | es | |||
| ) |
Writes a exodusII file with discontinuous data
Definition at line 429 of file exodusII_io.C.
References libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_variable_names(), and write_nodal_data_discontinuous().
00431 { 00432 std::vector<std::string> solution_names; 00433 std::vector<Number> v; 00434 00435 es.build_variable_names (solution_names); 00436 es.build_discontinuous_solution_vector (v); 00437 00438 this->write_nodal_data_discontinuous(name, v, solution_names); 00439 }
| void libMesh::ExodusII_IO::write_element_data | ( | const EquationSystems & | es | ) |
Write out element solution.
Definition at line 362 of file exodusII_io.C.
References libMesh::err.
Referenced by libMesh::ErrorVector::plot_error().
00363 { 00364 00365 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00366 << std::endl; 00367 libmesh_error(); 00368 }
| virtual void libMesh::MeshOutput< MeshBase >::write_equation_systems | ( | const std::string & | , | |
| const EquationSystems & | , | |||
| const std::set< std::string > * | system_names = NULL | |||
| ) | [virtual, inherited] |
This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object.
Referenced by libMesh::Nemesis_IO::write_timestep().
| void libMesh::ExodusII_IO::write_global_data | ( | const std::vector< Number > & | soln, | |
| const std::vector< std::string > & | names | |||
| ) |
Write out global variables.
Definition at line 571 of file exodusII_io.C.
References libMesh::err.
00573 { 00574 00575 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00576 << std::endl; 00577 libmesh_error(); 00578 }
| void libMesh::ExodusII_IO::write_information_records | ( | const std::vector< std::string > & | records | ) |
Write out information records.
Definition at line 544 of file exodusII_io.C.
References libMesh::err.
00545 { 00546 00547 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00548 << std::endl; 00549 libmesh_error(); 00550 }
| void libMesh::ExodusII_IO::write_nodal_data | ( | const std::string & | fname, | |
| const std::vector< Number > & | soln, | |||
| const std::vector< std::string > & | names | |||
| ) | [virtual] |
Write out a nodal solution.
Reimplemented from libMesh::MeshOutput< MeshBase >.
Definition at line 418 of file exodusII_io.C.
References libMesh::err.
00421 { 00422 00423 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00424 << std::endl; 00425 libmesh_error(); 00426 }
| void libMesh::ExodusII_IO::write_nodal_data_discontinuous | ( | const std::string & | fname, | |
| const std::vector< Number > & | soln, | |||
| const std::vector< std::string > & | names | |||
| ) |
Write out a discontinuous nodal solution.
Definition at line 442 of file exodusII_io.C.
References _timestep, libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::ExodusII_IO_Helper::create(), libMesh::ExodusII_IO_Helper::created(), end, exio_helper, libMesh::ExodusII_IO_Helper::initialize_discontinuous(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::processor_id(), libMesh::ExodusII_IO_Helper::write_elements_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), and libMesh::ExodusII_IO_Helper::write_sidesets().
Referenced by write_discontinuous_exodusII().
00445 { 00446 START_LOG("write_nodal_data_discontinuous()", "ExodusII_IO"); 00447 00448 const MeshBase & mesh = MeshOutput<MeshBase>::mesh(); 00449 00450 int num_vars = libmesh_cast_int<int>(names.size()); 00451 int num_nodes = 0; 00452 MeshBase::const_element_iterator it = mesh.active_elements_begin(); 00453 const MeshBase::const_element_iterator end = mesh.active_elements_end(); 00454 for ( ; it != end; ++it) 00455 num_nodes += (*it)->n_nodes(); 00456 00457 // FIXME: Will we ever _not_ need to do this? 00458 // DRG: Yes... when writing multiple timesteps to the same file. 00459 if (!exio_helper->created()) 00460 { 00461 exio_helper->create(fname); 00462 exio_helper->initialize_discontinuous(fname,mesh); 00463 exio_helper->write_nodal_coordinates_discontinuous(mesh); 00464 exio_helper->write_elements_discontinuous(mesh); 00465 exio_helper->write_sidesets(mesh); 00466 exio_helper->write_nodesets(mesh); 00467 exio_helper->initialize_nodal_variables(names); 00468 } 00469 00470 if (libMesh::processor_id() == 0) 00471 for (int c=0; c<num_vars; c++) 00472 { 00473 //Copy out this variable's solution 00474 std::vector<Number> cur_soln(num_nodes); 00475 00476 for(int i=0; i<num_nodes; i++) 00477 cur_soln[i] = soln[i*num_vars + c];//c*num_nodes+i]; 00478 00479 exio_helper->write_nodal_values(c+1,cur_soln,_timestep); 00480 } 00481 00482 STOP_LOG("write_nodal_data_discontinuous()", "ExodusII_IO"); 00483 }
| void libMesh::ExodusII_IO::write_timestep | ( | const std::string & | fname, | |
| const EquationSystems & | es, | |||
| const int | timestep, | |||
| const Real | time | |||
| ) |
Writes out the solution at a specific timestep.
- Parameters:
-
timestep The timestep to write out, should be _1_ indexed.
Definition at line 602 of file exodusII_io.C.
References libMesh::err.
00606 { 00607 00608 libMesh::err << "ERROR, ExodusII API is not defined.\n" 00609 << std::endl; 00610 libmesh_error(); 00611 }
Member Data Documentation
const bool libMesh::MeshOutput< MeshBase >::_is_parallel_format [protected, inherited] |
Flag specifying whether this format is parallel-capable. If this is false (default) I/O is only permitted when the mesh has been serialized.
Definition at line 126 of file mesh_output.h.
Referenced by libMesh::PostscriptIO::write(), libMesh::FroIO::write(), libMesh::EnsightIO::write(), and libMesh::DivaIO::write().
std::vector<std::string> libMesh::ExodusII_IO::_output_variables [private] |
The names of the variables to be output. If this is empty then all variables are output.
Definition at line 195 of file exodusII_io.h.
Referenced by set_output_variables().
int libMesh::ExodusII_IO::_timestep [private] |
Definition at line 184 of file exodusII_io.h.
Referenced by write_nodal_data_discontinuous().
bool libMesh::ExodusII_IO::_verbose [private] |
std::vector<bool> libMesh::MeshInput< MeshBase >::elems_of_dimension [protected, inherited] |
A vector of bools describing what dimension elements have been encountered when reading a mesh.
Definition at line 93 of file mesh_input.h.
Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UNVIO::element_in(), libMesh::VTKIO::read(), libMesh::Nemesis_IO::read(), libMesh::GMVIO::read(), read(), libMesh::UNVIO::read_implementation(), libMesh::UCDIO::read_implementation(), libMesh::LegacyXdrIO::read_mesh(), and libMesh::XdrIO::read_serialized_connectivity().
Only attempt to instantiate an ExodusII helper class if the Exodus API is defined. This class will have no functionality when LIBMESH_HAVE_EXODUS_API is not defined.
Definition at line 178 of file exodusII_io.h.
Referenced by read(), use_mesh_dimension_instead_of_spatial_dimension(), verbose(), write_nodal_data_discontinuous(), and ~ExodusII_IO().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:18 UTC
Hosted By: