From 8c3e2dd95e64794496e6c60f4bf5a1dfab21ee7c Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Tue, 31 Jul 2012 22:52:34 +0200 Subject: [PATCH] MatrixType comes before VectorType --- dune/tectonic/globalnonlinearity.hh | 4 ++-- dune/tectonic/globalruinanonlinearity.hh | 6 +++--- dune/tectonic/myblockproblem.hh | 8 ++++---- dune/tectonic/myconvexproblem.hh | 4 ++-- src/assemblers.cc | 6 +++--- src/assemblers.hh | 4 ++-- src/assemblers_tmpl.cc | 4 ++-- src/mysolver.cc | 14 +++++++------- src/mysolver.hh | 2 +- src/mysolver_tmpl.cc | 2 +- src/one-body-sample.cc | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh index 4010d6d6..eb15d8c9 100644 --- a/dune/tectonic/globalnonlinearity.hh +++ b/dune/tectonic/globalnonlinearity.hh @@ -12,11 +12,11 @@ #include "localnonlinearity.hh" namespace Dune { -template <class VectorTypeTEMPLATE, class MatrixTypeTEMPLATE> +template <class MatrixTypeTEMPLATE, class VectorTypeTEMPLATE> class GlobalNonlinearity { public: - typedef VectorTypeTEMPLATE VectorType; typedef MatrixTypeTEMPLATE MatrixType; + typedef VectorTypeTEMPLATE VectorType; int static const dim = VectorTypeTEMPLATE::block_type::dimension; double operator()(VectorType const &x) const { diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh index dd3af39b..7269676a 100644 --- a/dune/tectonic/globalruinanonlinearity.hh +++ b/dune/tectonic/globalruinanonlinearity.hh @@ -14,14 +14,14 @@ #include "nicefunction.hh" namespace Dune { -template <class VectorType, class MatrixType> +template <class MatrixType, class VectorType> class GlobalRuinaNonlinearity - : public GlobalNonlinearity<VectorType, MatrixType> { + : public GlobalNonlinearity<MatrixType, VectorType> { private: typedef shared_ptr<BlockVector<FieldVector<double, 1>> const> dataptr; public: - using GlobalNonlinearity<VectorType, MatrixType>::dim; + using GlobalNonlinearity<MatrixType, VectorType>::dim; GlobalRuinaNonlinearity(dataptr nodalIntegrals, dataptr a, dataptr mu, dataptr eta, dataptr normalStress, dataptr b, diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh index 3228de8d..dc447c98 100644 --- a/dune/tectonic/myblockproblem.hh +++ b/dune/tectonic/myblockproblem.hh @@ -16,10 +16,10 @@ #include "ellipticenergy.hh" /* Just for debugging */ -template <int dim, class VectorType, class MatrixType> +template <int dim, class MatrixType, class VectorType> double computeEnergy( MatrixType const &A, VectorType const &b, - Dune::GlobalNonlinearity<VectorType, MatrixType> const &phi, + Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi, VectorType const &x) { double ret; VectorType tmp(x.size()); @@ -123,7 +123,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { */ MyDirectionalConvexFunction< - Dune::GlobalNonlinearity<VectorType, MatrixType>> const psi(localA, + Dune::GlobalNonlinearity<MatrixType, VectorType>> const psi(localA, localb, problem.phi, u, v); @@ -201,7 +201,7 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { double const localb = tmp * direction; // <Av,v> MyDirectionalConvexFunction< - Dune::GlobalNonlinearity<VectorType, MatrixType>> const + Dune::GlobalNonlinearity<MatrixType, VectorType>> const psi(localA, localb, problem.phi, u, direction); Interval<double> D; diff --git a/dune/tectonic/myconvexproblem.hh b/dune/tectonic/myconvexproblem.hh index 2febf31a..054152fa 100644 --- a/dune/tectonic/myconvexproblem.hh +++ b/dune/tectonic/myconvexproblem.hh @@ -22,12 +22,12 @@ class MyConvexProblem { \param u The solution vector */ MyConvexProblem(MatrixType const &A, - Dune::GlobalNonlinearity<VectorType, MatrixType> const &phi, + Dune::GlobalNonlinearity<MatrixType, VectorType> const &phi, VectorType const &f) : A(A), phi(phi), f(f) {}; MatrixType const &A; - Dune::GlobalNonlinearity<VectorType, MatrixType> const φ + Dune::GlobalNonlinearity<MatrixType, VectorType> const φ VectorType const &f; }; diff --git a/src/assemblers.cc b/src/assemblers.cc index bda325b3..b6f8c726 100644 --- a/src/assemblers.cc +++ b/src/assemblers.cc @@ -52,8 +52,8 @@ assemble_frictional(GridView const &gridView, FEBasis const &feBasis, return nodalIntegrals; } -template <class VectorType, class MatrixType> -Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const> +template <class MatrixType, class VectorType> +Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const> assemble_nonlinearity( Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> @@ -85,7 +85,7 @@ assemble_nonlinearity( *L = parset.get<double>("ruina.L"); return Dune::make_shared< - Dune::GlobalRuinaNonlinearity<VectorType, MatrixType> const>( + Dune::GlobalRuinaNonlinearity<MatrixType, VectorType> const>( nodalIntegrals, a, mu, eta, normalStress, b, state, L, h); } case Config::Laursen: diff --git a/src/assemblers.hh b/src/assemblers.hh index 9c7b5579..d98ac6f8 100644 --- a/src/assemblers.hh +++ b/src/assemblers.hh @@ -22,8 +22,8 @@ Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> assemble_frictional(GridView const &gridView, FEBasis const &feBasis, Dune::BitSetVector<1> const &frictionalNodes); -template <class VectorType, class MatrixType> -Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const> +template <class MatrixType, class VectorType> +Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const> assemble_nonlinearity( Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc index 19367f1a..9f8b4bc2 100644 --- a/src/assemblers_tmpl.cc +++ b/src/assemblers_tmpl.cc @@ -30,8 +30,8 @@ assemble_frictional<GridType, GridView, SmallVector, P1Basis>( Dune::BitSetVector<1> const &frictionalNodes); template Dune::shared_ptr< - Dune::GlobalNonlinearity<VectorType, MatrixType> const> -assemble_nonlinearity<VectorType, MatrixType>( + Dune::GlobalNonlinearity<MatrixType, VectorType> const> +assemble_nonlinearity<MatrixType, VectorType>( Dune::ParameterTree const &parset, Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> nodalIntegrals, diff --git a/src/mysolver.cc b/src/mysolver.cc index fc1532f9..10f4f703 100644 --- a/src/mysolver.cc +++ b/src/mysolver.cc @@ -10,9 +10,9 @@ #include "mysolver.hh" -template <int dim, class VectorType, class MatrixType, class GridType, +template <int dim, class MatrixType, class VectorType, class GridType, class BlockProblemType> -MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver( +MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::MySolver( Dune::ParameterTree parset, int refinements, double solver_tolerance, GridType const &grid, Dune::BitSetVector<dim> const &ignoreNodes) : baseEnergyNorm(linearBaseSolverStep), @@ -43,20 +43,20 @@ MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::MySolver( multigridStep->ignoreNodes_ = &ignoreNodes; } -template <int dim, class VectorType, class MatrixType, class GridType, +template <int dim, class MatrixType, class VectorType, class GridType, class BlockProblemType> -MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::~MySolver() { +MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::~MySolver() { for (auto &x : transferOperators) delete x; delete multigridStep; } -template <int dim, class VectorType, class MatrixType, class GridType, +template <int dim, class MatrixType, class VectorType, class GridType, class BlockProblemType> -typename MySolver<dim, VectorType, MatrixType, GridType, +typename MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::SolverType * -MySolver<dim, VectorType, MatrixType, GridType, BlockProblemType>::getSolver() { +MySolver<dim, MatrixType, VectorType, GridType, BlockProblemType>::getSolver() { return multigridStep; } diff --git a/src/mysolver.hh b/src/mysolver.hh index 4587c767..a8a5c60d 100644 --- a/src/mysolver.hh +++ b/src/mysolver.hh @@ -13,7 +13,7 @@ #include <dune/fufem/assemblers/transferoperatorassembler.hh> #include <dune/tnnmg/iterationsteps/tnnmgstep.hh> -template <int dim, class VectorType, class MatrixType, class GridType, +template <int dim, class MatrixType, class VectorType, class GridType, class BlockProblemType> class MySolver { private: diff --git a/src/mysolver_tmpl.cc b/src/mysolver_tmpl.cc index e2ced974..522d7d6c 100644 --- a/src/mysolver_tmpl.cc +++ b/src/mysolver_tmpl.cc @@ -23,5 +23,5 @@ typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; typedef Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming> GridType; // typedef Dune::YaspGrid<DIM> GridType; -template class MySolver<DIM, VectorType, MatrixType, GridType, +template class MySolver<DIM, MatrixType, VectorType, GridType, MyBlockProblemType>; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index cd87e224..9acca63f 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) { typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType; // Set up TNNMG solver - MySolver<dim, VectorType, MatrixType, GridType, MyBlockProblemType> + MySolver<dim, MatrixType, VectorType, GridType, MyBlockProblemType> mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid, ignoreNodes); @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) { // TODO: We should not have to reassemble the nonlinearity anew // everytime auto myGlobalNonlinearity = - assemble_nonlinearity<VectorType, MatrixType>( + assemble_nonlinearity<MatrixType, VectorType>( parset.sub("boundary.friction"), nodalIntegrals, s4_new, h); MyConvexProblemType const myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b4); -- GitLab