cgma
CGMReadParallel.hpp
Go to the documentation of this file.
00001 #ifndef CGM_READ_PARALLEL_HPP
00002 #define CGM_READ_PARALLEL_HPP
00003 
00004 #include <vector>
00005 #include "CubitDefines.h"
00006 #include "GeometryQueryTool.hpp"
00007 #include "CGMParallelComm.hpp"
00008 #include "CGMFileOptions.hpp"
00009 
00010 enum BALANCE_METHOD {
00011   ROUND_ROBIN = 0,
00012   PARTITION_STATIC,
00013   PARTITION_DYNAMIC
00014 };
00015 
00016 class CGMReadParallel 
00017 {
00018 public:
00019 
00020   CGMReadParallel(GeometryQueryTool* gqt = NULL, CGMParallelComm *pc = NULL);
00021 
00022   enum ParallelLoadOption {BCAST, BCAST_AND_DELETE, SCATTER};
00023   
00024   // load a file
00025   CubitStatus load_file(const char *file_names, const char *options,
00026             const char* set_tag_name = 0,
00027             const int* set_tag_values = 0,
00028             int num_set_tag_values = 0);
00029   
00030   CubitStatus load_file(const char *file_name,
00031                         int parallel_mode, 
00032                         std::string &partition_tag_name, 
00033                         std::vector<int> &partition_tag_vals, 
00034                         std::vector<int> &pa_vec,
00035                         const CGMFileOptions &opts,
00036                         const char* set_tag_name,
00037                         const int* set_tag_values,
00038                         const int num_set_tag_values,
00039                         const int reader_rank,
00040             const bool surf_partition
00041             );
00042   
00043   static const char *CGMparallelOptsNames[];
00044 
00045   static const char *CGMpartitionOptsNames[];
00046   
00047   enum CGMParallelOpts {POPT_NONE=0, POPT_READ, POPT_READ_DELETE, POPT_BCAST,
00048             POPT_BCAST_DELETE, PORT_SCATTER,
00049             PORT_SCATTER_DELETE, POPT_READ_PARALLEL,
00050             POPT_FORMAT, POPT_DEFAULT};
00051 
00052   void set_reader(unsigned int reader);
00053 
00054 private:
00055 
00056   GeometryQueryTool* m_gqt;
00057 
00058   CGMParallelComm *m_pcomm;
00059 
00060   bool m_scatter, m_reader;
00061 
00062   unsigned int m_rank, m_proc_size;
00063 
00064   BALANCE_METHOD m_bal_method;
00065 
00066   // surf ref entity list to be partitioned
00067   DLIList<RefEntity*> m_surf_entity_list;
00068 
00069   CubitStatus read_entities(const char* file_name);
00070 
00071   // balance and save the information as attribute
00072   CubitStatus balance_round_robin();
00073 
00074   CubitStatus delete_nonlocal_entities(int reader,
00075                        std::string &ptag_name,
00076                                        std::vector<int> &ptag_vals);
00077 
00078   CubitStatus check_partition_info();
00079 };
00080 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines