moab
ReadCCMIO.hpp
Go to the documentation of this file.
00001 #ifndef READCCMIO_HPP
00002 #define READCCMIO_HPP
00003 
00004 #ifndef IS_BUILDING_MB
00005 #error "ReadCCMIO.hpp isn't supposed to be included into an application"
00006 #endif
00007 
00008 #include <vector>
00009 #include <set>
00010 #include <map>
00011 #include <string>
00012 
00013 #include "moab/Forward.hpp"
00014 #include "moab/Range.hpp"
00015 #include "moab/ExoIIInterface.hpp"
00016 #include "moab/ReaderIface.hpp"
00017 //#include "moab/TupleList.hpp"
00018 #include "ccmio.h"
00019 
00020 namespace moab {
00021 
00022 #undef READCCMIO_USE_TUPLE_LIST
00023 
00024 class ReadUtilIface;
00025 
00026 class ReadCCMIO : public ReaderIface
00027 {
00028  
00029 public:
00030 
00031   typedef std::map<int, std::vector<EntityHandle> > TupleList;
00032   typedef std::map<int, std::vector<int> > SenseList;
00033 
00035   ReadCCMIO(Interface *impl);
00036 
00038   virtual ~ReadCCMIO();
00039   
00040   static ReaderIface* factory( Interface* );
00041 
00042   ErrorCode load_file( const char* file_name,
00043                        const EntityHandle* file_set,
00044                        const FileOptions& opts,
00045                        const SubsetList* subset_list = 0,
00046                        const Tag* file_id_tag = 0 );
00047 
00048 private:
00049   
00050   ErrorCode read_processor(CCMIOID rootID, CCMIOID problemID,
00051                            CCMIOID processorID, CCMIOID verticesID,
00052                            CCMIOID topologyID, CCMIOSize_t proc,
00053                              Range *new_ents);
00054 
00055   ErrorCode read_cells(CCMIOSize_t proc, CCMIOID processorID,
00056                          CCMIOID verticesID, CCMIOID topologyID,
00057                          TupleList &vert_map, Range *new_cells);
00058 
00059 
00060   ErrorCode construct_cells(TupleList &face_map, 
00061 #ifndef READCCMIO_USE_TUPLE_LIST
00062                             SenseList &sense_map,
00063 #endif
00064                             TupleList &vert_map, 
00065                             std::map<int,int> &cell_topo_types,
00066                             std::vector<EntityHandle> &new_cells);
00067 
00068   ErrorCode ccmio_to_moab_type(int ccm_type, EntityType &moab_type, bool &has_mid_nodes);
00069 
00070   ErrorCode create_cell_from_faces(std::vector<EntityHandle> &facehs,
00071                                      std::vector<int> &senses,
00072                                    EntityType this_type,
00073                                    bool has_mid_nodes,
00074                                    EntityHandle &cell);
00075 
00076   ErrorCode read_gids_and_types(CCMIOID problemID,
00077                                   CCMIOID topologyID,
00078                                   std::vector<EntityHandle> &cells);
00079 
00080   ErrorCode read_all_faces(CCMIOID topologyID, TupleList &vert_map, 
00081                              TupleList &face_map
00082 #ifndef READCCMIO_USE_TUPLE_LIST
00083                              ,SenseList &sense_map
00084 #endif
00085                              , Range *new_faces);
00086 
00087 
00088   ErrorCode read_faces(CCMIOID faceID, 
00089                        CCMIOEntity bdy_or_int,
00090                          TupleList &vert_map,
00091                          TupleList &face_map
00092 #ifndef READCCMIO_USE_TUPLE_LIST
00093                          ,SenseList &sense_map
00094 #endif
00095                          , Range *new_faces);
00096 
00097   ErrorCode make_faces(int *farray, 
00098                        TupleList &vert_map,
00099                        std::vector<EntityHandle> &new_faces,
00100                        int num_faces);
00101 
00102   ErrorCode read_vertices(CCMIOSize_t proc, CCMIOID processorID, CCMIOID verticesID,
00103                             CCMIOID topologyID, 
00104                             Range *verts, TupleList &vert_map);
00105 
00106 
00107   ErrorCode get_processors(CCMIOID stateID, CCMIOID &processorID,
00108                            CCMIOID &verticesID, CCMIOID &topologyID,
00109                            CCMIOID &solutionID, 
00110                            std::vector<CCMIOSize_t> &procs, 
00111                            bool &has_solution);
00112 
00113   ErrorCode get_state(CCMIOID rootID, CCMIOID &problemID, CCMIOID &stateID);
00114 
00115 
00116   ErrorCode read_tag_values( const char* file_name,
00117                              const char* tag_name,
00118                              const FileOptions& opts,
00119                              std::vector<int>& tag_values_out,
00120                              const SubsetList* subset_list = 0 );
00121   
00122   ErrorCode load_matset_data(CCMIOID problemID);
00123   
00124   ErrorCode load_neuset_data(CCMIOID problemID);
00125   
00126   ErrorCode load_metadata(CCMIOID rootID, CCMIOID problemID, 
00127                           CCMIOID stateID, CCMIOID processorID,
00128                             const EntityHandle *file_set);
00129   
00130   ErrorCode read_topology_types(CCMIOID &topologyID, 
00131                                 std::map<int,int> &cell_topo_types);
00132 
00133   ErrorCode get_int_option(const char *opt_str, EntityHandle seth,
00134                            Tag &tag, CCMIOID node);
00135   
00136   ErrorCode get_dbl_option(const char *opt_str, EntityHandle seth,
00137                            Tag &tag, CCMIOID node);
00138   
00139   ErrorCode get_str_option(const char *opt_str, EntityHandle seth, Tag &tag, 
00140                            CCMIOID node, const char *tag_name = NULL);
00141   
00144   Tag mMaterialSetTag;
00145   Tag mDirichletSetTag;
00146   Tag mNeumannSetTag;
00147   Tag mHasMidNodesTag;
00148   Tag mGlobalIdTag;
00149   Tag mNameTag;
00150   Tag mMaterialIdTag, mMaterialTypeTag;
00151   Tag mRadiationTag, mPorosityIdTag, mSpinIdTag, mGroupIdTag, mColorIdxTag,
00152       mProcessorIdTag, mLightMaterialTag, mFreeSurfaceMaterialTag;
00153   Tag mThicknessTag, mProstarRegionNumberTag, mBoundaryTypeTag, mCreatingProgramTag;
00154   
00155   Interface *mbImpl;
00156 
00157   ReadUtilIface* readMeshIface;
00158 
00159   std::map<int,EntityHandle> newMatsets, newNeusets;
00160   
00161   bool hasSolution;
00162 };
00163 
00164 } // namespace moab
00165 
00166 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines