Sierra Toolkit Version of the Day
IO_Fixture.hpp
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/util/UseCase_mesh.hpp>
00013 
00014 #include <stk_util/environment/ReportHandler.hpp>
00015 
00016 #include <Teuchos_RCP.hpp>
00017 
00018 #include <string>
00019 
00020 namespace stk {
00021 namespace io {
00022 namespace util {
00023 
00028 class IO_Fixture
00029 {
00030  public:
00031 
00032   typedef stk::mesh::Field< double, stk::mesh::Cartesian> coord_field_type;
00033 
00034   IO_Fixture(stk::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::mesh::fem::FEMMetaData> arg_meta_data );
00058 
00062   void set_bulk_data( Teuchos::RCP<stk::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::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::mesh::BulkData & bulk_data()
00093   {
00094     ThrowRequire( !Teuchos::is_null(m_bulk_data)) ;
00095     return *m_bulk_data;
00096   }
00097 
00098   coord_field_type & get_coordinate_field()
00099   {
00100     coord_field_type * coord_field = meta_data().get_field<coord_field_type>("coordinates");
00101     ThrowRequire( coord_field != NULL);
00102     return * coord_field;
00103   }
00104 
00105   Teuchos::RCP<Ioss::Region> input_ioss_region()  { return m_ioss_input_region; }
00106   Teuchos::RCP<Ioss::Region> output_ioss_region() { return m_ioss_output_region; }
00107 
00108  private:
00109   stk::ParallelMachine                       m_comm;
00110   Teuchos::RCP<stk::mesh::fem::FEMMetaData>  m_fem_meta_data;
00111   Teuchos::RCP<stk::mesh::BulkData>          m_bulk_data;
00112 
00113   Teuchos::RCP<Ioss::Region>                 m_ioss_input_region;
00114   Teuchos::RCP<Ioss::Region>                 m_ioss_output_region;
00115 
00116   std::string                                m_mesh_type;
00117   stk::io::util::MeshData                    m_mesh_data;
00118 
00119   //disallow copy constructor and assignment operator
00120   IO_Fixture( const IO_Fixture & );
00121   IO_Fixture & operator = ( const IO_Fixture & );
00122 };
00123 
00124 } // namespace util
00125 } // namespace io
00126 } // namespace stk
00127 
00128 #endif //STK_IO_UTIL_IO_FIXTURE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends