diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 050c1e5624a4b931c86cf4bcee7d777673e7592c..95c0f05e26b4745bd443ee6215f5e5f87876d564 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,