Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
2ad438b7
Commit
2ad438b7
authored
Jul 26, 2013
by
Robert McGibbon
Browse files
Fix segfault when positions are not 3 dimensional.
parent
1c3d149d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
+6
-1
No files found.
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
View file @
2ad438b7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
%
typemap
(
in
)
std
::
vector
<
Vec3
>
&
(
std
::
vector
<
OpenMM
::
Vec3
>
vVec
)
{
%
typemap
(
in
)
std
::
vector
<
Vec3
>
&
(
std
::
vector
<
OpenMM
::
Vec3
>
vVec
)
{
// typemap -- %typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec)
// typemap -- %typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec)
int
i
,
pLength
;
int
i
,
pLength
,
itemLength
;
double
x
,
y
,
z
;
double
x
,
y
,
z
;
PyObject
*
o
;
PyObject
*
o
;
PyObject
*
o1
;
PyObject
*
o1
;
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
pLength
=
(
int
)
PySequence_Length
(
$
input
)
;
pLength
=
(
int
)
PySequence_Length
(
$
input
)
;
for
(
i
=
0
;
i
<
pLength
;
i
++
)
{
for
(
i
=
0
;
i
<
pLength
;
i
++
)
{
o
=
PySequence_GetItem
(
$
input
,
i
)
;
o
=
PySequence_GetItem
(
$
input
,
i
)
;
itemLength
=
(
int
)
PySequence_Length
(
o
)
;
if
(
itemLength
!=
3
)
{
PyErr_SetString
(
PyExc_TypeError
,
"Item must have length 3"
)
;
return
NULL
;
}
o1
=
PySequence_GetItem
(
o
,
0
)
;
o1
=
PySequence_GetItem
(
o
,
0
)
;
x
=
PyFloat_AsDouble
(
o1
)
;
x
=
PyFloat_AsDouble
(
o1
)
;
...
...
Write
Preview
Markdown
is supported
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