commit 8ddd016b63d84e8d69a94561cfd526738922b6f5
parent 97c614804caab461acd553b84695274dcf32e7fd
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 25 Jul 2022 17:34:18 +0200
Print messages when setuping meshes & properties
Diffstat:
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/rnatm_mesh.c b/src/rnatm_mesh.c
@@ -25,6 +25,8 @@
#include <star/smsh.h>
#include <star/suvm.h>
+#include <rsys/clock_time.h>
+
/*******************************************************************************
* Helper functions
******************************************************************************/
@@ -127,6 +129,8 @@ error:
res_T
setup_meshes(struct rnatm* atm, const struct rnatm_create_args* args)
{
+ char buf[128];
+ struct time t0, t1;
double gas_low[3];
double gas_upp[3];
struct suvm_device* suvm = NULL;
@@ -136,6 +140,9 @@ setup_meshes(struct rnatm* atm, const struct rnatm_create_args* args)
res_T res = RES_OK;
ASSERT(atm && args);
+ log_info(atm, "load and structure the atmosphere meshes\n");
+ time_current(&t0);
+
/* Create the Star-UVM device */
res = suvm_device_create(atm->logger, atm->allocator, atm->verbose, &suvm);
if(res != RES_OK) goto error;
@@ -148,6 +155,7 @@ setup_meshes(struct rnatm* atm, const struct rnatm_create_args* args)
if(res != RES_OK) goto error;
/* Load and structure gas volumetric mesh */
+ log_info(atm, "gas mesh: %s\n", args->gas.smsh_filename);
res = setup_uvm(atm, args, args->gas.smsh_filename, suvm, smsh,
&atm->gas.volume, &atm->gas.ntetrahedra, &atm->gas.nvertices);
if(res != RES_OK) goto error;
@@ -162,6 +170,7 @@ setup_meshes(struct rnatm* atm, const struct rnatm_create_args* args)
const char* filename = args->aerosols[i].smsh_filename;
/* Load and structure the aerosol mesh */
+ log_info(atm, "aerosol mesh: %s\n", filename);
res = setup_uvm(atm, args, filename, suvm, smsh, &aerosol->volume,
&aerosol->ntetrahedra, &aerosol->nvertices);
if(res != RES_OK) goto error;
@@ -189,6 +198,11 @@ setup_meshes(struct rnatm* atm, const struct rnatm_create_args* args)
}
}
+ /* Dump elapsed time */
+ time_sub(&t0, time_current(&t1), &t0);
+ time_dump(&t0, TIME_ALL, NULL, buf, sizeof(buf));
+ log_info(atm, "atmopshere meshes setuped in %s\n", buf);
+
exit:
if(smsh) SMSH(ref_put(smsh));
if(suvm) SUVM(device_ref_put(suvm));
diff --git a/src/rnatm_properties.c b/src/rnatm_properties.c
@@ -30,6 +30,7 @@
#include <star/sbuf.h>
#include <star/sck.h>
+#include <rsys/clock_time.h>
#include <rsys/cstr.h>
#include <rsys/text_reader.h>
@@ -237,7 +238,7 @@ parse_phase_fn_list
res = txtrdr_file(atm->allocator, args->phase_fn_lst_filename, '#', &txtrdr);
if(res != RES_OK) {
- log_err(atm, "Could not create text reader to parse file `%s' -- %s\n",
+ log_err(atm, "could not create text reader to parse file `%s' -- %s\n",
args->phase_fn_lst_filename, res_to_cstr(res));
goto error;
}
@@ -299,6 +300,8 @@ error:
static res_T
setup_gas_properties(struct rnatm* atm, const struct rnatm_gas_args* gas_args)
{
+ char buf[128];
+ struct time t0, t1;
struct sck_create_args sck_args = SCK_CREATE_ARGS_DEFAULT;
struct sbuf_create_args sbuf_args = SBUF_CREATE_ARGS_DEFAULT;
struct sbuf_desc sbuf_desc = SBUF_DESC_NULL;
@@ -306,6 +309,10 @@ setup_gas_properties(struct rnatm* atm, const struct rnatm_gas_args* gas_args)
res_T res = RES_OK;
ASSERT(atm && gas_args);
+ /* Start time recording */
+ log_info(atm, "load gas properties\n");
+ time_current(&t0);
+
/* Create the Star-Buffer loader */
sbuf_args.logger = atm->logger;
sbuf_args.allocator = atm->allocator;
@@ -334,6 +341,11 @@ setup_gas_properties(struct rnatm* atm, const struct rnatm_gas_args* gas_args)
res = check_gas_ck_desc(atm, gas_args);
if(res != RES_OK) goto error;
+ /* Print elapsed time */
+ time_sub(&t0, time_current(&t1), &t0);
+ time_dump(&t0, TIME_ALL, NULL, buf, sizeof(buf));
+ log_info(atm, "gas properties loaded in %s\n", buf);
+
exit:
return res;
error:
@@ -347,6 +359,9 @@ setup_aerosol_properties
struct aerosol* aerosol,
const struct rnatm_aerosol_args* aerosol_args)
{
+ char buf[128];
+ size_t iaerosol;
+ struct time t0, t1;
struct sars_create_args sars_args = SARS_CREATE_ARGS_DEFAULT;
struct sbuf_create_args sbuf_args = SBUF_CREATE_ARGS_DEFAULT;
struct sbuf_desc sbuf_desc = SBUF_DESC_NULL;
@@ -354,6 +369,13 @@ setup_aerosol_properties
res_T res = RES_OK;
ASSERT(atm && aerosol_args);
+ /* Recover the index of the current aerosol */
+ iaerosol = (size_t)(aerosol - darray_aerosol_cdata_get(&atm->aerosols));
+
+ /* Start time recording */
+ log_info(atm, "load aerosol%lu properties\n", (unsigned long)iaerosol);
+ time_current(&t0);
+
res = parse_phase_fn_list(atm, aerosol, aerosol_args);
if(res != RES_OK) goto error;
@@ -385,6 +407,12 @@ setup_aerosol_properties
res = check_aerosol_sars_desc(atm, aerosol, aerosol_args);
if(res != RES_OK) goto error;
+ /* Print elapsed time */
+ time_sub(&t0, time_current(&t1), &t0);
+ time_dump(&t0, TIME_ALL, NULL, buf, sizeof(buf));
+ log_info(atm, "aerosol%lu properties loaded in %s\n",
+ (unsigned long)iaerosol, buf);
+
exit:
return res;
error:
@@ -407,7 +435,6 @@ setup_properties(struct rnatm* atm, const struct rnatm_create_args* args)
FOR_EACH(i, 0, darray_aerosol_size_get(&atm->aerosols)) {
struct aerosol* aerosol = darray_aerosol_data_get(&atm->aerosols)+i;
-
res = setup_aerosol_properties(atm, aerosol, args->aerosols+i);
if(res != RES_OK) goto error;
}