|
Sierra Toolkit
Version of the Day
|
00001 #ifndef STK_IO_UTIL_IO_FIXTURE_HPP 00002 #define STK_IO_UTIL_IO_FIXTURE_HPP 00003 00004 #include <stk_util/parallel/Parallel.hpp> 00005 00006 #include <stk_mesh/base/Types.hpp> 00007 #include <stk_mesh/base/BulkData.hpp> 00008 00009 #include <stk_mesh/fem/FEMMetaData.hpp> 00010 00011 #include <stk_io/IossBridge.hpp> 00012 #include <stk_io/MeshReadWriteUtils.hpp> 00013 00014 #include <stk_util/environment/ReportHandler.hpp> 00015 00016 #include <Teuchos_RCP.hpp> 00017 00018 #include <string> 00019 00020 namespace stk_classic { 00021 namespace io { 00022 namespace util { 00023 00028 class IO_Fixture 00029 { 00030 public: 00031 00032 typedef stk_classic::mesh::Field< double, stk_classic::mesh::Cartesian> coord_field_type; 00033 00034 IO_Fixture(stk_classic::ParallelMachine comm); 00035 ~IO_Fixture(); 00036 00042 void create_output_mesh( 00043 const std::string & base_exodus_filename, 00044 bool add_transient = true, 00045 bool add_all_fields = false 00046 ); 00052 void add_timestep_to_output_mesh( double time ); 00053 00057 void set_meta_data( Teuchos::RCP<stk_classic::mesh::fem::FEMMetaData> arg_meta_data ); 00058 00062 void set_bulk_data( Teuchos::RCP<stk_classic::mesh::BulkData> arg_bulk_data ); 00063 00068 void set_input_ioss_region( Teuchos::RCP<Ioss::Region> input_region ); 00069 00075 void initialize_meta_data( const std::string & base_filename, 00076 const std::string & type = "exodusii" ); 00077 00084 void initialize_bulk_data(); 00085 00086 stk_classic::mesh::fem::FEMMetaData & meta_data() 00087 { 00088 ThrowRequire( !Teuchos::is_null(m_fem_meta_data)) ; 00089 return *m_fem_meta_data; 00090 } 00091 00092 stk_classic::mesh::BulkData & bulk_data() 00093 { 00094 ThrowRequire( !Teuchos::is_null(m_bulk_data)) ; 00095 return *m_bulk_data; 00096 } 00097 00098 stk_classic::io::MeshData & mesh_data() 00099 { 00100 return m_mesh_data; 00101 } 00102 00103 coord_field_type & get_coordinate_field() 00104 { 00105 coord_field_type * coord_field = meta_data().get_field<coord_field_type>("coordinates"); 00106 ThrowRequire( coord_field != NULL); 00107 return * coord_field; 00108 } 00109 00110 Teuchos::RCP<Ioss::Region> input_ioss_region() { return m_ioss_input_region; } 00111 Teuchos::RCP<Ioss::Region> output_ioss_region() { return m_ioss_output_region; } 00112 void output_ioss_region(Teuchos::RCP<Ioss::Region>); 00113 00114 private: 00115 stk_classic::ParallelMachine m_comm; 00116 Teuchos::RCP<stk_classic::mesh::fem::FEMMetaData> m_fem_meta_data; 00117 Teuchos::RCP<stk_classic::mesh::BulkData> m_bulk_data; 00118 00119 Teuchos::RCP<Ioss::Region> m_ioss_input_region; 00120 Teuchos::RCP<Ioss::Region> m_ioss_output_region; 00121 00122 std::string m_mesh_type; 00123 stk_classic::io::MeshData m_mesh_data; 00124 00125 //disallow copy constructor and assignment operator 00126 IO_Fixture( const IO_Fixture & ); 00127 IO_Fixture & operator = ( const IO_Fixture & ); 00128 }; 00129 00130 } // namespace util 00131 } // namespace io 00132 } // namespace stk_classic 00133 00134 #endif //STK_IO_UTIL_IO_FIXTURE_HPP