diff --git a/dune/gfe/riemannianpnsolver.cc b/dune/gfe/riemannianpnsolver.cc index bb7dc9c666d9d94e14b4a825ec0c99887dab3826..68841b254f2737d91b4042e74be7cf3ac46d1bfd 100644 --- a/dune/gfe/riemannianpnsolver.cc +++ b/dune/gfe/riemannianpnsolver.cc @@ -11,8 +11,13 @@ #include <dune/fufem/assemblers/localassemblers/massassembler.hh> #include <dune/fufem/assemblers/basisinterpolationmatrixassembler.hh> -// Using a cholmod solver as the inner solver +#if DUNE_VERSION_GTE(DUNE_SOLVERS, 2, 8) +// Using a cholmod solver as the inner solver, available only since 2.8 #include <dune/solvers/solvers/cholmodsolver.hh> +#else +// Using a umfpack solver as the inner solver +#include <dune/solvers/solvers/umfpacksolver.hh> +#endif #include <dune/solvers/norms/twonorm.hh> #include <dune/solvers/norms/h1seminorm.hh> @@ -96,8 +101,12 @@ setup(const GridType& grid, ////////////////////////////////////////////////////////////////// // Create the inner solver using a cholmod solver ////////////////////////////////////////////////////////////////// - +#if DUNE_VERSION_GTE(DUNE_SOLVERS, 2, 8) innerSolver_ = std::make_shared<Dune::Solvers::CholmodSolver<MatrixType,CorrectionType> >(); +#else + std::cout << "using umfpacksolver" << std::endl; + innerSolver_ = std::make_shared<Dune::Solvers::UMFPackSolver<MatrixType,CorrectionType> >(); +#endif innerSolver_->setIgnore(*globalDirichletNodes); // ////////////////////////////////////////////////////////////////////////////////////// diff --git a/dune/gfe/riemannianpnsolver.hh b/dune/gfe/riemannianpnsolver.hh index f802bd816463d3a1c436a1f617e87a25d99a5f6f..c640311b70967899f924cd934169b3b74c5bf3b3 100644 --- a/dune/gfe/riemannianpnsolver.hh +++ b/dune/gfe/riemannianpnsolver.hh @@ -13,7 +13,11 @@ #include <dune/solvers/common/boxconstraint.hh> #include <dune/solvers/norms/h1seminorm.hh> #include <dune/solvers/solvers/iterativesolver.hh> +#if DUNE_VERSION_GTE(DUNE_SOLVERS, 2, 8) #include <dune/solvers/solvers/cholmodsolver.hh> +#else +#include <dune/solvers/solvers/umfpacksolver.hh> +#endif #include <dune/gfe/periodic1dpq1nodalbasis.hh> @@ -67,7 +71,7 @@ public: hessianMatrix_(nullptr), h1SemiNorm_(NULL) {} - /** \brief Set up the solver using a choldmod solver as the inner solver */ + /** \brief Set up the solver using a choldmod or umfpack solver as the inner solver */ void setup(const GridType& grid, const Assembler* assembler, const SolutionType& x, @@ -123,8 +127,11 @@ protected: const Assembler* assembler_; /** \brief The solver for the quadratic inner problems */ +#if DUNE_VERSION_GTE(DUNE_SOLVERS, 2, 8) std::shared_ptr<typename Dune::Solvers::CholmodSolver<MatrixType,CorrectionType>> innerSolver_; - +#else + std::shared_ptr<typename Dune::Solvers::UMFPackSolver<MatrixType,CorrectionType>> innerSolver_; +#endif /** \brief The Dirichlet nodes */ const Dune::BitSetVector<blocksize>* ignoreNodes_; diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc index 21e564b5da1eb025b12b202c6156e34e1b67260f..83e5819d975015b486a7b3b6f30d459b02fd3f23 100644 --- a/src/cosserat-continuum.cc +++ b/src/cosserat-continuum.cc @@ -575,9 +575,6 @@ int main (int argc, char *argv[]) try solver.solve(); xTargetSpace = solver.getSol(); } else { //parameterSet.get<std::string>("solvertype") == "proximalNewton" -#if DUNE_VERSION_LT(DUNE_COMMON, 2, 8) - DUNE_THROW(Exception, "Please install dune-solvers >= 2.8 to use the Proximal Newton Solver with Cholmod!"); -#else RiemannianProximalNewtonSolver<DeformationFEBasis, TargetSpace> solver; solver.setup(*grid, &assembler, @@ -590,7 +587,6 @@ int main (int argc, char *argv[]) try solver.setInitialIterate(xTargetSpace); solver.solve(); xTargetSpace = solver.getSol(); -#endif } for (int i = 0; i < xTargetSpace.size(); i++) {