Reference documentation for deal.II version GIT 7b2de2f2f9 2023-09-24 11:00: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\}}\)
sparse_decomposition.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2002 - 2023 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_sparse_decomposition_h
17 #define dealii_sparse_decomposition_h
18 
19 #include <deal.II/base/config.h>
20 
22 
23 #include <cmath>
24 
26 
106 template <typename number>
107 class SparseLUDecomposition : protected SparseMatrix<number>,
108  public virtual Subscriptor
109 {
110 protected:
118 
119 public:
124 
129  virtual ~SparseLUDecomposition() override = 0;
130 
135  virtual void
136  clear() override;
137 
142  {
143  public:
147  explicit AdditionalData(const double strengthen_diagonal = 0.,
148  const unsigned int extra_off_diagonals = 0,
149  const bool use_previous_sparsity = false,
150  const SparsityPattern *use_this_sparsity = nullptr);
151 
159 
170  unsigned int extra_off_diagonals;
171 
181 
193  };
194 
210  template <typename somenumber>
211  void
213  const AdditionalData parameters);
214 
219  bool
220  empty() const;
221 
227  size_type
228  m() const;
229 
235  size_type
236  n() const;
237 
244  template <class OutVector, class InVector>
245  void
246  vmult_add(OutVector &dst, const InVector &src) const;
247 
255  template <class OutVector, class InVector>
256  void
257  Tvmult_add(OutVector &dst, const InVector &src) const;
258 
263  virtual std::size_t
265 
275  double,
276  << "The strengthening parameter " << arg1
277  << " is not greater or equal than zero!");
279 protected:
284  template <typename somenumber>
285  void
287 
294  virtual void
296 
306  virtual number
307  get_strengthen_diagonal(const number rowsum, const size_type row) const;
308 
313 
319  std::vector<const size_type *> prebuilt_lower_bound;
320 
324  void
326 
327 private:
338 };
339 
341 //---------------------------------------------------------------------------
342 
343 #ifndef DOXYGEN
344 
345 template <typename number>
346 inline number
348  const number /*rowsum*/,
349  const size_type /*row*/) const
350 {
351  return strengthen_diagonal;
352 }
353 
354 
355 
356 template <typename number>
357 inline bool
359 {
361 }
362 
363 
364 template <typename number>
367 {
368  return SparseMatrix<number>::m();
369 }
370 
371 
372 template <typename number>
375 {
376  return SparseMatrix<number>::n();
377 }
378 
379 // Note: This function is required for full compatibility with
380 // the LinearOperator class. ::MatrixInterfaceWithVmultAdd
381 // picks up the vmult_add function in the protected SparseMatrix
382 // base class.
383 template <typename number>
384 template <class OutVector, class InVector>
385 inline void
387  const InVector &src) const
388 {
389  OutVector tmp;
390  tmp.reinit(dst);
391  this->vmult(tmp, src);
392  dst += tmp;
393 }
394 
395 // Note: This function is required for full compatibility with
396 // the LinearOperator class. ::MatrixInterfaceWithVmultAdd
397 // picks up the vmult_add function in the protected SparseMatrix
398 // base class.
399 template <typename number>
400 template <class OutVector, class InVector>
401 inline void
403  const InVector &src) const
404 {
405  OutVector tmp;
406  tmp.reinit(dst);
407  this->Tvmult(tmp, src);
408  dst += tmp;
409 }
410 
411 //---------------------------------------------------------------------------
412 
413 
414 template <typename number>
416  const double strengthen_diag,
417  const unsigned int extra_off_diag,
418  const bool use_prev_sparsity,
419  const SparsityPattern *use_this_spars)
420  : strengthen_diagonal(strengthen_diag)
421  , extra_off_diagonals(extra_off_diag)
422  , use_previous_sparsity(use_prev_sparsity)
423  , use_this_sparsity(use_this_spars)
424 {}
425 
426 
427 #endif // DOXYGEN
428 
430 
431 #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
types::global_dof_index size_type
size_type n() const
size_type m() const
bool empty() const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
static ::ExceptionBase & ExcInvalidStrengthening(double arg1)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:512
@ matrix
Contents is actually a matrix.
types::global_dof_index size_type
Definition: cuda_kernels.h:45