[cig-commits] r11735 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Apr 2 11:02:01 PDT 2008


Author: luis
Date: 2008-04-02 11:02:01 -0700 (Wed, 02 Apr 2008)
New Revision: 11735

Modified:
   cs/benchmark/cigma/trunk/src/EvalCmd.cpp
   cs/benchmark/cigma/trunk/src/EvalCmd.h
Log:
Testing usage of FieldSet in EvalCmd


Modified: cs/benchmark/cigma/trunk/src/EvalCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/EvalCmd.cpp	2008-04-02 18:02:00 UTC (rev 11734)
+++ cs/benchmark/cigma/trunk/src/EvalCmd.cpp	2008-04-02 18:02:01 UTC (rev 11735)
@@ -1,7 +1,7 @@
 #include <iostream>
 #include <cassert>
-
 #include "EvalCmd.h"
+#include "ZeroField.h"
 #include "StringUtils.h"
 
 using namespace std;
@@ -15,12 +15,12 @@
 
     field = 0;
     points = 0;
-    values = 0;
+    //values = 0;
 }
 
 EvalCmd::~EvalCmd()
 {
-    // XXX:
+    // XXX
 }
 
 
@@ -104,17 +104,24 @@
     pointsReader.load_args(opt, "points");
     pointsReader.validate_args("eval");
     pointsReader.load_points();
-    if (pointsReader.points == 0)
+    points = pointsReader.points;
+    if (points == 0)
     {
         cerr << "eval: Could not load points dataset!" << endl;
         exit(1);
     }
 
+    /* initialize list of known fields */
+    fieldSet.initialize();
+
     /* determine the input field */
+    fieldReader.setFieldSet(&fieldSet);
     fieldReader.load_args(opt, "field");
     fieldReader.validate_args("eval");
     fieldReader.load_field();
-    if (fieldReader.field == 0)
+    field = fieldReader.field;
+    
+    if (field == 0)
     {
         cerr << "eval: Could not load field from path "
              << fieldReader.fieldPath
@@ -122,9 +129,14 @@
         exit(1);
     }
 
-
-    if (field->n_dim() != points->n_dim())
+    if (fieldReader.fieldPath == "zero")
     {
+        ZeroField *zero = static_cast<ZeroField*>(field);
+        assert(zero != 0);
+        zero->set_shape(points->n_dim(), 3);
+    }
+    else if (field->n_dim() != points->n_dim())
+    {
         cerr << "eval: Domain dimensions do not match: "
              << "field->dim = " << field->n_dim() << ", "
              << "points->dim = " << points->n_dim()
@@ -138,7 +150,7 @@
 {
     assert(field != 0);
     assert(points != 0);
-    assert(values != 0);
+    //assert(values != 0);
 
     // indices
     int i;

Modified: cs/benchmark/cigma/trunk/src/EvalCmd.h
===================================================================
--- cs/benchmark/cigma/trunk/src/EvalCmd.h	2008-04-02 18:02:00 UTC (rev 11734)
+++ cs/benchmark/cigma/trunk/src/EvalCmd.h	2008-04-02 18:02:01 UTC (rev 11735)
@@ -4,11 +4,14 @@
 #include <string>
 #include "Command.h"
 #include "Field.h"
+#include "FieldSet.h"
+#include "FieldReader.h"
 #include "Points.h"
-#include "FieldReader.h"
 #include "PointsReader.h"
 #include "Writer.h"
 
+
+
 namespace cigma
 {
     class EvalCmd;
@@ -29,6 +32,7 @@
     int run();
 
 public:
+    FieldSet fieldSet;
     FieldReader fieldReader;
     PointsReader pointsReader;
     Writer *valuesWriter;
@@ -39,7 +43,7 @@
 public:
     Field *field;
     Points *points;
-    Points *values;
+    //Points *values;
 };
 
 #endif



More information about the cig-commits mailing list