PlayaMPIOp.hpp

00001 // @HEADER
00002 // @HEADER
00003 
00004 #ifndef PLAYA_MPI_OP_H
00005 #define PLAYA_MPI_OP_H
00006 
00007 
00008 #include "PlayaDefs.hpp"
00009 #include "Teuchos_ConfigDefs.hpp"
00010 #include "Teuchos_RCP.hpp"
00011 #include <stack>
00012 
00013 #ifdef HAVE_MPI
00014 #include "mpi.h"
00015 #endif
00016 
00017 
00018 namespace Playa
00019 {
00020 using Teuchos::RCP;
00021 using Teuchos::rcp;
00022 
00024 class MPIOp
00025 {
00026 public:
00028   MPIOp(const std::string& name);
00029 
00030 #ifdef HAVE_MPI
00031 
00032   MPIOp(const std::string& name, const RCP<MPI_Op>& mpiType);
00033 #endif
00034 
00036   const std::string& name() const {return name_;}
00037 
00038 #ifdef HAVE_MPI
00039   MPI_Op* ptr() ;
00040 #endif
00041 
00042 #ifdef HAVE_MPI
00043   const MPI_Op& handle() const ;
00044 #endif
00045 
00046 
00048   static MPIOp sumOp() ;
00049   
00051   static MPIOp minOp() ;
00052   
00054   static MPIOp maxOp() ;
00055   
00057   static MPIOp minlocOp() ;
00058   
00060   static MPIOp maxlocOp() ;
00061   
00063   static MPIOp productOp() ;
00064 
00066   static void registerOp(const MPIOp& op);
00067       
00068   static std::stack<MPIOp>& opRegistry();
00069 
00070   static void clearOpRegistry();
00071 private:
00072   std::string name_;
00073 #ifdef HAVE_MPI
00074   RCP<MPI_Op> mpiOp_;
00075 #endif
00076 };
00077 
00078 
00079   
00080 } // namespace Playa
00081 
00082 #endif

doxygen