Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
ReadNCDF.cpp File Reference
#include "ReadNCDF.hpp"
#include "netcdf.h"
#include <algorithm>
#include <string>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <sstream>
#include <iostream>
#include <map>
#include "moab/CN.hpp"
#include "moab/Range.hpp"
#include "moab/Interface.hpp"
#include "ExoIIUtil.hpp"
#include "MBTagConventions.hpp"
#include "Internals.hpp"
#include "moab/ReadUtilIface.hpp"
#include "exodus_order.h"
#include "moab/FileOptions.hpp"
#include "moab/AdaptiveKDTree.hpp"
#include "moab/CartVect.hpp"
+ Include dependency graph for ReadNCDF.cpp:

Go to the source code of this file.

Namespaces

 moab
 Class representing axis-aligned bounding box.
 

Macros

#define INS_ID(stringvar, prefix, id, length)   snprintf( stringvar, length, prefix, id )
 
#define GET_DIM(ncdim, name, val)
 
#define GET_DIMB(ncdim, name, varname, id, val)
 
#define GET_VAR(name, id, dims)
 
#define GET_1D_INT_VAR(name, id, vals)
 
#define GET_1D_DBL_VAR(name, id, vals)
 

Macro Definition Documentation

◆ GET_1D_DBL_VAR

#define GET_1D_DBL_VAR (   name,
  id,
  vals 
)
Value:
{ \
std::vector< int > dum_dims; \
GET_VAR( name, id, dum_dims ); \
if( -1 != ( id ) ) \
{ \
size_t ntmp; \
int dvfail = nc_inq_dimlen( ncFile, dum_dims[0], &ntmp ); \
if( NC_NOERR != dvfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Couldn't get dimension length" ); \
} \
( vals ).resize( ntmp ); \
size_t ntmp1 = 0; \
dvfail = nc_get_vara_double( ncFile, id, &ntmp1, &ntmp, &( vals )[0] ); \
if( NC_NOERR != dvfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Problem getting variable " << ( name ) ); \
} \
} \
}

Definition at line 113 of file ReadNCDF.cpp.

◆ GET_1D_INT_VAR

#define GET_1D_INT_VAR (   name,
  id,
  vals 
)
Value:
{ \
GET_VAR( name, id, vals ); \
if( -1 != ( id ) ) \
{ \
size_t ntmp; \
int ivfail = nc_inq_dimlen( ncFile, ( vals )[0], &ntmp ); \
if( NC_NOERR != ivfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Couldn't get dimension length" ); \
} \
( vals ).resize( ntmp ); \
size_t ntmp1 = 0; \
ivfail = nc_get_vara_int( ncFile, id, &ntmp1, &ntmp, &( vals )[0] ); \
if( NC_NOERR != ivfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Problem getting variable " << ( name ) ); \
} \
} \
}

Definition at line 92 of file ReadNCDF.cpp.

◆ GET_DIM

#define GET_DIM (   ncdim,
  name,
  val 
)
Value:
{ \
int gdfail = nc_inq_dimid( ncFile, name, &( ncdim ) ); \
if( NC_NOERR == gdfail ) \
{ \
size_t tmp_val; \
gdfail = nc_inq_dimlen( ncFile, ncdim, &tmp_val ); \
if( NC_NOERR != gdfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Couldn't get dimension length" ); \
} \
else \
( val ) = tmp_val; \
} \
else \
( val ) = 0; \
}

Definition at line 50 of file ReadNCDF.cpp.

◆ GET_DIMB

#define GET_DIMB (   ncdim,
  name,
  varname,
  id,
  val 
)
Value:
INS_ID( name, varname, id, max_str_length + 1 ); \
GET_DIM( ncdim, name, val );

Definition at line 68 of file ReadNCDF.cpp.

◆ GET_VAR

#define GET_VAR (   name,
  id,
  dims 
)
Value:
{ \
( id ) = -1; \
int gvfail = nc_inq_varid( ncFile, name, &( id ) ); \
if( NC_NOERR == gvfail ) \
{ \
int ndims; \
gvfail = nc_inq_varndims( ncFile, id, &ndims ); \
if( NC_NOERR == gvfail ) \
{ \
( dims ).resize( ndims ); \
gvfail = nc_inq_vardimid( ncFile, id, &( dims )[0] ); \
if( NC_NOERR != gvfail ) \
{ \
MB_SET_ERR( MB_FAILURE, "ReadNCDF:: Couldn't get variable dimension IDs" ); \
} \
} \
} \
}

Definition at line 72 of file ReadNCDF.cpp.

◆ INS_ID

#define INS_ID (   stringvar,
  prefix,
  id,
  length 
)    snprintf( stringvar, length, prefix, id )

Definition at line 48 of file ReadNCDF.cpp.