GEOSX
common.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
18 #ifndef GEOSX_LINEARALGEBRA_INTERFACES_COMMON_HPP_
19 #define GEOSX_LINEARALGEBRA_INTERFACES_COMMON_HPP_
20 
21 #include "common/DataTypes.hpp"
22 
26 #define GEOSX_LAI_RUNTIME_ASSERT 1
27 #if GEOSX_LAI_RUNTIME_ASSERT
28 
33 #define GEOSX_LAI_ASSERT( expr ) GEOSX_ERROR_IF( !(expr), "" )
34 
40 #define GEOSX_LAI_ASSERT_MSG( expr, msg ) GEOSX_ERROR_IF( !(expr), msg )
41 
47 #define GEOSX_LAI_ASSERT_EQ( lhs, rhs ) GEOSX_ERROR_IF_NE( lhs, rhs )
48 
54 #define GEOSX_LAI_ASSERT_NE( lhs, rhs ) GEOSX_ERROR_IF_EQ( lhs, rhs )
55 
61 #define GEOSX_LAI_ASSERT_GT( lhs, rhs ) GEOSX_ERROR_IF_GE( rhs, lhs )
62 
68 #define GEOSX_LAI_ASSERT_GE( lhs, rhs ) GEOSX_ERROR_IF_GT( rhs, lhs )
69 #else
70 
75 #define GEOSX_LAI_ASSERT( expr ) GEOSX_ASSERT( expr )
76 
82 #define GEOSX_LAI_ASSERT_MSG( expr, msg ) GEOSX_ASSERT_MSG( expr, msg )
83 
89 #define GEOSX_LAI_ASSERT_EQ( lhs, rhs ) GEOSX_ASSERT_EQ( lhs, rhs )
90 
96 #define GEOSX_LAI_ASSERT_NE( lhs, rhs ) GEOSX_ASSERT_NE( lhs, rhs )
97 
103 #define GEOSX_LAI_ASSERT_GT( lhs, rhs ) GEOSX_ASSERT_GT( lhs, rhs )
104 
110 #define GEOSX_LAI_ASSERT_GE( lhs, rhs ) GEOSX_ASSERT_GE( lhs, rhs )
111 #endif
112 
117 #define GEOSX_LAI_CHECK_ERROR( call ) \
118  do { \
119  auto const ierr = call; \
120  GEOSX_ERROR_IF_NE_MSG( ierr, 0, "Error in call to " << #call ); \
121  } while( false )
122 
127 #define GEOSX_LAI_CHECK_ERROR_NNEG( call ) \
128  do { \
129  auto const ierr = call; \
130  GEOSX_ERROR_IF_GT_MSG( 0, ierr, "Error in call to " << #call ); \
131  } while( false )
132 
133 namespace geosx
134 {
135 
139 enum class LAIOutputFormat
140 {
141  NATIVE_ASCII,
142  NATIVE_BINARY,
143  MATLAB_ASCII,
144  MATLAB_BINARY,
145  MATRIX_MARKET
146 };
147 
152 {
154  using ROW_MAJOR_PERM = RAJA::PERM_IJ;
155 
157  using COL_MAJOR_PERM = RAJA::PERM_JI;
158 
160  constexpr static int const ROW_MAJOR = LvArray::typeManipulation::getStrideOneDimension( ROW_MAJOR_PERM {} );
161 
163  constexpr static int const COL_MAJOR = LvArray::typeManipulation::getStrideOneDimension( COL_MAJOR_PERM {} );
164 };
165 
166 }
167 
168 #endif //GEOSX_LINEARALGEBRA_INTERFACES_COMMON_HPP_
RAJA::PERM_JI COL_MAJOR_PERM
typedef LAI col major permutation consistent with RAJA order
Definition: common.hpp:157
RAJA::PERM_IJ ROW_MAJOR_PERM
typedef LAI row major permutation consistent with RAJA order
Definition: common.hpp:154
constexpr camp::idx_t getStrideOneDimension(camp::idx_seq< INDICES... >)
LAIOutputFormat
Definition: common.hpp:139