[cig-commits] r14085 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Feb 18 08:14:40 PST 2009


Author: luis
Date: 2009-02-18 08:14:40 -0800 (Wed, 18 Feb 2009)
New Revision: 14085

Modified:
   cs/cigma/trunk/src/ProgressTimer.cpp
   cs/cigma/trunk/src/ProgressTimer.h
   cs/cigma/trunk/src/cli_list_cmd.cpp
   cs/cigma/trunk/src/h5attr.cpp
   cs/cigma/trunk/src/io_hdf5.cpp
Log:
Changes to output formatting

Modified: cs/cigma/trunk/src/ProgressTimer.cpp
===================================================================
--- cs/cigma/trunk/src/ProgressTimer.cpp	2009-02-18 16:14:38 UTC (rev 14084)
+++ cs/cigma/trunk/src/ProgressTimer.cpp	2009-02-18 16:14:40 UTC (rev 14085)
@@ -1,6 +1,11 @@
 #include "ProgressTimer.h"
+#include <iomanip>
+#include <sstream>
+#include <cassert>
 using namespace std;
 
+const int width = 9;
+
 ProgressTimer::ProgressTimer()
 {
     t_0 = 0;
@@ -14,9 +19,14 @@
 
 string ProgressTimer::header(const char *firstcol)
 {
-    string hdr(firstcol);
-    hdr += " rate mins eta total progress\n";
-    return hdr;
+    ostringstream hdr;
+    hdr << setw(width) << right << firstcol << " "
+        << setw(width) << right << "rate" << " "
+        << setw(width) << right << "mins" << " "
+        << setw(width) << right << "eta" << " "
+        << setw(width) << right << "total" << " "
+        << setw(width+1) << right << "progress" << endl;
+    return hdr.str();
 }
 
 ProgressTimer& ProgressTimer::start(int tot)
@@ -41,12 +51,12 @@
 
 std::ostream& operator<<(std::ostream& os, const ProgressTimer& T)
 {
-    os << T.current << " "
-       << T.num_per_sec << " "
-       << T.elapsed_mins << " "
-       << T.remaining_mins << " "
-       << T.total_mins << " "
-       << T.progress << "%"
+    os << setw(width) << right << T.current << " "
+       << setw(width) << right << T.num_per_sec << " "
+       << setw(width) << right << T.elapsed_mins << " "
+       << setw(width) << right << T.remaining_mins << " "
+       << setw(width) << right << T.total_mins << " "
+       << setw(width) << right << T.progress << "%"
        << "          "
           "          "
           "\r"

Modified: cs/cigma/trunk/src/ProgressTimer.h
===================================================================
--- cs/cigma/trunk/src/ProgressTimer.h	2009-02-18 16:14:38 UTC (rev 14084)
+++ cs/cigma/trunk/src/ProgressTimer.h	2009-02-18 16:14:40 UTC (rev 14085)
@@ -4,7 +4,6 @@
 #include <ctime>
 #include <iostream>
 #include <string>
-#include <cassert>
 
 class ProgressTimer
 {

Modified: cs/cigma/trunk/src/cli_list_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_list_cmd.cpp	2009-02-18 16:14:38 UTC (rev 14084)
+++ cs/cigma/trunk/src/cli_list_cmd.cpp	2009-02-18 16:14:40 UTC (rev 14085)
@@ -20,7 +20,7 @@
     name = "list";
     brief = "List file contents (fields, dimensions, ...)";
 
-    usage = "Usage: cigma list <FILE>";
+    usage = "Usage: cigma list <DataFile>";
     appendix =
         "Only the following file extensions are supported:\n"
         "   .h5                 - Cigma HDF5 file\n"

Modified: cs/cigma/trunk/src/h5attr.cpp
===================================================================
--- cs/cigma/trunk/src/h5attr.cpp	2009-02-18 16:14:38 UTC (rev 14084)
+++ cs/cigma/trunk/src/h5attr.cpp	2009-02-18 16:14:40 UTC (rev 14085)
@@ -493,7 +493,7 @@
             if (objtype == H5I_GROUP)
             {
                 const char *prefix = location.c_str();
-                cout << indent << "Groups" << endl;
+                cout << indent << "Groups & Datasets" << endl;
                 #ifdef HAVE_HDF5_1_8_0
                 try
                 {

Modified: cs/cigma/trunk/src/io_hdf5.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5.cpp	2009-02-18 16:14:38 UTC (rev 14084)
+++ cs/cigma/trunk/src/io_hdf5.cpp	2009-02-18 16:14:40 UTC (rev 14085)
@@ -201,6 +201,9 @@
 // open hdf5 dataset
 H5::DataSet* h5_open_dataset(H5::H5File *file, const char *loc)
 {
+    //TRI_LOG_STR("h5_open_dataset()");
+    //TRI_LOG(loc);
+
     H5::DataSet* dataset = 0;
 
     if (file)



More information about the CIG-COMMITS mailing list