source: CIVL/examples/compare/provesa/driver.c@ beab7f2

main test-branch
Last change on this file since beab7f2 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/***
2 * IMPORTANT: Change the values of the variables marked by 'CHANGEME'
3 ***/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <math.h>
8
9#ifdef _CIVL
10$input double global_x[6];
11$output int global_retval;
12$output double global_f;
13$output double global_grad[6];
14#else
15//#pragma CIVL input
16double global_x[6];
17//#pragma CIVL output
18int global_retval;
19//#pragma CIVL output
20double global_f;
21//#pragma CIVL output
22double global_grad[6];
23#endif
24
25int g_fcn(double *obj, double g_x[6], const double x[6]);
26
27int main(void) {
28 double x[6],obj,gradient[6];
29 int retval;
30 int i;
31
32 #ifndef _CIVL
33 for (i=0;i<6;i++) global_x[i] = pow(i,0.6); //i*1.00000e-8; //pow(i,0.6);
34 #endif
35 printf("==================== INPUT STARTS HERE ====================\n");
36 for (i=0;i<6;i++) printf("global_x[%d] = %f\n", i, global_x[i]);
37 printf("==================== INPUT ENDS HERE ====================\n");
38 for (i=0;i<6;i++) x[i] = global_x[i];
39 retval = g_fcn(&obj,gradient,x);
40 global_retval = retval;
41 #ifdef _CIVL
42 printf("==================== RESULT STARTS HERE ====================\n");
43 #endif
44 printf("global_retval=%d\n", retval);
45 global_f = obj;
46 //printf("global_f=%f\n", obj);
47 for (i=0;i<6;i++) global_grad[i] = gradient[i];
48 for (i=0;i<6;i++) printf("global_grad[%d]=%f\n", i, gradient[i]);
49 #ifdef _CIVL
50 printf("==================== RESULT ENDS HERE ====================\n");
51 #endif
52 return 0;
53}
Note: See TracBrowser for help on using the repository browser.