From 8e4d4ae7b4f1d0b350e5c2942eb190bb555460a9 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Fri, 16 Oct 2020 13:42:40 -0400 Subject: Additional string and array routines updated --- src/clp.f90 | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 12 deletions(-) (limited to 'src/clp.f90') diff --git a/src/clp.f90 b/src/clp.f90 index b6c90bb..2fe45a9 100644 --- a/src/clp.f90 +++ b/src/clp.f90 @@ -77,27 +77,31 @@ module clp integer(c_int) :: Clp_readMps_C end function - subroutine Clp_copyInIntegerInformation(model,information) bind(C,name="Clp_copyInIntegerInformation") + subroutine Clp_copyInIntegerInformation_C(model,information) bind(C,name="Clp_copyInIntegerInformation") use iso_c_binding type(c_ptr), value :: model - character(c_char) :: information(*) + type(c_ptr), value :: information end subroutine + subroutine Clp_deleteIntegerInformation(model) bind(C,name="Clp_deleteIntegerInformation") use iso_c_binding type(c_ptr), value :: model end subroutine + subroutine Clp_resize(model,newNumberRows,newNumberColumns) bind(C,name="Clp_resize") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::newNumberRows integer(c_int), value ::newNumberColumns end subroutine + subroutine Clp_deleteRows(model,number,which) bind(C,name="Clp_deleteRows") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::number - type(c_ptr), value :: which + integer(c_int), dimension(*) :: which end subroutine + subroutine Clp_addRows(model,number,rowLower, & rowUpper,rowStarts,columns,elements) bind(C,name="Clp_addRows") use iso_c_binding @@ -109,12 +113,14 @@ module clp type(c_ptr), value :: columns real(c_double) :: elements(*) end subroutine + subroutine Clp_deleteColumns(model,number,which) bind(C,name="Clp_deleteColumns") use iso_c_binding type(c_ptr), value :: model - integer(c_int), value ::number - type(c_ptr), value :: which + integer(c_int), value :: number + integer(kind=c_int), dimension(*) :: which end subroutine + subroutine Clp_addColumns(model,number,columnLower,columnUpper, & objective,columnStarts,rows,elements) bind(C,name="Clp_addColumns") use iso_c_binding @@ -123,108 +129,128 @@ module clp real(c_double) :: columnLower(*) real(c_double) :: columnUpper(*) real(c_double) :: objective(*) - type(c_ptr), value :: columnStarts - type(c_ptr), value :: rows + integer(c_long) :: columnStarts(*) + integer(c_int) :: rows(*) real(c_double) :: elements(*) end subroutine + subroutine Clp_chgRowLower(model,rowLower) bind(C,name="Clp_chgRowLower") use iso_c_binding type(c_ptr), value :: model real(c_double) :: rowLower(*) end subroutine + subroutine Clp_chgRowUpper(model,rowUpper) bind(C,name="Clp_chgRowUpper") use iso_c_binding type(c_ptr), value :: model real(c_double) :: rowUpper(*) end subroutine + subroutine Clp_chgColumnLower(model,columnLower) bind(C,name="Clp_chgColumnLower") use iso_c_binding type(c_ptr), value :: model real(c_double) :: columnLower(*) end subroutine + subroutine Clp_chgColumnUpper(model,columnUpper) bind(C,name="Clp_chgColumnUpper") use iso_c_binding type(c_ptr), value :: model real(c_double) :: columnUpper(*) end subroutine + subroutine Clp_chgObjCoefficients(model,objIn) bind(C,name="Clp_chgObjCoefficients") use iso_c_binding type(c_ptr), value :: model real(c_double) :: objIn(*) end subroutine + subroutine Clp_dropNames(model) bind(C,name="Clp_dropNames") use iso_c_binding type(c_ptr), value :: model end subroutine + subroutine Clp_copyNames(model,rowNames,columnNames) bind(C,name="Clp_copyNames") use iso_c_binding type(c_ptr), value :: model character(c_char) :: rowNames(*) character(c_char) :: columnNames(*) end subroutine + function Clp_numberRows(model) bind(C,name="Clp_numberRows") use iso_c_binding type(c_ptr), value :: model integer(c_int) :: Clp_numberRows end function + function Clp_numberColumns(model) bind(C,name="Clp_numberColumns") use iso_c_binding type(c_ptr), value :: model integer(c_int) :: Clp_numberColumns end function + function Clp_primalTolerance(model) bind(C,name="Clp_primalTolerance") use iso_c_binding type(c_ptr), value :: model real(c_double) :: Clp_primalTolerance end function + subroutine Clp_setPrimalTolerance(model,value) bind(C,name="Clp_setPrimalTolerance") use iso_c_binding type(c_ptr), value :: model real(c_double), value :: value end subroutine + function Clp_dualTolerance(model) bind(C,name="Clp_dualTolerance") use iso_c_binding type(c_ptr), value :: model real(c_double) :: Clp_dualTolerance end function + subroutine Clp_setDualTolerance(model,value) bind(C,name="Clp_setDualTolerance") use iso_c_binding type(c_ptr), value :: model real(c_double), value :: value end subroutine + function Clp_dualObjectiveLimit(model) bind(C,name="Clp_dualObjectiveLimit") use iso_c_binding type(c_ptr), value :: model real(c_double) :: Clp_dualObjectiveLimit end function + subroutine Clp_setDualObjectiveLimit(model,value) bind(C,name="Clp_setDualObjectiveLimit") use iso_c_binding type(c_ptr), value :: model real(c_double), value :: value end subroutine + function Clp_objectiveOffset(model) bind(C,name="Clp_objectiveOffset") use iso_c_binding type(c_ptr), value :: model real(c_double) :: Clp_objectiveOffset end function + subroutine Clp_setObjectiveOffset(model,value) bind(C,name="Clp_setObjectiveOffset") use iso_c_binding type(c_ptr), value :: model real(c_double), value :: value end subroutine - subroutine Clp_problemName(model,maxNumberCharacters,array) bind(C,name="Clp_problemName") + + subroutine Clp_problemName_C(model,maxNumberCharacters,array) bind(C,name="Clp_problemName") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::maxNumberCharacters - character(c_char) :: array(*) + type(c_ptr), value :: array end subroutine - function Clp_setProblemName(model,maxNumberCharacters,array) bind(C,name="COINLINKAGEClp_setProblemName") + + function Clp_setProblemName_C(model,maxNumberCharacters,array) bind(C,name="Clp_setProblemName") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::maxNumberCharacters - character(c_char) :: array(*) - integer(c_int) :: COINLINKAGEClp_setProblemName + type(c_ptr) :: array + integer(c_int) :: Clp_setProblemName_C end function + function Clp_numberIterations(model) bind(C,name="Clp_numberIterations") use iso_c_binding type(c_ptr), value :: model @@ -961,5 +987,61 @@ contains end function Clp_readMps + subroutine Clp_copyInIntegerInformation(model, information) + use clp_interface_utils + use iso_c_binding + implicit none + + type(c_ptr), intent(in)::model + character(len=*), intent(in)::information + type(c_ptr)::c_info + + c_info = allocate_and_populate_c_string(information) + + call Clp_copyInIntegerInformation_C(model, c_info) + + call c_free(c_info) + + end subroutine Clp_copyInIntegerInformation + + function Clp_setProblemName(model, maxNumberCharacters, array) + use clp_interface_utils + use iso_c_binding + implicit none + + type(c_ptr), intent(in)::model + integer, intent(in)::maxNumberCharacters + character(len=*)::array + + type(c_ptr)::c_array + + integer::Clp_setProblemName + + c_array = allocate_and_populate_c_string(array) + + Clp_setProblemName = Clp_setProblemName_C(model, maxNumberCharacters, c_array) + + call c_free(c_array) + + end function Clp_SetProblemName + + subroutine Clp_problemName(model,maxNumberCharacters,array) + use clp_interface_utils + use iso_c_binding + implicit none + + type(c_ptr) :: model + integer(c_int), intent(in) :: maxNumberCharacters + character(len=*) :: array + + type(c_ptr)::c_array + + c_array = allocate_and_populate_c_string(array) + + call Clp_problemName_C(model, maxNumberCharacters, c_array) + + call c_free(c_array) + + end subroutine Clp_problemName end module clp -- cgit v1.2.3