deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20: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\}}\)
Loading...
Searching...
No Matches
sparse_decomposition.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2002 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_sparse_decomposition_h
14#define dealii_sparse_decomposition_h
15
16#include <deal.II/base/config.h>
17
19
20#include <cmath>
21
23
103template <typename number>
104class SparseLUDecomposition : protected SparseMatrix<number>,
105 public virtual EnableObserverPointer
106{
107protected:
115
116public:
121
126 virtual ~SparseLUDecomposition() override = 0;
127
132 virtual void
133 clear() override;
134
139 {
140 public:
144 explicit AdditionalData(const double strengthen_diagonal = 0.,
145 const unsigned int extra_off_diagonals = 0,
146 const bool use_previous_sparsity = false,
147 const SparsityPattern *use_this_sparsity = nullptr);
148
156
168
178
190 };
191
207 template <typename somenumber>
208 void
210 const AdditionalData parameters);
211
216 bool
217 empty() const;
218
225 m() const;
226
233 n() const;
234
241 template <class OutVector, class InVector>
242 void
243 vmult_add(OutVector &dst, const InVector &src) const;
244
252 template <class OutVector, class InVector>
253 void
254 Tvmult_add(OutVector &dst, const InVector &src) const;
255
260 virtual std::size_t
262
272 double,
273 << "The strengthening parameter " << arg1
274 << " is not greater or equal than zero!");
276protected:
281 template <typename somenumber>
282 void
284
291 virtual void
293
303 virtual number
304 get_strengthen_diagonal(const number rowsum, const size_type row) const;
305
310
316 std::vector<const size_type *> prebuilt_lower_bound;
317
321 void
323
324private:
335};
336
338//---------------------------------------------------------------------------
339
340#ifndef DOXYGEN
341
342template <typename number>
343inline number
345 const number /*rowsum*/,
346 const size_type /*row*/) const
347{
348 return strengthen_diagonal;
349}
350
351
352
353template <typename number>
354inline bool
356{
358}
359
360
361template <typename number>
364{
366}
367
368
369template <typename number>
372{
374}
375
376// Note: This function is required for full compatibility with
377// the LinearOperator class. ::MatrixInterfaceWithVmultAdd
378// picks up the vmult_add function in the protected SparseMatrix
379// base class.
380template <typename number>
381template <class OutVector, class InVector>
382inline void
384 const InVector &src) const
385{
386 OutVector tmp;
387 tmp.reinit(dst);
388 this->vmult(tmp, src);
389 dst += tmp;
390}
391
392// Note: This function is required for full compatibility with
393// the LinearOperator class. ::MatrixInterfaceWithVmultAdd
394// picks up the vmult_add function in the protected SparseMatrix
395// base class.
396template <typename number>
397template <class OutVector, class InVector>
398inline void
400 const InVector &src) const
401{
402 OutVector tmp;
403 tmp.reinit(dst);
404 this->Tvmult(tmp, src);
405 dst += tmp;
406}
407
408//---------------------------------------------------------------------------
409
410
411template <typename number>
413 const double strengthen_diag,
414 const unsigned int extra_off_diag,
415 const bool use_prev_sparsity,
416 const SparsityPattern *use_this_spars)
417 : strengthen_diagonal(strengthen_diag)
418 , extra_off_diagonals(extra_off_diag)
419 , use_previous_sparsity(use_prev_sparsity)
420 , use_this_sparsity(use_this_spars)
421{}
422
423
424#endif // DOXYGEN
425
427
428#endif // dealii_sparse_decomposition_h
AdditionalData(const double strengthen_diagonal=0., const unsigned int extra_off_diagonals=0, const bool use_previous_sparsity=false, const SparsityPattern *use_this_sparsity=nullptr)
virtual number get_strengthen_diagonal(const number rowsum, const size_type row) const
virtual void strengthen_diagonal_impl()
void Tvmult_add(OutVector &dst, const InVector &src) const
size_type n() const
size_type m() const
typename SparseMatrix< number >::size_type size_type
virtual ~SparseLUDecomposition() override=0
void vmult_add(OutVector &dst, const InVector &src) const
void copy_from(const SparseMatrix< somenumber > &matrix)
virtual std::size_t memory_consumption() const
std::vector< const size_type * > prebuilt_lower_bound
virtual void clear() override
void initialize(const SparseMatrix< somenumber > &matrix, const AdditionalData parameters)
SparsityPattern * own_sparsity
size_type n() const
size_type m() const
bool empty() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
static ::ExceptionBase & ExcInvalidStrengthening(double arg1)
#define DeclException1(Exception1, type1, outsequence)