00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __deal2__transpose_matrix_h
00013 #define __deal2__transpose_matrix_h
00014
00015
00016 #include <deal.II/base/subscriptor.h>
00017 #include <deal.II/lac/pointer_matrix.h>
00018
00019 DEAL_II_NAMESPACE_OPEN
00020
00021
00036 template<class MATRIX, class VECTOR>
00037 class
00038 TransposeMatrix : public PointerMatrixBase<VECTOR>
00039 {
00040 public:
00051 TransposeMatrix (const MATRIX* M=0);
00052
00058 TransposeMatrix(const char* name);
00059
00069 TransposeMatrix(const MATRIX* M,
00070 const char* name);
00071
00072
00073 virtual void clear();
00074
00079 bool empty () const;
00080
00087 const TransposeMatrix& operator= (const MATRIX* M);
00088
00092 virtual void vmult (VECTOR& dst,
00093 const VECTOR& src) const;
00094
00098 virtual void Tvmult (VECTOR& dst,
00099 const VECTOR& src) const;
00100
00105 virtual void vmult_add (VECTOR& dst,
00106 const VECTOR& src) const;
00107
00112 virtual void Tvmult_add (VECTOR& dst,
00113 const VECTOR& src) const;
00114
00115 private:
00120 virtual const void* get() const;
00121
00125 SmartPointer<const MATRIX,TransposeMatrix<MATRIX,VECTOR> > m;
00126 };
00127
00128
00129
00130
00131
00132 template<class MATRIX, class VECTOR>
00133 TransposeMatrix<MATRIX, VECTOR>::TransposeMatrix (const MATRIX* M)
00134 : m(M)
00135 {}
00136
00137
00138 template<class MATRIX, class VECTOR>
00139 TransposeMatrix<MATRIX, VECTOR>::TransposeMatrix (const char* name)
00140 : m(0, name)
00141 {}
00142
00143
00144 template<class MATRIX, class VECTOR>
00145 TransposeMatrix<MATRIX, VECTOR>::TransposeMatrix (
00146 const MATRIX* M,
00147 const char* name)
00148 : m(M, name)
00149 {}
00150
00151
00152 template<class MATRIX, class VECTOR>
00153 inline void
00154 TransposeMatrix<MATRIX, VECTOR>::clear ()
00155 {
00156 m = 0;
00157 }
00158
00159
00160 template<class MATRIX, class VECTOR>
00161 inline const TransposeMatrix<MATRIX, VECTOR>&
00162 TransposeMatrix<MATRIX, VECTOR>::operator= (const MATRIX* M)
00163 {
00164 m = M;
00165 return *this;
00166 }
00167
00168
00169 template<class MATRIX, class VECTOR>
00170 inline bool
00171 TransposeMatrix<MATRIX, VECTOR>::empty () const
00172 {
00173 if (m == 0)
00174 return true;
00175 return m->empty();
00176 }
00177
00178 template<class MATRIX, class VECTOR>
00179 inline void
00180 TransposeMatrix<MATRIX, VECTOR>::vmult (VECTOR& dst,
00181 const VECTOR& src) const
00182 {
00183 Assert (m != 0, ExcNotInitialized());
00184 m->Tvmult (dst, src);
00185 }
00186
00187
00188 template<class MATRIX, class VECTOR>
00189 inline void
00190 TransposeMatrix<MATRIX, VECTOR>::Tvmult (VECTOR& dst,
00191 const VECTOR& src) const
00192 {
00193 Assert (m != 0, ExcNotInitialized());
00194 m->vmult (dst, src);
00195 }
00196
00197
00198 template<class MATRIX, class VECTOR>
00199 inline void
00200 TransposeMatrix<MATRIX, VECTOR>::vmult_add (VECTOR& dst,
00201 const VECTOR& src) const
00202 {
00203 Assert (m != 0, ExcNotInitialized());
00204 m->Tvmult_add (dst, src);
00205 }
00206
00207
00208 template<class MATRIX, class VECTOR>
00209 inline void
00210 TransposeMatrix<MATRIX, VECTOR>::Tvmult_add (VECTOR& dst,
00211 const VECTOR& src) const
00212 {
00213 Assert (m != 0, ExcNotInitialized());
00214 m->vmult_add (dst, src);
00215 }
00216
00217
00218 template<class MATRIX, class VECTOR>
00219 inline const void*
00220 TransposeMatrix<MATRIX, VECTOR>::get () const
00221 {
00222 return m;
00223 }
00224
00225
00226
00227 DEAL_II_NAMESPACE_CLOSE
00228
00229 #endif
00230