libMesh
Loading...
Searching...
No Matches
shell_matrix.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
20#ifndef LIBMESH_SHELL_MATRIX_H
21#define LIBMESH_SHELL_MATRIX_H
22
23
24// Local includes
25#include "libmesh/libmesh_common.h"
26#include "libmesh/reference_counted_object.h"
27#include "libmesh/libmesh.h"
28#include "libmesh/id_types.h"
29#include "libmesh/parallel_object.h"
30#include "libmesh/dof_map.h"
31#include "libmesh/parallel.h"
32
33namespace libMesh
34{
35
36// forward declarations
37template <typename T> class NumericVector;
38enum SolverPackage : int;
39
48template <typename T>
49class ShellMatrix : public ReferenceCountedObject<ShellMatrix<T>>,
50 public ParallelObject
51{
52public:
57
62 static std::unique_ptr<ShellMatrix<T>>
64 const SolverPackage solver_package = libMesh::default_solver_package());
65
69 virtual ~ShellMatrix ();
70
75 virtual numeric_index_type m () const = 0;
76
81 virtual numeric_index_type n () const = 0;
82
87 virtual void vector_mult (NumericVector<T> & dest,
88 const NumericVector<T> & arg) const = 0;
89
93 virtual void vector_mult_add (NumericVector<T> & dest,
94 const NumericVector<T> & arg) const = 0;
95
99 virtual void get_diagonal (NumericVector<T> & dest) const = 0;
100
104 void attach_dof_map (const DofMap & dof_map)
105 { _dof_map = &dof_map; }
106
107
108 virtual void clear () { libmesh_error_msg ("Not implemented yet"); }
109
110 virtual void init () { libmesh_error_msg ("Not implemented yet"); }
111
113
114protected:
119
124};
125
126
127
128//-----------------------------------------------------------------------
129// ShellMatrix inline members
130template <typename T>
131inline
133 ParallelObject(comm_in),
134 _dof_map(nullptr),
135 _omit_constrained_dofs(false)
136{}
137
138
139template <typename T>
140inline
143
144
145} // namespace libMesh
146
147
148#endif // LIBMESH_SHELL_MATRIX_H
void ErrorVector unsigned int
This class handles the numbering of degrees of freedom on a mesh.
Definition dof_map.h:181
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
An object whose state is distributed along a set of processors.
const Parallel::Communicator & comm() const
This class implements reference counting.
Generic shell matrix, i.e.
virtual numeric_index_type n() const =0
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const =0
Multiplies the matrix with arg and stores the result in dest.
virtual void clear()
virtual void get_diagonal(NumericVector< T > &dest) const =0
Copies the diagonal part of the matrix into dest.
static std::unique_ptr< ShellMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a ShellMatrix<T> using the linear solver package specified by solver_package.
void attach_dof_map(const DofMap &dof_map)
Get a pointer to the DofMap to use.
virtual void init()
virtual void vector_mult_add(NumericVector< T > &dest, const NumericVector< T > &arg) const =0
Multiplies the matrix with arg and adds the result to dest.
bool _omit_constrained_dofs
Whether to omit constrained dofs from this data structure.
virtual numeric_index_type m() const =0
ShellMatrix(const Parallel::Communicator &comm_in)
Constructor; does nothing.
virtual ~ShellMatrix()
Destructor.
DofMap const * _dof_map
The DofMap object associated with this object.
The libMesh namespace provides an interface to certain functionality in the library.
SolverPackage default_solver_package()
Definition libmesh.C:1064
dof_id_type numeric_index_type
Definition id_types.h:99
SolverPackage
Defines an enum for various linear solver packages.