Reference documentation for deal.II version Git 6cf3cbfd16 2020-07-12 08:18:15 -0400
\(\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 - 2018 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 
105 template <typename number>
106 class SparseLUDecomposition : protected SparseMatrix<number>,
107  public virtual Subscriptor
108 {
109 protected:
117 
118 public:
123 
128  virtual ~SparseLUDecomposition() override = 0;
129 
134  virtual void
135  clear() override;
136 
141  {
142  public:
146  AdditionalData(const double strengthen_diagonal = 0,
147  const unsigned int extra_off_diagonals = 0,
148  const bool use_previous_sparsity = false,
149  const SparsityPattern *use_this_sparsity = nullptr);
150 
158 
169  unsigned int extra_off_diagonals;
170 
180 
192  };
193 
209  template <typename somenumber>
210  void
212  const AdditionalData parameters);
213 
218  bool
219  empty() const;
220 
226  size_type
227  m() const;
228 
234  size_type
235  n() const;
236 
243  template <class OutVector, class InVector>
244  void
245  vmult_add(OutVector &dst, const InVector &src) const;
246 
254  template <class OutVector, class InVector>
255  void
256  Tvmult_add(OutVector &dst, const InVector &src) const;
257 
262  virtual std::size_t
263  memory_consumption() const;
264 
274  double,
275  << "The strengthening parameter " << arg1
276  << " is not greater or equal than zero!");
278 protected:
283  template <typename somenumber>
284  void
286 
293  virtual void
295 
305  virtual number
306  get_strengthen_diagonal(const number rowsum, const size_type row) const;
307 
312 
318  std::vector<const size_type *> prebuilt_lower_bound;
319 
323  void
325 
326 private:
337 };
338 
340 //---------------------------------------------------------------------------
341 
342 #ifndef DOXYGEN
343 
344 template <typename number>
345 inline number
347  const number /*rowsum*/,
348  const size_type /*row*/) const
349 {
350  return strengthen_diagonal;
351 }
352 
353 
354 
355 template <typename number>
356 inline bool
358 {
360 }
361 
362 
363 template <typename number>
366 {
367  return SparseMatrix<number>::m();
368 }
369 
370 
371 template <typename number>
374 {
375  return SparseMatrix<number>::n();
376 }
377 
378 // Note: This function is required for full compatibility with
379 // the LinearOperator class. ::MatrixInterfaceWithVmultAdd
380 // picks up the vmult_add function in the protected SparseMatrix
381 // base class.
382 template <typename number>
383 template <class OutVector, class InVector>
384 inline void
386  const InVector &src) const
387 {
388  OutVector tmp;
389  tmp.reinit(dst);
390  this->vmult(tmp, src);
391  dst += tmp;
392 }
393 
394 // Note: This function is required for full compatibility with
395 // the LinearOperator class. ::MatrixInterfaceWithVmultAdd
396 // picks up the vmult_add function in the protected SparseMatrix
397 // base class.
398 template <typename number>
399 template <class OutVector, class InVector>
400 inline void
402  const InVector &src) const
403 {
404  OutVector tmp;
405  tmp.reinit(dst);
406  this->Tvmult(tmp, src);
407  dst += tmp;
408 }
409 
410 //---------------------------------------------------------------------------
411 
412 
413 template <typename number>
415  const double strengthen_diag,
416  const unsigned int extra_off_diag,
417  const bool use_prev_sparsity,
418  const SparsityPattern *use_this_spars)
419  : strengthen_diagonal(strengthen_diag)
420  , extra_off_diagonals(extra_off_diag)
421  , use_previous_sparsity(use_prev_sparsity)
422  , use_this_sparsity(use_this_spars)
423 {}
424 
425 
426 #endif // DOXYGEN
427 
429 
430 #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)
void vmult_add(OutVector &dst, const InVector &src) const
Contents is actually a matrix.
static ::ExceptionBase & ExcInvalidStrengthening(double arg1)
bool empty() const
void copy_from(const SparseMatrix< somenumber > &matrix)
SparsityPattern * own_sparsity
size_type n() const
size_type n() const
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
void vmult(OutVector &dst, const InVector &src) const
virtual void clear() override
typename SparseMatrix< number >::size_type size_type
virtual ~SparseLUDecomposition() override=0
std::vector< const size_type * > prebuilt_lower_bound
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
void Tvmult_add(OutVector &dst, const InVector &src) const
size_type m() const
virtual std::size_t memory_consumption() const
virtual void strengthen_diagonal_impl()
virtual number get_strengthen_diagonal(const number rowsum, const size_type row) const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
void initialize(const SparseMatrix< somenumber > &matrix, const AdditionalData parameters)
size_type m() const
void Tvmult(OutVector &dst, const InVector &src) const