From 263c24da5072335da4c44b19749082d31df44d56 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Mon, 31 Oct 2011 13:29:04 +0100 Subject: [PATCH] Cleanup --- src/myconvexproblem.hh | 20 ++++++-------------- src/one-body-sample.cc | 6 ++---- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/myconvexproblem.hh b/src/myconvexproblem.hh index 4767daba..ee91633d 100644 --- a/src/myconvexproblem.hh +++ b/src/myconvexproblem.hh @@ -11,39 +11,31 @@ \tparam MatrixTypeTEMPLATE The type used for the matrix of the quadratic part */ -template <class NonlinearityTypeTEMPLATE, class MatrixTypeTEMPLATE> +template <class NonlinearityTypeTEMPLATE, class MatrixTypeTEMPLATE, + class VectorTypeTEMPLATE> class MyConvexProblem { public: typedef NonlinearityTypeTEMPLATE NonlinearityType; - typedef typename NonlinearityType::VectorType VectorType; + typedef VectorTypeTEMPLATE VectorType; typedef MatrixTypeTEMPLATE MatrixType; - typedef typename NonlinearityType::LocalVectorType LocalVectorType; + typedef typename VectorType::block_type LocalVectorType; typedef typename MatrixType::block_type LocalMatrixType; static const int block_size = NonlinearityType::block_size; /** \brief Constructor with the problem components - \param a A scalar factor in front of the quadratic part (the quadratic - part includes a factor of 1/2 already) \param A The matrix of the quadratic part - \param am A scalar factor in front of the optional rank-one matrix - \param Am A rank-one matrix given by a single vector. The matrix is - AmAm^T \param phi The nonlinearity \param f The linear functional \param u The solution vector */ - MyConvexProblem(double a, const MatrixType& A, double am, - const VectorType& Am, NonlinearityType& phi, + MyConvexProblem(const MatrixType& A, NonlinearityType& phi, const VectorType& f, VectorType& u) - : a(a), A(A), am(am), Am(Am), phi(phi), f(f), u(u) {}; + : A(A), phi(phi), f(f), u(u) {}; - double a; const MatrixType& A; - double am; - const VectorType& Am; NonlinearityType& phi; const VectorType& f; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index f1aeda9b..2d849a55 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -142,12 +142,10 @@ int main() { typedef ZeroNonlinearity<SmallVector, SmallMatrix> NonlinearityType; NonlinearityType phi; - typedef MyConvexProblem<NonlinearityType, OperatorType> + typedef MyConvexProblem<NonlinearityType, OperatorType, VectorType> MyConvexProblemType; - VectorType unused_vector(grid.size(grid.maxLevel(), dim), 0); - MyConvexProblemType myConvexProblem(1, stiffnessMatrix, 0, unused_vector, - phi, f, u1); + MyConvexProblemType myConvexProblem(stiffnessMatrix, phi, f, u1); typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; MyBlockProblemType myBlockProblem(myConvexProblem); -- GitLab