[MOAB-dev] commit/MOAB: danwu: Minor changes to NCHelperGCRM.cpp.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Jun 16 11:21:03 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/fe37b13f0c51/
Changeset:   fe37b13f0c51
Branch:      master
User:        danwu
Date:        2014-06-16 18:20:47
Summary:     Minor changes to NCHelperGCRM.cpp.

Affected #:  1 file

diff --git a/src/io/NCHelperGCRM.cpp b/src/io/NCHelperGCRM.cpp
index 25ed53c..c7409c5 100644
--- a/src/io/NCHelperGCRM.cpp
+++ b/src/io/NCHelperGCRM.cpp
@@ -115,16 +115,16 @@ ErrorCode NCHelperGCRM::init_mesh_vals()
 
   // Store time coordinate values in tVals
   if (nTimeSteps > 0) {
-    if ((vmit = varInfo.find("Time")) != varInfo.end()) {
-      rval = read_coordinate("Time", 0, nTimeSteps - 1, tVals);
-      ERRORR(rval, "Trouble reading 'Time' variable.");
-    }
-    else if ((vmit = varInfo.find("time")) != varInfo.end()) {
+    if ((vmit = varInfo.find("time")) != varInfo.end()) {
       rval = read_coordinate("time", 0, nTimeSteps - 1, tVals);
       ERRORR(rval, "Trouble reading 'time' variable.");
     }
+    else if ((vmit = varInfo.find("t")) != varInfo.end()) {
+      rval = read_coordinate("t", 0, nTimeSteps - 1, tVals);
+      ERRORR(rval, "Trouble reading 't' variable.");
+    }
     else {
-      // If time variable does not exist, set dummy values to tVals
+      // If expected time variable is not available, set dummy time coordinate values to tVals
       for (int t = 0; t < nTimeSteps; t++)
         tVals.push_back((double)t);
     }
@@ -158,7 +158,7 @@ ErrorCode NCHelperGCRM::init_mesh_vals()
     }
   }
 
-  // Hack: create dummy variables for dimensions (like nCells) with no corresponding coordinate variables
+  // Hack: create dummy variables for dimensions (like cells) with no corresponding coordinate variables
   rval = create_dummy_variables();
   ERRORR(rval, "Failed to create dummy variables.");
 
@@ -586,8 +586,14 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
           ERRORR(MB_FAILURE, "not implemented");
           break;
         }
-        case NC_DOUBLE:
-        case NC_FLOAT: {
+        case NC_SHORT:
+        case NC_INT: {
+          ERRORR(MB_FAILURE, "not implemented");
+          break;
+        }
+        case NC_FLOAT:
+        case NC_DOUBLE: {
+          // Read float as double
           std::vector<double> tmpdoubledata(sz);
 
           // In the case of ucd mesh, and on multiple proc,
@@ -595,12 +601,11 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
           // localGid range;
           // basically, we have to give a different point
           // for data to start, for every subrange :(
-
           size_t indexInDoubleArray = 0;
           size_t ic = 0;
           for (Range::pair_iterator pair_iter = pLocalGid->pair_begin();
               pair_iter != pLocalGid->pair_end();
-              pair_iter++, ic++) {
+              ++pair_iter, ic++) {
             EntityHandle starth = pair_iter->first;
             EntityHandle endh = pair_iter->second; // inclusive
             vdatas[i].readStarts[1] = (NCDF_SIZE) (starth - 1);
@@ -627,15 +632,6 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset_async(std::vector<ReadNC::V
 
           break;
         }
-
-        case NC_INT: {
-          ERRORR(MB_FAILURE, "not implemented");
-          break;
-        }
-        case NC_SHORT: {
-          ERRORR(MB_FAILURE, "not implemented");
-          break;
-        }
         default:
           success = 1;
       }
@@ -701,8 +697,14 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
           ERRORR(MB_FAILURE, "not implemented");
           break;
         }
-        case NC_DOUBLE:
-        case NC_FLOAT: {
+        case NC_SHORT:
+        case NC_INT: {
+          ERRORR(MB_FAILURE, "not implemented");
+          break;
+        }
+        case NC_FLOAT:
+        case NC_DOUBLE: {
+          // Read float as double
           std::vector<double> tmpdoubledata(sz);
 
           // In the case of ucd mesh, and on multiple proc,
@@ -714,7 +716,7 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
           size_t ic = 0;
           for (Range::pair_iterator pair_iter = pLocalGid->pair_begin();
               pair_iter != pLocalGid->pair_end();
-              pair_iter++, ic++) {
+              ++pair_iter, ic++) {
             EntityHandle starth = pair_iter->first;
             EntityHandle endh = pair_iter->second; // Inclusive
             vdatas[i].readStarts[1] = (NCDF_SIZE) (starth - 1);
@@ -736,14 +738,6 @@ ErrorCode NCHelperGCRM::read_ucd_variables_to_nonset(std::vector<ReadNC::VarData
 
           break;
         }
-        case NC_INT: {
-          ERRORR(MB_FAILURE, "not implemented");
-          break;
-        }
-        case NC_SHORT: {
-          ERRORR(MB_FAILURE, "not implemented");
-          break;
-        }
         default:
           success = 1;
       }

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list