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

Method ReadMidpointCoordinates

IO/NetCDF/vtkSLACReader.cxx:1564–1594  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1562
1563//------------------------------------------------------------------------------
1564int 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//------------------------------------------------------------------------------
1597int vtkSLACReader::ReadMidpointData(

Callers 1

ReadMidpointDataMethod · 0.95

Calls 10

nc_inq_varidFunction · 0.85
nc_get_var_doubleFunction · 0.85
AddMidpointMethod · 0.80
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetPointerMethod · 0.45
GetMethod · 0.45
GetInformationMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected