[yoda-svn] r498 - in trunk: . include/YODA src tests

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Jul 12 18:08:44 BST 2012


Author: buckley
Date: Thu Jul 12 18:08:44 2012
New Revision: 498

Log:
Supporting Histo2D in WriterYODA, and other tweaks.

Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/include/YODA/Histo2D.h
   trunk/include/YODA/Writer.h
   trunk/include/YODA/WriterAIDA.h
   trunk/include/YODA/WriterYODA.h
   trunk/src/Histo2D.cc
   trunk/src/Writer.cc
   trunk/src/WriterAIDA.cc
   trunk/src/WriterYODA.cc
   trunk/tests/Makefile.am
   trunk/tests/TestHisto1Da.cc
   trunk/tests/TestHisto2Da.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/ChangeLog	Thu Jul 12 18:08:44 2012	(r498)
@@ -1,3 +1,7 @@
+2012-07-12  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Supporting Histo2D in WriterYODA.
+
 2012-07-02  Andy Buckley  <andy.buckley at cern.ch>
 
 	* More incremental progress toward a working 2D bin hash mechanism.

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/TODO	Thu Jul 12 18:08:44 2012	(r498)
@@ -6,11 +6,17 @@
 * Add Axis1D/2D _locked member -> true on first fill. (AB)
    Done for Axis1D: is it a good idea?
 
+* Write / support comments on ends of YODA format data lines
+   Ignore anything after "#" on data lines -- use this to write convenience
+   height & error info for each bin since not obvious from sumWX2 etc.
+
 * Add nice constructor behaviour and docstrings to the Scatter2D Python interface. (AB)
 
 * Remove nasty Cython shims (DM)
+   Does inheritance work automatically in Cython now?
 
 * Complete basic Histo2D and Profile2D functionality. (AB)
+   Axis2D is working
 
 * Make Python interface test scripts (DM)
 
@@ -23,6 +29,9 @@
 
 NEXT
 
+* Add "official" counter and bar-chart types (AB)
+   Need better names!
+
 * Add a merge() method in Bin2D. Add a constructor that takes Dbns.
 
 * Rebinning: global rebinning of Axis2D -> Histo2D by integer factor(s) --
@@ -30,11 +39,6 @@
 
 * Automatically determine input and output formats (= readers/writers) from file extn.
 
-* Test that a y-binned Histo2D has the same per-y-column stats as an
-  equivalently x-binned Profile1D. Perhaps use this as an opportunity to
-  implement one of the the conversion functions mentioned in the NEXT
-  section...
-
 * Test negative- and mixed-weighted stat calculations, and scaling.
 
 * Test gap handling on 1D and 2D axes.

Modified: trunk/include/YODA/Histo2D.h
==============================================================================
--- trunk/include/YODA/Histo2D.h	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/include/YODA/Histo2D.h	Thu Jul 12 18:08:44 2012	(r498)
@@ -292,7 +292,6 @@
     //@{
 
     /// Get the total volume of the histogram
-    // @todo This does not work!! (AB: Explain what you mean!)
     double integral(bool includeoverflows=true) const {
       return sumW(includeoverflows);
     }

Modified: trunk/include/YODA/Writer.h
==============================================================================
--- trunk/include/YODA/Writer.h	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/include/YODA/Writer.h	Thu Jul 12 18:08:44 2012	(r498)
@@ -7,9 +7,12 @@
 #define YODA_Writer_h
 
 #include "YODA/AnalysisObject.h"
+#include "YODA/Plot.h"
 #include "YODA/Histo1D.h"
+#include "YODA/Histo2D.h"
 #include "YODA/Profile1D.h"
 #include "YODA/Scatter2D.h"
+
 #include <string>
 #include <fstream>
 
@@ -110,18 +113,30 @@
     //@}
 
 
+    /// Set precision of numerical quantities in this writer's output.
+    void setPrecision(int precision) {
+      _precision = precision;
+    }
+
+
   protected:
 
     /// Main writer elements
     virtual void writeHeader(std::ostream& stream) = 0;
-    void writeBody(std::ostream& stream, const AnalysisObject& ao);
+    virtual void writeBody(std::ostream& stream, const AnalysisObject& ao);
     virtual void writeFooter(std::ostream& stream) = 0;
 
     /// Specific AO type writer implementations
+    virtual void writePlot(std::ostream& os, const Plot& h) = 0;
     virtual void writeHisto1D(std::ostream& os, const Histo1D& h) = 0;
+    virtual void writeHisto2D(std::ostream& os, const Histo2D& h) = 0;
     virtual void writeProfile1D(std::ostream& os, const Profile1D& p) = 0;
+    // virtual void writeProfile2D(std::ostream& os, const Profile2D& p) = 0;
     virtual void writeScatter2D(std::ostream& os, const Scatter2D& s) = 0;
-    //virtual void writeScatter3D(std::ostream& os, const Scatter3D& s) = 0;
+    // virtual void writeScatter3D(std::ostream& os, const Scatter3D& s) = 0;
+
+    /// Output precision
+    int _precision;
 
   };
 

Modified: trunk/include/YODA/WriterAIDA.h
==============================================================================
--- trunk/include/YODA/WriterAIDA.h	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/include/YODA/WriterAIDA.h	Thu Jul 12 18:08:44 2012	(r498)
@@ -23,6 +23,7 @@
     /// Singleton creation function
     static Writer& create() {
       static WriterAIDA _instance;
+      _instance.setPrecision(6);
       return _instance;
     }
 
@@ -36,7 +37,9 @@
     void writeHeader(std::ostream& stream);
     void writeFooter(std::ostream& stream);
 
+    void writePlot(std::ostream& os, const Plot& p);
     void writeHisto1D(std::ostream& os, const Histo1D& h);
+    void writeHisto2D(std::ostream& os, const Histo2D& h);
     void writeProfile1D(std::ostream& os, const Profile1D& p);
     void writeScatter2D(std::ostream& os, const Scatter2D& s);
 

Modified: trunk/include/YODA/WriterYODA.h
==============================================================================
--- trunk/include/YODA/WriterYODA.h	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/include/YODA/WriterYODA.h	Thu Jul 12 18:08:44 2012	(r498)
@@ -24,6 +24,7 @@
     /// Singleton creation function
     static Writer& create() {
       static WriterYODA _instance;
+      _instance.setPrecision(6);
       return _instance;
     }
 
@@ -37,13 +38,18 @@
     void writeHeader(std::ostream& stream);
     void writeFooter(std::ostream& stream);
 
+    void writePlot(std::ostream& stream, const Plot& p);
     void writeHisto1D(std::ostream& stream, const Histo1D& h);
+    void writeHisto2D(std::ostream& stream, const Histo2D& h);
     void writeProfile1D(std::ostream& stream, const Profile1D& p);
     void writeScatter2D(std::ostream& stream, const Scatter2D& s);
     //void writeScatter3D(std::ostream& stream, const Scatter3D& s);
 
+
   private:
 
+    void _writeAnnotations(std::ostream& os, const AnalysisObject& ao);
+
     /// Private since it's a singleton.
     WriterYODA() { }
 

Modified: trunk/src/Histo2D.cc
==============================================================================
--- trunk/src/Histo2D.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/src/Histo2D.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -31,6 +31,7 @@
       if (y <  _axis.yMin()) iy = -1; else if (y >= _axis.yMax()) iy = 1;
       _axis.outflow(ix, iy).fill(x, y, weight);
     }
+    /// @todo Re-enable
     // // Lock the axis now that a fill has happened
     // _axis._setLock(true);
   }
@@ -39,7 +40,7 @@
   double Histo2D::sumW(bool includeoverflows) const {
     if (includeoverflows) return _axis.totalDbn().sumW();
     double sumw = 0;
-    for(size_t i = 0; i < bins().size(); ++i) sumw += bin(i).sumW();
+    foreach (const HistoBin2D& b, bins()) sumw += b.sumW();
     return sumw;
   }
 
@@ -47,7 +48,7 @@
   double Histo2D::sumW2(bool includeoverflows) const {
     if (includeoverflows) return _axis.totalDbn().sumW2();
     double sumw2 = 0;
-    for(size_t i = 0; i < bins().size(); ++i) sumw2+= bin(i).sumW2();
+    foreach (const HistoBin2D& b, bins()) sumw2 += b.sumW2();
     return sumw2;
   }
 
@@ -55,24 +56,16 @@
   double Histo2D::xMean(bool includeoverflows) const {
     if (includeoverflows) return _axis.totalDbn().xMean();
     double sumwx = 0;
-    double sumw  = 0;
-    for(size_t i = 0; i < bins().size(); ++i) {
-      sumwx += bin(i).sumW2();
-      sumw  += bin(i).sumW();
-    }
-    return sumwx/sumw;
+    foreach (const HistoBin2D& b, bins()) sumwx += b.sumWX();
+    return sumwx/sumW();
   }
 
 
   double Histo2D::yMean(bool includeoverflows) const {
     if (includeoverflows) return _axis.totalDbn().yMean();
     double sumwy = 0;
-    double sumw = 0;
-    for(size_t i = 0; i < bins().size(); ++i) {
-      sumwy += bin(i).sumWY();
-      sumw  += bin(i).sumW();
-    }
-    return sumwy/sumw;
+    foreach (const HistoBin2D& b, bins()) sumwy += b.sumWY();
+    return sumwy/sumW();
   }
 
 
@@ -80,7 +73,7 @@
     if (includeoverflows) return _axis.totalDbn().xVariance();
     double sigma2 = 0;
     const double xMean = this->xMean();
-    for(size_t i = 0; i < bins().size(); ++i) {
+    for (size_t i = 0; i < bins().size(); ++i) {
       const double diff = bin(i).focus().first - xMean;
       sigma2 += diff * diff * bin(i).sumW();
     }
@@ -92,7 +85,7 @@
     if (includeoverflows) return _axis.totalDbn().yVariance();
     double sigma2 = 0;
     const double yMean = this->yMean();
-    for(size_t i = 0; i < bins().size(); ++i) {
+    for (size_t i = 0; i < bins().size(); ++i) {
       const double diff = bin(i).focus().first - yMean;
       sigma2 += diff * diff * bin(i).sumW();
     }

Modified: trunk/src/Writer.cc
==============================================================================
--- trunk/src/Writer.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/src/Writer.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -31,12 +31,20 @@
 
   void Writer::writeBody(std::ostream& stream, const AnalysisObject& ao) {
     const string aotype = ao.type();
-    if (aotype == "Histo1D") {
+    if (aotype == "Plot") {
+      writePlot(stream, dynamic_cast<const Plot&>(ao));
+    } else if (aotype == "Histo1D") {
       writeHisto1D(stream, dynamic_cast<const Histo1D&>(ao));
+    } else if (aotype == "Histo2D") {
+      writeHisto2D(stream, dynamic_cast<const Histo2D&>(ao));
     } else if (aotype == "Profile1D") {
       writeProfile1D(stream, dynamic_cast<const Profile1D&>(ao));
+    // } else if (aotype == "Profile2D") {
+    //   writeProfile2D(stream, dynamic_cast<const Profile2D&>(ao));
     } else if (aotype == "Scatter2D") {
       writeScatter2D(stream, dynamic_cast<const Scatter2D&>(ao));
+    // } else if (aotype == "Scatter3D") {
+    //   writeScatter3D(stream, dynamic_cast<const Scatter3D&>(ao));
     } else {
       ostringstream oss;
       oss << "Unrecognised analysis object type " << aotype << " in Writer::write";

Modified: trunk/src/WriterAIDA.cc
==============================================================================
--- trunk/src/WriterAIDA.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/src/WriterAIDA.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -6,6 +6,12 @@
 #include "YODA/WriterAIDA.h"
 #include "YODA/Utils/StringUtils.h"
 
+#include "YODA/Plot.h"
+#include "YODA/Histo1D.h"
+#include "YODA/Histo2D.h"
+#include "YODA/Profile1D.h"
+#include "YODA/Scatter2D.h"
+
 #include <iostream>
 #include <iomanip>
 
@@ -27,6 +33,11 @@
   }
 
 
+  void WriterAIDA::writePlot(std::ostream& os, const Plot& p) {
+    os << flush;
+  }
+
+
   void WriterAIDA::writeHisto1D(std::ostream& os, const Histo1D& h) {
     Scatter2D tmp = mkScatter(h);
     tmp.setAnnotation("Type", "Histo1D");
@@ -34,6 +45,14 @@
   }
 
 
+  void WriterAIDA::writeHisto2D(std::ostream& os, const Histo2D& h) {
+    os << endl << "<!-- HISTO2D WRITING TO AIDA IS CURRENTLY UNSUPPORTED! -->" << endl << endl;
+    // Scatter3D tmp = mkScatter(h);
+    // tmp.setAnnotation("Type", "Histo2D");
+    // writeScatter3D(os, tmp);
+  }
+
+
   void WriterAIDA::writeProfile1D(std::ostream& os, const Profile1D& p) {
     Scatter2D tmp = mkScatter(p);
     tmp.setAnnotation("Type", "Profile1D");

Modified: trunk/src/WriterYODA.cc
==============================================================================
--- trunk/src/WriterYODA.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/src/WriterYODA.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -5,6 +5,12 @@
 //
 #include "YODA/WriterYODA.h"
 
+#include "YODA/Plot.h"
+#include "YODA/Histo1D.h"
+#include "YODA/Histo2D.h"
+#include "YODA/Profile1D.h"
+#include "YODA/Scatter2D.h"
+
 #include <iostream>
 #include <iomanip>
 
@@ -14,11 +20,7 @@
 
 
   void WriterYODA::writeHeader(std::ostream& os) {
-    // os <<
-    //   "# BEGIN PLOT\n"
-    //   "LogY=0\n"
-    //   "Title=Test Histo\n"
-    //   "# END PLOT\n\n";
+    os << flush;
   }
 
 
@@ -27,9 +29,8 @@
   }
 
 
-  void _writeAnnotations(std::ostream& os, const AnalysisObject& ao) {
-    // os << "Path=" << h.path() << "\n";
-    // os << "Title=" << h.title() << "\n";
+  void WriterYODA::_writeAnnotations(std::ostream& os, const AnalysisObject& ao) {
+    os << scientific << showpoint << setprecision(_precision);
     typedef pair<string,string> sspair;
     foreach (const sspair& kv, ao.annotations()) {
       os << kv.first << "=" << kv.second << "\n";
@@ -37,10 +38,14 @@
   }
 
 
+  void WriterYODA::writePlot(std::ostream& os, const Plot& p) {
+    _writeAnnotations(os, p);
+  }
+
+
   void WriterYODA::writeHisto1D(std::ostream& os, const Histo1D& h) {
     ios_base::fmtflags oldflags = os.flags();
-    const int precision = 6;
-    os << scientific << showpoint << setprecision(precision);
+    os << scientific << showpoint << setprecision(_precision);
 
     os << "# BEGIN YODA_HISTO1D " << h.path() << "\n";
     _writeAnnotations(os, h);
@@ -60,11 +65,11 @@
     os << h.overflow().sumW()  << "\t" << h.overflow().sumW2()  << "\t";
     os << h.overflow().sumWX() << "\t" << h.overflow().sumWX2() << "\t";
     os << h.overflow().numEntries() << "\n";
-    for (vector<HistoBin1D>::const_iterator b = h.bins().begin(); b != h.bins().end(); ++b) {
-      os << b->lowEdge() << "\t" << b->highEdge() << "\t";
-      os << b->sumW()    << "\t" << b->sumW2()    << "\t";
-      os << b->sumWX()   << "\t" << b->sumWX2()   << "\t";
-      os << b->numEntries() << "\n";
+    foreach (const HistoBin1D& b, h.bins()) {
+      os << b.lowEdge() << "\t" << b.highEdge() << "\t";
+      os << b.sumW()    << "\t" << b.sumW2()    << "\t";
+      os << b.sumWX()   << "\t" << b.sumWX2()   << "\t";
+      os << b.numEntries() << "\n";
     }
     os << "# END YODA_HISTO1D\n\n";
 
@@ -72,10 +77,48 @@
   }
 
 
+  void WriterYODA::writeHisto2D(std::ostream& os, const Histo2D& h) {
+    ios_base::fmtflags oldflags = os.flags();
+    os << scientific << showpoint << setprecision(_precision);
+
+    os << "# BEGIN YODA_HISTO2D " << h.path() << "\n";
+    _writeAnnotations(os, h);
+    if ( h.totalDbn().numEntries() > 0 )
+      os << "# Mean: (" << h.xMean() << ", " << h.yMean() << ")\n";
+    os << "# Area: " << h.integral() << "\n";
+    os << "# xlow\t xhigh\t ylow\t yhigh\t sumw\t sumw2\t sumwx\t sumwx2\t sumwy\t sumwy2\t numEntries\n";
+    os << "Total   \tTotal   \t";
+    os << h.totalDbn().sumW()  << "\t" << h.totalDbn().sumW2()  << "\t";
+    os << h.totalDbn().sumWX() << "\t" << h.totalDbn().sumWX2() << "\t";
+    os << h.totalDbn().sumWY() << "\t" << h.totalDbn().sumWY2() << "\t";
+    os << h.totalDbn().numEntries() << "\n";
+    for (size_t ix = -1; ix <= 1; ++ix) {
+      for (size_t iy = -1; ix <= 1; ++ix) {
+        os << "Outflow\t" << ix << ":" << iy << "\t";
+        const Dbn2D& d = h.outflow(ix, iy);
+        os << d.sumW()  << "\t" << d.sumW2()  << "\t";
+        os << d.sumWX() << "\t" << d.sumWX2() << "\t";
+        os << d.sumWY() << "\t" << d.sumWY2() << "\t";
+        os << d.numEntries() << "\n";
+      }
+    }
+    foreach (const HistoBin2D& b, h.bins()) {
+      os << b.lowEdgeX() << "\t" << b.highEdgeX() << "\t";
+      os << b.lowEdgeY() << "\t" << b.highEdgeY() << "\t";
+      os << b.sumW()    << "\t" << b.sumW2()    << "\t";
+      os << b.sumWX()   << "\t" << b.sumWX2()   << "\t";
+      os << b.sumWY()   << "\t" << b.sumWY2()   << "\t";
+      os << b.numEntries() << "\n";
+    }
+    os << "# END YODA_HISTO2D\n\n";
+
+    os.flags(oldflags);
+  }
+
+
   void WriterYODA::writeProfile1D(std::ostream& os, const Profile1D& p) {
     ios_base::fmtflags oldflags = os.flags();
-    const int precision = 6;
-    os << scientific << showpoint << setprecision(precision);
+    os << scientific << showpoint << setprecision(_precision);
 
     os << "# BEGIN YODA_PROFILE1D " << p.path() << "\n";
     _writeAnnotations(os, p);
@@ -95,12 +138,12 @@
     os << p.overflow().sumWX() << "\t" << p.overflow().sumWX2() << "\t";
     os << p.overflow().sumWY() << "\t" << p.overflow().sumWY2() << "\t";
     os << p.overflow().numEntries() << "\n";
-    for (vector<ProfileBin1D>::const_iterator b = p.bins().begin(); b != p.bins().end(); ++b) {
-      os << b->lowEdge() << "\t" << b->highEdge() << "\t";
-      os << b->sumW()    << "\t" << b->sumW2()    << "\t";
-      os << b->sumWX()   << "\t" << b->sumWX2()   << "\t";
-      os << b->sumWY()   << "\t" << b->sumWY2()   << "\t";
-      os << b->numEntries() << "\n";
+    foreach (const ProfileBin1D& b, p.bins()) {
+      os << b.lowEdge() << "\t" << b.highEdge() << "\t";
+      os << b.sumW()    << "\t" << b.sumW2()    << "\t";
+      os << b.sumWX()   << "\t" << b.sumWX2()   << "\t";
+      os << b.sumWY()   << "\t" << b.sumWY2()   << "\t";
+      os << b.numEntries() << "\n";
     }
     os << "# END YODA_PROFILE1D\n\n";
 
@@ -110,8 +153,7 @@
 
   void WriterYODA::writeScatter2D(std::ostream& os, const Scatter2D& s) {
     ios_base::fmtflags oldflags = os.flags();
-    const int precision = 6;
-    os << scientific << showpoint << setprecision(precision);
+    os << scientific << showpoint << setprecision(_precision);
 
     os << "# BEGIN YODA_SCATTER2D " << s.path() << "\n";
     _writeAnnotations(os, s);
@@ -129,8 +171,7 @@
 
   /*void WriterYODA::writeScatter3D(std::ostream& os, const Scatter3D& s) {
     ios_base::fmtflags oldflags = os.flags();
-    const int precision = 6;
-    os << scientific << showpoint << setprecision(precision);
+    os << scientific << showpoint << setprecision(_precision);
 
     os << "# BEGIN YODA_SCATTER3D " << s.path() << "\n";
     _writeAnnotations(os, s);

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/tests/Makefile.am	Thu Jul 12 18:08:44 2012	(r498)
@@ -1,6 +1,7 @@
 check_PROGRAMS = \
   testweights \
   testhisto1Da testhisto1Db \
+  testhisto2Da \
   testprofile1Da \
   testindexedset testsortedvector\
   testhisto1Dcreate \
@@ -32,6 +33,7 @@
 testprofile1Dcreate_SOURCES = Profile1D/P1DCreate.cc
 testprofile1Dfill_SOURCES = Profile1D/P1DFill.cc
 testprofile1Dmodify_SOURCES = Profile1D/P1DModify.cc
+testhisto2Da_SOURCES = TestHisto2Da.cc
 # testhisto2De_SOURCES = TestHisto2Derase.cc
 testhisto2Dcreate_SOURCES = Histo2D/H2DCreate.cc
 testhisto2Dfill_SOURCES = Histo2D/H2DFill.cc
@@ -53,6 +55,7 @@
 TESTS = \
   testweights \
   testhisto1Da testhisto1Db \
+  testhisto2Da \
   testprofile1Da \
   testindexedset testsortedvector \
   testhisto1Dcreate \

Modified: trunk/tests/TestHisto1Da.cc
==============================================================================
--- trunk/tests/TestHisto1Da.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/tests/TestHisto1Da.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -6,6 +6,7 @@
 using namespace std;
 using namespace YODA;
 
+
 bool compareHeight(const HistoBin1D& a, const HistoBin1D& b) {
   return a.height() < b.height();
 }

Modified: trunk/tests/TestHisto2Da.cc
==============================================================================
--- trunk/tests/TestHisto2Da.cc	Thu Jul 12 16:13:28 2012	(r497)
+++ trunk/tests/TestHisto2Da.cc	Thu Jul 12 18:08:44 2012	(r498)
@@ -1,6 +1,7 @@
 
 #include "YODA/Histo2D.h"
 #include "YODA/Scatter3D.h"
+#include "YODA/WriterYODA.h"
 
 #include <cmath>
 #include <iostream>
@@ -34,9 +35,9 @@
 
 
 int main() {
- 
+
     cout << "-----------------------------" << endl;
-    // Addition/Subtraction:
+    // Addition/subtraction:
     cout << "Creating histos to be added/subtracted/divided:" << endl;
 
     Histo2D first(10, 0, 100, 10, 0, 100);
@@ -54,13 +55,17 @@
     Histo2D added(first+second);
     cout << "Addition? Copy constructor?" << endl;
     Histo2D subtracted(first-second);
-    cout << "Division crashes!" << endl;
-    Scatter3D divided(first/second);
+
+    // cout << "Division crashes!" << endl;
+    // Scatter3D divided(first/second);
 
     cout << "Done!" << endl;
     printStats(added);
     printStats(subtracted);
 
+    // Write to stdout
+    WriterYODA::write(cout, added);
+
     cout << "-----------------------------" << endl;
     return EXIT_SUCCESS;
 }


More information about the yoda-svn mailing list