23 #ifndef ERROR_H_INCLUDED 24 #define ERROR_H_INCLUDED 27 #include <string_view> 100 constexpr
static const bool STOP_ERROR_DEBUG_MODE =
true;
102 constexpr
static const bool STOP_ERROR_DEBUG_MODE =
true;
118 std::cout<<
"Error "<<(int)error<<
": ";
122 std::cout<<
"Abstract function \""<<caller<<
"\" called. Should not be, virtual function.\n";
break;
124 std::cout<<
"Copy constructor called with wrong type in "<<caller<<
": "<<spec<<
".\n";
break;
126 std::cout<<
"Index "<<spec<<
" out of bounds in "<<caller<<
".\n";
break;
128 std::cout<<
"Initializing a vector element with a sequence in "<<caller<<
".\n";
break;
130 std::cout<<
"Evaluating the value of non valued Abstract in "<<caller<<
".\n";
break;
132 std::cout<<
"Undefined behaviour in "<<caller<<
"\n.";
break;
134 std::cout<<
"Contracting dummy index in "<<caller<<
": "<<spec<<std::endl;
break;
136 std::cout<<
"Mismatch in contraction ("<<caller<<
"): "<<spec<<std::endl;
break;
138 std::cout<<
"Mismatch in symmetry in "<<caller<<
".\n";
break;
140 std::cout<<
"Unknown property in "<<caller<<
": "<<spec<<std::endl;
break;
142 std::cout<<
"Bad set of indices in creation of TensorElement in "<<caller<<std::endl;
break;
144 std::cout<<
"Invalid initialization of TensorParent in "<<caller<<
": bad tensor.\n";
break;
146 std::cout<<
"Invalid sum of indicial objects in "<<caller<<std::endl;
break;
148 std::cout<<
"Bad dependency set for "<<spec<<
" in "<<caller<<
"\n";
break;
150 std::cout<<
"Bad type of expression sent in "<<caller<<
": requires "<<spec<<
".\n";
break;
152 std::cout<<
"Bad symmetry set in TensorParent (wrong dimension) in "<<caller<<
".\n";
break;
154 std::cout<<
"Bad contraction of indices in "<<caller<<
": "<<spec<<
".\n";
break;
156 std::cout<<
"Unknown type of equation in "<<caller<<
": "<<spec<<
".\n";
break;
158 std::cout<<
"Setting a property with something else than an equality in "<<caller<<
": "<<spec<<
".\n";
break;
160 std::cout<<
"An arbitrary abstract has been evaluated from "<<caller<<
". Should not be.\n";
break;
162 std::cout<<
"Comparing non-dummy Abstract in "<<caller<<
".\n";
break;
164 std::cout<<
"Setting commutability property of an object for which it is not possible in "<<caller<<
".\n";
break;
166 std::cout<<
"Negative dimension encountered in "<<caller<<
": "<<spec<<std::endl;
break;
168 std::cout<<
"Calling a special contraction of TensorElement in "<<caller<<
", but there is no contraction.\n";
break;
170 std::cout<<
"Initializing badly a self-contraction property of TensorParent in "<<caller<<
".\n";
break;
172 std::cout<<
"Bas initialization of field in "<<caller<<
": need a vector of the right space.\n";
break;
175 std::cout<<
"Rules of the operator are not implemented in "<<caller<<
".\n";
break;
177 std::cout<<
"Bad initialization of operator in "<<caller<<
".\n";
break;
180 std::cout<<
"SmError "<<(int)error<<
" not recognized.\n";
182 if (STOP_ERROR_DEBUG_MODE)
184 else if (option::errorStopsProgram)
205 std::cout<<
"Warning "<<(int)warning<<
": ";
209 std::cout<<
"ScmType "<<
" unknown in function \""<<caller<<
"\".\n";
break;
211 std::cout<<
"Invalid dimension "<<spec<<
" in function "<<caller<<
".\n";
break;
213 std::cout<<
"Float value encountered in Factorial. Replacing by rounded value.\n";
break;
215 std::cout<<
"Evaluating non valued in "<<caller<<
". Replacing by 0.\n";
break;
217 std::cout<<
"Infinite result found in "<<caller<<
".\n";
break;
219 std::cout<<
"Copying building block in "<<caller<<
": "<<spec<<
"\n";
break;
221 std::cout<<
"The function getNCharacters() is not implemented for type "<<spec<<
" in "<<caller<<
".\n";
break;
224 std::cout<<
"SmWarning "<<(int)warning<<
" not recognized.\n";
252 std::ostream& operator<<(std::ostream& fout, CSLError error);
254 void CallErrorImpl(CSLError error,
255 std::string_view func,
256 std::string_view file,
259 void CallErrorImpl(CSLError error,
260 std::string_view func,
261 std::string_view file,
263 std::string_view message);
265 #define CSL_ASSERT(cond, error)\ 267 CallErrorImpl(error, __func__, __FILE__, __LINE__);\ 269 #define CSL_ASSERT_SPEC(cond, error, message)\ 271 CallErrorImpl(error, __func__, __FILE__, __LINE__, message);\ 274 #define CALL_SMERROR(error)\ 275 CallErrorImpl(error, __func__, __FILE__, __LINE__) 277 #define CALL_SMERROR_SPEC(error, message)\ 278 CallErrorImpl(error, __func__, __FILE__, __LINE__, message)
Namespace for csl library.
Definition: abreviation.h:34
Warning
List of all warning possible.
Definition: error.h:77
void callError(cslError::Error error, const std::string &caller)
Calls callError(cslError::Error, const std::string&,T) with no spec.
Definition: error.cpp:20
void callWarning(cslError::Warning warning, const std::string &caller, T spec)
Displays a warning message depending on the warning warning, the name of the caller function caller a...
Definition: error.h:202
Error
List all error possible.
Definition: error.h:36