libMesh
shell_matrix.C
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 
19 
20 // Local Includes
21 #include "libmesh/shell_matrix.h"
22 #include "libmesh/petsc_shell_matrix.h"
23 #include "libmesh/enum_solver_package.h"
24 
25 namespace libMesh
26 {
27 
28  // Full specialization for Real datatypes
29  template <typename T>
30  std::unique_ptr<ShellMatrix<T>>
32  const SolverPackage solver_package)
33  {
34  // Avoid unused parameter warnings when no solver packages are enabled.
35  libmesh_ignore(comm);
36 
37  // Build the appropriate vector
38  switch (solver_package)
39  {
40  #ifdef LIBMESH_HAVE_PETSC
41  case PETSC_SOLVERS:
42  return std::make_unique<PetscShellMatrix<T>>(comm);
43  #endif
44 
45  default:
46  libmesh_error_msg("ERROR: Unrecognized solver package: " << solver_package);
47  }
48  }
49 
50 //------------------------------------------------------------------
51 // Explicit instantiations
52 template class LIBMESH_EXPORT ShellMatrix<Number>;
53 
54 } // namespace libMesh
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:31
The libMesh namespace provides an interface to certain functionality in the library.
void libmesh_ignore(const Args &...)
SolverPackage
Defines an enum for various linear solver packages.