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