|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 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_IossBridge_hpp 00010 #define stk_io_IossBridge_hpp 00011 00012 #include <string> 00013 #include <stk_util/parallel/Parallel.hpp> 00014 #include <stk_mesh/base/Types.hpp> 00015 #include <stk_mesh/fem/CoordinateSystems.hpp> 00016 #include <stk_mesh/fem/FEMMetaData.hpp> 00017 00018 // TODO: remove this and uses of USE_FEMMETADATA once the migration is done (srkenno@sandia.gov) 00019 00020 #define USE_FEMMETADATA 00021 #ifdef USE_FEMMETADATA 00022 #include <stk_mesh/fem/FEMHelpers.hpp> 00023 #endif 00024 00025 #include <stk_mesh/fem/TopologyDimensions.hpp> 00026 #include <Ioss_DBUsage.h> 00027 #include <Ioss_Field.h> 00028 #include <Ioss_SideBlock.h> 00029 #include <Ioss_ElementTopology.h> 00030 00031 namespace Ioss { 00032 class Region; 00033 class GroupingEntity; 00034 class EntityBlock; 00035 class SideSet; 00036 class Field; 00037 class ElementTopology; 00038 } 00039 00040 struct CellTopologyData; 00041 00042 namespace stk_classic { 00043 00057 namespace io { 00058 00070 bool include_entity(const Ioss::GroupingEntity *entity); 00071 00072 void internal_part_processing(Ioss::GroupingEntity *entity, stk_classic::mesh::fem::FEMMetaData &meta); 00073 00074 void internal_part_processing(Ioss::EntityBlock *entity, stk_classic::mesh::fem::FEMMetaData &meta); 00075 00077 void internal_part_processing(Ioss::GroupingEntity *entity, stk_classic::mesh::MetaData &meta); 00078 00080 void internal_part_processing(Ioss::EntityBlock *entity, stk_classic::mesh::MetaData &meta); 00081 00092 template <typename T> 00093 void default_part_processing(const std::vector<T*> &entities, 00094 stk_classic::mesh::fem::FEMMetaData &fem_meta) 00095 { 00096 for(size_t i=0; i < entities.size(); i++) { 00097 T* entity = entities[i]; 00098 internal_part_processing(entity, fem_meta); 00099 } 00100 } 00101 00103 template <typename T> 00104 void default_part_processing(const std::vector<T*> &entities, stk_classic::mesh::MetaData &meta, 00105 const stk_classic::mesh::EntityRank) 00106 { 00107 stk_classic::mesh::fem::FEMMetaData &fem_meta = stk_classic::mesh::fem::FEMMetaData::get(meta); 00108 default_part_processing (entities, fem_meta); 00109 } 00110 00131 void define_output_db( Ioss::Region & io_region, 00132 const mesh::BulkData& bulk_data, 00133 const Ioss::Region *input_region = NULL, 00134 const stk_classic::mesh::Selector *anded_selector = NULL, 00135 const bool sort_stk_parts = false); 00136 00137 00145 void write_output_db( Ioss::Region & io_region , 00146 const mesh::BulkData& bulk, 00147 const stk_classic::mesh::Selector *anded_selector = NULL); 00148 00149 00150 //---------------------------------------------------------------------- 00151 00172 bool is_valid_part_field(const stk_classic::mesh::FieldBase *field, 00173 const stk_classic::mesh::EntityRank part_type, 00174 const stk_classic::mesh::Part &part, 00175 const stk_classic::mesh::Part &universal, 00176 const Ioss::Field::RoleType filter_role, 00177 const bool add_all = false); 00178 00184 void ioss_add_fields(const stk_classic::mesh::Part &part, 00185 const stk_classic::mesh::EntityRank part_type, 00186 Ioss::GroupingEntity *entity, 00187 const Ioss::Field::RoleType filter_role, 00188 const bool add_all = false); 00189 00202 void define_io_fields(Ioss::GroupingEntity *entity, 00203 Ioss::Field::RoleType role, 00204 stk_classic::mesh::Part &part, 00205 stk_classic::mesh::EntityRank part_type); 00206 00211 const CellTopologyData *map_topology_ioss_to_cell(const Ioss::ElementTopology *topology); 00212 00218 std::string map_topology_cell_to_ioss( const CellTopologyData *cell_top, 00219 int spatial_dimension); 00220 00232 void get_entity_list(Ioss::GroupingEntity *io_entity, 00233 stk_classic::mesh::EntityRank part_type, 00234 const stk_classic::mesh::BulkData &bulk, 00235 std::vector<stk_classic::mesh::Entity*> &entities); 00236 00243 void field_data_from_ioss(const stk_classic::mesh::FieldBase *field, 00244 std::vector<stk_classic::mesh::Entity*> &entities, 00245 Ioss::GroupingEntity *io_entity, 00246 const std::string &io_fld_name); 00247 00254 void field_data_to_ioss(const stk_classic::mesh::FieldBase *field, 00255 std::vector<stk_classic::mesh::Entity*> &entities, 00256 Ioss::GroupingEntity *io_entity, 00257 const std::string &io_fld_name, 00258 Ioss::Field::RoleType filter_role); 00259 00260 00265 const mesh::Field<double, mesh::ElementNode> *get_distribution_factor_field(const mesh::Part &p); 00266 00270 void set_distribution_factor_field(mesh::Part &p, 00271 const mesh::Field<double, mesh::ElementNode> &df_field); 00272 00278 const Ioss::Field::RoleType* get_field_role(const mesh::FieldBase &f); 00279 00283 void set_field_role(mesh::FieldBase &f, const Ioss::Field::RoleType &role); 00284 00293 bool is_part_io_part(mesh::Part &part); 00294 00298 void put_io_part_attribute( mesh::Part &part, Ioss::GroupingEntity *entity = NULL); 00299 00303 void remove_io_part_attribute(mesh::Part &part); 00304 00305 const Ioss::GroupingEntity *get_associated_ioss_entity(const mesh::Part &part); 00306 00307 size_t db_api_int_size(const Ioss::GroupingEntity *entity); 00308 00309 // To minimize ifdefs for the deprecated code: 00310 bool invalid_rank(mesh::EntityRank rank); 00311 mesh::EntityRank part_primary_entity_rank(const mesh::Part &part); 00312 mesh::EntityRank element_rank(const mesh::MetaData &meta); 00313 mesh::EntityRank side_rank(const mesh::MetaData &meta); 00314 mesh::EntityRank face_rank(const mesh::MetaData &meta); 00315 mesh::EntityRank edge_rank(const mesh::MetaData &meta); 00316 mesh::EntityRank node_rank(const mesh::MetaData &meta); 00317 void set_cell_topology(mesh::Part &part, const CellTopologyData * const cell_topology); 00318 const CellTopologyData *get_cell_topology(const mesh::Part &part); 00319 00320 void initialize_spatial_dimension(mesh::fem::FEMMetaData &fem_meta, size_t spatial_dimension, const std::vector<std::string> &entity_rank_names); 00321 00323 void initialize_spatial_dimension(mesh::MetaData &meta, size_t spatial_dimension, const std::vector<std::string> &entity_rank_names); 00324 00325 void get_io_field_type(const stk_classic::mesh::FieldBase *field, 00326 const stk_classic::mesh::FieldRestriction &res, 00327 std::pair<std::string, Ioss::Field::BasicType> *result); 00332 }//namespace io 00333 }//namespace stk_classic 00334 #endif 00335