pmatrix.hh
00001 #ifndef DUNE_AMG_PMATRIX_HH
00002 #define DUNE_AMG_PMATRIX_HH
00003
00004 #include<dune/common/helpertemplates.hh>
00005 #include<dune/common/typetraits.hh>
00006 #include<dune/istl/solvercategory.hh>
00007 #include<dune/istl/operators.hh>
00008 #include"pinfo.hh"
00009
00010 #if HAVE_MPI
00011
00012 namespace Dune
00013 {
00014 namespace Amg
00015 {
00016
00022 template<class M, class IS, class X, class Y>
00023 class ParallelMatrix : public AssembledLinearOperator<M,X,Y>
00024 {
00025 public:
00027 typedef M Matrix;
00033 typedef M matrix_type;
00035 typedef Dune::Amg::ParallelInformation<IS> ParallelInformation;
00036
00037 enum{
00038 category = SolverCategory::overlapping
00039 };
00040
00041 ParallelMatrix(const Matrix& matrix, const ParallelInformation& info)
00042 : matrix_(&matrix), info_(&info)
00043 {}
00044
00045
00050 const Matrix& getmat() const
00051 {
00052 return *matrix_;
00053 }
00058 const ParallelInformation& info() const
00059 {
00060 return *info_;
00061 }
00062
00063 void apply(const X& x, Y&) const
00064 {
00065 DUNE_THROW(NotImplemented, "Markus was too lazy to implement this.");
00066 }
00067
00068 void applyscaleadd(typename X::field_type a, const X& x, Y&) const
00069 {
00070 DUNE_THROW(NotImplemented, "Markus was too lazy to implement this.");
00071 }
00072 private:
00074 const Matrix* matrix_;
00076 const ParallelInformation* info_;
00077 };
00078
00079 template<class M, class IS>
00080 struct ParallelMatrixArgs
00081 {
00082 M& matrix;
00083 ParallelInformation<IS>& info;
00084
00085 ParallelMatrixArgs(M& m, ParallelInformation<IS>& i)
00086 : matrix(m), info(i)
00087 {}
00088 };
00089
00090 template<class T>
00091 class ConstructionTraits;
00092
00093 template<class M, class IS, class X, class Y>
00094 class ConstructionTraits<ParallelMatrix<M,IS,X,Y> >
00095 {
00096 public:
00097 typedef const ParallelMatrixArgs<M,IS> Arguments;
00098
00099 static inline ParallelMatrix<M,IS,X,Y>* construct(Arguments& args)
00100 {
00101 return new ParallelMatrix<M,IS,X,Y>(args.matrix, args.info);
00102 }
00103 };
00104 }
00105
00106 }
00107 #endif
00108 #endif