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 TotalEnergies
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 GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
19 #define GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
20 
21 #include "common/DataTypes.hpp"
22 
26 #define GEOS_LAI_RUNTIME_ASSERT 1
27 #if GEOS_LAI_RUNTIME_ASSERT
28 
33 #define GEOS_LAI_ASSERT( expr ) GEOS_ERROR_IF( !(expr), "" )
34 
40 #define GEOS_LAI_ASSERT_MSG( expr, msg ) GEOS_ERROR_IF( !(expr), msg )
41 
47 #define GEOS_LAI_ASSERT_EQ( lhs, rhs ) GEOS_ERROR_IF_NE( lhs, rhs )
48 
54 #define GEOS_LAI_ASSERT_NE( lhs, rhs ) GEOS_ERROR_IF_EQ( lhs, rhs )
55 
61 #define GEOS_LAI_ASSERT_GT( lhs, rhs ) GEOS_ERROR_IF_GE( rhs, lhs )
62 
68 #define GEOS_LAI_ASSERT_GE( lhs, rhs ) GEOS_ERROR_IF_GT( rhs, lhs )
69 #else
70 
75 #define GEOS_LAI_ASSERT( expr ) GEOS_ASSERT( expr )
76 
82 #define GEOS_LAI_ASSERT_MSG( expr, msg ) GEOS_ASSERT_MSG( expr, msg )
83 
89 #define GEOS_LAI_ASSERT_EQ( lhs, rhs ) GEOS_ASSERT_EQ( lhs, rhs )
90 
96 #define GEOS_LAI_ASSERT_NE( lhs, rhs ) GEOS_ASSERT_NE( lhs, rhs )
97 
103 #define GEOS_LAI_ASSERT_GT( lhs, rhs ) GEOS_ASSERT_GT( lhs, rhs )
104 
110 #define GEOS_LAI_ASSERT_GE( lhs, rhs ) GEOS_ASSERT_GE( lhs, rhs )
111 #endif
112 
117 #define GEOS_LAI_CHECK_ERROR( call ) \
118  do { \
119  auto const ierr = call; \
120  GEOS_ERROR_IF_NE_MSG( ierr, 0, "Error in call to " << #call ); \
121  } while( false )
122 
127 #define GEOS_LAI_CHECK_ERROR_NNEG( call ) \
128  do { \
129  auto const ierr = call; \
130  GEOS_ERROR_IF_GT_MSG( 0, ierr, "Error in call to " << #call ); \
131  } while( false )
132 
133 namespace geos
134 {
135 
139 enum class LAIOutputFormat
140 {
141  NATIVE_ASCII,
142  NATIVE_BINARY,
143  MATLAB_ASCII,
144  MATLAB_BINARY,
145  MATRIX_MARKET
146 };
147 
148 }
149 
150 #endif //GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
LAIOutputFormat
Definition: common.hpp:140