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

Method ReadPolyhedronCellArray

IO/XML/vtkXMLUnstructuredDataReader.cxx:911–1453  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

909
910//------------------------------------------------------------------------------
911int vtkXMLUnstructuredDataReader::ReadPolyhedronCellArray(vtkIdType numberOfCells,
912 vtkXMLDataElement* eCells, vtkCellArray* outFaces, vtkCellArray* outFaceOffsets)
913{
914 if (numberOfCells <= 0)
915 {
916 return 1;
917 }
918 else
919 {
920 if (!eCells || !outFaces || !outFaceOffsets)
921 {
922 return 0;
923 }
924 }
925
926 // Split progress range
927 float progressRange[2] = { 0, 0 };
928 this->GetProgressRange(progressRange);
929 float fractions[5] = { 0, 0.2f, 0.4f, 0.6f, 1 };
930
931 // Set range of progress for offsets array.
932 this->SetProgressRange(progressRange, 0, fractions);
933
934 //
935 // Start by reading polyhedron_to_face arrays
936 //
937 // ------------------------ Read polyhedron_to_face offsets -------------------------------------
938 vtkSmartPointer<vtkDataArray> polyhedronCellOffsets;
939 {
940 vtkXMLDataElement* polyOffsets = this->FindDataArrayWithName(eCells, "polyhedron_offsets");
941 if (!polyOffsets && !this->AbortExecute)
942 {
943 vtkErrorMacro("Cannot read polyhedron cell offsets from "
944 << eCells->GetName() << " in piece " << this->Piece
945 << " because the \"polyhedron_offsets\" array could not be found.");
946 return 0;
947 }
948
949 if (this->AbortExecute)
950 {
951 return 0;
952 }
953
954 auto aOffsets = vtk::TakeSmartPointer(this->CreateArray(polyOffsets));
955 if (!aOffsets)
956 {
957 vtkErrorMacro("Polyhedron cell offsets array missing from " << eCells->GetName());
958 return 0;
959 }
960
961 if (!aOffsets->IsA("vtkDataArray"))
962 {
963 vtkErrorMacro(
964 "Cannot cast polyhedron cell offsets from " << eCells->GetName() << " to vtkDataArray.");
965 return 0;
966 }
967
968 polyhedronCellOffsets = vtkArrayDownCast<vtkDataArray>(aOffsets.Get());

Callers 1

ReadPieceDataMethod · 0.80

Calls 15

MatchArrayTypesFunction · 0.85
FindDataArrayWithNameMethod · 0.80
IsAMethod · 0.80
ReadArrayValuesMethod · 0.80
ExecuteFunction · 0.50
NewFunction · 0.50
GetProgressRangeMethod · 0.45
SetProgressRangeMethod · 0.45
GetNameMethod · 0.45
CreateArrayMethod · 0.45
GetMethod · 0.45
GetNumberOfComponentsMethod · 0.45

Tested by

no test coverage detected