test_ssol_rect_geometry.h (2412B)
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 plane 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 rectangle 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 rectangle size" 27 #endif 28 #if !defined(PLANE_NAME) 29 #error "Missing the DARRAY_NAME macro defining the rectangle name" 30 #endif 31 32 #define EDGES__ CONCAT(PLANE_NAME, _EDGES__) 33 #define TRG_IDS__ CONCAT(PLANE_NAME, _TRG_IDS__) 34 #define RECT_DESC__ CONCAT(PLANE_NAME, _DESC__) 35 #define RECT_NVERTS__ CONCAT(PLANE_NAME, _NVERTS__) 36 #define RECT_NTRIS__ CONCAT(PLANE_NAME, _NTRIS__) 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 static const float EDGES__ [] = { 55 X_MIN, Y_MIN, 0.f, 56 X_MAX, Y_MIN, 0.f, 57 X_MAX, Y_MAX, 0.f, 58 X_MIN, Y_MAX, 0.f 59 }; 60 61 const unsigned RECT_NVERTS__ = sizeof(EDGES__) / (3*sizeof(float)); 62 63 const unsigned TRG_IDS__ [] = { 0, 2, 1, 2, 0, 3 }; 64 const unsigned RECT_NTRIS__ = sizeof(TRG_IDS__) / (3*sizeof(unsigned)); 65 66 static const struct desc RECT_DESC__ = { EDGES__, TRG_IDS__ }; 67 68 #undef EDGES__ 69 #undef TRG_IDS__ 70 #undef RECT_DESC__ 71 #undef RECT_NVERTS__ 72 #undef RECT_NTRIS__ 73 74 #undef HALF_X 75 #undef HALF_Y 76 #undef X_MIN 77 #undef X_MAX 78 #undef Y_MIN 79 #undef Y_MAX 80 #undef PLANE_NAME