Skip to content

Commit

Permalink
Add properties functions to c example test.
Browse files Browse the repository at this point in the history
  • Loading branch information
MFraters committed Oct 26, 2024
1 parent 85ed163 commit 238c857
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/C/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int main(int argc, char *argv[]) {

create_world(&ptr_world, argv[1], &has_output_dir, output_dir, random_number_seed);

// simple specific interfaces
printf("2d temperature: \n");
temperature_2d(ptr_world,x,z,depth,&temperature);
printf("temperature in C = %f \n", temperature);
Expand All @@ -46,6 +47,20 @@ int main(int argc, char *argv[]) {
composition_3d(ptr_world,x,y,z,depth,composition_number,&composition);
printf("composition in C = %f \n", composition);

// High performance generic interface for getting many properties at the same time
unsigned int properties[6][3] = {
{1,0,0}, // temmperature
{2,0,0}, // composition 0
{2,1,0}, // composition 1
{3,0,10}, // grain compositon 0, 10 grains
{4,0,0}, // tag
{5,0,0} // velocity (3 values)
};
double values[1];
printf("2d temperature: \n");
properties_2d(ptr_world,x,z,depth,properties,1,values);
printf("temperature in C = %f \n", values[0]);

release_world(ptr_world);

return 0;
Expand Down

0 comments on commit 238c857

Please sign in to comment.