diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-10-27 14:42:15 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-10-27 14:42:15 -0400 |
commit | a53e0ecf6d3e5d3bb3ca32fa800f9eb17ff8ba1e (patch) | |
tree | 7dc71ec02e89dada9c8abc349fa15d50be759b59 | |
parent | 480726c7a04db36096151d0cc529c446ef3df97f (diff) | |
download | clp_fortran-a53e0ecf6d3e5d3bb3ca32fa800f9eb17ff8ba1e.tar.gz clp_fortran-a53e0ecf6d3e5d3bb3ca32fa800f9eb17ff8ba1e.zip |
Implemented status enums. Implemented additional Fortran wrappers for getElements and any procedures returning int arrays.
-rw-r--r-- | libClpFortran.prj | 4 | ||||
-rw-r--r-- | src/clp.f90 | 96 | ||||
-rw-r--r-- | src/clp_constants.F90 | 16 |
3 files changed, 109 insertions, 7 deletions
diff --git a/libClpFortran.prj b/libClpFortran.prj index e47772e..8c4a184 100644 --- a/libClpFortran.prj +++ b/libClpFortran.prj @@ -15,7 +15,9 @@ "open":"1" },{ "filename":"src/clp_interface_utils.f90", - "enabled":"1" + "enabled":"1", + "panel":1, + "open":"1" },{ "filename":"src/clp_types.f90", "enabled":"1" diff --git a/src/clp.f90 b/src/clp.f90 index 427ec55..2c8692a 100644 --- a/src/clp.f90 +++ b/src/clp.f90 @@ -401,21 +401,25 @@ module clp type(c_ptr), value :: model type(c_ptr) :: Clp_getVectorStarts_C end function - function Clp_getIndices(model) bind(C,name="Clp_getIndices") + + function Clp_getIndices_C(model) bind(C,name="Clp_getIndices") use iso_c_binding type(c_ptr), value :: model - type(c_ptr) :: Clp_getIndices + type(c_ptr) :: Clp_getIndices_C end function - function Clp_getVectorLengths(model) bind(C,name="Clp_getVectorLengths") + + function Clp_getVectorLengths_C(model) bind(C,name="Clp_getVectorLengths") use iso_c_binding type(c_ptr), value :: model - type(c_ptr) :: Clp_getVectorLengths + type(c_ptr) :: Clp_getVectorLengths_C end function - function Clp_getElements(model) bind(C,name="Clp_getElements") + + function Clp_getElements_C(model) bind(C,name="Clp_getElements") use iso_c_binding type(c_ptr), value :: model - type(c_ptr) :: Clp_getElements + type(c_ptr) :: Clp_getElements_C end function + function Clp_objectiveValue(model) bind(C,name="Clp_objectiveValue") use iso_c_binding type(c_ptr), value :: model @@ -1616,4 +1620,84 @@ contains end subroutine Clp_freeRay + function Clp_getIndices(model) result(res) + use iso_c_binding + implicit none + + type(c_ptr) :: model + integer(c_int), dimension(:), pointer :: res + integer::nrows + + type(c_ptr) :: c_res + + res => null() + + c_res = Clp_getIndices_C(model) + if(c_associated(c_res)) then + nrows = Clp_Numberrows(model) + call c_f_pointer(c_res, res, (/ nrows /)) + end if + + end function Clp_getIndices + + function Clp_getVectorLengths(model) result(res) + use iso_c_binding + implicit none + + type(c_ptr) :: model + integer(c_int), dimension(:), pointer :: res + integer::ncols + + type(c_ptr) :: c_res + + res => null() + + c_res = Clp_getVectorLengths_C(model) + if(c_associated(c_res)) then + ncols = Clp_Numbercolumns(model) + call c_f_pointer(c_res, res, (/ ncols /)) + end if + + end function Clp_getVectorLengths + + function Clp_getElements(model) result(res) + use iso_c_binding + use clp_constants + implicit none + + type(c_ptr) :: model + real(c_double), dimension(:), pointer :: res + integer :: n + + type(c_ptr) :: c_res + + res => null() + + c_res = Clp_getElements_C(model) + if(c_associated(c_res)) then + n = Clp_getNumElements(model) + call c_f_pointer(c_res, res, (/ n /)) + end if + + end function Clp_getElements + + subroutine Clp_integerInformation(model, str) + use iso_c_binding + use clp_interface_utils + implicit none + + type(c_ptr) :: model + character(*), intent(out) :: str + + type(c_ptr) :: cstr + + str = ' ' + + cstr = Clp_integerInformation_C(model) + if(c_associated(cstr)) then + call populate_fortran_string(cstr, str) + end if + + end subroutine Clp_integerInformation + end module clp diff --git a/src/clp_constants.F90 b/src/clp_constants.F90 index bf7b285..5a44089 100644 --- a/src/clp_constants.F90 +++ b/src/clp_constants.F90 @@ -11,4 +11,20 @@ module clp_constants integer, parameter :: CoinBigIndex_t = c_long_long #endif + enum, bind(c) + enumerator :: Status_isFree = 0 + enumerator :: Status_basic + enumerator :: Status_atUpperBound + enumerator :: Status_atLowerBound + enumerator :: Status_superBasic + enumerator :: Status_isFixed + end enum + + enum, bind(c) + enumerator :: FakeBound_noFake = 0 + enumerator :: FakeBound_lowerFake + enumerator :: FakeBound_upperFake + enumerator :: FakeBound_bothFake + end enum + end module clp_constants |