From f7cb26cbf508ca43c92e53ad32f67d0648377d55 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sat, 1 Jun 2013 22:01:47 +0200 Subject: [PATCH] Drop constness for state updates --- dune/tectonic/frictionpotential.hh | 2 +- dune/tectonic/globalnonlinearity.hh | 2 +- dune/tectonic/globalruinanonlinearity.hh | 18 +++++++++--------- dune/tectonic/localfriction.hh | 6 +++--- src/assemblers.cc | 4 ++-- src/assemblers.hh | 2 +- src/assemblers_tmpl.cc | 3 +-- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/dune/tectonic/frictionpotential.hh b/dune/tectonic/frictionpotential.hh index 35e7f693..e2a8c87f 100644 --- a/dune/tectonic/frictionpotential.hh +++ b/dune/tectonic/frictionpotential.hh @@ -91,7 +91,7 @@ class FrictionPotential : public FrictionPotentialWrapper { private: double const coefficientProduct; - double const V_m; + double V_m; }; class TrivialFunction : public FrictionPotentialWrapper { diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh index 0a1c53dc..246cc7f1 100644 --- a/dune/tectonic/globalnonlinearity.hh +++ b/dune/tectonic/globalnonlinearity.hh @@ -31,7 +31,7 @@ class GlobalNonlinearity { /* Return a restriction of the outer function to the i'th node. */ - virtual shared_ptr<LocalFriction<dim> const> restriction(int i) const = 0; + virtual shared_ptr<LocalFriction<dim>> restriction(int i) const = 0; void addHessian(VectorType const &v, MatrixType &hessian) const { for (size_t i = 0; i < v.size(); ++i) { diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh index 0181c619..42875a88 100644 --- a/dune/tectonic/globalruinanonlinearity.hh +++ b/dune/tectonic/globalruinanonlinearity.hh @@ -27,26 +27,26 @@ class GlobalRuinaNonlinearity dataref nodalIntegrals, FrictionData const &fd, dataref state) : restrictions(nodalIntegrals.size()) { - auto trivialNonlinearity = make_shared<LocalFriction<dim> const>( - make_shared<TrivialFunction const>()); + auto trivialNonlinearity = + make_shared<LocalFriction<dim>>(make_shared<TrivialFunction>()); for (size_t i = 0; i < restrictions.size(); ++i) { - restrictions[i] = frictionalNodes[i][0] - ? trivialNonlinearity - : make_shared<LocalFriction<dim> const>( - make_shared<FrictionPotential const>( - nodalIntegrals[i], fd, state[i])); + restrictions[i] = + frictionalNodes[i][0] + ? trivialNonlinearity + : make_shared<LocalFriction<dim>>(make_shared<FrictionPotential>( + nodalIntegrals[i], fd, state[i])); } } /* Return a restriction of the outer function to the i'th node. */ - virtual shared_ptr<LocalFriction<dim> const> restriction(int i) const { + shared_ptr<LocalFriction<dim>> restriction(int i) const override { return restrictions[i]; } private: - std::vector<shared_ptr<LocalFriction<dim> const>> restrictions; + std::vector<shared_ptr<LocalFriction<dim>>> restrictions; }; } #endif diff --git a/dune/tectonic/localfriction.hh b/dune/tectonic/localfriction.hh index 2320302a..01138327 100644 --- a/dune/tectonic/localfriction.hh +++ b/dune/tectonic/localfriction.hh @@ -18,7 +18,7 @@ template <int dimension> class LocalFriction { using VectorType = FieldVector<double, dimension>; using MatrixType = FieldMatrix<double, dimension, dimension>; - LocalFriction(shared_ptr<FrictionPotentialWrapper const> func) + LocalFriction(shared_ptr<FrictionPotentialWrapper> func) : func(func), smp(func->smallestPositivePoint()) {} double operator()(VectorType const &x) const { @@ -125,8 +125,8 @@ template <int dimension> class LocalFriction { } private: - shared_ptr<FrictionPotentialWrapper const> const func; - double const smp; + shared_ptr<FrictionPotentialWrapper> const func; + double smp; }; } #endif diff --git a/src/assemblers.cc b/src/assemblers.cc index 1e2e2b13..74f3a4e8 100644 --- a/src/assemblers.cc +++ b/src/assemblers.cc @@ -48,14 +48,14 @@ assemble_frictional(GridView const &gridView, AssemblerType const &assembler, } template <class MatrixType, class VectorType> -Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const> +Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType>> assemble_nonlinearity( Dune::BitSetVector<1> const &frictionalNodes, Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals, FrictionData const &fd, Dune::BlockVector<Dune::FieldVector<double, 1>> const &state) { return Dune::make_shared< - Dune::GlobalRuinaNonlinearity<MatrixType, VectorType> const>( + Dune::GlobalRuinaNonlinearity<MatrixType, VectorType>>( frictionalNodes, nodalIntegrals, fd, state); } diff --git a/src/assemblers.hh b/src/assemblers.hh index acbde2fe..22b19e69 100644 --- a/src/assemblers.hh +++ b/src/assemblers.hh @@ -24,7 +24,7 @@ assemble_frictional(GridView const &gridView, AssemblerType const &assembler, Dune::BitSetVector<1> const &frictionalNodes); template <class MatrixType, class VectorType> -Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType> const> +Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType>> assemble_nonlinearity( Dune::BitSetVector<1> const &frictionalNodes, Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals, diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc index aa565f59..87a44928 100644 --- a/src/assemblers_tmpl.cc +++ b/src/assemblers_tmpl.cc @@ -31,8 +31,7 @@ assemble_frictional<GridView, SmallVector, AssemblerType>( GridView const &gridView, AssemblerType const &assembler, Dune::BitSetVector<1> const &frictionalNodes); -template Dune::shared_ptr< - Dune::GlobalNonlinearity<MatrixType, VectorType> const> +template Dune::shared_ptr<Dune::GlobalNonlinearity<MatrixType, VectorType>> assemble_nonlinearity<MatrixType, VectorType>( Dune::BitSetVector<1> const &frictionalNodes, Dune::BlockVector<Dune::FieldVector<double, 1>> const &nodalIntegrals, -- GitLab