Reference documentation for deal.II version 9.5.0
\(\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\}}\)
Loading...
Searching...
No Matches
identity_matrix.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2006 - 2022 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
23
25
70{
71public:
76
82
86 explicit IdentityMatrix(const size_type n);
87
91 void
93
99 m() const;
100
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
144private:
149};
150
151
152
153// ------------------------- inline and template functions -------------
154#ifndef DOXYGEN
155
156
158 : size(0)
159{}
160
161
162
163inline IdentityMatrix::IdentityMatrix(const size_type n)
164 : size(n)
165{}
166
167
168
169inline void
170IdentityMatrix::reinit(const size_type n)
171{
172 size = n;
173}
174
175
176
178IdentityMatrix::m() const
179{
180 return size;
181}
182
183
184
186IdentityMatrix::n() const
187{
188 return size;
189}
190
191
192
193template <typename OutVectorType, typename InVectorType>
194inline void
195IdentityMatrix::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
205template <typename OutVectorType, typename InVectorType>
206inline void
207IdentityMatrix::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
217template <typename OutVectorType, typename InVectorType>
218inline void
219IdentityMatrix::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
229template <typename OutVectorType, typename InVectorType>
230inline void
231IdentityMatrix::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
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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int global_dof_index
Definition types.h:82