MCPcopy Create free account
hub / github.com/SimVascular/SimVascular / GetGeometryObjects

Function GetGeometryObjects

Code/Source/PythonAPI/Geometry_PyModule.cxx:114–141  ·  view source on GitHub ↗

-------------------- GetGeometryObjects -------------------- Create a list of cvPolyData objects from a list of vtkPolyData objects. [TODO:DaveP] It would be good to use shared_ptr here to manage deleting cvPolyData objects but the sys_geom functions don't use them.

Source from the content-addressed store, hash-verified

112// functions don't use them.
113//
114static std::vector<cvPolyData*>
115GetGeometryObjects(PyUtilApiFunction& api, PyObject* objList)
116{
117 std::vector<cvPolyData*> cvPolyDataList;
118 auto numObjs = PyList_Size(objList);
119
120 if (numObjs == 0) {
121 api.error("The polydata list argument is empty.");
122 return cvPolyDataList;
123 }
124
125 for (int i = 0; i < numObjs; i++ ) {
126 auto obj = PyList_GetItem(objList, i);
127 auto polydata = GetVtkPolyData(api, obj);
128 if (polydata == nullptr) {
129 api.error("Index " + std::to_string(i) + " of the polydata list argument is not a vtkPolyData object.");
130 for (auto cvPolydata : cvPolyDataList) {
131 delete cvPolydata;
132 }
133 cvPolyDataList.clear();
134 return cvPolyDataList;
135 }
136 auto cvPolydata = new cvPolyData(polydata);
137 cvPolyDataList.push_back(cvPolydata);
138 }
139
140 return cvPolyDataList;
141}
142
143//////////////////////////////////////////////////////
144// M o d u l e F u n c t i o n s //

Callers 4

Geom_loftFunction · 0.85
Geom_loft_nurbsFunction · 0.85
Geom_all_unionFunction · 0.85

Calls 3

errorMethod · 0.80
clearMethod · 0.80
GetVtkPolyDataFunction · 0.70

Tested by

no test coverage detected