------------------------------------------------------------------------------
| 1562 | |
| 1563 | //------------------------------------------------------------------------------ |
| 1564 | int vtkSLACReader::ReadMidpointCoordinates( |
| 1565 | int meshFD, vtkMultiBlockDataSet* output, vtkSLACReader::MidpointCoordinateMap& map) |
| 1566 | { |
| 1567 | // Get the number of midpoints. |
| 1568 | int midpointsVar; |
| 1569 | CALL_NETCDF_INT(nc_inq_varid(meshFD, "surface_midpoint", &midpointsVar)); |
| 1570 | vtkIdType numMidpoints = this->GetNumTuplesInVariable(meshFD, midpointsVar, 5); |
| 1571 | if (numMidpoints < 1) |
| 1572 | return 0; |
| 1573 | |
| 1574 | // Read in the raw data. |
| 1575 | VTK_CREATE(vtkDoubleArray, midpointData); |
| 1576 | midpointData->SetNumberOfComponents(5); |
| 1577 | midpointData->SetNumberOfTuples(numMidpoints); |
| 1578 | CALL_NETCDF_INT(nc_get_var_double(meshFD, midpointsVar, midpointData->GetPointer(0))); |
| 1579 | |
| 1580 | vtkPoints* points = |
| 1581 | vtkPoints::SafeDownCast(output->GetInformation()->Get(vtkSLACReader::POINTS())); |
| 1582 | vtkIdType pointTotal = points->GetNumberOfPoints(); |
| 1583 | // Create a searchable structure. |
| 1584 | for (vtkIdType i = 0; i < numMidpoints; i++) |
| 1585 | { |
| 1586 | double* mp = midpointData->GetPointer(i * 5); |
| 1587 | |
| 1588 | EdgeEndpoints edge(static_cast<vtkIdType>(mp[0]), static_cast<vtkIdType>(mp[1])); |
| 1589 | MidpointCoordinates midpoint(mp + 2, i + pointTotal); |
| 1590 | map.AddMidpoint(edge, midpoint); |
| 1591 | } |
| 1592 | |
| 1593 | return 1; |
| 1594 | } |
| 1595 | |
| 1596 | //------------------------------------------------------------------------------ |
| 1597 | int vtkSLACReader::ReadMidpointData( |
no test coverage detected