mpiseriallap.hh

Go to the documentation of this file.
00001 #ifndef __RVL_MPI_SERLAP
00002 #define __RVL_MPI_SERLAP
00003 
00004 #include "locallinalg.hh"
00005 #include "mpiserialfo.hh"
00006 
00007 namespace RVL {
00008 
00009   template<typename Scalar>
00010   class MPISerialLAP: public LinearAlgebraPackage<Scalar> {
00011     
00012   private:
00013     
00014     mutable RVLAssignConst<Scalar> this_zero;
00015     mutable RVLL2innerProd<Scalar> this_ser_inner;
00016     mutable RVLLinCombObject<Scalar> this_lco;
00017     
00018     int root;
00019 #ifdef IWAVE_USE_MPI
00020     MPI_Comm comm;
00021 #endif
00022 
00023     mutable MPISerialFunctionObjectRedn<Scalar,Scalar> this_mpi_inner;
00024     
00025   public:
00026 
00027     MPISerialLAP(Scalar ipscale = ScalarFieldTraits<Scalar>::One(),
00028          int _root = 0
00029 #ifdef IWAVE_USE_MPI 
00030          , MPI_Comm _comm=MPI_COMM_WORLD
00031 #endif
00032          )
00033       : this_zero(ScalarFieldTraits<Scalar>::Zero()), 
00034     this_ser_inner(abs(ipscale)), this_lco(), 
00035     root(_root), 
00036 #ifdef IWAVE_USE_MPI
00037     comm(_comm),
00038 #endif
00039     this_mpi_inner(this_ser_inner,root
00040 #ifdef IWAVE_USE_MPI
00041                , comm
00042 #endif
00043                ) {}
00044     MPISerialLAP(const MPISerialLAP<Scalar> & p) 
00045       : this_zero(ScalarFieldTraits<Scalar>::Zero()),
00046     this_ser_inner(p.this_ser_inner.getScale()),this_lco(),
00047     root(p.root), 
00048 #ifdef IWAVE_USE_MPI
00049     comm(p.comm),
00050 #endif
00051     this_mpi_inner(this_ser_inner,root
00052 #ifdef IWAVE_USE_MPI
00053                , comm
00054 #endif
00055                ) {}
00056     ~MPISerialLAP() {}
00057 
00058     FunctionObjectScalarRedn<Scalar> & inner() const {
00059       return this_mpi_inner; 
00060     }
00061     FunctionObject & zero() const {
00062       return this_zero;
00063     }
00064     LinCombObject<Scalar> & linComb() const {
00065       return this_lco; 
00066     }
00067 
00068     virtual bool compare(LinearAlgebraPackage<Scalar> const & lap) const {
00069       MPISerialLAP<Scalar> const * tmp = NULL;
00070       if ((tmp=dynamic_cast<MPISerialLAP<Scalar> const *>(&lap))) return true;
00071       return false;
00072     }    
00073 
00075     void setScale(Scalar newscale) { this_ser_inner.setScale(newscale); }
00076 
00077     ostream & write(ostream & str) const {
00078       str<<"MPISerialLAP\n";
00079       return str;
00080     }
00081   };
00082 
00083 }
00084 
00085 #endif
00086 
00087 

Generated on 5 Jan 2017 for MPIRVL by  doxygen 1.4.7