From c852d7a1d724c63a3336510b81c06df284dfcfa2 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Wed, 9 Nov 2011 13:52:10 +0100 Subject: [PATCH] Move typedef and declaration out of the loop Also do not initialise vonMisesStress needlessly --- src/one-body-sample.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 3cfb2892..60561cc3 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -132,6 +132,7 @@ int main() { typedef Dune::FieldMatrix<double, dim, dim> SmallMatrix; typedef Dune::BCRSMatrix<SmallMatrix> OperatorType; typedef Dune::BlockVector<SmallVector> VectorType; + typedef Dune::BlockVector<Dune::FieldVector<double, 1>> CellVectorType; // FIXME: Random values size_t const runs = 1000; @@ -187,6 +188,7 @@ int main() { VectorType u1(grid.size(grid.maxLevel(), dim)); u1 = 0; VectorType u2 = u1; + CellVectorType vonMisesStress; VectorType b1(grid.size(grid.maxLevel(), dim)); VectorType b2(grid.size(grid.maxLevel(), dim)); @@ -234,9 +236,6 @@ int main() { solver.solve(); } - typedef Dune::BlockVector<Dune::FieldVector<double, 1>> CellVectorType; - - CellVectorType vonMisesStress(grid.size(grid.maxLevel(), dim - 1)); auto *displacement = new BasisGridFunction<P1Basis, VectorType>(p1Basis, u1); VonMisesStressAssembler<GridType> localStressAssembler(E, nu, -- GitLab