From 3a509a9d22179c1dd8a931de5a96fc637650177a Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Tue, 19 Jan 2016 09:27:56 +0100
Subject: [PATCH] Write the simulation result in raw binary format

This data is used by the compute-disc-error program to measure discretization errors.
---
 src/cosserat-continuum.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc
index c06be327..af7da69d 100644
--- a/src/cosserat-continuum.cc
+++ b/src/cosserat-continuum.cc
@@ -342,6 +342,16 @@ int main (int argc, char *argv[]) try
     //   Output result
     // //////////////////////////////
 
+    // Write the corresponding coefficient vector: verbatim in binary, to be completely lossless
+    // This data may be used by other applications measuring the discretization error
+    BlockVector<TargetSpace::CoordinateType> xEmbedded(x.size());
+    for (size_t i=0; i<x.size(); i++)
+      xEmbedded[i] = x[i].globalCoordinates();
+
+    std::ofstream outFile("cosserat-continuum-result-" + std::to_string(numLevels) + ".data", std::ios_base::binary);
+    GenericVector::writeBinary(outFile, xEmbedded);
+    outFile.close();
+
     // finally: compute the average deformation of the Neumann boundary
     // That is what we need for the locking tests
     FieldVector<double,3> averageDef(0);
-- 
GitLab