From f6bae5d27d8741df4b42be5a7e139fa461ed4307 Mon Sep 17 00:00:00 2001
From: Jonathan Youett <youett@mi.fu-berlin.de>
Date: Fri, 30 Sep 2011 15:46:18 +0000
Subject: [PATCH] make writer scale with rod radius

[[Imported from SVN: r7856]]
---
 dune/gfe/rodwriter.hh | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/dune/gfe/rodwriter.hh b/dune/gfe/rodwriter.hh
index 05a3838a..29c1772a 100644
--- a/dune/gfe/rodwriter.hh
+++ b/dune/gfe/rodwriter.hh
@@ -6,6 +6,7 @@
 #include <ctime>
 
 #include <dune/common/exceptions.hh>
+#include <dune/common/fvector.hh>
 #include <dune/istl/bvector.hh>
 #include <dune/solvers/common/numproc.hh>
 
@@ -124,7 +125,8 @@ void writeRod(const std::vector<RigidBodyMotion<2> >& rod,
 /** \brief Write a spatial rod
  */
 void writeRod(const std::vector<RigidBodyMotion<3> >& rod, 
-              const std::string& filename)
+              const std::string& filename,
+              double radius = 1.0)
 {
     int nPoints = rod.size();
 
@@ -169,20 +171,24 @@ void writeRod(const std::vector<RigidBodyMotion<3> >& rod,
     // ///////////////////////////////////////
     outfile << std::endl << "@2" << std::endl;
 
-    for (size_t i=0; i<rod.size(); i++) 
-        outfile << rod[i].q.director(0) << std::endl;
+    for (size_t i=0; i<rod.size(); i++) {
+        Dune::FieldVector<double,3> dir = rod[i].q.director(0);
+        dir *= radius; 
+        outfile << dir << std::endl;
+    }
 
     outfile << std::endl << "@3" << std::endl;
 
-    for (size_t i=0; i<rod.size(); i++) 
-        outfile << rod[i].q.director(1) << std::endl;
-
+    for (size_t i=0; i<rod.size(); i++) {
+        Dune::FieldVector<double,3> dir = rod[i].q.director(1);
+        dir *= radius; 
+        outfile << dir << std::endl;
+    }
 
     std::cout << "Result written successfully to: " << filename << std::endl;
 
 }
 
-
 /** \brief Write a spatial rod along with a strain or stress field
  */
 void writeRodElementData(Dune::BlockVector<Dune::FieldVector<double, 1> >& data,
-- 
GitLab