[MOAB-dev] commit/MOAB: danwu: Updated ScdNCHelper::kji_to_jik() with return type void, to be consistent with ScdNCWriteHelper::jik_to_kji().

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jun 24 10:47:40 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/742478bdedca/
Changeset:   742478bdedca
Branch:      master
User:        danwu
Date:        2014-06-24 17:47:14
Summary:     Updated ScdNCHelper::kji_to_jik() with return type void, to be consistent with ScdNCWriteHelper::jik_to_kji().

Affected #:  2 files

diff --git a/src/io/NCHelper.cpp b/src/io/NCHelper.cpp
index 93cda3b..8a1b91e 100644
--- a/src/io/NCHelper.cpp
+++ b/src/io/NCHelper.cpp
@@ -1180,14 +1180,14 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset(std::vector<ReadNC::VarData>
           std::vector<char> tmpchardata(sz);
           success = NCFUNCAG(_vara_text)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
                                         &tmpchardata[0]);
+          ERRORS(success, "Failed to read char data.");
           if (vdatas[i].numLev > 1)
             // Transpose (lev, lat, lon) to (lat, lon, lev)
-            success = kji_to_jik(ni, nj, nk, data, &tmpchardata[0]);
+            kji_to_jik(ni, nj, nk, data, &tmpchardata[0]);
           else {
             for (std::size_t idx = 0; idx != tmpchardata.size(); idx++)
               ((char*) data)[idx] = tmpchardata[idx];
           }
-          ERRORS(success, "Failed to read char data.");
           break;
         }
         case NC_SHORT:
@@ -1195,14 +1195,14 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset(std::vector<ReadNC::VarData>
           std::vector<int> tmpintdata(sz);
           success = NCFUNCAG(_vara_int)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
                                         &tmpintdata[0]);
+          ERRORS(success, "Failed to read int data.");
           if (vdatas[i].numLev > 1)
             // Transpose (lev, lat, lon) to (lat, lon, lev)
-            success = kji_to_jik(ni, nj, nk, data, &tmpintdata[0]);
+            kji_to_jik(ni, nj, nk, data, &tmpintdata[0]);
           else {
             for (std::size_t idx = 0; idx != tmpintdata.size(); idx++)
               ((int*) data)[idx] = tmpintdata[idx];
           }
-          ERRORS(success, "Failed to read int data.");
           break;
         }
         case NC_FLOAT:
@@ -1210,14 +1210,14 @@ ErrorCode ScdNCHelper::read_scd_variables_to_nonset(std::vector<ReadNC::VarData>
           std::vector<double> tmpdoubledata(sz);
           success = NCFUNCAG(_vara_double)(_fileId, vdatas[i].varId, &vdatas[i].readStarts[0], &vdatas[i].readCounts[0],
                                           &tmpdoubledata[0]);
+          ERRORS(success, "Failed to read double data.");
           if (vdatas[i].numLev > 1)
             // Transpose (lev, lat, lon) to (lat, lon, lev)
-            success = kji_to_jik(ni, nj, nk, data, &tmpdoubledata[0]);
+            kji_to_jik(ni, nj, nk, data, &tmpdoubledata[0]);
           else {
             for (std::size_t idx = 0; idx != tmpdoubledata.size(); idx++)
               ((double*) data)[idx] = tmpdoubledata[idx];
           }
-          ERRORS(success, "Failed to read double data.");
           break;
         }
         default:

diff --git a/src/io/NCHelper.hpp b/src/io/NCHelper.hpp
index afc49dc..44d93b7 100644
--- a/src/io/NCHelper.hpp
+++ b/src/io/NCHelper.hpp
@@ -134,7 +134,7 @@ private:
   //! Create COORDS tag for quads coordinate
   ErrorCode create_quad_coordinate_tag();
 
-  template <typename T> ErrorCode kji_to_jik(size_t ni, size_t nj, size_t nk, void* dest, T* source)
+  template <typename T> void kji_to_jik(size_t ni, size_t nj, size_t nk, void* dest, T* source)
   {
     size_t nik = ni * nk, nij = ni * nj;
     T* tmp_data = reinterpret_cast<T*>(dest);
@@ -142,7 +142,6 @@ private:
       for (std::size_t i = 0; i != ni; i++)
         for (std::size_t k = 0; k != nk; k++)
           tmp_data[j*nik + i*nk + k] = source[k*nij + j*ni + i];
-    return MB_SUCCESS;
   }
 
 protected:

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