htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 1f2a7abf1153f7dbb8fc0747f4cd3e2922b72ddd
parent 71a53154d1383a05991b0c6b565a22526fcd4ecb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 12 Dec 2022 10:07:41 +0100

planeto: update the source creation API

Only the htrdr structure is required as an input argument, not the whole
htrdr_planeto_command structure.

Diffstat:
Msrc/planeto/htrdr_planeto.c | 2+-
Msrc/planeto/htrdr_planeto_source.c | 13+++++++------
Msrc/planeto/htrdr_planeto_source.h | 8++++----
3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/planeto/htrdr_planeto.c b/src/planeto/htrdr_planeto.c @@ -385,7 +385,7 @@ setup_source if(cmd->output_type == HTRDR_PLANETO_ARGS_OUTPUT_OCTREES) goto exit; - res = htrdr_planeto_source_create(cmd, &args->source, &cmd->source); + res = htrdr_planeto_source_create(cmd->htrdr, &args->source, &cmd->source); if(res != RES_OK) goto error; exit: diff --git a/src/planeto/htrdr_planeto_source.c b/src/planeto/htrdr_planeto_source.c @@ -197,7 +197,7 @@ release_source(ref_T* ref) ******************************************************************************/ res_T htrdr_planeto_source_create - (struct htrdr_planeto* cmd, + (struct htrdr* htrdr, const struct htrdr_planeto_source_args* args, struct htrdr_planeto_source** out_source) { @@ -206,18 +206,18 @@ htrdr_planeto_source_create double lat; /* In radians */ double lon; /* In radians */ res_T res = RES_OK; - ASSERT(cmd && out_source); + ASSERT(htrdr && out_source); ASSERT(htrdr_planeto_source_args_check(args) == RES_OK); - src = MEM_CALLOC(htrdr_get_allocator(cmd->htrdr), 1, sizeof(*src)); + src = MEM_CALLOC(htrdr_get_allocator(htrdr), 1, sizeof(*src)); if(!src) { - htrdr_log_err(cmd->htrdr, "error allocating source\n"); + htrdr_log_err(htrdr, "error allocating source\n"); res = RES_MEM_ERR; goto error; } ref_init(&src->ref); - htrdr_ref_get(cmd->htrdr); - src->htrdr = cmd->htrdr; + htrdr_ref_get(htrdr); + src->htrdr = htrdr; src->radius = args->radius * 1e3/*From km to m*/; if(!args->rnrl_filename) { @@ -402,6 +402,7 @@ htrdr_planeto_source_get_spectrum goto error; } + source_spectrum->source = source; source_spectrum->range[0] = range[0]; source_spectrum->range[1] = range[1]; diff --git a/src/planeto/htrdr_planeto_source.h b/src/planeto/htrdr_planeto_source.h @@ -21,21 +21,21 @@ #include <rsys/rsys.h> /* Forward declarations */ -struct htrdr_planeto; +struct htrdr; struct htrdr_planeto_source; struct htrdr_planeto_source_args; struct ssp_rng; struct htrdr_planeto_source_spectrum { - struct htrdr_planeto_source* source; + const struct htrdr_planeto_source* source; double range[2]; /* In nm. Limits are inclusive */ size_t size; /* Number of elements representing the spectrum */ - void* buffer; /* Pointer toward the spectrum data */ + const void* buffer; /* Pointer toward the spectrum data */ }; extern LOCAL_SYM res_T htrdr_planeto_source_create - (struct htrdr_planeto* cmd, + (struct htrdr* htrdr, const struct htrdr_planeto_source_args* args, struct htrdr_planeto_source** source);