Fortran interface to NVector returns a pointer with the wrong dimension
When using the Fortran 2003 interface to Sundial, retrieved arrays from NVectors are not the correct dimension
https://github.com/LLNL/sundials/blob/e2f29c34f324829302037a1492db480be8828084/src/sundials/fmod/fsundials_nvector_mod.f90#L824
The Fortran-C interface assumes NVector arrays are always length 1. So, for example when I do
type(N_Vector) :: sunvec_y
real(c_double), pointer :: yvec(:)
yvec => FN_VGetArrayPointer(sunvec_y)
then yvec is a fortran pointer to an array of length 1, instead of the actual length of the NVector. Instead, yvec should be given the proper length during the call to FN_VGetArrayPointer
You can try changing the line
call c_f_pointer(fresult, swig_result, [1])
to
call c_f_pointer(fresult, swig_result, [F_NVGetLength(v)])
That works (returned array has right dimension) except you have a little typo. It should be
call c_f_pointer(fresult, swig_result, [FN_VGetLength(v)])
Temporary fix in place with #214.