libMesh
Loading...
Searching...
No Matches
condensed_eigen_system.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
19#ifndef LIBMESH_CONDENSED_EIGEN_SYSTEM_H
20#define LIBMESH_CONDENSED_EIGEN_SYSTEM_H
21
22#include "libmesh/libmesh_config.h"
23
24// Currently, the EigenSystem should only be available
25// if SLEPc support is enabled.
26#if defined(LIBMESH_HAVE_SLEPC)
27
28// Local Includes
29#include "libmesh/eigen_system.h"
30#include "libmesh/sparse_matrix.h"
31
32namespace libMesh
33{
34
47{
48public:
49
54 const std::string & name_in,
55 const unsigned int number_in);
56
67
72
77
81 sys_type & system () { return *this; }
82
95 void initialize_condensed_dofs(const std::set<dof_id_type> &
96 global_condensed_dofs_set =
97 std::set<dof_id_type>());
98
103
109 virtual void solve() override;
110
111 virtual void clear () override;
112
119 virtual std::pair<Real, Real> get_eigenpair(dof_id_type i) override;
120
121 bool has_condensed_matrix_A() const { return _condensed_matrix_A.get(); }
122 bool has_condensed_matrix_B() const { return _condensed_matrix_B.get(); }
124
129
134
139
147
154
161
170
176 std::vector<dof_id_type> local_non_condensed_dofs_vector;
177
183
189
190 virtual void reinit() override;
191
192protected:
193 virtual void add_matrices () override;
194
195private:
196 virtual bool condense_constrained_dofs() const override final { return true; }
197
203
208
213
217 std::unique_ptr<SparseMatrix<Number>> _condensed_matrix_A;
218
222 std::unique_ptr<SparseMatrix<Number>> _condensed_matrix_B;
223
227 std::unique_ptr<SparseMatrix<Number>> _condensed_precond_matrix;
228};
229
230
231} // namespace libMesh
232
233
234#endif // LIBMESH_HAVE_SLEPC
235
236#endif // LIBMESH_CONDENSED_EIGEN_SYSTEM_H
This class extends EigenSystem to allow a simple way of solving (standard or generalized) eigenvalue ...
virtual bool condense_constrained_dofs() const override final
Whether this object should condense out constrained degrees of freedom.
virtual void add_matrices() override
Adds the necessary matrices and shell matrices.
void dont_create_submatrices_in_solve()
Instructs not to create the condensed submatrices from the global matrices right before the solve.
void copy_super_to_sub(NumericVector< Number > &super, NumericVector< Number > &sub)
Copy a logically super-vector into a sub-vector.
bool _have_condensed_dofs
Whether there are any condensed degrees of freedom.
std::vector< dof_id_type > local_non_condensed_dofs_vector
Vector storing the local dof indices that will not be condensed.
bool _condensed_dofs_initialized
A private flag to indicate whether the condensed dofs have been initialized.
virtual void solve() override
Override to solve the condensed eigenproblem with the dofs in local_non_condensed_dofs_vector strippe...
EigenSystem Parent
The type of the parent.
bool _create_submatrices_in_solve
Denotes whether to create the condensed submatrices from the global matrices in the solve.
void copy_sub_to_super(const NumericVector< Number > &sub, NumericVector< Number > &super)
Copy a logically sub-vector into a super-vector.
void initialize_condensed_dofs(const std::set< dof_id_type > &global_condensed_dofs_set=std::set< dof_id_type >())
Loop over the dofs on each processor to initialize the list of non-condensed dofs.
SparseMatrix< Number > & get_condensed_matrix_B()
std::unique_ptr< SparseMatrix< Number > > _condensed_matrix_A
The (condensed) system matrix for standard eigenvalue problems.
virtual void clear() override
Clear all the data structures associated with the system.
void initialize_condensed_matrices()
Initializes the condensed matrices.
CondensedEigenSystem(CondensedEigenSystem &&)=default
std::unique_ptr< SparseMatrix< Number > > _condensed_precond_matrix
The condensed preconditioning matrix.
virtual std::pair< Real, Real > get_eigenpair(dof_id_type i) override
Override get_eigenpair() to retrieve the eigenpair for the condensed eigensolve.
CondensedEigenSystem & operator=(const CondensedEigenSystem &)=delete
CondensedEigenSystem(const CondensedEigenSystem &)=delete
Special functions.
std::unique_ptr< SparseMatrix< Number > > _condensed_matrix_B
A second (condensed) system matrix for generalized eigenvalue problems.
SparseMatrix< Number > & get_condensed_precond_matrix()
CondensedEigenSystem sys_type
The type of system.
dof_id_type n_global_non_condensed_dofs() const
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
SparseMatrix< Number > & get_condensed_matrix_A()
Manages consistently variables, degrees of freedom, and coefficient vectors for eigenvalue problems.
This is the EquationSystems class.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Generic sparse matrix.
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(ctx)
uint8_t dof_id_type
Definition id_types.h:67