00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _TEUCHOS_MPI_REDUCTION_OP_BASE_HPP_
00030 #define _TEUCHOS_MPI_REDUCTION_OP_BASE_HPP_
00031
00032 #include "Teuchos_RefCountPtr.hpp"
00033
00034 #ifdef HAVE_MPI
00035
00036 #include "mpi.h"
00037
00038 extern "C" {
00039
00050 void Teuchos_MPI_reduction_op(
00051 void *invec
00052 ,void *inoutvec
00053 ,int *len
00054 ,MPI_Datatype *datatype
00055 );
00056
00057 }
00058
00059 namespace Teuchos {
00060
00065 class MPIReductionOpBase {
00066 public:
00068 virtual ~MPIReductionOpBase() {}
00070 virtual void reduce(
00071 void *invec
00072 ,void *inoutvec
00073 ,int *len
00074 ,MPI_Datatype *datatype
00075 ) const = 0;
00076 };
00077
00088 void set_reduct_op( const RefCountPtr<const MPIReductionOpBase>& reduct_op );
00089
00093 RefCountPtr<const MPIReductionOpBase> get_reduct_op();
00094
00117 class MPIReductionOpCreator {
00118 public:
00131 MPIReductionOpCreator( const Teuchos::RefCountPtr<const MPIReductionOpBase>& reduct_op );
00133 ~MPIReductionOpCreator();
00141 const MPI_Op& mpi_op() const;
00142 private:
00143 MPI_Op mpi_op_;
00144 MPIReductionOpCreator();
00145 };
00146
00147
00148
00149
00150 inline
00151 const MPI_Op& MPIReductionOpCreator::mpi_op() const
00152 {
00153 return mpi_op_;
00154 }
00155
00156 }
00157
00158 #endif // HAVE_MPI
00159
00160 #endif // _TEUCHOS_MPI_REDUCTION_OP_BASE_HPP_