NOAA-OWP / t-route

Tree based hydrologic and hydraulic routing
Other
42 stars 45 forks source link

Combine noIC and NOLOOP MC fortran functions. #83

Open jameshalgren opened 4 years ago

jameshalgren commented 4 years ago

The noIC and NOLOOP versions of the fortran code are essentially identical. The only substantial difference is that the noIC version uses variables in a module which have to be pre-assigned, while the NOLOOP version uses a direct call.

(other differences are capitalization of variables and minor renaming of depth-->depthc)

We might consider picking one and archiving the other. @groutr: Are there benefits to the pre-assignment when we start talking about c-bindings?

src/fortran_routing/mc_pylink_v00/MC_singleSeg_singleTS/MCsingleSegStime_f2py_NOLOOP.f90 and src/fortran_routing/mc_pylink_v00/MC_singleSeg_singleTS/MCsingleSegStime_f2py_noIC_clean.f90

groutr commented 4 years ago

I prefer the direct call version because I think it's cleaner.

On Fri, Jul 10, 2020, 5:02 PM jameshalgren notifications@github.com wrote:

The noIC and NOLOOP versions of the fortran code are essentially identical. The only substantial difference is that the noIC version uses variables in a module which have to be pre-assigned, while the NOLOOP version uses a direct call.

(other differences are capitalization of variables and minor renaming of depth-->depthc)

We might consider picking one and archiving the other. @groutr https://github.com/groutr: Are there benefits to the pre-assignment when we start talking about c-bindings?

src/fortran_routing/mc_pylink_v00/MC_singleSeg_singleTS/MCsingleSegStime_f2py_NOLOOP.f90 and

src/fortran_routing/mc_pylink_v00/MC_singleSeg_singleTS/MCsingleSegStime_f2py_noIC_clean.f90

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NOAA-OWP/t-route/issues/83, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRPCXB4SW3AK5D5YPOSBHLR26FYBANCNFSM4OW626VQ .

groutr commented 4 years ago

Researching this a bit further, I think direct call is the simplest. If direct call is not possible (because you can't modify the fortran or some other consideration), then the solution seems to be mapping a C-struct to the common variables. Ideally, it would need to be done in a way that doesn't require the GIL. https://stackoverflow.com/questions/41153036/access-fortran-common-variables-from-cython

jameshalgren commented 3 years ago

Moving this to v01 technical debt. The discussion of enhancements to the V01 code may lead us back to this question. Or, it could become irrelevant.