Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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 
00023 #undef READCCMIO_USE_TUPLE_LIST
00024 
00025 class ReadUtilIface;
00026 
00027 class ReadCCMIO : public ReaderIface
00028 {
00029 
00030   public:
00031     typedef std::map< int, std::vector< EntityHandle > > TupleList;
00032     typedef std::map< int, std::vector< int > > SenseList;
00033 
00034     //! Constructor
00035     ReadCCMIO( Interface* impl );
00036 
00037     //! Destructor
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     ErrorCode read_processor( CCMIOID rootID,
00050                               CCMIOID problemID,
00051                               CCMIOID processorID,
00052                               CCMIOID verticesID,
00053                               CCMIOID topologyID,
00054                               CCMIOSize_t proc,
00055                               Range* new_ents );
00056 
00057     ErrorCode read_cells( CCMIOSize_t proc,
00058                           CCMIOID processorID,
00059                           CCMIOID verticesID,
00060                           CCMIOID topologyID,
00061                           TupleList& vert_map,
00062                           Range* new_cells );
00063 
00064     ErrorCode construct_cells( TupleList& face_map,
00065 #ifndef READCCMIO_USE_TUPLE_LIST
00066                                SenseList& sense_map,
00067 #endif
00068                                TupleList& vert_map,
00069                                std::map< int, int >& cell_topo_types,
00070                                std::vector< EntityHandle >& new_cells );
00071 
00072     ErrorCode ccmio_to_moab_type( int ccm_type, EntityType& moab_type, bool& has_mid_nodes );
00073 
00074     ErrorCode create_cell_from_faces( std::vector< EntityHandle >& facehs,
00075                                       std::vector< int >& senses,
00076                                       EntityType this_type,
00077                                       bool has_mid_nodes,
00078                                       EntityHandle& cell );
00079 
00080     ErrorCode read_gids_and_types( CCMIOID problemID, CCMIOID topologyID, std::vector< EntityHandle >& cells );
00081 
00082     ErrorCode read_all_faces( CCMIOID topologyID,
00083                               TupleList& vert_map,
00084                               TupleList& face_map
00085 #ifndef READCCMIO_USE_TUPLE_LIST
00086                               ,
00087                               SenseList& sense_map
00088 #endif
00089                               ,
00090                               Range* new_faces );
00091 
00092     ErrorCode read_faces( CCMIOID faceID,
00093                           CCMIOEntity bdy_or_int,
00094                           TupleList& vert_map,
00095                           TupleList& face_map
00096 #ifndef READCCMIO_USE_TUPLE_LIST
00097                           ,
00098                           SenseList& sense_map
00099 #endif
00100                           ,
00101                           Range* new_faces );
00102 
00103     ErrorCode make_faces( int* farray, TupleList& vert_map, std::vector< EntityHandle >& new_faces, int num_faces );
00104 
00105     ErrorCode read_vertices( CCMIOSize_t proc,
00106                              CCMIOID processorID,
00107                              CCMIOID verticesID,
00108                              CCMIOID topologyID,
00109                              Range* verts,
00110                              TupleList& vert_map );
00111 
00112     ErrorCode get_processors( CCMIOID stateID,
00113                               CCMIOID& processorID,
00114                               CCMIOID& verticesID,
00115                               CCMIOID& topologyID,
00116                               CCMIOID& solutionID,
00117                               std::vector< CCMIOSize_t >& procs,
00118                               bool& has_solution );
00119 
00120     ErrorCode get_state( CCMIOID rootID, CCMIOID& problemID, CCMIOID& stateID );
00121 
00122     ErrorCode read_tag_values( const char* file_name,
00123                                const char* tag_name,
00124                                const FileOptions& opts,
00125                                std::vector< int >& tag_values_out,
00126                                const SubsetList* subset_list = 0 );
00127 
00128     ErrorCode load_matset_data( CCMIOID problemID );
00129 
00130     ErrorCode load_neuset_data( CCMIOID problemID );
00131 
00132     ErrorCode load_metadata( CCMIOID rootID,
00133                              CCMIOID problemID,
00134                              CCMIOID stateID,
00135                              CCMIOID processorID,
00136                              const EntityHandle* file_set );
00137 
00138     ErrorCode read_topology_types( CCMIOID& topologyID, std::map< int, int >& cell_topo_types );
00139 
00140     ErrorCode get_int_option( const char* opt_str, EntityHandle seth, Tag& tag, CCMIOID node );
00141 
00142     ErrorCode get_dbl_option( const char* opt_str, EntityHandle seth, Tag& tag, CCMIOID node );
00143 
00144     ErrorCode get_str_option( const char* opt_str,
00145                               EntityHandle seth,
00146                               Tag& tag,
00147                               CCMIOID node,
00148                               const char* tag_name = NULL );
00149 
00150     //! Cached tags for reading.  Note that all these tags are defined when the
00151     //! core is initialized.
00152     Tag mMaterialSetTag;
00153     Tag mDirichletSetTag;
00154     Tag mNeumannSetTag;
00155     Tag mHasMidNodesTag;
00156     Tag mGlobalIdTag;
00157     Tag mNameTag;
00158     Tag mMaterialIdTag, mMaterialTypeTag;
00159     Tag mRadiationTag, mPorosityIdTag, mSpinIdTag, mGroupIdTag, mColorIdxTag, mProcessorIdTag, mLightMaterialTag,
00160         mFreeSurfaceMaterialTag;
00161     Tag mThicknessTag, mProstarRegionNumberTag, mBoundaryTypeTag, mCreatingProgramTag;
00162 
00163     Interface* mbImpl;
00164 
00165     ReadUtilIface* readMeshIface;
00166 
00167     std::map< int, EntityHandle > newMatsets, newNeusets;
00168 
00169     bool hasSolution;
00170 };
00171 
00172 }  // namespace moab
00173 
00174 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines