libMesh
static_condensation_preconditioner.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #ifndef LIBMESH_STATIC_CONDENSATION_PRECONDITIONER_H
19 #define LIBMESH_STATIC_CONDENSATION_PRECONDITIONER_H
20 
21 #include "libmesh/preconditioner.h"
22 #include "libmesh/static_condensation.h"
23 
24 namespace libMesh
25 {
27 {
28 public:
30 
31  virtual bool initialized() const override { return _sc.initialized(); }
32 
33  virtual void init() override { _sc.init(); }
34 
35  virtual void setup() override { _sc.setup(); }
36 
37  virtual void apply(const NumericVector<Number> & full_rhs,
38  NumericVector<Number> & full_sol) override;
39 
40  virtual void clear() override { _sc.clear(); }
41 
42  virtual void zero() override { _sc.zero(); }
43 
44 private:
46 };
47 
49  : Preconditioner<Number>(sc.comm()), _sc(sc)
50 {
51 }
52 
53 inline void
55  NumericVector<Number> & full_sol)
56 {
57  _sc.apply(full_rhs, full_sol);
58 }
59 
60 } // namespace libMesh
61 
62 #endif // LIBMESH_STATIC_CONDENSATION_PRECONDITIONER_H
virtual void init() override
Initialize data structures if not done so already.
virtual void zero() override
Set all entries to 0.
void setup()
A no-op to be consistent with shimming from the StaticCondenstionPreconditioner.
virtual bool initialized() const override
The libMesh namespace provides an interface to certain functionality in the library.
virtual void apply(const NumericVector< Number > &full_rhs, NumericVector< Number > &full_sol) override
virtual void clear() override
Release all memory and clear data structures.
This class provides a uniform interface for preconditioners.
void apply(const NumericVector< Number > &full_rhs, NumericVector< Number > &full_sol)
Perform our three stages, forward_elimination(), a solve() on the condensed system, and finally a backwards_substitution()
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1) override
Initialize SparseMatrix with the specified sizes.
virtual void clear() noexcept override
Restores the SparseMatrix<T> to a pristine state.
virtual void zero() override
Can be used to zero items relevant to the preconditioner.
virtual void setup() override
This is called every time the "operator might have changed".