Reference documentation for deal.II version 9.4.1
\(\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 - 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
23
25
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:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
#define Assert(cond, exc)
Definition: exceptions.h:1473
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int global_dof_index
Definition: types.h:76