From c283774e7a7324ec92b73ae78f629468b004355c Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 30 Sep 2024 13:12:01 -0500 Subject: [PATCH] Use new C routines --- include/cutest.h | 26 +++++++++++++------------- src/test/utest.c | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/include/cutest.h b/include/cutest.h index 02d2256..4375842 100644 --- a/include/cutest.h +++ b/include/cutest.h @@ -101,9 +101,9 @@ typedef int ipc_; #endif typedef struct VarTypes { - int nbnds, neq, nlin, nrange, nlower, nupper, - nineq, nineq_lin, nineq_nlin, neq_lin, - neq_nlin; + int nbnds, neq, nlin, nrange, nlower, nupper, + nineq, nineq_lin, nineq_nlin, neq_lin, + neq_nlin; } VarTypes; /* @@ -310,9 +310,9 @@ void CUTEST_usetup ( integer *status, const integer *funit, void CUTEST_csetup ( integer *status, const integer *funit, const integer *iout, const integer *io_buffer, integer *n, integer *m, - doublereal *x, doublereal *bl, doublereal *bu, + doublereal *x, doublereal *bl, doublereal *bu, doublereal *v, doublereal *cl, doublereal *cu, - logical *equatn, logical *linear, const integer *e_order, + logical *equatn, logical *linear, const integer *e_order, const integer *l_order, const integer *v_order ); /* Unconstrained dimensioning and report routines */ @@ -500,7 +500,7 @@ void CUTEST_csgreh ( integer *status, const integer *n, const integer *m, const logical *grlagf, integer *nnzj, const integer *lcjac, doublereal *cjac, integer *indvar, integer *indfun, - integer *ne, const integer *le, integer *iprnhi, + integer *ne, const integer *le, integer *iprnhi, integer *iprhi, const integer *lirnhi, integer *irnhi, const integer *lhi, doublereal *hi, const logical *byrows ); @@ -565,9 +565,9 @@ void CUTEST_usetup_s ( integer *status, const integer *funit, void CUTEST_csetup_s ( integer *status, const integer *funit, const integer *iout, const integer *io_buffer, integer *n, integer *m, - real *x, real *bl, real *bu, + real *x, real *bl, real *bu, real *v, real *cl, real *cu, - logical *equatn, logical *linear, const integer *e_order, + logical *equatn, logical *linear, const integer *e_order, const integer *l_order, const integer *v_order ); /* Unconstrained dimensioning and report routines */ @@ -701,7 +701,7 @@ void CUTEST_cdh_s ( integer *status, const integer *n, const integer *m, void CUTEST_cdhc_s ( integer *status, const integer *n, const integer *m, const real *x, const real *y, const integer *lh1, real *h ); -void CUTEST_cdhj_s ( integer *status, const integer *n, const integer *m, +void CUTEST_cdhj_s ( integer *status, const integer *n, const integer *m, const real *x, const real *y0, const real *y, const integer *lh1, real *h ); void CUTEST_cshp_s ( integer *status, const integer *n, integer *nnzh, @@ -754,7 +754,7 @@ void CUTEST_csgreh_s ( integer *status, const integer *n, const integer *m, const logical *grlagf, integer *nnzj, const integer *lcjac, real *cjac, integer *indvar, integer *indfun, - integer *ne, const integer *le, integer *iprnhi, + integer *ne, const integer *le, integer *iprnhi, integer *iprhi, const integer *lirnhi, integer *irnhi, const integer *lhi, real *hi, const logical *byrows ); @@ -914,9 +914,9 @@ void CUTEST_usetup_q ( integer *status, const integer *funit, void CUTEST_csetup_q ( integer *status, const integer *funit, const integer *iout, const integer *io_buffer, integer *n, integer *m, - quadreal *x, quadreal *bl, quadreal *bu, + quadreal *x, quadreal *bl, quadreal *bu, quadreal *v, quadreal *cl, quadreal *cu, - logical *equatn, logical *linear, const integer *e_order, + logical *equatn, logical *linear, const integer *e_order, const integer *l_order, const integer *v_order ); /* Unconstrained dimensioning and report routines */ @@ -1103,7 +1103,7 @@ void CUTEST_csgreh_q ( integer *status, const integer *n, const integer *m, const logical *grlagf, integer *nnzj, const integer *lcjac, quadreal *cjac, integer *indvar, integer *indfun, - integer *ne, const integer *le, integer *iprnhi, + integer *ne, const integer *le, integer *iprnhi, integer *iprhi, const integer *lirnhi, integer *irnhi, const integer *lhi, quadreal *hi, const logical *byrows ); diff --git a/src/test/utest.c b/src/test/utest.c index 314bd69..201a128 100644 --- a/src/test/utest.c +++ b/src/test/utest.c @@ -50,6 +50,7 @@ int main() { rpc_ *vector, *result; rpc_ **H2_val, **H_band; char *p_name; + char *classification; char **X_names; rpc_ CPU[4], CALLS[4]; @@ -61,7 +62,13 @@ int main() { CUTEST_udimen_r(&status, &input, &n); printf("* n = %d\n", n); l_h2_1 = n; - + + MALLOC(classification, FCSTRING_LEN + 1, char); + MALLOC(p_name, FSTRING_LEN + 1, char); + MALLOC(X_names, n, char *); + for (i = 0; i < n; i++) + MALLOC(X_names[i], FSTRING_LEN + 1, char); + X = malloc(n * sizeof(rpc_)); X_l = malloc(n * sizeof(rpc_)); X_u = malloc(n * sizeof(rpc_)); @@ -96,7 +103,14 @@ int main() { printf("error status = %d\n", status); } write_x(n, X, X_l, X_u); - + + // Obtain classification + printf("Call CUTEST_classification\n"); + CUTEST_classification_r(&status, &input, classification); + if (status != 0) { + printf("error status = %d\n", status); + } + // Obtain variable and problem names printf("Call CUTEST_unames\n"); CUTEST_unames_r(&status, &n, p_name, X_names);