------------------------------------------------------------------------------
| 1689 | |
| 1690 | //------------------------------------------------------------------------------ |
| 1691 | void vtkNetCDFCFReader::AddUnstructuredRectilinearCoordinates( |
| 1692 | vtkUnstructuredGrid* unstructuredOutput, const int extent[6]) |
| 1693 | { |
| 1694 | vtkDependentDimensionInfo* info = this->FindDependentDimensionInfo(this->LoadingDimensions); |
| 1695 | |
| 1696 | vtkDoubleArray* longitudeCoordinates = info->GetLongitudeCoordinates(); |
| 1697 | vtkDoubleArray* latitudeCoordinates = info->GetLatitudeCoordinates(); |
| 1698 | |
| 1699 | int numPointsPerCell = longitudeCoordinates->GetNumberOfComponents(); |
| 1700 | vtkIdType totalNumCells = longitudeCoordinates->GetNumberOfTuples(); |
| 1701 | |
| 1702 | double bounds[6]; |
| 1703 | GetRangeOfAllComponents(longitudeCoordinates, bounds + 0); |
| 1704 | GetRangeOfAllComponents(latitudeCoordinates, bounds + 2); |
| 1705 | bounds[4] = bounds[5] = 0.0; |
| 1706 | |
| 1707 | VTK_CREATE(vtkPoints, points); |
| 1708 | points->SetDataTypeToDouble(); |
| 1709 | points->Allocate(totalNumCells); |
| 1710 | |
| 1711 | VTK_CREATE(vtkMergePoints, locator); |
| 1712 | locator->InitPointInsertion(points, bounds); |
| 1713 | |
| 1714 | // Make space in output unstructured grid. |
| 1715 | unstructuredOutput->Allocate(extent[1] - extent[0]); |
| 1716 | vtkCellArray* cells = unstructuredOutput->GetCells(); |
| 1717 | cells->AllocateEstimate(extent[1] - extent[0], numPointsPerCell); |
| 1718 | |
| 1719 | std::vector<vtkIdType> cellPoints(numPointsPerCell); |
| 1720 | |
| 1721 | // This is a rather lame way to break up cells amongst processes. It will be |
| 1722 | // slow and ghost cells are totally screwed up. |
| 1723 | for (int cellId = extent[0]; cellId < extent[1]; cellId++) |
| 1724 | { |
| 1725 | for (int cellPointId = 0; cellPointId < numPointsPerCell; cellPointId++) |
| 1726 | { |
| 1727 | double coord[3]; |
| 1728 | coord[0] = longitudeCoordinates->GetComponent(cellId, cellPointId); |
| 1729 | coord[1] = latitudeCoordinates->GetComponent(cellId, cellPointId); |
| 1730 | coord[2] = 0.0; |
| 1731 | |
| 1732 | vtkIdType pointId; |
| 1733 | locator->InsertUniquePoint(coord, pointId); |
| 1734 | |
| 1735 | cellPoints[cellPointId] = pointId; |
| 1736 | } |
| 1737 | unstructuredOutput->InsertNextCell(VTK_POLYGON, numPointsPerCell, &cellPoints.at(0)); |
| 1738 | } |
| 1739 | |
| 1740 | points->Squeeze(); |
| 1741 | unstructuredOutput->SetPoints(points); |
| 1742 | } |
| 1743 | |
| 1744 | //------------------------------------------------------------------------------ |
| 1745 | void vtkNetCDFCFReader::AddUnstructuredSphericalCoordinates( |
no test coverage detected