Sierra Toolkit  Version of the Day
IO_Fixture.hpp
1 #ifndef STK_IO_UTIL_IO_FIXTURE_HPP
2 #define STK_IO_UTIL_IO_FIXTURE_HPP
3 
4 #include <stk_util/parallel/Parallel.hpp>
5 
6 #include <stk_mesh/base/Types.hpp>
7 #include <stk_mesh/base/BulkData.hpp>
8 
9 #include <stk_mesh/fem/FEMMetaData.hpp>
10 
11 #include <stk_io/IossBridge.hpp>
12 #include <stk_io/MeshReadWriteUtils.hpp>
13 
14 #include <stk_util/environment/ReportHandler.hpp>
15 
16 #include <Teuchos_RCP.hpp>
17 
18 #include <string>
19 
20 namespace stk_classic {
21 namespace io {
22 namespace util {
23 
29 {
30  public:
31 
33 
35  ~IO_Fixture();
36 
42  void create_output_mesh(
43  const std::string & base_exodus_filename,
44  bool add_transient = true,
45  bool add_all_fields = false
46  );
52  void add_timestep_to_output_mesh( double time );
53 
57  void set_meta_data( Teuchos::RCP<stk_classic::mesh::fem::FEMMetaData> arg_meta_data );
58 
62  void set_bulk_data( Teuchos::RCP<stk_classic::mesh::BulkData> arg_bulk_data );
63 
68  void set_input_ioss_region( Teuchos::RCP<Ioss::Region> input_region );
69 
75  void initialize_meta_data( const std::string & base_filename,
76  const std::string & type = "exodusii" );
77 
84  void initialize_bulk_data();
85 
87  {
88  ThrowRequire( !Teuchos::is_null(m_fem_meta_data)) ;
89  return *m_fem_meta_data;
90  }
91 
92  stk_classic::mesh::BulkData & bulk_data()
93  {
94  ThrowRequire( !Teuchos::is_null(m_bulk_data)) ;
95  return *m_bulk_data;
96  }
97 
98  stk_classic::io::MeshData & mesh_data()
99  {
100  return m_mesh_data;
101  }
102 
103  coord_field_type & get_coordinate_field()
104  {
105  coord_field_type * coord_field = meta_data().get_field<coord_field_type>("coordinates");
106  ThrowRequire( coord_field != NULL);
107  return * coord_field;
108  }
109 
110  Teuchos::RCP<Ioss::Region> input_ioss_region() { return m_ioss_input_region; }
111  Teuchos::RCP<Ioss::Region> output_ioss_region() { return m_ioss_output_region; }
112  void output_ioss_region(Teuchos::RCP<Ioss::Region>);
113 
114  private:
116  Teuchos::RCP<stk_classic::mesh::fem::FEMMetaData> m_fem_meta_data;
117  Teuchos::RCP<stk_classic::mesh::BulkData> m_bulk_data;
118 
119  Teuchos::RCP<Ioss::Region> m_ioss_input_region;
120  Teuchos::RCP<Ioss::Region> m_ioss_output_region;
121 
122  std::string m_mesh_type;
123  stk_classic::io::MeshData m_mesh_data;
124 
125  //disallow copy constructor and assignment operator
126  IO_Fixture( const IO_Fixture & );
127  IO_Fixture & operator = ( const IO_Fixture & );
128 };
129 
130 } // namespace util
131 } // namespace io
132 } // namespace stk_classic
133 
134 #endif //STK_IO_UTIL_IO_FIXTURE_HPP
void add_timestep_to_output_mesh(double time)
Definition: IO_Fixture.cpp:129
FEMMetaData is a class that implements a Finite Element Method skin on top of the Sierra Tool Kit Met...
Definition: FEMMetaData.hpp:54
void set_bulk_data(Teuchos::RCP< stk_classic::mesh::BulkData > arg_bulk_data)
Definition: IO_Fixture.cpp:143
void initialize_meta_data(const std::string &base_filename, const std::string &type="exodusii")
Definition: IO_Fixture.cpp:150
void set_meta_data(Teuchos::RCP< stk_classic::mesh::fem::FEMMetaData > arg_meta_data)
Definition: IO_Fixture.cpp:136
void create_output_mesh(const std::string &base_exodus_filename, bool add_transient=true, bool add_all_fields=false)
Definition: IO_Fixture.cpp:34
Field with defined data type and multi-dimensions (if any)
Definition: Field.hpp:118
Manager for an integrated collection of entities, entity relations, and buckets of field data...
Definition: BulkData.hpp:49
Sierra Toolkit.
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
field_type * get_field(const std::string &name) const
Get a field, return NULL if it does not exist.
void set_input_ioss_region(Teuchos::RCP< Ioss::Region > input_region)
Definition: IO_Fixture.cpp:191