deal.II version GIT relicensing-2652-g41e7496fd4 2025-02-17 19:10:00+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
21#include <deal.II/base/types.h>
22
24
26
71{
72public:
77
83
87 explicit IdentityMatrix(const size_type n);
88
92 void
94
100 m() const;
101
107 n() const;
108
113 template <typename OutVectorType, typename InVectorType>
114 void
115 vmult(OutVectorType &out, const InVectorType &in) const;
116
122 template <typename OutVectorType, typename InVectorType>
123 void
124 vmult_add(OutVectorType &out, const InVectorType &in) const;
125
131 template <typename OutVectorType, typename InVectorType>
132 void
133 Tvmult(OutVectorType &out, const InVectorType &in) const;
134
135
141 template <typename OutVectorType, typename InVectorType>
142 void
143 Tvmult_add(OutVectorType &out, const InVectorType &in) const;
144
145private:
150};
151
152
153
154// ------------------------- inline and template functions -------------
155#ifndef DOXYGEN
156
157
159 : size(0)
160{}
161
162
163
164inline IdentityMatrix::IdentityMatrix(const size_type n)
165 : size(n)
166{}
167
168
169
170inline void
171IdentityMatrix::reinit(const size_type n)
172{
173 size = n;
174}
175
176
177
179IdentityMatrix::m() const
180{
181 return size;
182}
183
184
185
187IdentityMatrix::n() const
188{
189 return size;
190}
191
192
193
194template <typename OutVectorType, typename InVectorType>
195inline void
197{
198 Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
199 Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
200
201 out = in;
202}
203
204
205
206template <typename OutVectorType, typename InVectorType>
207inline void
209{
210 Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
211 Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
212
213 out += in;
214}
215
216
217
218template <typename OutVectorType, typename InVectorType>
219inline void
221{
222 Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
223 Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
224
225 out = in;
226}
227
228
229
230template <typename OutVectorType, typename InVectorType>
231inline void
233{
234 Assert(out.size() == size, ExcDimensionMismatch(out.size(), size));
235 Assert(in.size() == size, ExcDimensionMismatch(in.size(), size));
236
237 out += in;
238}
239
240
241#endif
242
246
247#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:518
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:519
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
std::size_t size
Definition mpi.cc:739
unsigned int global_dof_index
Definition types.h:90