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

Method AllocSphericalGeometry

IO/NetCDF/vtkMPASReader.cxx:1615–1712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1613//------------------------------------------------------------------------------
1614
1615int vtkMPASReader::AllocSphericalGeometry()
1616{
1617 int varid;
1618 CHECK_VAR("xCell", varid);
1619 this->PointX = new double[this->NumberOfPoints + this->PointOffset];
1620 if (!this->Internals->ValidateDimensions(varid, false, 1, "nCells"))
1621 {
1622 return 0;
1623 }
1624 size_t start_pt[] = { 0 };
1625 size_t count_pt[] = { this->NumberOfPoints };
1626 if (this->Internals->nc_err(nc_get_vara_double(
1627 this->Internals->ncFile, varid, start_pt, count_pt, this->PointX + this->PointOffset)))
1628 {
1629 return 0;
1630 }
1631 // point 0 is 0.0
1632 this->PointX[0] = 0.0;
1633
1634 CHECK_VAR("yCell", varid);
1635 this->PointY = new double[this->NumberOfPoints + this->PointOffset];
1636 if (!this->Internals->ValidateDimensions(varid, false, 1, "nCells"))
1637 {
1638 return 0;
1639 }
1640 if (this->Internals->nc_err(nc_get_vara_double(
1641 this->Internals->ncFile, varid, start_pt, count_pt, this->PointY + this->PointOffset)))
1642 {
1643 return 0;
1644 }
1645 // point 0 is 0.0
1646 this->PointY[0] = 0.0;
1647
1648 CHECK_VAR("zCell", varid);
1649 this->PointZ = new double[this->NumberOfPoints + this->PointOffset];
1650 if (!this->Internals->ValidateDimensions(varid, false, 1, "nCells"))
1651 {
1652 return 0;
1653 }
1654 if (this->Internals->nc_err(nc_get_vara_double(
1655 this->Internals->ncFile, varid, start_pt, count_pt, this->PointZ + this->PointOffset)))
1656 {
1657 return 0;
1658 }
1659 // point 0 is 0.0
1660 this->PointZ[0] = 0.0;
1661
1662 CHECK_VAR("cellsOnVertex", varid);
1663 this->OrigConnections = new int[this->NumberOfCells * this->PointsPerCell];
1664 // TODO Spec says dims should be '3', 'nVertices', but my example files
1665 // use nVertices, vertexDegree...
1666 if (!this->Internals->ValidateDimensions(varid, false, 2, "nVertices", "vertexDegree"))
1667 {
1668 return 0;
1669 }
1670 size_t start_conn[] = { 0, 0 };
1671 size_t count_conn[] = { this->NumberOfCells, this->PointsPerCell };
1672 if (this->Internals->nc_err(nc_get_vara_int(

Callers 1

ReadAndOutputGridMethod · 0.95

Calls 5

nc_get_vara_doubleFunction · 0.85
nc_get_vara_intFunction · 0.85
ValidateDimensionsMethod · 0.80
nc_var_idMethod · 0.80
nc_errMethod · 0.45

Tested by

no test coverage detected