MOAB: Mesh Oriented datABase  (version 5.2.1)
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, const EntityHandle* file_set, const FileOptions& opts,
00025                          const ReaderIface::SubsetList* subset_list = 0, const Tag* file_id_tag = 0 );
00026 
00027     //! load multiple files
00028     ErrorCode load_file( const char** file_names, const int num_files, const EntityHandle* file_set,
00029                          const FileOptions& opts, const ReaderIface::SubsetList* subset_list = 0,
00030                          const Tag* file_id_tag = 0 );
00031 
00032     ErrorCode load_file( const char** file_names, const int num_files, const EntityHandle* file_set, int parallel_mode,
00033                          std::string& partition_tag_name, std::vector< int >& partition_tag_vals, bool distrib,
00034                          bool partition_by_rank, std::vector< int >& pa_vec, const FileOptions& opts,
00035                          const ReaderIface::SubsetList* subset_list, const Tag* file_id_tag, const int reader_rank,
00036                          const bool cputime, const int resolve_dim, const int shared_dim, const int ghost_dim,
00037                          const int bridge_dim, const int num_layers, const int addl_ents );
00038     //! Constructor
00039     ReadParallel( Interface* impl = NULL, ParallelComm* pc = NULL );
00040 
00041     //! Destructor
00042     virtual ~ReadParallel() {}
00043 
00044     static const char* parallelOptsNames[];
00045 
00046     enum ParallelActions
00047     {
00048         PA_READ                     = 0,
00049         PA_READ_PART                = 1,
00050         PA_BROADCAST                = 2,
00051         PA_DELETE_NONLOCAL          = 3,
00052         PA_CHECK_GIDS_SERIAL        = 4,
00053         PA_GET_FILESET_ENTS         = 5,
00054         PA_RESOLVE_SHARED_ENTS      = 6,
00055         PA_EXCHANGE_GHOSTS          = 7,
00056         PA_RESOLVE_SHARED_SETS      = 8,
00057         PA_AUGMENT_SETS_WITH_GHOSTS = 9,
00058         PA_PRINT_PARALLEL           = 10,
00059         PA_CREATE_TRIVIAL_PARTITION = 11,
00060         PA_CORRECT_THIN_GHOSTS      = 12
00061     };
00062 
00063     static const char* ParallelActionsNames[];
00064 
00065     enum ParallelOpts
00066     {
00067         POPT_NONE = 0,
00068         POPT_BCAST,
00069         POPT_BCAST_DELETE,
00070         POPT_READ_DELETE,
00071         POPT_READ_PART,
00072         POPT_DEFAULT
00073     };
00074 
00075     //! PUBLIC TO ALLOW TESTING
00076     ErrorCode delete_nonlocal_entities( std::string& ptag_name, std::vector< int >& ptag_vals, bool distribute,
00077                                         EntityHandle file_set );
00078 
00079     ErrorCode delete_nonlocal_entities( EntityHandle file_set );
00080 
00081   protected:
00082     ErrorCode create_partition_sets( std::string& ptag_name, EntityHandle file_set );
00083 
00084   private:
00085     Interface* mbImpl;
00086 
00087     // each reader can keep track of its own pcomm
00088     ParallelComm* myPcomm;
00089 
00090     DebugOutput myDebug;
00091 
00092     Error* mError;
00093 };
00094 
00095 inline ErrorCode ReadParallel::load_file( const char* file_name, const EntityHandle* file_set, const FileOptions& opts,
00096                                           const ReaderIface::SubsetList* subset_list, const Tag* file_id_tag )
00097 {
00098     return load_file( &file_name, 1, file_set, opts, subset_list, file_id_tag );
00099 }
00100 
00101 }  // namespace moab
00102 
00103 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines