From 5affcea41fb221324a8369c7f1e1233b474e2bc4 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Thu, 11 Aug 2011 12:49:13 +0000
Subject: [PATCH] change std::vector to Dune::array to adapt to changes in the
 local assembler base class

[[Imported from SVN: r7574]]
---
 dune/gfe/rodassembler.cc      |  4 ++--
 dune/gfe/rodlocalstiffness.hh | 11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dune/gfe/rodassembler.cc b/dune/gfe/rodassembler.cc
index 9af57e40..dc356b2e 100644
--- a/dune/gfe/rodassembler.cc
+++ b/dune/gfe/rodassembler.cc
@@ -33,10 +33,10 @@ assembleGradient(const std::vector<RigidBodyMotion<3> >& sol,
     for (; it!=endIt; ++it) {
 
         // A 1d grid has two vertices
-        const int nDofs = 2;
+        static const int nDofs = 2;
 
         // Extract local solution
-        std::vector<RigidBodyMotion<3> > localSolution(nDofs);
+        Dune::array<RigidBodyMotion<3>, nDofs> localSolution;
         
         for (int i=0; i<nDofs; i++)
             localSolution[i] = sol[indexSet.subIndex(*it,i,gridDim)];
diff --git a/dune/gfe/rodlocalstiffness.hh b/dune/gfe/rodlocalstiffness.hh
index f0dfc6ae..ac64fff6 100644
--- a/dune/gfe/rodlocalstiffness.hh
+++ b/dune/gfe/rodlocalstiffness.hh
@@ -96,7 +96,7 @@ public:
     }
     
     virtual RT energy (const Entity& e,
-                       const std::vector<RigidBodyMotion<3> >& localSolution) const;
+                       const Dune::array<RigidBodyMotion<3>, dim+1>& localSolution) const;
 
     /** \brief Assemble the element gradient of the energy functional */
     void assembleGradient(const Entity& element,
@@ -142,7 +142,7 @@ protected:
 template <class GridType, class RT>
 RT RodLocalStiffness<GridType, RT>::
 energy(const Entity& element,
-       const std::vector<RigidBodyMotion<3> >& localSolution
+       const Dune::array<RigidBodyMotion<3>, dim+1>& localSolution
        ) const
 {
     RT energy = 0;
@@ -159,6 +159,9 @@ energy(const Entity& element,
     const Dune::QuadratureRule<double, 1>& shearingQuad 
         = Dune::QuadratureRules<double, 1>::rule(element.type(), shearQuadOrder);
     
+    // hack: convert from std::array to std::vector
+    std::vector<RigidBodyMotion<3> > localSolutionVector(localSolution.begin(), localSolution.end());
+
     for (size_t pt=0; pt<shearingQuad.size(); pt++) {
         
         // Local position of the quadrature point
@@ -168,7 +171,7 @@ energy(const Entity& element,
         
         double weight = shearingQuad[pt].weight() * integrationElement;
         
-        Dune::FieldVector<double,6> strain = getStrain(localSolution, element, quadPos);
+        Dune::FieldVector<double,6> strain = getStrain(localSolutionVector, element, quadPos);
         
         // The reference strain
         Dune::FieldVector<double,6> referenceStrain = getStrain(localReferenceConfiguration, element, quadPos);
@@ -189,7 +192,7 @@ energy(const Entity& element,
         
         double weight = bendingQuad[pt].weight() * element.geometry().integrationElement(quadPos);
         
-        Dune::FieldVector<double,6> strain = getStrain(localSolution, element, quadPos);
+        Dune::FieldVector<double,6> strain = getStrain(localSolutionVector, element, quadPos);
         
         // The reference strain
         Dune::FieldVector<double,6> referenceStrain = getStrain(localReferenceConfiguration, element, quadPos);
-- 
GitLab