Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
d1106919
Commit
d1106919
authored
Sep 15, 2017
by
Georg Martin Reinke
Browse files
simplify load_cim
parent
1daa562d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/PyComponent.cpp
View file @
d1106919
...
...
@@ -108,19 +108,8 @@ PyObject* DPsim::pyLoadCim(PyObject* self, PyObject* args) {
std
::
vector
<
BaseComponent
*>
comps
=
reader
->
getComponents
();
list
=
PyList_New
(
comps
.
size
());
for
(
int
i
=
0
;
i
<
comps
.
size
();
i
++
)
{
// corresponds to "pyComp = dpsim.Component()" in Python
PyObject
*
emptyTuple
=
PyTuple_New
(
0
);
PyComponent
*
pyComp
=
(
PyComponent
*
)
PyObject_CallObject
((
PyObject
*
)
&
PyComponentType
,
emptyTuple
);
Py_DECREF
(
emptyTuple
);
if
(
!
pyComp
)
{
Py_DECREF
(
list
);
delete
reader
;
return
nullptr
;
}
/*
PyComponent
*
pyComp
=
PyObject_New
(
PyComponent
,
&
PyComponentType
);
PyObject_Init
((
PyObject
*
)
pyComp
,
&
PyComponentType
);
*/
pyComp
->
comp
=
comps
[
i
];
PyList_SET_ITEM
(
list
,
i
,
(
PyObject
*
)
pyComp
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment