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
6144a88b
Commit
6144a88b
authored
Jul 29, 2013
by
peastman
Browse files
Merge pull request #82 from rmcgibbo/setLength
Fix segfault when positions are not 3 dimensional.
parents
1c3d149d
2ad438b7
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 @
6144a88b
...
...
@@ -2,7 +2,7 @@
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
%
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
;
PyObject
*
o
;
PyObject
*
o1
;
...
...
@@ -10,6 +10,11 @@
pLength
=
(
int
)
PySequence_Length
(
$
input
)
;
for
(
i
=
0
;
i
<
pLength
;
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
)
;
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