3 /* interops with myftype_1 */
9 /* interops with particle in f90 */
10 typedef struct particle
12 double x
; /* x position */
13 double vx
; /* velocity in x direction */
14 double y
; /* y position */
15 double vy
; /* velocity in y direction */
16 double z
; /* z position */
17 double vz
; /* velocity in z direction */
21 extern void abort(void);
22 void types_test(particle_t
*my_particles
, int num_particles
);
23 /* declared in the fortran module bind_c_dts */
24 extern myctype_t myDerived
;
26 int main(int argc
, char **argv
)
28 particle_t my_particles
[100];
30 /* the fortran code will modify the middle particle */
31 my_particles
[49].x
= 1.0;
32 my_particles
[49].vx
= 1.0;
33 my_particles
[49].y
= 1.0;
34 my_particles
[49].vy
= 1.0;
35 my_particles
[49].z
= 1.0;
36 my_particles
[49].vz
= 1.0;
37 my_particles
[49].m
= 1.0;
43 types_test(&(my_particles
[0]), 100);
45 if(fabs(my_particles
[49].x
- 1.2) > 0.00000000)
47 if(fabs(my_particles
[49].vx
- 1.2) > 0.00000000)
49 if(fabs(my_particles
[49].y
- 1.2) > 0.00000000)
51 if(fabs(my_particles
[49].vy
- 1.2) > 0.00000000)
53 if(fabs(my_particles
[49].z
- 1.2) > 0.00000000)
55 if(fabs(my_particles
[49].vz
- 1.2) > 0.00000000)
57 if(fabs(my_particles
[49].m
- 1.2) > 0.00000000)
63 if(fabs(myDerived
.r
- 4.0) > 0.00000000)