star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

sln_line.h (2107B)


      1 /* Copyright (C) 2022, 2026 |Méso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2026 Université de Lorraine
      3  * Copyright (C) 2022 Centre National de la Recherche Scientifique
      4  * Copyright (C) 2022 Université Paul Sabatier
      5  *
      6  * This program is free software: you can redistribute it and/or modify
      7  * it under the terms of the GNU General Public License as published by
      8  * the Free Software Foundation, either version 3 of the License, or
      9  * (at your option) any later version.
     10  *
     11  * This program is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     14  * GNU General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU General Public License
     17  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     18 
     19 #ifndef SLN_LINE_H
     20 #define SLN_LINE_H
     21 
     22 #include "sln.h"
     23 
     24 #include <star/shtr.h>
     25 #include <rsys/rsys.h>
     26 #include <math.h>
     27 
     28 struct line {
     29   double wavenumber; /* Line center wrt pressure in cm^-1 */
     30   double profile_factor; /* m^-1.cm^-1 (1e2*density*intensity) */
     31   double gamma_d; /* Doppler half width */
     32   double gamma_l; /* Lorentz half width */
     33   enum shtr_molecule_id molecule_id;
     34 };
     35 #define LINE_NULL__ {0}
     36 static const struct line LINE_NULL = LINE_NULL__;
     37 
     38 /* Forward declaration */
     39 struct sln_mixture;
     40 struct sln_tree;
     41 struct darray_vertex;
     42 
     43 static INLINE double
     44 line_center
     45   (const struct shtr_line* line,
     46    const double pressure) /* In atm */
     47 {
     48   ASSERT(line && pressure >= 0);
     49   return line->wavenumber + line->delta_air * pressure;
     50 }
     51 
     52 extern LOCAL_SYM res_T
     53 line_setup
     54   (const struct sln_tree* tree,
     55    const size_t iline,
     56    struct line* line);
     57 
     58 extern LOCAL_SYM double
     59 line_value
     60   (const struct sln_tree* tree,
     61    const struct line* line,
     62    const double wavenumber);
     63 
     64 extern LOCAL_SYM res_T
     65 line_mesh
     66   (struct sln_tree* tree,
     67    const size_t iline,
     68    const size_t nvertices_hint,
     69    /* Range of generated line vertices. Bounds are inclusive */
     70    size_t vertices_range[2]); /* out */
     71 
     72 #endif /* SLN_LINE_H */