libMesh
shell_matrix.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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/enum_solver_package.h"
32 #include "libmesh/auto_ptr.h" // libmesh_make_unique
33 #include "libmesh/parallel.h"
34 
35 namespace libMesh
36 {
37 
38 // forward declarations
39 template <typename T> class NumericVector;
40 
41 
50 template <typename T>
51 class ShellMatrix : public ReferenceCountedObject<ShellMatrix<T>>,
52  public ParallelObject
53 {
54 public:
58  ShellMatrix (const Parallel::Communicator & comm_in);
59 
64  static std::unique_ptr<ShellMatrix<T>>
65  build(const Parallel::Communicator & comm,
66  const SolverPackage solver_package = libMesh::default_solver_package());
67 
71  virtual ~ShellMatrix ();
72 
77  virtual numeric_index_type m () const = 0;
78 
83  virtual numeric_index_type n () const = 0;
84 
89  virtual void vector_mult (NumericVector<T> & dest,
90  const NumericVector<T> & arg) const = 0;
91 
95  virtual void vector_mult_add (NumericVector<T> & dest,
96  const NumericVector<T> & arg) const = 0;
97 
101  virtual void get_diagonal (NumericVector<T> & dest) const = 0;
102 
106  void attach_dof_map (const DofMap & dof_map)
107  { _dof_map = &dof_map; }
108 
109 
110  virtual void clear () { libmesh_error_msg ("Not implemented yet"); }
111 
112  virtual void init () { libmesh_error_msg ("Not implemented yet"); }
113 
114 protected:
118  DofMap const * _dof_map;
119 };
120 
121 
122 
123 //-----------------------------------------------------------------------
124 // ShellMatrix inline members
125 template <typename T>
126 inline
127 ShellMatrix<T>::ShellMatrix (const Parallel::Communicator & comm_in) :
128  ParallelObject(comm_in),
129  _dof_map(nullptr)
130 {}
131 
132 
133 template <typename T>
134 inline
136 {}
137 
138 
139 } // namespace libMesh
140 
141 
142 #endif // LIBMESH_SHELL_MATRIX_H
libMesh::ShellMatrix
Generic shell matrix, i.e.
Definition: eigen_preconditioner.h:36
libMesh::ShellMatrix::init
virtual void init()
Definition: shell_matrix.h:112
libMesh::SolverPackage
SolverPackage
Defines an enum for various linear solver packages.
Definition: enum_solver_package.h:34
libMesh::ShellMatrix::ShellMatrix
ShellMatrix(const Parallel::Communicator &comm_in)
Constructor; does nothing.
Definition: shell_matrix.h:127
libMesh::ShellMatrix::clear
virtual void clear()
Definition: shell_matrix.h:110
libMesh::ShellMatrix::get_diagonal
virtual void get_diagonal(NumericVector< T > &dest) const =0
Copies the diagonal part of the matrix into dest.
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::ShellMatrix::n
virtual numeric_index_type n() const =0
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::default_solver_package
SolverPackage default_solver_package()
Definition: libmesh.C:993
libMesh::ShellMatrix::vector_mult
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const =0
Multiplies the matrix with arg and stores the result in dest.
libMesh::ShellMatrix::_dof_map
const DofMap * _dof_map
The DofMap object associated with this object.
Definition: shell_matrix.h:118
libMesh::ShellMatrix::attach_dof_map
void attach_dof_map(const DofMap &dof_map)
Get a pointer to the DofMap to use.
Definition: shell_matrix.h:106
libMesh::ShellMatrix::~ShellMatrix
virtual ~ShellMatrix()
Destructor.
Definition: shell_matrix.h:135
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::DofMap
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:176
libMesh::ShellMatrix::build
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.
Definition: shell_matrix.C:33
libMesh::ShellMatrix::vector_mult_add
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.
libMesh::ParallelObject
An object whose state is distributed along a set of processors.
Definition: parallel_object.h:55
libMesh::ShellMatrix::m
virtual numeric_index_type m() const =0