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

Method Add2DSphericalCoordinates

IO/NetCDF/vtkNetCDFCFReader.cxx:1491–1565  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1489
1490//------------------------------------------------------------------------------
1491void vtkNetCDFCFReader::Add2DSphericalCoordinates(vtkPoints* points, const int extent[6])
1492{
1493 points->SetDataTypeToDouble();
1494 points->Allocate(
1495 (extent[1] - extent[0] + 1) * (extent[3] - extent[2] + 1) * (extent[5] - extent[4] + 1));
1496
1497 vtkDependentDimensionInfo* info = this->FindDependentDimensionInfo(this->LoadingDimensions);
1498
1499 vtkDoubleArray* longitudeCoordinates = info->GetLongitudeCoordinates();
1500 vtkDoubleArray* latitudeCoordinates = info->GetLatitudeCoordinates();
1501
1502 vtkDoubleArray* verticalCoordinates = nullptr;
1503 if (this->LoadingDimensions->GetNumberOfTuples() == 3)
1504 {
1505 int vertDim = this->LoadingDimensions->GetValue(0);
1506 if (info->GetHasBounds())
1507 {
1508 verticalCoordinates = this->GetDimensionInfo(vertDim)->GetBounds();
1509 }
1510 else
1511 {
1512 verticalCoordinates = this->GetDimensionInfo(vertDim)->GetCoordinates();
1513 }
1514 }
1515
1516 // Check the height scale and bias.
1517 double vertScale = this->VerticalScale;
1518 double vertBias = this->VerticalBias;
1519 if (verticalCoordinates)
1520 {
1521 double* verticalRange = verticalCoordinates->GetRange();
1522 if ((verticalRange[0] * vertScale + vertBias < 0) ||
1523 (verticalRange[1] * vertScale + vertBias < 0))
1524 {
1525 vertBias = -std::min(verticalRange[0], verticalRange[1]) * vertScale;
1526 }
1527 }
1528 else
1529 {
1530 if (vertScale + vertBias <= 0)
1531 {
1532 vertScale = 1.0;
1533 vertBias = 0.0;
1534 }
1535 }
1536
1537 for (int k = extent[4]; k <= extent[5]; k++)
1538 {
1539 double h;
1540 if (verticalCoordinates)
1541 {
1542 h = verticalCoordinates->GetValue(k) * vertScale + vertBias;
1543 }
1544 else
1545 {
1546 h = vertScale + vertBias;
1547 }
1548 for (int j = extent[2]; j <= extent[3]; j++)

Callers 1

RequestDataMethod · 0.95

Calls 15

GetDimensionInfoMethod · 0.95
AddStructuredCellsMethod · 0.95
GetHasBoundsMethod · 0.80
minFunction · 0.50
cosFunction · 0.50
sinFunction · 0.50
AllocateMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected