| 68 | |
| 69 | |
| 70 | class ParallelMatrix : public BaseMatrix |
| 71 | { |
| 72 | shared_ptr<BaseMatrix> mat; |
| 73 | shared_ptr<ParallelDofs> row_paralleldofs, col_paralleldofs; |
| 74 | PARALLEL_OP op; |
| 75 | |
| 76 | public: |
| 77 | ParallelMatrix (shared_ptr<BaseMatrix> amat, shared_ptr<ParallelDofs> apardofs, |
| 78 | PARALLEL_OP op = C2D); |
| 79 | // : mat(*amat), pardofs(*apardofs) |
| 80 | // {const_cast<BaseMatrix&>(mat).SetParallelDofs (apardofs);} |
| 81 | |
| 82 | ParallelMatrix (shared_ptr<BaseMatrix> amat, shared_ptr<ParallelDofs> arpardofs, |
| 83 | shared_ptr<ParallelDofs> acpardofs, PARALLEL_OP op = C2D); |
| 84 | |
| 85 | virtual ~ParallelMatrix () override; |
| 86 | virtual bool IsComplex() const override { return mat->IsComplex(); } |
| 87 | virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override; |
| 88 | |
| 89 | virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override ; |
| 90 | virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override; |
| 91 | |
| 92 | virtual BaseVector & AsVector() override { return mat->AsVector(); } |
| 93 | virtual const BaseVector & AsVector() const override { return mat->AsVector(); } |
| 94 | |
| 95 | shared_ptr<BaseMatrix> GetMatrix() const { return mat; } |
| 96 | virtual shared_ptr<BaseMatrix> CreateMatrix () const override; |
| 97 | virtual AutoVector CreateVector () const override; |
| 98 | virtual AutoVector CreateRowVector () const override; |
| 99 | virtual AutoVector CreateColVector () const override; |
| 100 | |
| 101 | virtual ostream & Print (ostream & ost) const override; |
| 102 | |
| 103 | virtual int VHeight() const override; |
| 104 | virtual int VWidth() const override; |
| 105 | |
| 106 | // virtual const ParallelDofs * GetParallelDofs () const {return &pardofs;} |
| 107 | shared_ptr<ParallelDofs> GetRowParallelDofs () const { return row_paralleldofs; } |
| 108 | shared_ptr<ParallelDofs> GetColParallelDofs () const { return col_paralleldofs; } |
| 109 | |
| 110 | PARALLEL_OP GetOpType () const { return op; } |
| 111 | virtual optional<NgMPI_Comm> GetCommunicator() const override |
| 112 | { |
| 113 | if (row_paralleldofs) |
| 114 | return row_paralleldofs->GetCommunicator(); |
| 115 | else |
| 116 | return nullopt; |
| 117 | } |
| 118 | |
| 119 | virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = 0) const override; |
| 120 | template <typename TM> |
| 121 | shared_ptr<BaseMatrix> InverseMatrixTM (shared_ptr<BitArray> subset = 0) const; |
| 122 | |
| 123 | virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<const Array<int>> clusters) const override; |
| 124 | virtual string SetInverseType ( string ainversetype ) const override; |
| 125 | virtual string GetInverseType () const override; |
| 126 | |
| 127 | virtual shared_ptr<BaseMatrix> DeleteZeroElements(double tol) const override |