From 5a7aeffabe531fe146142454b07efcfefe16121e Mon Sep 17 00:00:00 2001 From: Adrian Jenkins Date: Tue, 11 May 2021 14:51:53 +0100 Subject: [PATCH] Edited main.c to receive the descriptor and particle load grid, and to choose the correct relative level for the Panphasia field. --- .../panphasia_ho/high_order_panphasia_routines.c | 2 +- external/panphasia_ho/main.c | 13 ++++++++++--- external/panphasia_ho/panphasia_functions.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/external/panphasia_ho/high_order_panphasia_routines.c b/external/panphasia_ho/high_order_panphasia_routines.c index 054194d..672c575 100644 --- a/external/panphasia_ho/high_order_panphasia_routines.c +++ b/external/panphasia_ho/high_order_panphasia_routines.c @@ -729,7 +729,7 @@ int demo_descriptor_() return (0); }; -int PANPHASIA_init_descriptor_(char *descriptor, int *verbose) +int PANPHASIA_init_descriptor_(const char *descriptor, int *verbose) { int error; int verb; diff --git a/external/panphasia_ho/main.c b/external/panphasia_ho/main.c index 641be67..d9c5400 100644 --- a/external/panphasia_ho/main.c +++ b/external/panphasia_ho/main.c @@ -18,7 +18,7 @@ int number_omp_threads = 1; #endif // does the same as the main below, but does not initialise MPI or FFTW (this should be done in MONOFONIC) -int PANPHASIA_HO_main(void) +int PANPHASIA_HO_main(const char *descriptor, size_t *ngrid_load) { int verbose = 0; int error; @@ -26,11 +26,18 @@ int PANPHASIA_HO_main(void) size_t rel_level; int fdim=1; //Option to scale Fourier grid dimension relative to Panphasia coefficient grid - char descriptor[300] = "[Panph6,L20,(424060,82570,148256),S1,KK0,CH-999,Auriga_100_vol2]"; + //char descriptor[300] = "[Panph6,L20,(424060,82570,148256),S1,KK0,CH-999,Auriga_100_vol2]"; PANPHASIA_init_descriptor_(descriptor, &verbose); - rel_level = 6; //Set size of test dataset + printf("Descriptor %s\n ngrid_load %llu\n",descriptor,*ngrid_load); + + // Choose smallest value of level to equal of exceed *ngrid_load) + + for (rel_level=0; fdim*(descriptor_base_size<<(rel_level+1))<=*ngrid_load; rel_level++); + + printf("Setting relative level = %llu\n",rel_level); + if (error = PANPHASIA_init_level_(&rel_level, &x0, &y0, &z0, &verbose)) { diff --git a/external/panphasia_ho/panphasia_functions.h b/external/panphasia_ho/panphasia_functions.h index 77327cb..01a579e 100644 --- a/external/panphasia_ho/panphasia_functions.h +++ b/external/panphasia_ho/panphasia_functions.h @@ -54,7 +54,7 @@ void return_root_legendre_coefficients_(PAN_REAL *root); int parse_and_validate_descriptor_(const char *, int *); int demo_descriptor_(); long long int compute_check_digit_(); -int PANPHASIA_init_descriptor_(char *descriptor, int *verbose); +int PANPHASIA_init_descriptor_(const char *descriptor, int *verbose); int PANPHASIA_init_level_(size_t *oct_level, size_t *rel_orig_x, size_t *rel_orig_y,size_t *rel_orig_z,int *verbose);