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

Method GetArray

Wrapping/PythonCore/vtkPythonArgs.cxx:1173–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171
1172// For an array of smart pointers
1173bool vtkPythonArgs::GetArray(vtkSmartPointerBase* a, size_t n, const char* classname)
1174{
1175 PyObject* o = PyTuple_GetItem(this->Args, this->I++);
1176 if (a)
1177 {
1178 Py_ssize_t m = static_cast<Py_ssize_t>(n);
1179
1180 if (PySequence_Check(o))
1181 {
1182 m = PySequence_Size(o);
1183 if (m == static_cast<Py_ssize_t>(n))
1184 {
1185 bool r = true;
1186 for (Py_ssize_t i = 0; i < m && r; i++)
1187 {
1188 r = false;
1189 PyObject* s = PySequence_GetItem(o, i);
1190 if (s)
1191 {
1192 vtkObjectBase* ob = vtkPythonUtil::GetPointerFromObject(s, classname);
1193 if (ob || s == Py_None)
1194 {
1195 r = true;
1196 a[i] = ob;
1197 }
1198 Py_DECREF(s);
1199 }
1200 }
1201 return r;
1202 }
1203 }
1204
1205 return vtkPythonSequenceError(o, n, m);
1206 }
1207
1208 return true;
1209}
1210
1211//------------------------------------------------------------------------------
1212// Define all the GetNArray methods in the class.

Callers 9

field_dataFunction · 0.45
meshFunction · 0.45
writeDataMethod · 0.45
writeDataMethod · 0.45
convertMethod · 0.45
extractRequiredFieldsFunction · 0.45
GetLinesFromPolygonMethod · 0.45

Calls 1

vtkPythonSequenceErrorFunction · 0.85

Tested by

no test coverage detected