htsky

Load and structure a vertically stratified atmosphere
git clone git://git.meso-star.fr/htsky.git
Log | Files | Refs | README | LICENSE

commit a416ce077c2995122f6e92e9844ab06dfcb1b5d4
parent 26b2a62e4bbe6bcd7d28a1bcb4fc78499b017536
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  2 Jul 2021 16:16:29 +0200

Merge branch 'release_0.2.2'

Diffstat:
MREADME.md | 7++++++-
Mcmake/CMakeLists.txt | 9+++++----
Msrc/htsky.c | 7++++---
Msrc/htsky.h | 8++++----
Msrc/htsky_atmosphere.c | 9+++++++--
Msrc/htsky_atmosphere.h | 2+-
Msrc/htsky_c.h | 4++--
Msrc/htsky_cloud.c | 29+++++++++++++++++++++--------
Msrc/htsky_cloud.h | 2+-
Msrc/htsky_dump_cloud_vtk.c | 2+-
Msrc/htsky_log.c | 2+-
Msrc/htsky_log.h | 2+-
Msrc/htsky_svx.c | 2+-
Msrc/htsky_svx.h | 4++--
14 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/README.md b/README.md @@ -48,6 +48,11 @@ for further informations on CMake. ## Release notes +### Version 0.2.2 + +- Correction of compilation errors due to API breaks in Star-VoXel 0.2. +- Correction invalid memory writes. + ### Version 0.2.1 - Fix the acceleration data structures: the Kmin and Kmax stored in the @@ -84,7 +89,7 @@ for further informations on CMake. ## License -Copyright (C) 2018, 2019, 2020 [|Meso|Star](http://www.meso-star.com) +Copyright (C) 2018, 2019, 2020, 2021 [|Meso|Star](http://www.meso-star.com) (<contact@meso-star.com>). Copyright (C) 2018, 2019 Centre National de la Recherche Scientifique (CNRS), Université Paul Sabatier (<contact-edstar@laplace.univ-tlse.fr>). HTSky is free software released diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -1,4 +1,5 @@ -# Copyright (C) 2020 |Meso|Star> (contact@meso-star.com) +# Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) +# Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.1) project(htsky C) set(HTSKY_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) @@ -27,7 +28,7 @@ find_package(HTMIE 0.0.2 REQUIRED) find_package(OpenMP 1.2 REQUIRED) find_package(RCMake 0.3 REQUIRED) find_package(RSys 0.7 REQUIRED) -find_package(StarVX 0.1 REQUIRED) +find_package(StarVX 0.2 REQUIRED) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR}) include(rcmake) @@ -45,7 +46,7 @@ include_directories( ################################################################################ set(VERSION_MAJOR 0) set(VERSION_MINOR 2) -set(VERSION_PATCH 1) +set(VERSION_PATCH 2) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(HTSKY_FILES_SRC diff --git a/src/htsky.c b/src/htsky.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -493,6 +493,7 @@ release_sky(ref_T* ref) if(sky->htgop) HTGOP(ref_put(sky->htgop)); if(sky->htmie) HTMIE(ref_put(sky->htmie)); if(sky->bands) MEM_RM(sky->allocator, sky->bands); + if(sky->logger == &sky->logger__) logger_release(&sky->logger__); darray_split_release(&sky->svx2htcp_z); str_release(&sky->name); ASSERT(MEM_ALLOCATED_SIZE(&sky->svx_allocator) == 0); @@ -561,7 +562,7 @@ htsky_create res = str_set(&sky->name, args->name); if(res != RES_OK) { - log_err(sky, "Cannot setup the material name to `%s'.\n", args->name); + log_err(sky, "Cannot setup the sky name to `%s'.\n", args->name); goto error; } @@ -681,7 +682,7 @@ htsky_create exit: if(cache) fclose(cache); - *out_sky = sky; + if(out_sky) *out_sky = sky; return res; error: if(sky) { diff --git a/src/htsky.h b/src/htsky.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -65,7 +65,7 @@ enum htsky_svx_op { enum htsky_spectral_type { HTSKY_SPECTRAL_LW, /* Longwave */ - HTSKY_SPECTRAL_SW, /* Longwave */ + HTSKY_SPECTRAL_SW, /* Shortwave */ HTSKY_SPECTRAL_TYPES_COUNT__ }; @@ -74,7 +74,7 @@ struct htsky_args { const char* htgop_filename; const char* htmie_filename; const char* cache_filename; /* May be NULL <=> no cached data structure */ - const char* name; /* Name of the sky. Used by the Star-MTL binding */ + const char* name; /* Name of the sky */ enum htsky_spectral_type spectral_type; double wlen_range[2]; /* Spectral range to handle. In nm */ unsigned grid_max_definition[3]; /* Maximum definition of the grid */ @@ -93,7 +93,7 @@ struct htsky_args { HTSKY_SPECTRAL_TYPES_COUNT__, /* spectral type */ \ {DBL_MAX,-DBL_MAX}, /* Spectral integration range */ \ {UINT_MAX, UINT_MAX, UINT_MAX}, /* Maximum definition of the grid */ \ - 1, /* Optical thickness a*/ \ + 1, /* Optical thickness */ \ (unsigned)~0, /* #threads */ \ 0, /* Repeat clouds */ \ 0 /* Verbosity level */ \ diff --git a/src/htsky_atmosphere.c b/src/htsky_atmosphere.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -30,7 +30,11 @@ * Helper functions ******************************************************************************/ static void -atmosphere_vox_get(const size_t xyz[3], void* dst, void* context) +atmosphere_vox_get + (const size_t xyz[3], + const uint64_t mcode, + void* dst, + void* context) { float* vox = dst; struct build_tree_context* ctx = context; @@ -42,6 +46,7 @@ atmosphere_vox_get(const size_t xyz[3], void* dst, void* context) double ka_max, ks_max, kext_max; size_t ilayer; ASSERT(xyz && dst && context); + (void)mcode; /* Compute the boundaries of the SVX voxel */ HTGOP(get_level(ctx->sky->htgop, 0, &level)); diff --git a/src/htsky_atmosphere.h b/src/htsky_atmosphere.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_c.h b/src/htsky_c.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -92,7 +92,7 @@ struct htsky { unsigned nthreads; /* #threads */ - struct str name; /* Name of the sky used by the Star-MTL binding */ + struct str name; /* Name of the sky */ struct mem_allocator* allocator; struct mem_allocator svx_allocator; diff --git a/src/htsky_cloud.c b/src/htsky_cloud.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -409,7 +409,7 @@ compute_xh2o_range_irregular_z double x_h2o_range[2]) { size_t ivox[3]; - size_t igrid_low[2], igrid_upp[3]; + size_t igrid_low[3], igrid_upp[3]; size_t ilut_low, ilut_upp; size_t ilut; size_t ivox_z_prev; @@ -595,10 +595,15 @@ cloud_vox_get_gas } static void -cloud_vox_get(const size_t xyz[3], void* dst, void* context) +cloud_vox_get + (const size_t xyz[3], + const uint64_t mcode, + void* dst, + void* context) { struct build_tree_context* ctx = context; ASSERT(context); + (void)mcode; cloud_vox_get_particle(xyz, dst, ctx); cloud_vox_get_gas(xyz, dst, ctx); } @@ -621,6 +626,15 @@ cloud_vox_challenge_merge && vox_challenge_merge_component(HTSKY_CPNT_GAS, voxels, nvoxs, ctx); } +static INLINE void +print_progress(struct htsky* sky, const int progress) +{ + ASSERT(sky && progress >= 0 && progress <= 100); + log_info(sky, "\033[2K\r"); /* Erase the line */ + log_info(sky,"Computing clouds data & building octrees: %3d%%\r" , progress); +} + + static res_T cloud_build_octrees (struct htsky* sky, @@ -666,8 +680,7 @@ cloud_build_octrees vxsz[2] = vxsz[2] / (double)nvoxs[2]; omp_set_num_threads((int)sky->nthreads); - #define LOG_MSG "\033[2K\rComputing clouds data & building octrees: %3d%%" - log_info(sky, LOG_MSG, 0); + print_progress(sky, 0); #pragma omp parallel for schedule(dynamic, 1/*chunksize*/) for(ispecdata=0; ispecdata < nspecdata; ++ispecdata) { struct svx_voxel_desc vox_desc = SVX_VOXEL_DESC_NULL; @@ -727,15 +740,15 @@ cloud_build_octrees #pragma omp critical if(pcent > progress) { progress = pcent; - log_info(sky, LOG_MSG, pcent); + print_progress(sky, pcent); } } if(res != RES_OK) goto error; - log_info(sky, LOG_MSG"\n", 100); - #undef LOG_MSG + print_progress(sky, 100); + log_info(sky, "\n"); /* New line */ exit: return (res_T)res; diff --git a/src/htsky_cloud.h b/src/htsky_cloud.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_dump_cloud_vtk.c b/src/htsky_dump_cloud_vtk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_log.c b/src/htsky_log.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_log.h b/src/htsky_log.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_svx.c b/src/htsky_svx.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify diff --git a/src/htsky_svx.h b/src/htsky_svx.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019, 2020 |Meso|Star> (contact@meso-star.com) +/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com) * Copyright (C) 2018, 2019 CNRS, Université Paul Sabatier * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ #include <rsys/math.h> - /* +/* * SVX Memory layout * ----------------- *