| 239 | } |
| 240 | |
| 241 | std::string vtkMPASReader::Internal::dimensionedArrayName(int nc_var) const |
| 242 | { |
| 243 | char name[NC_MAX_NAME + 1]; |
| 244 | if (nc_err(nc_inq_varname(ncFile, nc_var, name))) |
| 245 | { |
| 246 | return ""; |
| 247 | } |
| 248 | |
| 249 | int ndims; |
| 250 | if (nc_err(nc_inq_varndims(ncFile, nc_var, &ndims))) |
| 251 | { |
| 252 | return ""; |
| 253 | } |
| 254 | int dims[NC_MAX_VAR_DIMS]; |
| 255 | if (nc_err(nc_inq_vardimid(ncFile, nc_var, dims))) |
| 256 | { |
| 257 | return ""; |
| 258 | } |
| 259 | |
| 260 | std::ostringstream out; |
| 261 | out << name << "("; |
| 262 | |
| 263 | for (int dim = 0; dim < ndims; ++dim) |
| 264 | { |
| 265 | if (dim != 0) |
| 266 | { |
| 267 | out << ", "; |
| 268 | } |
| 269 | |
| 270 | if (nc_err(nc_inq_dimname(ncFile, dims[dim], name))) |
| 271 | { |
| 272 | return ""; |
| 273 | } |
| 274 | out << name; |
| 275 | } |
| 276 | out << ")"; |
| 277 | return out.str(); |
| 278 | } |
| 279 | |
| 280 | //------------------------------------------------------------------------------ |
| 281 | // Returns true if the dimensions in var match the expected args, or prints a |
no test coverage detected