| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2004 - 2024 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_petsc_full_matrix_h |
| 16 |
#define dealii_petsc_full_matrix_h |
| 17 |
|
| 18 |
|
| 19 |
#include <deal.II/base/config.h> |
| 20 |
|
| 21 |
#ifdef DEAL_II_WITH_PETSC |
| 22 |
|
| 23 |
# include <deal.II/lac/exceptions.h> |
| 24 |
# include <deal.II/lac/petsc_matrix_base.h> |
| 25 |
|
| 26 |
DEAL_II_NAMESPACE_OPEN |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
namespace PETScWrappers |
| 31 |
{ |
| 32 |
/** |
| 33 |
* @addtogroup PETScWrappers |
| 34 |
* @{ |
| 35 |
*/ |
| 36 |
|
| 37 |
/** |
| 38 |
* Implementation of a sequential dense matrix class based on PETSc. All the |
| 39 |
* functionality is actually in the base class, except for the calls to |
| 40 |
* generate a sequential dense matrix. This is possible since PETSc only |
| 41 |
* works on an abstract matrix type and internally distributes to functions |
| 42 |
* that do the actual work depending on the actual matrix type (much like |
| 43 |
* using virtual functions). Only the functions creating a matrix of |
| 44 |
* specific type differ, and are implemented in this particular class. |
| 45 |
* |
| 46 |
* @ingroup Matrix1 |
| 47 |
*/ |
| 48 |
class FullMatrix : public MatrixBase |
| 49 |
{ |
| 50 |
public: |
| 51 |
/** |
| 52 |
* Declare type for container size. |
| 53 |
*/ |
| 54 |
using size_type = types::global_dof_index; |
| 55 |
|
| 56 |
|
| 57 |
/** |
| 58 |
* Default constructor. Create an empty matrix. |
| 59 |
*/ |
| 60 |
FullMatrix(); |
| 61 |
|
| 62 |
|
| 63 |
/** |
| 64 |
* Create a full matrix of dimensions @p m times @p n. |
| 65 |
*/ |
| 66 |
FullMatrix(const size_type m, const size_type n); |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* Throw away the present matrix and generate one that has the same |
| 71 |
* properties as if it were created by the constructor of this class with |
| 72 |
* the same argument list as the present function. |
| 73 |
*/ |
| 74 |
void |
| 75 |
reinit(const size_type m, const size_type n); |
| 76 |
|
| 77 |
|
| 78 |
private: |
| 79 |
/** |
| 80 |
* Do the actual work for the respective reinit() function and the |
| 81 |
* matching constructor, i.e. create a matrix. Getting rid of the previous |
| 82 |
* matrix is left to the caller. |
| 83 |
*/ |
| 84 |
void |
| 85 |
do_reinit(const size_type m, const size_type n); |
| 86 |
}; |
| 87 |
|
| 88 |
/** @} */ |
| 89 |
} // namespace PETScWrappers |
| 90 |
|
| 91 |
|
| 92 |
DEAL_II_NAMESPACE_CLOSE |
| 93 |
|
| 94 |
#else |
| 95 |
|
| 96 |
// Make sure the scripts that create the C++20 module input files have |
| 97 |
// something to latch on if the preprocessor #ifdef above would |
| 98 |
// otherwise lead to an empty content of the file. |
| 99 |
DEAL_II_NAMESPACE_OPEN |
| 100 |
DEAL_II_NAMESPACE_CLOSE |
| 101 |
|
| 102 |
#endif // DEAL_II_WITH_PETSC |
| 103 |
|
| 104 |
#endif |