From 2ab958ada0c2559a7ce45f57671a1ae2cf186fe7 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sun, 11 Mar 2012 17:23:45 +0100 Subject: [PATCH] Define finestSize --- src/one-body-sample.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 724de7ad..4812c267 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -157,6 +157,7 @@ int main(int argc, char *argv[]) { Dune::FieldVector<bool, dim>(false), // non-periodic in each direction 0); // zero overlap (whatever that is) grid->globalRefine(refinements); + size_t const finestSize = grid->size(grid->maxLevel(), dim); typedef GridType::LeafGridView GridView; GridView const leafView = grid->leafView(); @@ -196,29 +197,27 @@ int main(int argc, char *argv[]) { GenericNonlinearGS<MyBlockProblemType> nonlinearGSStep; nonlinearGSStep.ignoreNodes_ = &ignoreNodes; - VectorType u1(grid->size(grid->maxLevel(), dim)); + VectorType u1(finestSize); u1 = 0.0; // Has to be zero! VectorType u2 = u1; VectorType u3 = u1; VectorType u4 = u1; VectorType u5 = u1; - SingletonVectorType s4_old(grid->size(grid->maxLevel(), dim)); - SingletonVectorType s5_old(grid->size(grid->maxLevel(), dim)); + SingletonVectorType s4_old(finestSize); + SingletonVectorType s5_old(finestSize); s4_old = parset.get<double>("boundary.friction.state.initial"); s5_old = s4_old; - VectorType u1_diff(grid->size(grid->maxLevel(), dim)); + VectorType u1_diff(finestSize); u1_diff = 0.0; // Has to be zero! VectorType u2_diff = u1_diff; VectorType u3_diff = u1_diff; VectorType u4_diff = u1_diff; VectorType u5_diff = u1_diff; - auto s4_new = Dune::make_shared<SingletonVectorType>( - grid->size(grid->maxLevel(), dim)); - auto s5_new = Dune::make_shared<SingletonVectorType>( - grid->size(grid->maxLevel(), dim)); + auto s4_new = Dune::make_shared<SingletonVectorType>(finestSize); + auto s5_new = Dune::make_shared<SingletonVectorType>(finestSize); *s4_new = s4_old; *s5_new = *s4_new; @@ -305,12 +304,11 @@ int main(int argc, char *argv[]) { if (parset.get<bool>("solver.nonlineargs.use")) { auto state = Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>( - grid->size(grid->maxLevel(), dim)); + finestSize); *state = 0.0; auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( - grid->size(grid->maxLevel(), dim), parset, nodalIntegrals, - state, h); + finestSize, parset, nodalIntegrals, state, h); MyConvexProblemType const myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b1); MyBlockProblemType myBlockProblem(parset, myConvexProblem); @@ -331,8 +329,7 @@ int main(int argc, char *argv[]) { ++state_fpi) { auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( - grid->size(grid->maxLevel(), dim), parset, nodalIntegrals, - s4_new, h); + finestSize, parset, nodalIntegrals, s4_new, h); MyConvexProblemType const myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b4); @@ -404,8 +401,7 @@ int main(int argc, char *argv[]) { ++state_fpi) { auto myGlobalNonlinearity = assemble_nonlinearity<VectorType, OperatorType>( - grid->size(grid->maxLevel(), dim), parset, nodalIntegrals, - s5_new, h); + finestSize, parset, nodalIntegrals, s5_new, h); MyConvexProblemType const myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b5); -- GitLab