diff options
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--] | src/clp.f90 | 73 |
1 files changed, 64 insertions, 9 deletions
diff --git a/src/clp.f90 b/src/clp.f90 index 24fc769..9235c07 100644..100755 --- a/src/clp.f90 +++ b/src/clp.f90 @@ -49,21 +49,21 @@ module clp type(c_ptr), value :: solve end subroutine - subroutine Clp_loadProblem(model,numcols,numrows,start, & + subroutine Clp_loadProblem_C(model,numcols,numrows,start, & index,value,collb,colub,obj,rowlb,rowub) bind(C,name="Clp_loadProblem") use iso_c_binding use clp_constants type(c_ptr), value :: model integer(c_int), value ::numcols integer(c_int), value ::numrows - integer(CoinBigIndex_t) :: start(*) - integer(c_int) :: index(*) - real(c_double) :: value(*) - real(c_double) :: collb(*) - real(c_double) :: colub(*) - real(c_double) :: obj(*) - real(c_double) :: rowlb(*) - real(c_double) :: rowub(*) + type(c_ptr), value :: start + type(c_ptr), value :: index + type(c_ptr), value :: value + type(c_ptr), value :: collb + type(c_ptr), value :: colub + type(c_ptr), value :: obj + type(c_ptr), value :: rowlb + type(c_ptr), value :: rowub end subroutine subroutine Clp_loadQuadraticObjective(model,numberColumns, & @@ -1729,5 +1729,60 @@ contains call Clp_Registercallback_C(model, c_funloc(Clp_boundCallbackInterface)) end subroutine Clp_registerCallback + + subroutine Clp_loadProblem(model,numcols,numrows,start,vindex,vvalue,& + collb,colub,obj,rowlb,rowub) + use iso_c_binding + use clp_constants + implicit none + + type(c_ptr) :: model + integer(c_int), intent(in) ::numcols + integer(c_int), intent(in) ::numrows + integer(CoinBigIndex_t), dimension(:), target:: start ! ia + integer(c_int), dimension(:), target :: vindex ! ja + real(c_double), dimension(:), target :: vvalue + real(c_double), dimension(:), target, optional :: collb + real(c_double), dimension(:), target, optional :: colub + real(c_double), dimension(:), target, optional :: obj + real(c_double), dimension(:), target, optional :: rowlb + real(c_double), dimension(:), target, optional :: rowub + + type(c_ptr)::collb_ptr, colub_ptr, obj_ptr, rowlb_ptr, rowub_ptr + + if(present(collb)) then + collb_ptr = c_loc(collb) + else + collb_ptr = c_null_ptr + end if + + if(present(colub)) then + colub_ptr = c_loc(colub) + else + colub_ptr = c_null_ptr + end if + + if(present(obj)) then + obj_ptr = c_loc(obj) + else + obj_ptr = c_null_ptr + end if + + if(present(rowlb)) then + rowlb_ptr = c_loc(rowlb) + else + rowlb_ptr = c_null_ptr + end if + + if(present(rowub)) then + rowub_ptr = c_loc(rowub) + else + rowub_ptr = c_null_ptr + end if + + call Clp_loadProblem_C(model, numcols, numrows, c_loc(start), c_loc(vindex), c_loc(vvalue), & + collb_ptr, colub_ptr, obj_ptr, rowlb_ptr, rowub_ptr) + + end subroutine Clp_loadProblem end module clp |