rnatm

Load and structure data describing an atmosphere
git clone git://git.meso-star.fr/rnatm.git
Log | Files | Refs | README | LICENSE

rnatm_octrees_storage.h (3172B)


      1 /* Copyright (C) 2022, 2023, 2025 Centre National de la Recherche Scientifique
      2  * Copyright (C) 2022, 2023, 2025 Institut Pierre-Simon Laplace
      3  * Copyright (C) 2022, 2023, 2025 Institut de Physique du Globe de Paris
      4  * Copyright (C) 2022, 2023, 2025 |Méso|Star> (contact@meso-star.com)
      5  * Copyright (C) 2022, 2023, 2025 Observatoire de Paris
      6  * Copyright (C) 2022, 2023, 2025 Université de Reims Champagne-Ardenne
      7  * Copyright (C) 2022, 2023, 2025 Université de Versaille Saint-Quentin
      8  * Copyright (C) 2022, 2023, 2025 Université Paul Sabatier
      9  *
     10  * This program is free software: you can redistribute it and/or modify
     11  * it under the terms of the GNU General Public License as published by
     12  * the Free Software Foundation, either version 3 of the License, or
     13  * (at your option) any later version.
     14  *
     15  * This program is distributed in the hope that it will be useful,
     16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     18  * GNU General Public License for more details.
     19  *
     20  * You should have received a copy of the GNU General Public License
     21  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     22 
     23 #ifndef RNATM_OCTREES_STORAGE_H
     24 #define RNATM_OCTREES_STORAGE_H
     25 
     26 #include <rsys/hash.h>
     27 #include <rsys/rsys.h>
     28 
     29 struct rnatm;
     30 
     31 /* Storage version. It must be incremented and versioning must be performed on
     32  * serialized data when its memory layout is updated */
     33 static const int OCTREES_STORAGE_VERSION = 1;
     34 
     35 struct octrees_storage_desc {
     36   size_t ibands[2]; /* Indices of the band to handle. Limits are inclusive */
     37   double optical_thickness; /* Threshold used during octree construction */
     38   unsigned grid_definition[3];
     39 
     40   /* Signature of the meshes used to build the octrees */
     41   hash256_T mesh_signature;
     42   hash256_T* band_signatures; /* Per band signature */
     43 
     44   struct mem_allocator* allocator;
     45   int version;
     46 };
     47 #define OCTREES_STORAGE_DESC_NULL__ {{0,0},0,{0,0,0},{0},NULL,NULL,0}
     48 static const struct octrees_storage_desc OCTREES_STORAGE_DESC_NULL =
     49   OCTREES_STORAGE_DESC_NULL__;
     50 
     51 extern LOCAL_SYM res_T
     52 octrees_storage_desc_init
     53   (const struct rnatm* atm,
     54    struct octrees_storage_desc* desc);
     55 
     56 extern LOCAL_SYM res_T
     57 octrees_storage_desc_init_from_stream
     58   (const struct rnatm* atm,
     59    struct octrees_storage_desc* desc,
     60    FILE* stream);
     61 
     62 extern LOCAL_SYM void
     63 octrees_storage_desc_release
     64   (struct octrees_storage_desc* desc);
     65 
     66 extern LOCAL_SYM res_T
     67 check_octrees_storage_compatibility
     68   (const struct octrees_storage_desc* reference,
     69    const struct octrees_storage_desc* challenge);
     70 
     71 extern LOCAL_SYM res_T
     72 write_octrees_storage_desc
     73   (const struct rnatm* atm,
     74    const struct octrees_storage_desc* desc,
     75    FILE* stream);
     76 
     77 extern LOCAL_SYM res_T
     78 reserve_octrees_storage_toc
     79   (const struct rnatm* atm,
     80    FILE* stream);
     81 
     82 extern LOCAL_SYM res_T
     83 write_octrees_storage_toc
     84   (const struct rnatm* atm,
     85    FILE* stream);
     86 
     87 extern LOCAL_SYM res_T
     88 read_octrees_storage_toc
     89   (struct rnatm* atm,
     90    FILE* stream);
     91 
     92 extern LOCAL_SYM res_T
     93 store_octrees
     94   (struct rnatm* atm,
     95    const size_t ioctrees[2],
     96    FILE* stream);
     97 
     98 #endif /* RNATM_OCTREES_STORAGE_H */