[MOAB-dev] r4349 - MOAB/trunk/src/io
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Fri Dec 10 12:07:00 CST 2010
Author: tautges
Date: 2010-12-10 12:07:00 -0600 (Fri, 10 Dec 2010)
New Revision: 4349
Modified:
MOAB/trunk/src/io/WriteSLAC.cpp
MOAB/trunk/src/io/WriteSLAC.hpp
Log:
Ported to netcdf C interface.
Passes make check.
Modified: MOAB/trunk/src/io/WriteSLAC.cpp
===================================================================
--- MOAB/trunk/src/io/WriteSLAC.cpp 2010-12-10 17:02:55 UTC (rev 4348)
+++ MOAB/trunk/src/io/WriteSLAC.cpp 2010-12-10 18:07:00 UTC (rev 4349)
@@ -38,7 +38,7 @@
#include <iostream>
#include <assert.h>
-#include "netcdf.hh"
+#include "netcdf.h"
#include "moab/Interface.hpp"
#include "moab/Range.hpp"
#include "moab/CN.hpp"
@@ -52,6 +52,17 @@
#define INS_ID(stringvar, prefix, id) \
sprintf(stringvar, prefix, id)
+#define GET_VAR(name, id, dims) \
+ { \
+ id = -1;\
+ int fail = nc_inq_varid(ncFile, name, &id); \
+ if (NC_NOERR == fail) { \
+ int ndims;\
+ fail = nc_inq_varndims(ncFile, id, &ndims);\
+ if (NC_NOERR == fail) {\
+ dims.resize(ndims); \
+ fail = nc_inq_vardimid(ncFile, id, &dims[0]);}}}
+
WriterIface* WriteSLAC::factory( Interface* iface )
{ return new WriteSLAC( iface ); }
@@ -111,9 +122,6 @@
mbImpl->release_interface(iface_name, mWriteIface);
mbImpl->tag_delete(mEntityMark);
-
- if (NULL != ncFile)
- delete ncFile;
}
void WriteSLAC::reset_matset(std::vector<WriteSLAC::MaterialSetData> &matset_info)
@@ -195,8 +203,8 @@
// try to open the file after gather mesh info succeeds
- ncFile = new NcFile(file_name, overwrite ? NcFile::Replace : NcFile::New );
- if (NULL == ncFile) {
+ int fail = nc_create(file_name, overwrite ? NC_CLOBBER : NC_NOCLOBBER, &ncFile);
+ if (NC_NOERR != fail) {
reset_matset(matset_info);
return MB_FAILURE;
More information about the moab-dev
mailing list