Reference documentation for deal.II version 8.5.1
transpose_matrix.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2002 - 2015 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__transpose_matrix_h
17 #define dealii__transpose_matrix_h
18 
19 
20 #include <deal.II/base/subscriptor.h>
21 #include <deal.II/lac/pointer_matrix.h>
22 
23 DEAL_II_NAMESPACE_OPEN
24 
25 
43 template<typename MatrixType, typename VectorType>
44 class
46 {
47 public:
55  TransposeMatrix (const MatrixType *M=0);
56 
61  TransposeMatrix(const char *name);
62 
68  TransposeMatrix(const MatrixType *M,
69  const char *name);
70 
71  // Use doc from base class
72  virtual void clear();
73 
77  bool empty () const;
78 
84  const TransposeMatrix &operator= (const MatrixType *M);
85 
89  virtual void vmult (VectorType &dst,
90  const VectorType &src) const;
91 
95  virtual void Tvmult (VectorType &dst,
96  const VectorType &src) const;
97 
101  virtual void vmult_add (VectorType &dst,
102  const VectorType &src) const;
103 
107  virtual void Tvmult_add (VectorType &dst,
108  const VectorType &src) const;
109 
110 private:
115 };
116 
117 
118 //----------------------------------------------------------------------//
119 
120 
121 template<typename MatrixType, typename VectorType>
123  : m(M)
124 {}
125 
126 
127 template<typename MatrixType, typename VectorType>
129  : m(0, name)
130 {}
131 
132 
133 template<typename MatrixType, typename VectorType>
135  const char *name)
136  : m(M, name)
137 {}
138 
139 
140 template<typename MatrixType, typename VectorType>
141 inline void
143 {
144  m = 0;
145 }
146 
147 
148 template<typename MatrixType, typename VectorType>
151 {
152  m = M;
153  return *this;
154 }
155 
156 
157 template<typename MatrixType, typename VectorType>
158 inline bool
160 {
161  if (m == 0)
162  return true;
163  return m->empty();
164 }
165 
166 template<typename MatrixType, typename VectorType>
167 inline void
169  const VectorType &src) const
170 {
171  Assert (m != 0, ExcNotInitialized());
172  m->Tvmult (dst, src);
173 }
174 
175 
176 template<typename MatrixType, typename VectorType>
177 inline void
179  const VectorType &src) const
180 {
181  Assert (m != 0, ExcNotInitialized());
182  m->vmult (dst, src);
183 }
184 
185 
186 template<typename MatrixType, typename VectorType>
187 inline void
189  const VectorType &src) const
190 {
191  Assert (m != 0, ExcNotInitialized());
192  m->Tvmult_add (dst, src);
193 }
194 
195 
196 template<typename MatrixType, typename VectorType>
197 inline void
199  const VectorType &src) const
200 {
201  Assert (m != 0, ExcNotInitialized());
202  m->vmult_add (dst, src);
203 }
204 
205 
206 DEAL_II_NAMESPACE_CLOSE
207 
208 #endif
SmartPointer< const MatrixType, TransposeMatrix< MatrixType, VectorType > > m
static ::ExceptionBase & ExcNotInitialized()
virtual void vmult_add(VectorType &dst, const VectorType &src) const
virtual void Tvmult_add(VectorType &dst, const VectorType &src) const
virtual void clear()
#define Assert(cond, exc)
Definition: exceptions.h:313
const TransposeMatrix & operator=(const MatrixType *M)
virtual void vmult(VectorType &dst, const VectorType &src) const
virtual void Tvmult(VectorType &dst, const VectorType &src) const
TransposeMatrix(const MatrixType *M=0)
bool empty() const