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

Method FindDataArrayWithName

IO/XML/vtkXMLUnstructuredDataReader.cxx:98–127  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

96
97//------------------------------------------------------------------------------
98vtkXMLDataElement* vtkXMLUnstructuredDataReader ::FindDataArrayWithName(
99 vtkXMLDataElement* eParent, const char* name)
100{
101 // Find a nested element that represents a data array with the given name.
102 // and proper TimeStep
103 int i;
104 for (i = 0; i < eParent->GetNumberOfNestedElements(); ++i)
105 {
106 vtkXMLDataElement* eNested = eParent->GetNestedElement(i);
107 if (strcmp(eNested->GetName(), "DataArray") == 0)
108 {
109 const char* aName = eNested->GetAttribute("Name");
110 if (aName && (strcmp(aName, name) == 0))
111 {
112 int numTimeSteps =
113 eNested->GetVectorAttribute("TimeStep", this->NumberOfTimeSteps, this->TimeSteps);
114 assert(numTimeSteps <= this->NumberOfTimeSteps);
115 // Check if CurrentTimeStep is in the array and particular field is also:
116 int isCurrentTimeInArray =
117 vtkXMLReader::IsTimeStepInArray(this->CurrentTimeStep, this->TimeSteps, numTimeSteps);
118 // If no time is specified or if time is specified and match then read
119 if (!numTimeSteps || isCurrentTimeInArray)
120 {
121 return eNested;
122 }
123 }
124 }
125 }
126 return nullptr;
127}
128
129//------------------------------------------------------------------------------
130vtkIdTypeArray* vtkXMLUnstructuredDataReader::ConvertToIdTypeArray(vtkDataArray* a)

Callers 5

ReadCellArrayMethod · 0.80
ReadFaceArrayMethod · 0.80
ReadFaceCellArrayMethod · 0.80
ReadPieceDataMethod · 0.80

Calls 6

GetNestedElementMethod · 0.80
GetVectorAttributeMethod · 0.80
assertFunction · 0.50
GetNameMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected