From 6c4e05a1cf42bef84dafd5c83e4c5eb01dfe6a37 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Wed, 13 May 2015 16:28:57 +0200
Subject: [PATCH] Make writing the result for embedding spaces of any dimension

---
 src/harmonicmaps.cc | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/harmonicmaps.cc b/src/harmonicmaps.cc
index 0632cc3a..bc7a3636 100644
--- a/src/harmonicmaps.cc
+++ b/src/harmonicmaps.cc
@@ -244,19 +244,16 @@ int main (int argc, char *argv[]) try
     //   Output result
     // //////////////////////////////
 
-    typedef BlockVector<FieldVector<double,3> > EmbeddedVectorType;
+    typedef BlockVector<TargetSpace::CoordinateType> EmbeddedVectorType;
     EmbeddedVectorType xEmbedded(x.size());
-    for (size_t i=0; i<x.size(); i++) {
-        xEmbedded[i][0] = x[i].globalCoordinates()[0];
-        xEmbedded[i][1] = x[i].globalCoordinates()[1];
-        xEmbedded[i][2] = x[i].globalCoordinates()[2];
-    }
+    for (size_t i=0; i<x.size(); i++)
+        xEmbedded[i] = x[i].globalCoordinates();
 
     Dune::Functions::DiscreteScalarGlobalBasisFunction<decltype(feBasis),decltype(xEmbedded)> xFunction(feBasis,xEmbedded);
     auto localXFunction = localFunction(xFunction);
 
     VTKWriter<GridType::LeafGridView> vtkWriter(grid->leafGridView());
-    vtkWriter.addVertexData(localXFunction, VTK::FieldInfo("orientation", VTK::FieldInfo::Type::vector, 3));
+    vtkWriter.addVertexData(localXFunction, VTK::FieldInfo("orientation", VTK::FieldInfo::Type::scalar, xEmbedded[0].size()));
     vtkWriter.write(resultPath + "_" + energy + "_result");
 
     /////////////////////////////////////////////////////////////////
-- 
GitLab