Reference documentation for deal.II version GIT relicensing-903-gcd01479aa8 2024-06-25 10:50:02+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\}}\)
Loading...
Searching...
No Matches
identity_matrix.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2006 - 2022 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_identity_matrix_h
16#define dealii_identity_matrix_h
17
18
19#include <deal.II/base/config.h>
20
22
24
69{
70public:
75
81
85 explicit IdentityMatrix(const size_type n);
86
90 void
92
98 m() const;
99
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
143private:
148};
149
150
151
152// ------------------------- inline and template functions -------------
153#ifndef DOXYGEN
154
155
157 : size(0)
158{}
159
160
161
162inline IdentityMatrix::IdentityMatrix(const size_type n)
163 : size(n)
164{}
165
166
167
168inline void
169IdentityMatrix::reinit(const size_type n)
170{
171 size = n;
172}
173
174
175
177IdentityMatrix::m() const
178{
179 return size;
180}
181
182
183
185IdentityMatrix::n() const
186{
187 return size;
188}
189
190
191
192template <typename OutVectorType, typename InVectorType>
193inline void
194IdentityMatrix::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
204template <typename OutVectorType, typename InVectorType>
205inline void
206IdentityMatrix::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
216template <typename OutVectorType, typename InVectorType>
217inline void
218IdentityMatrix::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
228template <typename OutVectorType, typename InVectorType>
229inline void
230IdentityMatrix::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(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:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int global_dof_index
Definition types.h:81