Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
ReadParallel.hpp
Go to the documentation of this file.
00001 #ifndef READ_PARALLEL_HPP
00002 #define READ_PARALLEL_HPP
00003 
00004 #include "moab/Forward.hpp"
00005 #include "moab/ReaderIface.hpp"
00006 #include "DebugOutput.hpp"
00007 
00008 #include <string>
00009 
00010 namespace moab
00011 {
00012 
00013 class ReadUtilIface;
00014 class ParallelComm;
00015 class Error;
00016 
00017 class ReadParallel
00018 {
00019 
00020   public:
00021     static ReaderIface* factory( Interface* );
00022 
00023     //! load a file
00024     ErrorCode load_file( const char* file_name,
00025                          const EntityHandle* file_set,
00026                          const FileOptions& opts,
00027                          const ReaderIface::SubsetList* subset_list = 0,
00028                          const Tag* file_id_tag                     = 0 );
00029 
00030     //! load multiple files
00031     ErrorCode load_file( const char** file_names,
00032                          const int num_files,
00033                          const EntityHandle* file_set,
00034                          const FileOptions& opts,
00035                          const ReaderIface::SubsetList* subset_list = 0,
00036                          const Tag* file_id_tag                     = 0 );
00037 
00038     ErrorCode load_file( const char** file_names,
00039                          const int num_files,
00040                          const EntityHandle* file_set,
00041                          int parallel_mode,
00042                          std::string& partition_tag_name,
00043                          std::vector< int >& partition_tag_vals,
00044                          bool distrib,
00045                          bool partition_by_rank,
00046                          std::vector< int >& pa_vec,
00047                          const FileOptions& opts,
00048                          const ReaderIface::SubsetList* subset_list,
00049                          const Tag* file_id_tag,
00050                          const int reader_rank,
00051                          const bool cputime,
00052                          const int resolve_dim,
00053                          const int shared_dim,
00054                          const int ghost_dim,
00055                          const int bridge_dim,
00056                          const int num_layers,
00057                          const int addl_ents );
00058     //! Constructor
00059     ReadParallel( Interface* impl = NULL, ParallelComm* pc = NULL );
00060 
00061     //! Destructor
00062     virtual ~ReadParallel() {}
00063 
00064     static const char* parallelOptsNames[];
00065 
00066     enum ParallelActions
00067     {
00068         PA_READ                     = 0,
00069         PA_READ_PART                = 1,
00070         PA_BROADCAST                = 2,
00071         PA_DELETE_NONLOCAL          = 3,
00072         PA_CHECK_GIDS_SERIAL        = 4,
00073         PA_GET_FILESET_ENTS         = 5,
00074         PA_RESOLVE_SHARED_ENTS      = 6,
00075         PA_EXCHANGE_GHOSTS          = 7,
00076         PA_RESOLVE_SHARED_SETS      = 8,
00077         PA_AUGMENT_SETS_WITH_GHOSTS = 9,
00078         PA_PRINT_PARALLEL           = 10,
00079         PA_CREATE_TRIVIAL_PARTITION = 11,
00080         PA_CORRECT_THIN_GHOSTS      = 12
00081     };
00082 
00083     static const char* ParallelActionsNames[];
00084 
00085     enum ParallelOpts
00086     {
00087         POPT_NONE = 0,
00088         POPT_BCAST,
00089         POPT_BCAST_DELETE,
00090         POPT_READ_DELETE,
00091         POPT_READ_PART,
00092         POPT_DEFAULT
00093     };
00094 
00095     //! PUBLIC TO ALLOW TESTING
00096     ErrorCode delete_nonlocal_entities( std::string& ptag_name,
00097                                         std::vector< int >& ptag_vals,
00098                                         bool distribute,
00099                                         EntityHandle file_set );
00100 
00101     ErrorCode delete_nonlocal_entities( EntityHandle file_set );
00102 
00103   protected:
00104     ErrorCode create_partition_sets( std::string& ptag_name, EntityHandle file_set );
00105 
00106   private:
00107     Interface* mbImpl;
00108 
00109     // each reader can keep track of its own pcomm
00110     ParallelComm* myPcomm;
00111 
00112     DebugOutput myDebug;
00113 
00114     Error* mError;
00115 };
00116 
00117 inline ErrorCode ReadParallel::load_file( const char* file_name,
00118                                           const EntityHandle* file_set,
00119                                           const FileOptions& opts,
00120                                           const ReaderIface::SubsetList* subset_list,
00121                                           const Tag* file_id_tag )
00122 {
00123     return load_file( &file_name, 1, file_set, opts, subset_list, file_id_tag );
00124 }
00125 
00126 }  // namespace moab
00127 
00128 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines