From 9366d07820e82a26da0f86dd6de5f50a6578a83c Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sat, 25 Feb 2012 20:39:21 +0100 Subject: [PATCH] Introduce SingletonVectorType --- src/one-body-sample.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 1beff467..555ae15e 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -132,14 +132,13 @@ template <class GridType, class GridView, class LocalVectorType, class FEBasis> Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> assemble_frictional(GridView const &gridView, FEBasis const &feBasis, Dune::BitSetVector<1> const &frictionalNodes) { + typedef Dune::FieldVector<double, 1> Singleton; BoundaryPatch<GridView> frictionalBoundary(gridView, frictionalNodes); - ConstantFunction<LocalVectorType, Dune::FieldVector<double, 1>> - constantOneFunction(1); - NeumannBoundaryAssembler<GridType, Dune::FieldVector<double, 1>> - frictionalBoundaryAssembler(constantOneFunction); + ConstantFunction<LocalVectorType, Singleton> constantOneFunction(1); + NeumannBoundaryAssembler<GridType, Singleton> frictionalBoundaryAssembler( + constantOneFunction); - auto nodalIntegrals = - Dune::make_shared<Dune::BlockVector<Dune::FieldVector<double, 1>>>(); + auto nodalIntegrals = Dune::make_shared<Dune::BlockVector<Singleton>>(); BoundaryFunctionalAssembler<FEBasis>(feBasis, frictionalBoundary) .assemble(frictionalBoundaryAssembler, *nodalIntegrals, true); // resize and zero output vector @@ -155,7 +154,6 @@ assemble_nonlinearity( Dune::shared_ptr<Dune::BlockVector<Dune::FieldVector<double, 1>>> state, double h) { typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType; - // {{{ Assemble terms for the nonlinearity auto mu = Dune::make_shared<SingletonVectorType>(size); *mu = parset.get<double>("boundary.friction.mu"); @@ -232,7 +230,7 @@ int main(int argc, char *argv[]) { 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; + typedef Dune::BlockVector<Dune::FieldVector<double, 1>> SingletonVectorType; auto const E = parset.get<double>("body.E"); auto const nu = parset.get<double>("body.nu"); @@ -314,7 +312,7 @@ int main(int argc, char *argv[]) { grid->size(grid->maxLevel(), dim)); *s4_new = s4_old; - CellVectorType vonMisesStress; + SingletonVectorType vonMisesStress; VectorType b1; VectorType b2; @@ -478,7 +476,7 @@ int main(int argc, char *argv[]) { Dune::make_shared<VTKBasisGridFunction<P1Basis, VectorType> const>( p1Basis, u4, "displacement"); auto const vonmises_ptr = Dune::make_shared< - VTKBasisGridFunction<P0Basis, CellVectorType> const>( + VTKBasisGridFunction<P0Basis, SingletonVectorType> const>( p0Basis, vonMisesStress, "stress"); Dune::VTKWriter<GridView> writer(leafView); writer.addVertexData(displacement_ptr); -- GitLab