From bd7f047d29f1297dfca9c7fbf8f491612b5bce58 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 25 May 2012 11:27:06 +0200
Subject: [PATCH] Get size from the other arguments

---
 src/assemblers.cc      | 4 +++-
 src/assemblers.hh      | 2 +-
 src/assemblers_tmpl.cc | 4 ++--
 src/one-body-sample.cc | 3 +--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/assemblers.cc b/src/assemblers.cc
index 7194effe..3f40e119 100644
--- a/src/assemblers.cc
+++ b/src/assemblers.cc
@@ -58,11 +58,13 @@ assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
 template <class VectorType, class MatrixType>
 Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const>
 assemble_nonlinearity(
-    int size, Dune::ParameterTree const &parset,
+    Dune::ParameterTree const &parset,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
         nodalIntegrals,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
     double h) {
+  auto const size = (*nodalIntegrals).size();
+
   typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType;
   // {{{ Assemble terms for the nonlinearity
   auto mu = Dune::make_shared<SingletonVectorType>(size);
diff --git a/src/assemblers.hh b/src/assemblers.hh
index 4d44efd5..9c7b5579 100644
--- a/src/assemblers.hh
+++ b/src/assemblers.hh
@@ -25,7 +25,7 @@ assemble_frictional(GridView const &gridView, FEBasis const &feBasis,
 template <class VectorType, class MatrixType>
 Dune::shared_ptr<Dune::GlobalNonlinearity<VectorType, MatrixType> const>
 assemble_nonlinearity(
-    int size, Dune::ParameterTree const &parset,
+    Dune::ParameterTree const &parset,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
         nodalIntegrals,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc
index cb02a52c..6123cd5f 100644
--- a/src/assemblers_tmpl.cc
+++ b/src/assemblers_tmpl.cc
@@ -30,7 +30,7 @@ assemble_frictional<GridType2, GridView2, SmallVector2, P1Basis2>(
 template Dune::shared_ptr<
     Dune::GlobalNonlinearity<VectorType2, OperatorType2> const>
 assemble_nonlinearity<VectorType2, OperatorType2>(
-    int size, Dune::ParameterTree const &parset,
+    Dune::ParameterTree const &parset,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
         nodalIntegrals,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
@@ -61,7 +61,7 @@ assemble_frictional<GridType3, GridView3, SmallVector3, P1Basis3>(
 template Dune::shared_ptr<
     Dune::GlobalNonlinearity<VectorType3, OperatorType3> const>
 assemble_nonlinearity<VectorType3, OperatorType3>(
-    int size, Dune::ParameterTree const &parset,
+    Dune::ParameterTree const &parset,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>>
         nodalIntegrals,
     Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state,
diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 9716d8a8..568349e9 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -277,8 +277,7 @@ int main(int argc, char *argv[]) {
              ++state_fpi) {
           auto myGlobalNonlinearity =
               assemble_nonlinearity<VectorType, OperatorType>(
-                  finestSize, parset.sub("boundary.friction"), nodalIntegrals,
-                  s4_new, h);
+                  parset.sub("boundary.friction"), nodalIntegrals, s4_new, h);
           MyConvexProblemType const myConvexProblem(stiffnessMatrix,
                                                     *myGlobalNonlinearity, b4);
 
-- 
GitLab