moab
ReadDamsel.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : ReadDamsel.hpp
00003 //
00004 // Purpose       : Damsel file reader
00005 //
00006 // Creator       : Tim Tautges
00007 //-------------------------------------------------------------------------
00008 
00009 #ifndef READDAMSEL_HPP
00010 #define READDAMSEL_HPP
00011 
00012 #ifndef IS_BUILDING_MB
00013 //#error "ReadDamsel.hpp isn't supposed to be included into an application"
00014 #endif
00015 
00016 #include <vector>
00017 #include <map>
00018 #include <string>
00019 
00020 #include "moab/Forward.hpp"
00021 #include "moab/ReaderIface.hpp"
00022 #include "moab/Range.hpp"
00023 #include "moab/RangeMap.hpp"
00024 #include "DebugOutput.hpp"
00025 #include "DamselUtil.hpp"
00026 
00027 #include "damsel.h"
00028 
00029 namespace moab {
00030 
00031 class ReadUtilIface;
00032 class ParallelComm;
00033 class Error;
00034 
00035 class ReadDamsel : public ReaderIface
00036 {
00037    
00038 public:
00039   
00040   static ReaderIface* factory( Interface* );
00041   
00043   ErrorCode load_file( const char* file_name,
00044                        const EntityHandle* file_set,
00045                        const FileOptions& opts,
00046                        const SubsetList* subset_list = 0,
00047                        const Tag* file_id_tag = 0 );
00048 
00050    ReadDamsel(Interface* impl = NULL);
00051 
00053   virtual ~ReadDamsel();
00054 
00055   virtual ErrorCode read_tag_values( const char* file_name,
00056                                      const char* tag_name,
00057                                      const FileOptions& opts,
00058                                      std::vector<int>& tag_values_out,
00059                                      const SubsetList* subset_list = 0 );
00060 
00061 private:
00062 
00064   ErrorCode get_contents(damsel_model m, damsel_container c, Range &ents);
00065 
00068   ErrorCode get_contents(damsel_model m, damsel_container c, EntityHandle *ents);
00069 
00070   ErrorCode init();
00071 
00072   ErrorCode parse_options(const FileOptions &opts,
00073                           bool &parallel);
00074   
00075   ErrorCode process_tags(std::vector<damsel_tag_buf_type> &tag_infos);
00076   
00077   ErrorCode process_ent_info(const damsel_entity_buf_type &einfo);
00078   
00079   ErrorCode process_entity_tags(int count, damsel_container tag_container, 
00080                                 damsel_container app_cont, Range &these_ents);
00081   
00082   ErrorCode process_coll_infos(std::vector<damsel_collection_buf_type> &coll_infos);
00083 
00085   ErrorCode container_to_handle_pairs(damsel_container &cont, std::vector<damsel_handle> &handle_pairs);
00086 
00089   ErrorCode insert_into_map(std::vector<damsel_handle> &handle_pairs, EntityHandle start_handle);
00090   
00091   class subrange
00092   {
00093    public:
00094     subrange(damsel_handle ch, EntityHandle s, int c) : collh(ch), seth(s), count(c) {}
00095     damsel_handle collh;
00096     EntityHandle seth;
00097     int count;
00098   };
00099 
00100 //------------member variables ------------//
00101 
00103   Interface* mbImpl;
00104 
00106   ReadUtilIface *readMeshIface;
00107   
00109   Error *mError;
00110   
00112   std::string fileName;
00113 
00115   bool nativeParallel;
00116 
00118   ParallelComm *myPcomm;
00119   
00121   Tag mGlobalIdTag;
00122   
00124   RangeMap<damsel_handle, EntityHandle, 0> dmHandleRMap;
00125   
00127   DamselUtil dU;
00128 };
00129 
00130 inline const bool operator==(const damsel_err_t &lhs, const damsel_err_t &rhs) 
00131 {
00132   return lhs.id == rhs.id;
00133 }
00134   
00135 } // namespace moab
00136 
00137 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines