solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

test_ssol_cube_geometry.h (2768B)


      1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2016, 2018 CNRS
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     16 
     17 #include "test_ssol_geometries.h"
     18 
     19 /*******************************************************************************
     20 * Rectangle polygon
     21 ******************************************************************************/
     22 #if !defined(HALF_X) && !(defined(X_MIN) && defined(X_MAX))
     23 #error "Missing the HALF_X or X_MIN and X_MAX macros defining the cube size"
     24 #endif
     25 #if !defined(HALF_Y) && !(defined(Y_MIN) && defined(Y_MAX))
     26 #error "Missing the HALF_Y or Y_MIN and Y_MAX macros defining the cube size"
     27 #endif
     28 #if !defined(HALF_Z) && !(defined(Z_MIN) && defined(Z_MAX))
     29 #error "Missing the HALF_Z or Z_MIN and Z_MAX macros defining the cube size"
     30 #endif
     31 #if !defined(CUBE_NAME)
     32 #error "Missing the CUBE_NAME macro defining the rectangle name"
     33 #endif
     34 
     35 #define EDGES__ CONCAT(CUBE_NAME, _EDGES__)
     36 #define CUBE_NVERTS__ CONCAT(CUBE_NAME, _NVERTS__)
     37 
     38 #if !defined(X_MIN)
     39 #define X_MIN (float)(-(HALF_X))
     40 #endif
     41 
     42 #if !defined(X_MAX)
     43 #define X_MAX (float)(HALF_X)
     44 #endif
     45 
     46 #if !defined(Y_MIN)
     47 #define Y_MIN (float)(-(HALF_Y))
     48 #endif
     49 
     50 #if !defined(Y_MAX)
     51 #define Y_MAX (float)(HALF_Y)
     52 #endif
     53 
     54 #if !defined(Z_MIN)
     55 #define Z_MIN (float)(-(HALF_Z))
     56 #endif
     57 
     58 #if !defined(Z_MAX)
     59 #define Z_MAX (float)(HALF_Z)
     60 #endif
     61 
     62 static const float EDGES__ [] = {
     63   X_MIN, Y_MIN, Z_MIN,
     64   X_MIN, Y_MIN, Z_MAX,
     65   X_MIN, Y_MAX, Z_MIN,
     66   X_MIN, Y_MAX, Z_MAX,
     67   X_MAX, Y_MIN, Z_MIN,
     68   X_MAX, Y_MIN, Z_MAX,
     69   X_MAX, Y_MAX, Z_MIN,
     70   X_MAX, Y_MAX, Z_MAX
     71 };
     72 
     73 const unsigned CUBE_NVERTS__ = sizeof(EDGES__) / (3*sizeof(float));
     74 
     75 const unsigned TRG_IDS__ [] = {
     76   0, 6, 4,
     77   0, 2, 6,
     78   0, 3, 2,
     79   0, 1, 3,
     80   2, 7, 6,
     81   2, 3, 7,
     82   4, 6, 7,
     83   4, 7, 5,
     84   0, 4, 5,
     85   0, 5, 1,
     86   1, 5, 7,
     87   1, 7, 3
     88 };
     89 const unsigned CUBE_NTRIS__ = sizeof(TRG_IDS__) / (3*sizeof(unsigned));
     90 
     91 static const struct desc CUBE_DESC__ = { EDGES__, TRG_IDS__ };
     92 
     93 #undef EDGES__
     94 #undef TRG_IDS__
     95 #undef CUBE_DESC__
     96 #undef CUBE_NVERTS__
     97 #undef CUBE_NTRIS__
     98 
     99 #undef HALF_X
    100 #undef HALF_Y
    101 #undef HALF_Z
    102 #undef X_MIN
    103 #undef X_MAX
    104 #undef Y_MIN
    105 #undef Y_MAX
    106 #undef Z_MIN
    107 #undef Z_MAX
    108 #undef CUBE_NAME