Reference documentation for deal.II version GIT 5c75851574 2022-09-25 16:30:01+00:00
\(\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 - 2020 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 
70 {
71 public:
76 
82 
86  explicit IdentityMatrix(const size_type n);
87 
91  void
92  reinit(const size_type n);
93 
98  size_type
99  m() const;
100 
105  size_type
106  n() const;
107 
112  template <typename OutVectorType, typename InVectorType>
113  void
114  vmult(OutVectorType &out, const InVectorType &in) const;
115 
121  template <typename OutVectorType, typename InVectorType>
122  void
123  vmult_add(OutVectorType &out, const InVectorType &in) const;
124 
130  template <typename OutVectorType, typename InVectorType>
131  void
132  Tvmult(OutVectorType &out, const InVectorType &in) const;
133 
134 
140  template <typename OutVectorType, typename InVectorType>
141  void
142  Tvmult_add(OutVectorType &out, const InVectorType &in) const;
143 
144 private:
149 };
150 
151 
152 
153 // ------------------------- inline and template functions -------------
154 #ifndef DOXYGEN
155 
156 
158  : size(0)
159 {}
160 
161 
162 
164  : size(n)
165 {}
166 
167 
168 
169 inline void
171 {
172  size = n;
173 }
174 
175 
176 
178 IdentityMatrix::m() const
179 {
180  return size;
181 }
182 
183 
184 
186 IdentityMatrix::n() const
187 {
188  return size;
189 }
190 
191 
192 
193 template <typename OutVectorType, typename InVectorType>
194 inline void
195 IdentityMatrix::vmult(OutVectorType &out, const InVectorType &in) const
196 {
197  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
198  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
199 
200  out = in;
201 }
202 
203 
204 
205 template <typename OutVectorType, typename InVectorType>
206 inline void
207 IdentityMatrix::vmult_add(OutVectorType &out, const InVectorType &in) const
208 {
209  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
210  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
211 
212  out += in;
213 }
214 
215 
216 
217 template <typename OutVectorType, typename InVectorType>
218 inline void
219 IdentityMatrix::Tvmult(OutVectorType &out, const InVectorType &in) const
220 {
221  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
222  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
223 
224  out = in;
225 }
226 
227 
228 
229 template <typename OutVectorType, typename InVectorType>
230 inline void
231 IdentityMatrix::Tvmult_add(OutVectorType &out, const InVectorType &in) const
232 {
233  Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
234  Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
235 
236  out += in;
237 }
238 
239 
240 #endif
241 
245 
246 #endif
void vmult(OutVectorType &out, const InVectorType &in) const
size_type n() const
types::global_dof_index size_type
IdentityMatrix(const size_type n)
size_type m() const
void reinit(const size_type n)
void Tvmult(OutVectorType &out, const InVectorType &in) const
void Tvmult_add(OutVectorType &out, const InVectorType &in) const
void vmult_add(OutVectorType &out, const InVectorType &in) const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:457
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:458
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define Assert(cond, exc)
Definition: exceptions.h:1501
types::global_dof_index size_type
Definition: cuda_kernels.h:45
unsigned int global_dof_index
Definition: types.h:81