diff --git a/cmf/__init__.py b/cmf/__init__.py index 9925ee47..3cf1668a 100644 --- a/cmf/__init__.py +++ b/cmf/__init__.py @@ -22,8 +22,7 @@ from .timetools import StopWatch, datetime_to_cmf, timerange -__version__ = '2.0.0b5' -__compiletime__ = 'Mon Aug 30 17:45:30 2021' +__version__ = '2.0.0b6' from .cmf_core import connect_cells_with_flux as __ccwf diff --git a/cmf/cmf_core.py b/cmf/cmf_core.py index 51ba36f7..1c8e4db1 100644 --- a/cmf/cmf_core.py +++ b/cmf/cmf_core.py @@ -423,7 +423,6 @@ def __format__(self, fmt): # Register Time in _cmf_core: _cmf_core.Time_swigregister(Time) -__compiledate__ = cvar.__compiledate__ Pi = cvar.Pi class Date(object): @@ -2012,6 +2011,7 @@ def __init__(self, *args): global_water_balance = _swig_new_instance_method(_cmf_core.node_list_global_water_balance) water_balance = _swig_new_instance_method(_cmf_core.node_list_water_balance) conc = _swig_new_instance_method(_cmf_core.node_list_conc) + set_solute_source = _swig_new_instance_method(_cmf_core.node_list_set_solute_source) get_fluxes_to = _swig_new_instance_method(_cmf_core.node_list_get_fluxes_to) get_fluxes3d_to = _swig_new_instance_method(_cmf_core.node_list_get_fluxes3d_to) get_fluxes3d = _swig_new_instance_method(_cmf_core.node_list_get_fluxes3d) diff --git a/cmf/cmf_core_src/cmf_wrap.cpp b/cmf/cmf_core_src/cmf_wrap.cpp index 0ba7b4a5..2a7bc777 100644 --- a/cmf/cmf_core_src/cmf_wrap.cpp +++ b/cmf/cmf_core_src/cmf_wrap.cpp @@ -3542,6 +3542,16 @@ static bool check_time(PyObject* dt) { +#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE PyObject* +SWIG_From_long_SS_long (long long value) +{ + return ((value < LONG_MIN) || (value > LONG_MAX)) ? + PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value)); +} +#endif + + SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) { @@ -3555,48 +3565,6 @@ SWIG_pchar_descriptor(void) } -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - if (carray) { - if (size > INT_MAX) { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? - SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); - } else { -#if PY_VERSION_HEX >= 0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); -#else - return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); -#endif -#else - return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); -#endif - } - } else { - return SWIG_Py_Void(); - } -} - - -SWIGINTERNINLINE PyObject * -SWIG_From_std_string (const std::string& s) -{ - return SWIG_FromCharPtrAndSize(s.data(), s.size()); -} - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_long_SS_long (long long value) -{ - return ((value < LONG_MIN) || (value > LONG_MAX)) ? - PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value)); -} -#endif - - SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { @@ -3750,6 +3718,38 @@ SWIG_AsVal_char (PyObject * obj, char *val) } +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { +#if PY_VERSION_HEX >= 0x03000000 +#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#else + return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); +#endif +#else + return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); +#endif + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_std_string (const std::string& s) +{ + return SWIG_FromCharPtrAndSize(s.data(), s.size()); +} + + #define cmf_math_timeseries_begin_get(self_) new cmf::math::Time(self_->begin()) @@ -7811,20 +7811,6 @@ SWIGINTERN PyObject *point_vector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObj return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN int Swig_var___compiledate___set(PyObject *) { - SWIG_Error(SWIG_AttributeError,"Variable __compiledate__ is read-only."); - return 1; -} - - -SWIGINTERN PyObject *Swig_var___compiledate___get(void) { - PyObject *pyobj = 0; - - pyobj = SWIG_From_std_string(static_cast< std::string >(__compiledate__)); - return pyobj; -} - - SWIGINTERN PyObject *_wrap_minimum(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; real arg1 ; @@ -16265,7 +16251,7 @@ SWIGINTERN PyObject *_wrap_state_list___getitem(PyObject *SWIGUNUSEDPARM(self), { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__math__StateVariable_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -16275,7 +16261,7 @@ SWIGINTERN PyObject *_wrap_state_list___getitem(PyObject *SWIGUNUSEDPARM(self), } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::SoluteStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::SoluteStorage */ { @@ -21693,7 +21679,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::RainSource*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::RainSource */ { @@ -21703,7 +21689,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::DirichletBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::DirichletBoundary */ { @@ -21713,7 +21699,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::NeumannBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::NeumannBoundary */ { @@ -21723,7 +21709,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SoilLayer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SoilLayer */ { @@ -21733,7 +21719,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::aquifer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::aquifer */ { @@ -21743,7 +21729,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::Reach*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::Reach */ { @@ -21753,7 +21739,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::OpenWaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::OpenWaterStorage */ { @@ -21763,7 +21749,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -21773,7 +21759,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::MacroPore*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::MacroPore */ { @@ -21783,7 +21769,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_0(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SurfaceWater*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SurfaceWater */ { @@ -21857,7 +21843,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::RainSource*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::RainSource */ { @@ -21867,7 +21853,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::DirichletBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::DirichletBoundary */ { @@ -21877,7 +21863,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::NeumannBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::NeumannBoundary */ { @@ -21887,7 +21873,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SoilLayer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SoilLayer */ { @@ -21897,7 +21883,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::aquifer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::aquifer */ { @@ -21907,7 +21893,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::Reach*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::Reach */ { @@ -21917,7 +21903,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::OpenWaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::OpenWaterStorage */ { @@ -21927,7 +21913,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -21937,7 +21923,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::MacroPore*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::MacroPore */ { @@ -21947,7 +21933,7 @@ SWIGINTERN PyObject *_wrap_flux_connection_get_target__SWIG_1(PyObject *SWIGUNUS } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SurfaceWater*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SurfaceWater */ { @@ -28703,7 +28689,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::RainSource*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::RainSource */ { @@ -28713,7 +28699,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::DirichletBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::DirichletBoundary */ { @@ -28723,7 +28709,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::NeumannBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::NeumannBoundary */ { @@ -28733,7 +28719,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SoilLayer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SoilLayer */ { @@ -28743,7 +28729,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::aquifer*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::aquifer */ { @@ -28753,7 +28739,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::Reach*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::Reach */ { @@ -28763,7 +28749,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::OpenWaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::OpenWaterStorage */ { @@ -28773,7 +28759,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -28783,7 +28769,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::MacroPore*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::MacroPore */ { @@ -28793,7 +28779,7 @@ SWIGINTERN PyObject *_wrap_node_list___get(PyObject *SWIGUNUSEDPARM(self), PyObj } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SurfaceWater*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SurfaceWater */ { @@ -29216,6 +29202,65 @@ SWIGINTERN PyObject *_wrap_node_list_conc(PyObject *SWIGUNUSEDPARM(self), PyObje } +SWIGINTERN PyObject *_wrap_node_list_set_solute_source(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + cmf::water::node_list *arg1 = (cmf::water::node_list *) 0 ; + cmf::water::solute *arg2 = 0 ; + cmf::math::num_array arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + char * kwnames[] = { + (char *)"self", (char *)"_Solute", (char *)"source_fluxes", NULL + }; + ptrdiff_t result; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:node_list_set_solute_source", kwnames, &obj0, &obj1, &obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cmf__water__node_list, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "node_list_set_solute_source" "', argument " "1"" of type '" "cmf::water::node_list *""'"); + } + arg1 = reinterpret_cast< cmf::water::node_list * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_cmf__water__solute, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "node_list_set_solute_source" "', argument " "2"" of type '" "cmf::water::solute const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "node_list_set_solute_source" "', argument " "2"" of type '" "cmf::water::solute const &""'"); + } + arg2 = reinterpret_cast< cmf::water::solute * >(argp2); + { + // Convert a array_wrapper from numpy array + double * data=0; + ptrdiff_t size = from_npy_array(obj2,&data); + if (!data) { + SWIG_exception_fail(SWIG_TypeError,"Input data is not 'array-like' (in the sense of numpy arrays)"); + return NULL; + } + arg3 = cmf::math::num_array(size,data); + } + { + try { + result = (arg1)->set_solute_source((cmf::water::solute const &)*arg2,arg3); + } catch (const std::out_of_range& e) { + SWIG_exception(SWIG_IndexError, e.what()); + } catch (const std::exception& e) { + SWIG_exception(SWIG_RuntimeError, e.what()); + } catch (...) { + SWIG_exception(SWIG_RuntimeError, "unknown error"); + } + } + resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_node_list_get_fluxes_to(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; cmf::water::node_list *arg1 = (cmf::water::node_list *) 0 ; @@ -39332,7 +39377,7 @@ SWIGINTERN PyObject *_wrap_Cell___get_rain_source(PyObject *SWIGUNUSEDPARM(self) { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::RainfallStationReference::ptr*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::RainfallStationReference::ptr */ { @@ -39342,7 +39387,7 @@ SWIGINTERN PyObject *_wrap_Cell___get_rain_source(PyObject *SWIGUNUSEDPARM(self) } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::ConstantRainSource::ptr*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::ConstantRainSource::ptr */ { @@ -39352,7 +39397,7 @@ SWIGINTERN PyObject *_wrap_Cell___get_rain_source(PyObject *SWIGUNUSEDPARM(self) } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::atmosphere::IDWRainfall*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::atmosphere::IDWRainfall */ { @@ -39524,7 +39569,7 @@ SWIGINTERN PyObject *_wrap_Cell_get_surfacewater(PyObject *SWIGUNUSEDPARM(self), { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::upslope::SurfaceWater*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::upslope::SurfaceWater */ { @@ -39534,7 +39579,7 @@ SWIGINTERN PyObject *_wrap_Cell_get_surfacewater(PyObject *SWIGUNUSEDPARM(self), } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::DirichletBoundary*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::DirichletBoundary */ { @@ -39928,7 +39973,7 @@ SWIGINTERN PyObject *_wrap_Cell_get_storage(PyObject *SWIGUNUSEDPARM(self), PyOb { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__water__flux_node_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::river::OpenWaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::river::OpenWaterStorage */ { @@ -39938,7 +39983,7 @@ SWIGINTERN PyObject *_wrap_Cell_get_storage(PyObject *SWIGUNUSEDPARM(self), PyOb } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -48015,7 +48060,7 @@ SWIGINTERN PyObject *_wrap_SoilLayer_get_soil(PyObject *SWIGUNUSEDPARM(self), Py } { int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ if (!dcast) { cmf::upslope::BrooksCoreyRetentionCurve *dobj = dynamic_cast(result); if (dobj) { @@ -48024,7 +48069,7 @@ SWIGINTERN PyObject *_wrap_SoilLayer_get_soil(PyObject *SWIGUNUSEDPARM(self), Py } }/*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ if (!dcast) { cmf::upslope::VanGenuchtenMualem *dobj = dynamic_cast(result); if (dobj) { @@ -48033,7 +48078,7 @@ SWIGINTERN PyObject *_wrap_SoilLayer_get_soil(PyObject *SWIGUNUSEDPARM(self), Py } }/*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\factory.swg,72,%_factory_dispatch@*/ if (!dcast) { cmf::upslope::LinearRetention *dobj = dynamic_cast(result); if (dobj) { @@ -71079,7 +71124,7 @@ SWIGINTERN PyObject *_wrap_Integrator___getitem(PyObject *SWIGUNUSEDPARM(self), { if (!(result)) resultobj = SWIG_NewPointerObj(0,SWIGTYPE_p_std__shared_ptrT_cmf__math__StateVariable_t, SWIG_POINTER_OWN); int dcast = 0; - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,193,%formacro@*//*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::WaterStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::WaterStorage */ { @@ -71089,7 +71134,7 @@ SWIGINTERN PyObject *_wrap_Integrator___getitem(PyObject *SWIGUNUSEDPARM(self), } /*@SWIG@*/ - /*@SWIG:C:\Users\philipp\anaconda3\envs\cmf2\Library\bin\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ + /*@SWIG:C:\Apps\swigwin-4.0.2\Lib\typemaps\swigmacros.swg,185,%_formacro_1@*//*@SWIG:cmf\cmf_core_src\cmf_swiglib.i,74,%_node_down_cast@*/ if (dcast==0 && result) /*check for cmf::water::SoluteStorage*/ { std::shared_ptr output = std::dynamic_pointer_cast(result); if (output) /*flux_node is cmf::water::SoluteStorage */ { @@ -78862,6 +78907,14 @@ static PyMethodDef SwigMethods[] = { "Returns an array holding the concentration of all the flux nodes for\n" "the given solute. \n" ""}, + { "node_list_set_solute_source", (PyCFunction)(void(*)(void))_wrap_node_list_set_solute_source, METH_VARARGS|METH_KEYWORDS, "\n" + "node_list_set_solute_source(node_list self, solute _Solute, cmf::math::num_array source_fluxes) -> ptrdiff_t\n" + "ptrdiff_t set_solute_source(const cmf::water::solute &_Solute,\n" + "cmf::math::num_array source_fluxes)\n" + "\n" + "Sets the source flux of a solute storage associated with a node (node\n" + "has to be a water storage) \n" + ""}, { "node_list_get_fluxes_to", (PyCFunction)(void(*)(void))_wrap_node_list_get_fluxes_to, METH_VARARGS|METH_KEYWORDS, "\n" "node_list_get_fluxes_to(node_list self, node_list targets, Time t) -> cmf::math::num_array\n" "cmf::math::num_array get_fluxes_to(const cmf::water::node_list\n" @@ -84706,6 +84759,14 @@ static PyMethodDef SwigMethods_proxydocs[] = { "Returns an array holding the concentration of all the flux nodes for\n" "the given solute. \n" ""}, + { "node_list_set_solute_source", (PyCFunction)(void(*)(void))_wrap_node_list_set_solute_source, METH_VARARGS|METH_KEYWORDS, "\n" + "set_solute_source(node_list self, solute _Solute, cmf::math::num_array source_fluxes) -> ptrdiff_t\n" + "ptrdiff_t set_solute_source(const cmf::water::solute &_Solute,\n" + "cmf::math::num_array source_fluxes)\n" + "\n" + "Sets the source flux of a solute storage associated with a node (node\n" + "has to be a water storage) \n" + ""}, { "node_list_get_fluxes_to", (PyCFunction)(void(*)(void))_wrap_node_list_get_fluxes_to, METH_VARARGS|METH_KEYWORDS, "\n" "get_fluxes_to(node_list self, node_list targets, Time t) -> cmf::math::num_array\n" "cmf::math::num_array get_fluxes_to(const cmf::water::node_list\n" @@ -91088,7 +91149,6 @@ SWIG_init(void) { PyDateTime_IMPORT; - SWIG_addvarlink(globals, "__compiledate__", Swig_var___compiledate___get, Swig_var___compiledate___set); SWIG_addvarlink(globals, "Pi", Swig_var_Pi_get, Swig_var_Pi_set); SWIG_Python_SetConstant(d, "JULIANDAY_0_1_1900",SWIG_From_int(static_cast< int >(2415019))); SWIG_Python_SetConstant(d, "Time_ms_per_day",SWIG_From_long_SS_long(static_cast< long long >(cmf::math::Time::ms_per_day))); diff --git a/cmf/cmf_core_src/math/real.h b/cmf/cmf_core_src/math/real.h index e0d87d90..d7280f3e 100644 --- a/cmf/cmf_core_src/math/real.h +++ b/cmf/cmf_core_src/math/real.h @@ -26,7 +26,6 @@ typedef double real; const real REAL_MAX = std::numeric_limits::max(); #endif -const std::string __compiledate__ = std::string("cmf compiled ") + std::string(__DATE__) + " - " + std::string(__TIME__); // Some helper functions /// Returns the minimum of two values diff --git a/setup.py b/setup.py index 5a60bf2c..8aa9cf8b 100755 --- a/setup.py +++ b/setup.py @@ -31,20 +31,6 @@ from distutils.command.build_py import build_py import logging logging.basicConfig(level=logging.DEBUG) -version = '2.0.0b5' - -branchversion = version -try: - from pygit2 import Repository - head = Repository('.').head.shorthand - if head != 'master': - branchversion = version + '.' + head -except: - Repository = None - -print('cmf', branchversion) - - swig = False openmp = False @@ -63,7 +49,7 @@ def __init__(self, includepath, libpath, *libs, build_script=None, build_always= self.build_always = build_always def __repr__(self): - return self.libs[0] + ' - library' + return self.libs[0] + '-library' def as_win32(self): checked_libs = [] @@ -77,19 +63,27 @@ def as_win32(self): return [self.libpath], reversed(checked_libs), [] def as_posix(self): - # Move static libraries to extra_objects (with path) to ensure static linking in posix systems - if os.path.exists(self.libpath): - libpath = self.libpath - elif os.path.exists(self.libpath + '64'): - libpath = self.libpath + '64' - else: - raise FileNotFoundError("Can't find static library directory" + self.libpath) + def get_posix_path_to_lib(libname): + def lib_to_path(libpath, libname): + p = libpath + '/' + f'lib{libname}.a' + if os.path.exists(p): + return p + else: + return None + + def raise_if_none(path_to_lib): + if path_to_lib: + return path_to_lib + else: + raise FileNotFoundError(f"Can't find static library {libname} in {self.libpath}[64]") + + return raise_if_none( + lib_to_path(self.libpath, libname) or + lib_to_path(self.libpath + '64', libname) + ) - libfiles = ['{}/lib{}.a'.format(libpath, l) for l in self.libs] - for lf in libfiles: - if not os.path.exists(lf): - raise FileNotFoundError("Can't find static library " + lf) - return [], [], libfiles + # Move static libraries to extra_objects (with path) to ensure static linking in posix systems + return [], [], [get_posix_path_to_lib(l) for l in self.libs] def exists(self): try: @@ -255,20 +249,9 @@ def updateversion(): Doxyfile: set PROJECT_NUMBER """ logging.debug('updateversion()') - - try: - module_code = open('cmf/__init__.py').readlines() - except IOError: - pass - else: - fout = open('cmf/__init__.py', 'w') - for line in module_code: - if line.startswith('__version__'): - fout.write("__version__ = '{}'\n".format(branchversion)) - elif line.startswith('__compiletime__'): - fout.write("__compiletime__ = '{}'\n".format(time.ctime())) - else: - fout.write(line) + with open('cmf/__init__.py') as initfile: + t = initfile.read() + version = re.search('__version__ ?= ?\'(.*?)\'', t).group(1) try: doxycode = open('tools/Doxyfile').readlines() except IOError: @@ -280,7 +263,7 @@ def updateversion(): fout.write("PROJECT_NUMBER = {}\n".format(version)) else: fout.write(line) - + return version def pop_arg(arg): """ @@ -394,14 +377,11 @@ def make_cmf_core(): # Get the source files cmf_files = [] # get_source_files() - if not any('cmf_core' in sl.libs for sl in static_libraries): - print('search source files') - cmf_files += get_source_files() if swig: # Adding cmf.i when build_ext should perform the swig call cmf_files.append("cmf/cmf_core_src/cmf.i") - swig_opts = ['-c++', '-w512', '-w511', '-O', '-keyword', '-castmode', '-modern'] + swig_opts = ['-c++', '-w512', '-w511', '-O', '-keyword', '-castmode'] else: # Else use what we have there @@ -422,7 +402,7 @@ def make_cmf_core(): if __name__ == '__main__': - updateversion() + version = updateversion() openmp = not pop_arg('noopenmp') swig = pop_arg('swig') debug = not pop_arg('nodebug') @@ -448,7 +428,7 @@ def make_cmf_core(): ext_modules=ext, packages=['cmf', 'cmf.draw', 'cmf.geometry'], python_requires='>=3.7', - install_requires='numpy>=1.11.1', + install_requires=['numpy>=1.11.1', 'cmake>3.1.0'], keywords='hydrology catchment simulation toolbox', author='Philipp Kraft', author_email="philipp.kraft@umwelt.uni-giessen.de", diff --git a/tools/Doxyfile b/tools/Doxyfile index a46986ec..86decdb2 100644 --- a/tools/Doxyfile +++ b/tools/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = cmf # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2.0.0b5 +PROJECT_NUMBER = 2.0.0b6 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/docker-build.sh b/tools/docker-build.sh new file mode 100644 index 00000000..8df48ede --- /dev/null +++ b/tools/docker-build.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# This file should be used in a manylinux container to build several binaries +set -e -u -x + +function repair_wheel { + wheel="$1" + if ! auditwheel show "$wheel"; then + echo "Skipping non-platform wheel $wheel" + else + auditwheel repair "$wheel" --plat "$PLAT" -w /io/wheelhouse/ + fi +} + + +export CFLAGS="-fPIC" +export CXXFLAGS="-fPIC" +CMFDIR=/io/cmf +TOOLDIR=$CMFDIR/tools + +# Install solvers +SOLVERBUILDDIR=$CMFDIR/build/extern +rm -rf $SOLVERBUILDDIR +cmake -S ${TOOLDIR} -B ${SOLVERBUILDDIR} -DCMAKE_BUILD_TYPE=Release +make -C ${SOLVERBUILDDIR} + +# build cmf_core +CMFBUILDDIR=$CMFDIR/build/cmf_core +rm -rf $CMFBUILDDIR +CMFSOURCEDIR=$CMFDIR/cmf/cmf_core_src +cmake -S $CMFSOURCEDIR -B $CMFBUILDDIR -DCMAKE_BUILD_TYPE=Release +make -C $CMFBUILDDIR +make install -C $CMFBUILDDIR + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" install -r $CMFDIR/requirements.txt + "${PYBIN}/python" bdist_wheel +done + +# Bundle external shared libraries into the wheels +for whl in dist/*.whl; do + repair_wheel "$whl" +done + +# Install packages and test +for PYBIN in /opt/python/*/bin/; do + "${PYBIN}/pip" install python-manylinux-demo --no-index -f /io/wheelhouse + (cd "$HOME"; "${PYBIN}/nosetests" pymanylinuxdemo) +done \ No newline at end of file diff --git a/tools/install_solvers.sh b/tools/install_solvers.sh index 2ba3c252..4503f9c7 100755 --- a/tools/install_solvers.sh +++ b/tools/install_solvers.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -export CLAGS="-fPIC" +export CFLAGS="-fPIC" export CXXFLAGS="-fPIC" CWD=$PWD