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 
00061       Ioss::PropertyManager m_property_manager;
00062 
00063       Ioss::Region *m_input_region;
00064       Ioss::Region *m_output_region;
00065 
00072       stk::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 
00127     void create_input_mesh(const std::string &type,
00128          const std::string &filename,
00129          MPI_Comm comm,
00130          stk::mesh::fem::FEMMetaData &metadata,
00131          MeshData &mesh_data);
00132 
00143     void populate_bulk_data(stk::mesh::BulkData &bulk_data, stk::io::MeshData &mesh_data);
00144 
00158     void process_mesh_bulk_data(Ioss::Region *region, stk::mesh::BulkData &bulk_data);
00159 
00174     void define_input_fields(MeshData &mesh_data, stk::mesh::fem::FEMMetaData &meta_data);
00175 
00182     void process_input_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, int step);
00183 
00191     void process_input_request(MeshData &mesh_data, stk::mesh::BulkData &bulk, double time);
00192 
00203     void input_mesh_fields(Ioss::Region *region, stk::mesh::BulkData &bulk_data, int step);
00204 
00215     void input_mesh_fields(Ioss::Region *region, stk::mesh::BulkData &bulk_data, double time);
00216 
00248     void create_output_mesh(const std::string &filename,
00249           MPI_Comm comm,
00250           stk::mesh::BulkData &bulk_data,
00251           MeshData &mesh_data);
00252 
00264     void define_output_fields(const MeshData &mesh_data,
00265             const stk::mesh::fem::FEMMetaData &fem_meta,
00266             bool add_all_fields = false);
00267 
00272     int process_output_request(MeshData &mesh_data,
00273              stk::mesh::BulkData &bulk,
00274              double time,
00275                                const std::set<const stk::mesh::Part*> &exclude=std::set<const stk::mesh::Part*>());
00280     template <typename INT>
00281     void get_element_block_sizes(MeshData &mesh_data,
00282                                  std::vector<INT>& el_blocks);
00283   }
00284 }
00285 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines