MCPcopy Create free account
hub / github.com/Kitware/VTK / BuildVarArrays

Method BuildVarArrays

IO/NetCDF/vtkMPASReader.cxx:1479–1560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477//------------------------------------------------------------------------------
1478
1479int vtkMPASReader::BuildVarArrays()
1480{
1481 // figure out what variables to visualize -
1482 if (!GetNcVars("nVertices", "nCells"))
1483 {
1484 return 0;
1485 }
1486
1487 for (size_t v = 0; v < this->Internals->pointVars.size(); v++)
1488 {
1489 int varid = this->Internals->pointVars[v];
1490 std::string name;
1491 if (this->UseDimensionedArrayNames)
1492 {
1493 name = this->Internals->dimensionedArrayName(varid);
1494 }
1495 else
1496 {
1497 char varname[NC_MAX_NAME + 1];
1498 if (this->Internals->nc_err(nc_inq_varname(this->Internals->ncFile, varid, varname)))
1499 {
1500 continue;
1501 }
1502 name = varname;
1503 }
1504 this->PointDataArraySelection->EnableArray(name.c_str());
1505 // Register the dimensions:
1506 int ndims;
1507 if (this->Internals->nc_err(nc_inq_varndims(this->Internals->ncFile, varid, &ndims)))
1508 {
1509 continue;
1510 }
1511 int dims[NC_MAX_VAR_DIMS];
1512 if (this->Internals->nc_err(nc_inq_vardimid(this->Internals->ncFile, varid, dims)))
1513 {
1514 continue;
1515 }
1516 for (int d = 0; d < ndims; ++d)
1517 {
1518 this->Internals->InitializeDimension(dims[d]);
1519 }
1520 vtkDebugMacro(<< "Adding point var: " << name);
1521 }
1522
1523 for (size_t v = 0; v < this->Internals->cellVars.size(); v++)
1524 {
1525 int varid = this->Internals->cellVars[v];
1526 std::string name;
1527 if (this->UseDimensionedArrayNames)
1528 {
1529 name = this->Internals->dimensionedArrayName(varid);
1530 }
1531 else
1532 {
1533 char varname[NC_MAX_NAME + 1];
1534 if (this->Internals->nc_err(nc_inq_varname(this->Internals->ncFile, varid, varname)))
1535 {
1536 continue;

Callers 1

RequestInformationMethod · 0.95

Calls 9

nc_inq_varnameFunction · 0.85
nc_inq_varndimsFunction · 0.85
nc_inq_vardimidFunction · 0.85
dimensionedArrayNameMethod · 0.80
EnableArrayMethod · 0.80
InitializeDimensionMethod · 0.80
sizeMethod · 0.45
nc_errMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected