[MOAB-dev] r4348 - in MOAB/trunk/src: io moab

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri Dec 10 11:02:55 CST 2010


Author: tautges
Date: 2010-12-10 11:02:55 -0600 (Fri, 10 Dec 2010)
New Revision: 4348

Modified:
   MOAB/trunk/src/io/ReadNCDF.cpp
   MOAB/trunk/src/io/WriteNCDF.cpp
   MOAB/trunk/src/io/WriteNCDF.hpp
   MOAB/trunk/src/moab/Range.hpp
Log:
- made Range::psize return size_t instead of unsigned int
- converted WriteNCDF to use netcdf C interface

Passes make check



Modified: MOAB/trunk/src/io/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNCDF.cpp	2010-12-10 04:34:20 UTC (rev 4347)
+++ MOAB/trunk/src/io/ReadNCDF.cpp	2010-12-10 17:02:55 UTC (rev 4348)
@@ -435,14 +435,14 @@
   GET_DIM(temp_dim, "len_line", max_line_length);
 
     // title; why are we even bothering if we're not going to keep it???
-  char *title = new char[max_line_length+1];
   fail = nc_inq_att(ncFile, NC_GLOBAL, "title", &att_type, &att_len);
   if (NC_NOERR != fail) {
     readMeshIface->report_error("ReadNCDF:: Problem getting title attribute.");
     return MB_FAILURE;
   }
-  if (att_type != NC_CHAR || (int)att_len > max_line_length) {
-    readMeshIface->report_error("ReadNCDF:: title didn't have type char or was too long.");
+  char *title = new char[att_len+1];
+  if (att_type != NC_CHAR) {
+    readMeshIface->report_error("ReadNCDF:: title didn't have type char.");
     return MB_FAILURE;
   }
   fail = nc_get_att_text(ncFile, NC_GLOBAL, "title", title);
@@ -707,6 +707,7 @@
       readMeshIface->report_error("ReadNCDF:: Problem getting connectivity.");
       return MB_FAILURE;
     }
+
       // Convert from exodus indices to vertex handles.
       // Iterate backwards in case handles are larger than ints.
     for (int i = number_nodes - 1; i >= 0; --i)

Modified: MOAB/trunk/src/io/WriteNCDF.cpp
===================================================================
--- MOAB/trunk/src/io/WriteNCDF.cpp	2010-12-10 04:34:20 UTC (rev 4347)
+++ MOAB/trunk/src/io/WriteNCDF.cpp	2010-12-10 17:02:55 UTC (rev 4348)
@@ -28,6 +28,7 @@
 
 #include "WriteNCDF.hpp"
 
+#include "netcdf.h"
 #include <utility>
 #include <algorithm>
 #include <time.h>
@@ -53,6 +54,34 @@
 #define INS_ID(stringvar, prefix, id) \
           sprintf(stringvar, prefix, id)
 
+#define GET_DIM(ncdim, name, val)\
+    {                            \
+    int fail = nc_inq_dimid(ncFile, name, &ncdim);          \
+    if (NC_NOERR == fail) {                                             \


More information about the moab-dev mailing list