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

Function CreatePoints

IO/CatalystConduit/vtkConduitToDataObject.cxx:1117–1142  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1115
1116//----------------------------------------------------------------------------
1117vtkSmartPointer<vtkPoints> CreatePoints(const conduit_cpp::Node& coords)
1118{
1119 if (coords["type"].as_string() != "explicit")
1120 {
1121 throw std::runtime_error("invalid node!");
1122 }
1123
1124 conduit_cpp::Node values = coords["values"];
1125 auto array = vtkConduitArrayUtilities::MCArrayToVTKArray(conduit_cpp::c_node(&values), "coords");
1126 if (array == nullptr)
1127 {
1128 throw std::runtime_error("failed to convert to VTK array!");
1129 }
1130 if (array->GetNumberOfComponents() < 3)
1131 {
1132 array = vtkConduitArrayUtilities::SetNumberOfComponents(array, 3);
1133 }
1134 else if (array->GetNumberOfComponents() > 3)
1135 {
1136 throw std::runtime_error("points cannot have more than 3 components!");
1137 }
1138
1139 auto pts = vtkSmartPointer<vtkPoints>::New();
1140 pts->SetData(array);
1141 return pts;
1142}
1143
1144//----------------------------------------------------------------------------
1145void SetPolyhedralCells(

Callers 4

CreateMeshFunction · 0.70
CreateStructuredGridFunction · 0.70

Calls 4

as_stringMethod · 0.80
NewFunction · 0.50
GetNumberOfComponentsMethod · 0.45
SetDataMethod · 0.45

Tested by

no test coverage detected