Fixed segfault in Func module when using numpy
The C++ py_func_new function assumes it's being passed a 1-dimensional array, but numpy generates 0-dimensional arrays for scalar inputs to array / asarray, e.g. when using Func.Sin.
This commit is contained in:
parent
5e81697129
commit
54315d4472
1 changed files with 4 additions and 1 deletions
|
|
@ -43,7 +43,10 @@ class Func1:
|
|||
self._own = 1
|
||||
self._func_id = 0
|
||||
self._typ = typ
|
||||
self.coeffs = asarray(coeffs,'d')
|
||||
if _cantera.nummod == 'numpy':
|
||||
self.coeffs = array(coeffs, dtype=float, ndmin=1)
|
||||
else:
|
||||
self.coeffs = asarray(coeffs,'d')
|
||||
self._func_id = _cantera.func_new(typ, n, self.coeffs)
|
||||
|
||||
def __del__(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue