[MOAB-dev] commit/MOAB: iulian07: append error when build with netcdf only

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Apr 30 16:41:10 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/fae72f00a208/
Changeset:   fae72f00a208
Branch:      master
User:        iulian07
Date:        2014-04-30 23:39:40
Summary:     append error when build with netcdf only

wrong open mode

Affected #:  2 files

diff --git a/src/io/NCWriteHelper.cpp b/src/io/NCWriteHelper.cpp
index 995bf3f..58d95c2 100644
--- a/src/io/NCWriteHelper.cpp
+++ b/src/io/NCWriteHelper.cpp
@@ -224,7 +224,11 @@ ErrorCode NCWriteHelper::init_file(std::vector<std::string>& var_names, std::vec
 
   // if append mode, make sure we are in define mode; a simple open will not allow creation of new variables
   if (append)
-    NCFUNC(redef)(_fileId);
+  {
+    int errcode = NCFUNC(redef)(_fileId);
+    if (errcode != NC_NOERR)
+      ERRORR(MB_FAILURE, "Can't open file in  redefine mode");
+  }
   // First initialize all coordinates, then fill VarData for actual variables (and dimensions)
   // Check that for used coordinates we have found the tags
   for (std::set<std::string>::iterator setIt = usedCoordinates.begin();

diff --git a/src/io/WriteNC.cpp b/src/io/WriteNC.cpp
index d4d79dd..0ec1aa8 100644
--- a/src/io/WriteNC.cpp
+++ b/src/io/WriteNC.cpp
@@ -95,15 +95,15 @@ ErrorCode WriteNC::write_file(const char* file_name,
 
   if (append)
   {
-#ifdef PNETCDF_FILE
     int omode = NC_WRITE;
+#ifdef PNETCDF_FILE
     if (isParallel)
       success = NCFUNC(open)(myPcomm->proc_config().proc_comm(), file_name, omode, MPI_INFO_NULL, &fileId);
     else
       success = NCFUNC(open)(MPI_COMM_SELF, file_name, omode, MPI_INFO_NULL, &fileId);
 #else
-    // This is a regular netcdf file
-    success = NCFUNC(open)(file_name, overwrite ? NC_CLOBBER : NC_NOCLOBBER, &fileId);
+    // This is a regular netcdf file, open in write mode
+    success = NCFUNC(open)(file_name, omode, &fileId);
 #endif
     ERRORS(success, "Failed to open file for appending.");
   }

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