|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010, 2011 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #ifndef STK_IO_MESHREADWRITEUTILS_HPP 00010 #define STK_IO_MESHREADWRITEUTILS_HPP 00011 #include <string> 00012 #include <vector> 00013 #include <set> 00014 #include <stk_util/parallel/Parallel.hpp> 00015 #include <Ioss_PropertyManager.h> 00016 00017 namespace Ioss { 00018 class Region; 00019 } 00020 00021 namespace stk_classic { 00022 namespace mesh { 00023 class Part; 00024 class BulkData; 00025 class Selector; 00026 namespace fem { 00027 class FEMMetaData; 00028 } 00029 } 00030 namespace io { 00031 class MeshData { 00032 // Used to maintain state between the meta data and bulk data 00033 // portions of the mesh generation process for use cases. 00034 public: 00035 MeshData() : m_input_region(NULL), m_output_region(NULL), 00036 m_anded_selector(NULL) 00037 {} 00038 00039 ~MeshData(); 00040 00061 Ioss::PropertyManager m_property_manager; 00062 00063 Ioss::Region *m_input_region; 00064 Ioss::Region *m_output_region; 00065 00072 stk_classic::mesh::Selector *m_anded_selector; 00073 00074 private: 00075 MeshData(const MeshData&); // Do not implement 00076 MeshData& operator=(const MeshData&); // Do not implement 00077 00078 }; 00079 00083 void show_mesh_help(); 00084 00130 void create_input_mesh(const std::string &type, 00131 const std::string &filename, 00132 MPI_Comm comm, 00133 stk_classic::mesh::fem::FEMMetaData &metadata, 00134 MeshData &mesh_data, 00135 bool lower_case_variable_names=true); 00136 00189 void create_input_mesh(const std::string &type, 00190 const std::string &filename, 00191 MPI_Comm comm, 00192 stk_classic::mesh::fem::FEMMetaData &metadata, 00193 MeshData &mesh_data, 00194 const std::vector<std::string>& names_to_add, 00195 bool lower_case_variable_names=true); 00196 00207 void populate_bulk_data(stk_classic::mesh::BulkData &bulk_data, stk_classic::io::MeshData &mesh_data); 00208 00222 void process_mesh_bulk_data(Ioss::Region *region, stk_classic::mesh::BulkData &bulk_data); 00223 00238 void define_input_fields(MeshData &mesh_data, stk_classic::mesh::fem::FEMMetaData &meta_data); 00239 00246 void process_input_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, int step); 00247 00255 void process_input_request(MeshData &mesh_data, stk_classic::mesh::BulkData &bulk, double time); 00256 00267 void input_mesh_fields(Ioss::Region *region, stk_classic::mesh::BulkData &bulk_data, int step); 00268 00279 void input_mesh_fields(Ioss::Region *region, stk_classic::mesh::BulkData &bulk_data, double time); 00280 00315 void create_output_mesh(const std::string &filename, 00316 MPI_Comm comm, 00317 stk_classic::mesh::BulkData &bulk_data, 00318 MeshData &mesh_data, 00319 bool lower_case_variable_names=true); 00320 00332 void define_output_fields(const MeshData &mesh_data, 00333 const stk_classic::mesh::fem::FEMMetaData &fem_meta, 00334 bool add_all_fields = false); 00335 00340 int process_output_request(MeshData &mesh_data, 00341 stk_classic::mesh::BulkData &bulk, 00342 double time, 00343 const std::set<const stk_classic::mesh::Part*> &exclude=std::set<const stk_classic::mesh::Part*>()); 00348 template <typename INT> 00349 void get_element_block_sizes(MeshData &mesh_data, 00350 std::vector<INT>& el_blocks); 00351 } 00352 } 00353 #endif