stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

sdis_Xd_begin.h (2928B)


      1 /* Copyright (C) 2016-2025 |Méso|Star> (contact@meso-star.com)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #include "sdis.h"
     17 #include <rsys/rsys.h>
     18 
     19 #ifdef SDIS_XD_BEGIN_H__
     20   #error "This header is already included without its associated sdis_Xd_end.h file."
     21 #endif
     22 
     23 #define SDIS_XD_BEGIN_H__
     24 
     25 /* Check prerequisite */
     26 #ifndef SDIS_XD_DIMENSION
     27   #error "The SDIS_XD_DIMENSION macro must be defined."
     28 #endif
     29 
     30 #if SDIS_XD_DIMENSION == 2
     31   #include <rsys/double2.h>
     32   #include <rsys/float2.h>
     33   #include <star/s2d.h>
     34 
     35   #define FORMAT_VECX "%g, %g"
     36   #define SPLITX(V) SPLIT2(V)
     37 
     38 #elif SDIS_XD_DIMENSION == 3
     39   #include <rsys/double3.h>
     40   #include <rsys/float3.h>
     41   #include <star/s3d.h>
     42 
     43   #define FORMAT_VECX "%g, %g, %g"
     44   #define SPLITX(V) SPLIT3(V)
     45 
     46 #else
     47   #error "Invalid dimension."
     48 #endif
     49 
     50 /* Syntactic sugar */
     51 #define DIM SDIS_XD_DIMENSION
     52 
     53 /* Star-XD macros generic to SDIS_XD_DIMENSION */
     54 #define sXd(Name) CONCAT(CONCAT(CONCAT(s, DIM), d_), Name)
     55 #define SXD_HIT_NONE CONCAT(CONCAT(S,DIM), D_HIT_NONE)
     56 #define SXD_HIT_NULL CONCAT(CONCAT(S,DIM), D_HIT_NULL)
     57 #define SXD_HIT_NULL__ CONCAT(CONCAT(S, DIM), D_HIT_NULL__)
     58 #define SXD_POSITION CONCAT(CONCAT(S, DIM), D_POSITION)
     59 #define SXD_GEOMETRY_NORMAL CONCAT(CONCAT(S, DIM), D_GEOMETRY_NORMAL)
     60 #define SXD_VERTEX_DATA_NULL CONCAT(CONCAT(S, DIM), D_VERTEX_DATA_NULL)
     61 #define SXD CONCAT(CONCAT(S, DIM), D)
     62 #define SXD_FLOAT2 CONCAT(CONCAT(S, DIM), D_FLOAT2)
     63 #define SXD_FLOAT3 CONCAT(CONCAT(S, DIM), D_FLOAT3)
     64 #define SXD_FLOATX CONCAT(CONCAT(CONCAT(S,DIM), D_FLOAT), DIM)
     65 #define SXD_GET_PRIMITIVE CONCAT(CONCAT(S, DIM), D_GET_PRIMITIVE)
     66 #define SXD_SAMPLE CONCAT(CONCAT(S, DIM), D_SAMPLE)
     67 #define SXD_TRACE CONCAT(CONCAT(S, DIM), D_TRACE)
     68 #define SXD_PRIMITIVE_NULL CONCAT(CONCAT(S, DIM), D_PRIMITIVE_NULL)
     69 #define SXD_PRIMITIVE_EQ CONCAT(CONCAT(S, DIM), D_PRIMITIVE_EQ)
     70 
     71 /* Vector macros generic to SDIS_XD_DIMENSION */
     72 #define dX(Func) CONCAT(CONCAT(CONCAT(d, DIM), _), Func)
     73 #define fX(Func) CONCAT(CONCAT(CONCAT(f, DIM), _), Func)
     74 #define fX_set_dX CONCAT(CONCAT(CONCAT(f, DIM), _set_d), DIM)
     75 #define fXX_mulfX CONCAT(CONCAT(CONCAT(CONCAT(f, DIM), DIM), _mulf), DIM)
     76 #define dX_set_fX CONCAT(CONCAT(CONCAT(d, DIM), _set_f), DIM)
     77 
     78 /* Macro making generic its submitted name to SDIS_XD_DIMENSION */
     79 #define XD(Name) CONCAT(CONCAT(CONCAT(Name, _), DIM), d)