From 50d02c5e1ac08bae03f87be690e399cdef7bef2d Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 14 Jan 2011 11:07:34 +0000 Subject: [PATCH] Method 'makeStraightRod' works for non-uniform grids and is a non-static method now [[Imported from SVN: r6749]] --- dirneucoupling.cc | 3 ++- dune/gfe/rodfactory.hh | 14 +++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dirneucoupling.cc b/dirneucoupling.cc index e4eb0ce2..bc535e91 100644 --- a/dirneucoupling.cc +++ b/dirneucoupling.cc @@ -153,7 +153,8 @@ int main (int argc, char *argv[]) try // Initial solution // ////////////////////////// - RodFactory<RodGridType::LeafGridView>::makeStraightRod(rodX, complex.rodGrids_["rod"]->size(1), rodRestEndPoint[0], rodRestEndPoint[1]); + RodFactory<RodGridType::LeafGridView> rodFactory(complex.rodGrids_["rod"]->leafView()); + rodFactory.create(rodX, rodRestEndPoint[0], rodRestEndPoint[1]); // ///////////////////////////////////////// // Read Dirichlet values diff --git a/dune/gfe/rodfactory.hh b/dune/gfe/rodfactory.hh index bfec8836..8f450ad6 100644 --- a/dune/gfe/rodfactory.hh +++ b/dune/gfe/rodfactory.hh @@ -28,7 +28,7 @@ public: \param[in] n The number of vertices */ template <int dim> - static void makeStraightRod(std::vector<RigidBodyMotion<dim> >& rod, int n, + void create(std::vector<RigidBodyMotion<dim> >& rod, const Dune::FieldVector<double,3>& beginning, const Dune::FieldVector<double,3>& end) { // Compute the correct orientation @@ -48,16 +48,8 @@ template <int dim> if (angle != 0) orientation = Rotation<3,double>(axis, angle); - // Set the values - rod.resize(n); - for (int i=0; i<n; i++) { - - rod[i].r = beginning; - rod[i].r.axpy(double(i) / (n-1), end-beginning); - rod[i].q = orientation; - - } - + // Set the values + create(rod, RigidBodyMotion<dim>(beginning,orientation), RigidBodyMotion<dim>(end,orientation)); } -- GitLab