nemesis_io_helper.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 #ifndef LIBMESH_NEMESIS_IO_HELPER_H 00019 #define LIBMESH_NEMESIS_IO_HELPER_H 00020 00021 #include "libmesh/libmesh_config.h" 00022 00023 #if defined(LIBMESH_HAVE_NEMESIS_API) && defined(LIBMESH_HAVE_EXODUS_API) 00024 00025 // Local headers 00026 #include "libmesh/exodusII_io_helper.h" 00027 00028 // C++ headers 00029 #include <set> 00030 #include <vector> 00031 00032 namespace libMesh 00033 { 00034 00035 // The Nemesis API header file. Should already be 00036 // correctly extern C'd but it doesn't hurt :) 00037 namespace Nemesis { 00038 extern "C" { 00039 #include "ne_nemesisI.h" 00040 } 00041 } 00042 00043 00053 class Nemesis_IO_Helper : public ExodusII_IO_Helper 00054 { 00055 public: 00059 explicit 00060 Nemesis_IO_Helper(bool verbose=false); 00061 00065 virtual ~Nemesis_IO_Helper(); 00066 00067 // /** 00068 // * Set the flag indicationg if we should be verbose. 00069 // */ 00070 // void verbose (bool set_verbosity); 00071 00085 void get_init_global(); 00086 00091 void get_ss_param_global(); 00092 void get_ns_param_global(); 00093 void get_eb_info_global(); 00094 void get_init_info(); 00095 void get_loadbal_param(); 00096 void get_elem_map(); 00097 void get_node_map(); 00098 void get_cmap_params(); 00099 void get_node_cmap(); 00100 void get_elem_cmap(); 00101 00112 void put_init_info(unsigned num_proc, 00113 unsigned num_proc_in_file, 00114 const char* ftype); 00115 00124 void put_init_global(dof_id_type num_nodes_global, 00125 dof_id_type num_elems_global, 00126 unsigned num_elem_blks_global, 00127 unsigned num_node_sets_global, 00128 unsigned num_side_sets_global); 00129 00137 void put_eb_info_global(std::vector<int>& global_elem_blk_ids, 00138 std::vector<int>& global_elem_blk_cnts); 00139 00148 void put_ns_param_global(std::vector<int>& global_nodeset_ids, 00149 std::vector<int>& num_global_node_counts, 00150 std::vector<int>& num_global_node_df_counts); 00151 00160 void put_ss_param_global(std::vector<int>& global_sideset_ids, 00161 std::vector<int>& num_global_side_counts, 00162 std::vector<int>& num_global_side_df_counts); 00163 00164 00165 00178 void put_loadbal_param(unsigned num_internal_nodes, 00179 unsigned num_border_nodes, 00180 unsigned num_external_nodes, 00181 unsigned num_internal_elems, 00182 unsigned num_border_elems, 00183 unsigned num_node_cmaps, 00184 unsigned num_elem_cmaps); 00185 00193 void put_cmap_params(std::vector<int>& node_cmap_ids, 00194 std::vector<int>& node_cmap_node_cnts, 00195 std::vector<int>& elem_cmap_ids, 00196 std::vector<int>& elem_cmap_elem_cnts); 00197 00216 void put_node_cmap(std::vector<std::vector<int> >& node_cmap_node_ids, 00217 std::vector<std::vector<int> >& node_cmap_proc_ids); 00218 00224 void put_node_map(std::vector<int>& node_mapi, 00225 std::vector<int>& node_mapb, 00226 std::vector<int>& node_mape); 00227 00238 void put_elem_cmap(std::vector<std::vector<int> >& elem_cmap_elem_ids, 00239 std::vector<std::vector<int> >& elem_cmap_side_ids, 00240 std::vector<std::vector<int> >& elem_cmap_proc_ids); 00241 00247 void put_elem_map(std::vector<int>& elem_mapi, 00248 std::vector<int>& elem_mapb); 00249 00254 void put_n_coord(unsigned start_node_num, 00255 unsigned num_nodes, 00256 std::vector<Real>& x_coor, 00257 std::vector<Real>& y_coor, 00258 std::vector<Real>& z_coor); 00259 00260 00265 virtual void write_nodal_coordinates(const MeshBase & mesh); 00266 00270 virtual void write_elements(const MeshBase & mesh); 00271 00275 virtual void write_sidesets(const MeshBase & mesh); 00276 00280 virtual void write_nodesets(const MeshBase & mesh); 00281 00286 virtual void create(std::string filename); 00287 00292 virtual void initialize(std::string title, const MeshBase & mesh); 00293 00297 void write_nodal_solution(const std::vector<Number> & values, const std::vector<std::string> names, int timestep); 00298 00303 std::string construct_nemesis_filename(const std::string& base_filename); 00304 00313 int nemesis_err_flag; 00314 00319 int num_nodes_global; 00320 int num_elems_global; 00321 int num_elem_blks_global; 00322 int num_node_sets_global; 00323 int num_side_sets_global; 00324 00329 int num_proc; 00330 00336 int num_proc_in_file; 00337 00343 char ftype; 00344 00352 std::vector<int> global_sideset_ids; 00353 std::vector<int> num_global_side_counts; 00354 std::vector<int> num_global_side_df_counts; 00355 00356 00364 std::vector<int> global_nodeset_ids; 00365 std::vector<int> num_global_node_counts; 00366 std::vector<int> num_global_node_df_counts; 00367 00368 00374 std::vector<int> global_elem_blk_ids; 00375 std::vector<int> global_elem_blk_cnts; 00376 00380 std::set<int> nodes_attached_to_local_elems; 00381 00385 std::map<subdomain_id_type, std::vector<unsigned int> > subdomain_map; 00386 00391 std::map<int, std::vector<int> > block_id_to_elem_connectivity; 00392 00401 int num_internal_nodes; 00402 00408 int num_border_nodes; 00409 00415 int num_external_nodes; 00416 00421 int num_internal_elems; 00422 00428 int num_border_elems; 00429 00435 int num_node_cmaps; 00436 00442 int num_elem_cmaps; 00443 00444 00445 00451 std::vector<int> elem_mapi; 00452 00458 std::vector<int> elem_mapb; 00459 00460 00461 00467 std::vector<int> node_mapi; 00468 00474 std::vector<int> node_mapb; 00475 00481 std::vector<int> node_mape; 00482 00483 00490 std::vector<int> node_cmap_ids; 00491 std::vector<int> node_cmap_node_cnts; 00492 std::vector<int> elem_cmap_ids; 00493 std::vector<int> elem_cmap_elem_cnts; 00494 00495 00504 std::vector<std::vector<int> > node_cmap_node_ids; 00505 std::vector<std::vector<int> > node_cmap_proc_ids; 00506 00507 00513 std::vector<std::vector<int> > elem_cmap_elem_ids; 00514 std::vector<std::vector<int> > elem_cmap_side_ids; 00515 std::vector<std::vector<int> > elem_cmap_proc_ids; 00516 00517 00518 private: 00519 // bool _verbose; 00520 00525 std::map<subdomain_id_type, unsigned> local_subdomain_counts; 00526 00531 std::set<unsigned> border_node_ids; 00532 00538 std::map<unsigned, std::set<unsigned> > proc_nodes_touched_intersections; 00539 00543 typedef std::map<unsigned, std::set<unsigned> >::iterator proc_nodes_touched_iterator; 00544 00548 std::map<unsigned, std::set<std::pair<unsigned,unsigned> > > proc_border_elem_sets; 00549 00553 typedef std::map<unsigned, std::set<std::pair<unsigned,unsigned> > >::iterator proc_border_elem_sets_iterator; 00554 00558 std::set<unsigned> internal_node_ids; 00559 00563 std::set<unsigned> internal_elem_ids; 00564 00568 std::set<unsigned> border_elem_ids; 00569 00574 void compute_num_global_elem_blocks(const MeshBase& pmesh); 00575 00580 void compute_num_global_nodesets(const MeshBase& pmesh); 00581 00586 void compute_num_global_sidesets(const MeshBase& pmesh); 00587 00594 void build_element_and_node_maps(const MeshBase& pmesh); 00595 00601 void compute_border_node_ids(const MeshBase& pmesh); 00602 00607 void compute_internal_and_border_elems_and_internal_nodes(const MeshBase& pmesh); 00608 00613 void compute_communication_map_parameters(); 00614 00619 void compute_node_communication_maps(); 00620 00626 void compute_node_maps(); 00627 00632 void compute_elem_communication_maps(); 00633 00638 void compute_element_maps(); 00639 00645 void write_exodus_initialization_info(const MeshBase& pmesh, 00646 const std::string& title); 00647 }; 00648 00649 } // namespace libMesh 00650 00651 #endif // #if defined(LIBMESH_HAVE_NEMESIS_API) && defined(LIBMESH_HAVE_EXODUS_API) 00652 #endif // LIBMESH_NEMESIS_IO_HELPER_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: