diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 562c4cb7a96d3ac5dbe85616c88412fe9455fb9a..3501cda8b9ccb140a40ac611ec2b7466a998c34d 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -162,20 +162,17 @@ int main() { 0); // zero overlap (whatever that is) grid.globalRefine(refinements); + // Set up nodal basis typedef P1NodalBasis<GridType::LeafGridView, double> P1Basis; P1Basis const p1Basis(grid.leafView()); - OperatorAssembler<P1Basis, P1Basis> const globalAssembler(p1Basis, p1Basis); - + // Assemble elastic force on the body StVenantKirchhoffAssembler<GridType, P1Basis::LocalFiniteElement, P1Basis::LocalFiniteElement> const localStiffness(E, nu); - OperatorType stiffnessMatrix; - globalAssembler.assemble(localStiffness, stiffnessMatrix); - - // Filled in some block - VectorType f(grid.size(grid.maxLevel(), dim)); + OperatorAssembler<P1Basis, P1Basis>(p1Basis, p1Basis) + .assemble(localStiffness, stiffnessMatrix); Dune::BitSetVector<dim> ignoreNodes(grid.size(grid.maxLevel(), dim), false); Dune::BitSetVector<1> neumannNodes(grid.size(grid.maxLevel(), dim), false); @@ -198,6 +195,7 @@ int main() { normalStress.resize(grid.size(grid.maxLevel(), dim)); std::fill(normalStress.begin(), normalStress.end(), 0.0); + VectorType f(grid.size(grid.maxLevel(), dim)); assemble_neumann<GridType, SmallVector, P1Basis>(grid, p1Basis, neumannNodes, f);