From a7969146c247fb4501540a26775e7cb0600010cc Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 23 Feb 2012 18:45:22 +0100 Subject: [PATCH] Move state to solvers --- src/one-body-sample.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 050c1e56..95c0f05e 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -270,11 +270,6 @@ int main(int argc, char *argv[]) { auto nodalIntegrals = assemble_frictional<GridType, GridView, SmallVector, P1Basis>( leafView, p1Basis, frictionalNodes); - auto state = - Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>( - grid->size(grid->maxLevel(), dim)); - *state = 0.0; - // {{{ Set up TNNMG solver // linear iteration step components TruncatedBlockGSStep<OperatorType, VectorType> linearBaseSolverStep; @@ -337,6 +332,10 @@ int main(int argc, char *argv[]) { stiffnessMatrix.mmv(u4, b4); if (parset.get<bool>("solver.nonlineargs.use")) { + auto state = + Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>( + grid->size(grid->maxLevel(), dim)); + *state = 0.0; auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( grid->size(grid->maxLevel(), dim), parset, nodalIntegrals, @@ -356,6 +355,10 @@ int main(int argc, char *argv[]) { u1 += u1_diff; if (parset.get<bool>("solver.tnnmg.use")) { + auto state = + Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>( + grid->size(grid->maxLevel(), dim)); + *state = 0.0; auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( grid->size(grid->maxLevel(), dim), parset, nodalIntegrals, -- GitLab