| 1613 | //------------------------------------------------------------------------------ |
| 1614 | |
| 1615 | int 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( |
no test coverage detected