How to use the pyodesys.native.cvode.ModuleNotFoundError function in pyodesys

To help you get started, we’ve selected a few pyodesys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bjodah / pyodesys / pyodesys / native / cvode.py View on Github external
from ._base import _NativeCodeBase, _NativeSysBase, _compile_kwargs

get_include, config, _libs = import_("pycvodes", "get_include", "config", "_libs")

if sys.version_info < (3, 6, 0):
    class ModuleNotFoundError(ImportError):
        pass


class NativeCvodeCode(_NativeCodeBase):
    wrapper_name = '_cvode_wrapper'

    try:
        _realtype = config['REAL_TYPE']
        _indextype = config['INDEX_TYPE']
    except ModuleNotFoundError:
        _realtype = '#error "realtype_failed-to-import-pycvodes-or-too-old-version"'
        _indextype = '#error "indextype_failed-to-import-pycvodes-or-too-old-version"'

    namespace = {
        'p_includes': ['"odesys_anyode_iterative.hpp"'],
        'p_support_recoverable_error': True,
        'p_jacobian_set_to_zero_by_solver': True,
        'p_baseclass': 'OdeSysIterativeBase',
        'p_realtype': _realtype,
        'p_indextype': _indextype
    }
    _support_roots = True

    def __init__(self, *args, **kwargs):
        self.compile_kwargs = copy.deepcopy(_compile_kwargs)
        self.compile_kwargs['define'] = ['PYCVODES_NO_KLU={}'.format("0" if config.get('KLU', True) else "1"),