Sierra Toolkit  Version of the Day
MeshReadWriteUtils.hpp
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 {
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 
00059       Ioss::PropertyManager m_property_manager;
00060 
00061       Ioss::Region *m_input_region;
00062       Ioss::Region *m_output_region;
00063 
00070       stk::mesh::Selector *m_anded_selector;
00071 
00072     private:
00073       MeshData(const MeshData&); // Do not implement
00074       MeshData& operator=(const MeshData&); // Do not implement
00075 
00076     };
00077 
00081     void show_mesh_help();
00082 
00125     void create_input_mesh(const std::string &type,
00126          const std::string &filename,
00127          MPI_Comm comm,
00128          stk::mesh::fem::FEMMetaData &metadata,
00129          MeshData &mesh_data);
00130 
00141     void populate_bulk_data(stk::mesh::BulkData &bulk_data, stk::io::MeshData &mesh_data);
00142 
00156     void process_mesh_bulk_data(Ioss::Region *region, stk::mesh::BulkData &bulk_data);
00157 
00172     void define_input_fields(MeshData &mesh_data, stk::mesh::fem::FEMMetaData &meta_data);
00173 
00180     void process_input_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, int step);
00181 
00189     void process_input_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, double time);
00190 
00201     void input_mesh_fields(Ioss::Region *region, stk::mesh::BulkData &bulk_data, int step);
00202 
00234     void create_output_mesh(const std::string &filename,
00235           MPI_Comm comm,
00236           stk::mesh::BulkData &bulk_data,
00237           MeshData &mesh_data);
00238 
00250     void define_output_fields(const MeshData &mesh_data,
00251             const stk::mesh::fem::FEMMetaData &fem_meta,
00252             bool add_all_fields = false);
00253 
00258     int process_output_request(MeshData &mesh_data,
00259              stk::mesh::BulkData &bulk,
00260              double time,
00261                                const std::set<const stk::mesh::Part*> &exclude=std::set<const stk::mesh::Part*>());
00266     template <typename INT>
00267     void get_element_block_sizes(MeshData &mesh_data,
00268                                  std::vector<INT>& el_blocks);
00269   }
00270 }
00271 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends