aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-10-26 16:58:08 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-10-26 16:58:08 -0400
commitb1be8b0f5ff9d32756c98a7f7fa6d9023d124527 (patch)
tree4dfe36c444f921754626a7e0220852403eb02788 /src
parent55861d4285709bc2df22799006fe8835e25721df (diff)
downloadclp_fortran-b1be8b0f5ff9d32756c98a7f7fa6d9023d124527.tar.gz
clp_fortran-b1be8b0f5ff9d32756c98a7f7fa6d9023d124527.zip
Implemented Fortran interfaces for row and column name subroutines
Diffstat (limited to 'src')
-rw-r--r--src/clp.f9055
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