GEOS
common.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
19 #ifndef GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
20 #define GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
21 
22 #include "common/DataTypes.hpp"
23 #include "common/logger/Logger.hpp"
24 
28 #define GEOS_LAI_RUNTIME_ASSERT 1
29 #if GEOS_LAI_RUNTIME_ASSERT
30 
35 #define GEOS_LAI_ASSERT( expr ) GEOS_ERROR_IF( !(expr), "" )
36 
42 #define GEOS_LAI_ASSERT_MSG( expr, msg ) GEOS_ERROR_IF( !(expr), msg )
43 
49 #define GEOS_LAI_ASSERT_EQ( lhs, rhs ) GEOS_ERROR_IF_NE( lhs, rhs )
50 
56 #define GEOS_LAI_ASSERT_NE( lhs, rhs ) GEOS_ERROR_IF_EQ( lhs, rhs )
57 
63 #define GEOS_LAI_ASSERT_GT( lhs, rhs ) GEOS_ERROR_IF_GE( rhs, lhs )
64 
70 #define GEOS_LAI_ASSERT_GE( lhs, rhs ) GEOS_ERROR_IF_GT( rhs, lhs )
71 #else
72 
77 #define GEOS_LAI_ASSERT( expr ) GEOS_ASSERT( expr )
78 
84 #define GEOS_LAI_ASSERT_MSG( expr, msg ) GEOS_ASSERT_MSG( expr, msg )
85 
91 #define GEOS_LAI_ASSERT_EQ( lhs, rhs ) GEOS_ASSERT_EQ( lhs, rhs )
92 
98 #define GEOS_LAI_ASSERT_NE( lhs, rhs ) GEOS_ASSERT_NE( lhs, rhs )
99 
105 #define GEOS_LAI_ASSERT_GT( lhs, rhs ) GEOS_ASSERT_GT( lhs, rhs )
106 
112 #define GEOS_LAI_ASSERT_GE( lhs, rhs ) GEOS_ASSERT_GE( lhs, rhs )
113 #endif
114 
119 #define GEOS_LAI_CHECK_ERROR( call ) \
120  do { \
121  auto const ierr = call; \
122  GEOS_ERROR_IF_NE_MSG( ierr, 0, "Error in call to " << #call ); \
123  } while( false )
124 
129 #define GEOS_LAI_CHECK_ERROR_NNEG( call ) \
130  do { \
131  auto const ierr = call; \
132  GEOS_ERROR_IF_GT_MSG( 0, ierr, "Error in call to " << #call ); \
133  } while( false )
134 
135 namespace geos
136 {
137 
141 enum class LAIOutputFormat
142 {
143  NATIVE_ASCII,
144  NATIVE_BINARY,
145  MATLAB_ASCII,
146  MATLAB_BINARY,
147  MATRIX_MARKET
148 };
149 
150 }
151 
152 #endif //GEOS_LINEARALGEBRA_INTERFACES_COMMON_HPP_
LAIOutputFormat
Definition: common.hpp:142