diff options
-rw-r--r-- | src/clp.f90 | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/src/clp.f90 b/src/clp.f90 index 4efaa29..2590121 100644 --- a/src/clp.f90 +++ b/src/clp.f90 @@ -498,17 +498,17 @@ module clp type(c_ptr), value :: model integer(c_int) :: Clp_lengthNames end function - subroutine Clp_rowName(model,iRow,name) bind(C,name="Clp_rowName") + subroutine Clp_rowName_C(model,iRow,np) bind(C,name="Clp_rowName") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::iRow - character(c_char) :: name(*) + type(c_ptr), value :: np end subroutine - subroutine Clp_columnName(model,iColumn,name) bind(C,name="Clp_columnName") + subroutine Clp_columnName_C(model,iColumn,np) bind(C,name="Clp_columnName") use iso_c_binding type(c_ptr), value :: model integer(c_int), value ::iColumn - character(c_char) :: name(*) + type(c_ptr), value :: np end subroutine function Clp_initialSolve(model) bind(C,name="Clp_initialSolve") use iso_c_binding @@ -1088,11 +1088,15 @@ contains call Clp_copyNames_C(model, c_loc(rn_c), c_loc(cn_c)) do i = 1, size(rowNames) - call c_free(rn_c(i)) + if(c_associated(rn_c(i))) then + call c_free(rn_c(i)) + end if end do do i = 1, size(columnNames) - call c_free(cn_c(i)) + if(c_associated(cn_c(i))) then + call c_free(cn_c(i)) + end if end do deallocate(rn_c) @@ -1100,4 +1104,43 @@ contains end subroutine Clp_copyNames + + subroutine Clp_rowName(model,iRow,name) + use iso_c_binding + use clp_interface_utils + implicit none + + type(c_ptr) :: model + integer, intent(in)::iRow + character(*), intent(in) :: name + + type(c_ptr) :: np + + np = allocate_and_populate_c_string(name) + if(c_associated(np)) then + call Clp_rowName_C(model, int(iRow, kind=c_int), np) + call c_free(np) + end if + + end subroutine Clp_rowName + + subroutine Clp_columnName(model,iColumn,name) + use iso_c_binding + use clp_interface_utils + implicit none + + type(c_ptr) :: model + integer, intent(in)::iColumn + character(*), intent(in) :: name + + type(c_ptr) :: np + + np = allocate_and_populate_c_string(name) + if(c_associated(np)) then + call Clp_rowName_C(model, int(iColumn, kind=c_int), np) + call c_free(np) + end if + + end subroutine Clp_columnName + end module clp |