From e83e9656f6eb024594655fb30ef9f41469866bd2 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Mon, 3 Jun 2013 12:08:47 +0200 Subject: [PATCH] MyConvexProblem -> ConvexProblem --- dune/tectonic/globalnonlinearity.hh | 1 + dune/tectonic/myconvexproblem.hh | 43 ----------------------------- src/mysolver.hh | 6 ++-- src/mysolver_tmpl.cc | 3 -- src/one-body-sample.cc | 15 ++++++---- 5 files changed, 14 insertions(+), 54 deletions(-) delete mode 100644 dune/tectonic/myconvexproblem.hh diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh index d2d9c502..427f2a88 100644 --- a/dune/tectonic/globalnonlinearity.hh +++ b/dune/tectonic/globalnonlinearity.hh @@ -20,6 +20,7 @@ class GlobalNonlinearity { public: using MatrixType = MatrixTypeTEMPLATE; using VectorType = VectorTypeTEMPLATE; + using LocalMatrixType = typename MatrixType::block_type; using LocalVectorType = typename VectorType::block_type; static const int block_size = LocalVectorType::dimension; using FrictionType = LocalFriction<block_size>; diff --git a/dune/tectonic/myconvexproblem.hh b/dune/tectonic/myconvexproblem.hh deleted file mode 100644 index 542ea00a..00000000 --- a/dune/tectonic/myconvexproblem.hh +++ /dev/null @@ -1,43 +0,0 @@ -// Based on dune/tnnmg/problem-classes/convexproblem.hh -// Allows phi to be const; does away with everything we do not need - -#ifndef MY_CONVEX_PROBLEM_HH -#define MY_CONVEX_PROBLEM_HH - -// Just for debugging -#include "dune/solvers/computeenergy.hh" - -#include "globalnonlinearity.hh" - -template <class MatrixTypeTEMPLATE, class VectorTypeTEMPLATE> -class MyConvexProblem { -public: - using VectorType = VectorTypeTEMPLATE; - using MatrixType = MatrixTypeTEMPLATE; - using LocalVectorType = typename VectorType::block_type; - using LocalMatrixType = typename MatrixType::block_type; - - int static const block_size = VectorType::block_type::dimension; - - /** \brief Constructor with the problem components - - \param A The matrix of the quadratic part - \param f The linear functional - \param u The solution vector - */ - MyConvexProblem(MatrixType const &A, - Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi, - VectorType const &f) - : A(A), phi(phi), f(f) {} - - /* Just for debugging */ - double operator()(VectorType const &x) const { - return phi(x) + computeEnergy(A, x, f); - } - - MatrixType const &A; - Dune::GlobalNonlinearity<MatrixType, VectorType> const φ - VectorType const &f; -}; - -#endif diff --git a/src/mysolver.hh b/src/mysolver.hh index ca422f1b..552d9d33 100644 --- a/src/mysolver.hh +++ b/src/mysolver.hh @@ -12,14 +12,16 @@ #include <dune/solvers/transferoperators/compressedmultigridtransfer.hh> #include <dune/fufem/assemblers/transferoperatorassembler.hh> #include <dune/tnnmg/iterationsteps/tnnmgstep.hh> +#include <dune/tnnmg/problem-classes/convexproblem.hh> #include "dune/tectonic/myblockproblem.hh" -#include "dune/tectonic/myconvexproblem.hh" +#include "dune/tectonic/globalnonlinearity.hh" template <int dim, class MatrixType, class VectorType, class GridType> class MySolver { private: - using ConvexProblemType = MyConvexProblem<MatrixType, VectorType>; + using ConvexProblemType = ConvexProblem< + Dune::GlobalNonlinearity<MatrixType, VectorType>, MatrixType>; using BlockProblemType = MyBlockProblem<ConvexProblemType>; using NonlinearSmootherType = GenericNonlinearGS<BlockProblemType>; using SolverType = TruncatedNonsmoothNewtonMultigrid<BlockProblemType, diff --git a/src/mysolver_tmpl.cc b/src/mysolver_tmpl.cc index 5af72f59..a4c726ec 100644 --- a/src/mysolver_tmpl.cc +++ b/src/mysolver_tmpl.cc @@ -8,9 +8,6 @@ #include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bvector.hh> -#include <dune/tectonic/myblockproblem.hh> -#include <dune/tectonic/myconvexproblem.hh> - using SmallVector = Dune::FieldVector<double, DIM>; using SmallMatrix = Dune::FieldMatrix<double, DIM, DIM>; using VectorType = Dune::BlockVector<SmallVector>; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 61bcf846..3e99cd96 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -63,9 +63,9 @@ #include <dune/solvers/norms/sumnorm.hh> #include <dune/solvers/solvers/loopsolver.hh> #include <dune/solvers/solvers/solver.hh> // Solver::FULL +#include <dune/tnnmg/problem-classes/convexproblem.hh> #include <dune/tectonic/myblockproblem.hh> -#include <dune/tectonic/myconvexproblem.hh> #include "assemblers.hh" #include "mysolver.hh" @@ -411,11 +411,14 @@ int main(int argc, char *argv[]) { SingletonVectorType const &_alpha) { myGlobalNonlinearity->updateState(_alpha); - using MyConvexProblemType = MyConvexProblem<MatrixType, VectorType>; - MyConvexProblemType const myConvexProblem( - problem_AB, *myGlobalNonlinearity, problem_rhs); - MyBlockProblem<MyConvexProblemType> velocityProblem(parset, - myConvexProblem); + using ConvexProblemType = ConvexProblem< + Dune::GlobalNonlinearity<MatrixType, VectorType>, MatrixType>; + // FIXME: Do we really need to pass u here? + ConvexProblemType const myConvexProblem(1.0, problem_AB, + *myGlobalNonlinearity, + problem_rhs, _problem_iterate); + MyBlockProblem<ConvexProblemType> velocityProblem(parset, + myConvexProblem); multigridStep->setProblem(_problem_iterate, velocityProblem); velocityProblemSolver.preprocess(); -- GitLab