Reference documentation for deal.II version Git e7bb9ce7b3 2020-09-18 12:07:32 -0400
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
identity_matrix.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2006 - 2018 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_identity_matrix_h
17 #define dealii_identity_matrix_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/lac/exceptions.h>
23 
25 
69 {
70 public:
75 
81 
85  explicit IdentityMatrix(const size_type n);
86 
90  void
91  reinit(const size_type n);
92 
97  size_type
98  m() const;
99 
104  size_type
105  n() const;
106 
111  template <typename OutVectorType, typename InVectorType>
112  void
113  vmult(OutVectorType &out, const InVectorType &in) const;
114 
120  template <typename OutVectorType, typename InVectorType>
121  void
122  vmult_add(OutVectorType &out, const InVectorType &in) const;
123 
129  template <typename OutVectorType, typename InVectorType>
130  void
131  Tvmult(OutVectorType &out, const InVectorType &in) const;
132 
133 
139  template <typename OutVectorType, typename InVectorType>
140  void
141  Tvmult_add(OutVectorType &out, const InVectorType &in) const;
142 
143 private:
148 };
149 
150 
151 
152 // ------------------------- inline and template functions -------------
153 #ifndef DOXYGEN
154 
155 
157  : size(0)
158 {}
159 
160 
161 
163  : size(n)
164 {}
165 
166 
167 
168 inline void
170 {
171  size = n;
172 }
173 
174 
175 
177 IdentityMatrix::m() const
178 {
179  return size;
180 }
181 
182 
183 
185 IdentityMatrix::n() const
186 {
187  return size;
188 }
189 
190 
191 
192 template <typename OutVectorType, typename InVectorType>
193 inline void
194 IdentityMatrix::vmult(OutVectorType &out, const InVectorType &in) const
195 {
196  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
197  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
198 
199  out = in;
200 }
201 
202 
203 
204 template <typename OutVectorType, typename InVectorType>
205 inline void
206 IdentityMatrix::vmult_add(OutVectorType &out, const InVectorType &in) const
207 {
208  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
209  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
210 
211  out += in;
212 }
213 
214 
215 
216 template <typename OutVectorType, typename InVectorType>
217 inline void
218 IdentityMatrix::Tvmult(OutVectorType &out, const InVectorType &in) const
219 {
220  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
221  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
222 
223  out = in;
224 }
225 
226 
227 
228 template <typename OutVectorType, typename InVectorType>
229 inline void
230 IdentityMatrix::Tvmult_add(OutVectorType &out, const InVectorType &in) const
231 {
232  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
233  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
234 
235  out += in;
236 }
237 
238 
239 #endif
240 
244 
245 #endif
void vmult_add(OutVectorType &out, const InVectorType &in) const
#define Assert(cond, exc)
Definition: exceptions.h:1411
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void Tvmult_add(OutVectorType &out, const InVectorType &in) const
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
unsigned int global_dof_index
Definition: types.h:76
void reinit(const size_type n)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
void Tvmult(OutVectorType &out, const InVectorType &in) const
size_type n() const
size_type m() const
void vmult(OutVectorType &out, const InVectorType &in) const