Line data Source code
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>> 31 132 : ShellMatrix<T>::build(const Parallel::Communicator & comm, 32 : const SolverPackage solver_package) 33 : { 34 : // Avoid unused parameter warnings when no solver packages are enabled. 35 0 : libmesh_ignore(comm); 36 : 37 : // Build the appropriate vector 38 132 : switch (solver_package) 39 : { 40 : #ifdef LIBMESH_HAVE_PETSC 41 132 : case PETSC_SOLVERS: 42 132 : return std::make_unique<PetscShellMatrix<T>>(comm); 43 : #endif 44 : 45 0 : default: 46 0 : 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