Documentation of CSL
Namespaces | Macros | Enumerations | Functions
error.h File Reference

File containing functions that are called by the program when something wrong happened: determines the behaviour in unexpected cases. More...

#include <iostream>
#include <string_view>
#include <csignal>
#include "options.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 csl
 Namespace for csl library.
 

Macros

#define CSL_ASSERT(cond, error)
 
#define CSL_ASSERT_SPEC(cond, error, message)
 
#define CALL_SMERROR(error)   CallErrorImpl(error, __func__, __FILE__, __LINE__)
 
#define CALL_SMERROR_SPEC(error, message)   CallErrorImpl(error, __func__, __FILE__, __LINE__, message)
 

Enumerations

enum  cslError::Error {
  cslError::AbstractFuncCalled =1, cslError::BadCopyConstructor, cslError::ElementSequence, cslError::OutOfBounds,
  cslError::EvalNotValued, cslError::UndefinedBehaviour, cslError::ContractDummy, cslError::ContractionMismatch,
  cslError::SymmetryMismatch, cslError::UnknownProperty, cslError::InvalidITensor, cslError::InvalidIndicialParent,
  cslError::InvalidIndicialSum, cslError::BadDependency, cslError::BadType, cslError::BadSymmetry,
  cslError::BadContraction, cslError::UnknownEquation, cslError::BadPropertySetting, cslError::ArbitraryEvaluated,
  cslError::ComparingNotDummy, cslError::BadCommutationProp, cslError::NegativeGroupDimension, cslError::NoContractionProperty,
  cslError::BadSelfContraction, cslError::BadFieldInitialization, cslError::OperatorNotImplemented, cslError::BadOperator
}
 List all error possible. More...
 
enum  cslError::Warning {
  cslError::UnknownType =0, cslError::InvalidDimension, cslError::FactorialFloat, cslError::NotValued,
  cslError::Infinity, cslError::CopyingBuildingBlock, cslError::NCharatersNotImplemented
}
 List of all warning possible. More...
 
enum  CSLError {
  AbstractCallError, AttributeError, EOFError, FloatingPointError,
  GeneratorExit, IndexError, IOError, KeyError,
  MathError, NameError, NotImplementedError, OverflowError,
  RuntimeError, SyntaxError, TypeError, ValueError,
  ZeroDivisionError
}
 

Functions

template<typename T >
void csl::callError (cslError::Error error, const std::string &caller, T spec)
 Displays an error message depending on the error error, the name of the caller function caller and a possible specificity of the error spec. For example spec is the index for OutOfBound error. This function stops the program. More...
 
void csl::callError (cslError::Error error, const std::string &caller)
 Calls callError(cslError::Error, const std::string&,T) with no spec.
 
template<typename T >
void csl::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 and a possible specificity of the warning spec. For example spec is the dimension for InvalidDimension error. This function does not stop the program. More...
 
std::ostream & operator<< (std::ostream &fout, CSLError error)
 
void CallErrorImpl (CSLError error, std::string_view func, std::string_view file, int line)
 
void CallErrorImpl (CSLError error, std::string_view func, std::string_view file, int line, std::string_view message)
 

Detailed Description

File containing functions that are called by the program when something wrong happened: determines the behaviour in unexpected cases.

Author
Grégoire Uhlrich
Version
1.3

Macro Definition Documentation

◆ CSL_ASSERT

#define CSL_ASSERT (   cond,
  error 
)
Value:
if (not (cond)) {\
CallErrorImpl(error, __func__, __FILE__, __LINE__);\
}

◆ CSL_ASSERT_SPEC

#define CSL_ASSERT_SPEC (   cond,
  error,
  message 
)
Value:
if (not (cond)) {\
CallErrorImpl(error, __func__, __FILE__, __LINE__, message);\
}

Enumeration Type Documentation

◆ Error

List all error possible.

Enumerator
AbstractFuncCalled 

A function has been called with an object for which it is not defined.

BadCopyConstructor 

Copy constructor called with wrong type.

ElementSequence 

Setting an element of a vectorial expression with a sequence of element.

OutOfBounds 

Index out of bounds for Expression with mutiple arguments.

EvalNotValued 

Evaluating an expression that cannot have a value.

UndefinedBehaviour 

Apparition of a case that has not been defined.

ContractDummy 

Trying to contract an index that is already contracted.

ContractionMismatch 

Trying to contract indices that do not match.

SymmetryMismatch 

Incompatibility between symmetries in the properties of an indicial expression.

UnknownProperty 

Trying to get a property of Abstract that is not defined..

InvalidITensor 

Invalid creation of TensorElement: bad indices.

InvalidIndicialParent 

Invalid parent: tensor not corresponding.

InvalidIndicialSum 

Summing two terms that have not the same index structure

BadDependency 

Setting a contradictory dependency for a variable.

BadType 

Bad type of Abstract sent in a function.

BadSymmetry 

Bad Symmetry sent in TensorParent (wring dimension).

BadContraction 

Bad contraction of indices in expression.

UnknownEquation 

Unknown type of equation used.

BadPropertySetting 

Setting a property that is not an equality.

ArbitraryEvaluated 

An arbitrary Abstract is evaluated, should not.

ComparingNotDummy 

A non-dummy Abstract is sent in Comparator.

BadCommutationProp 

Setting the commutation of an object for which it is determined.

NegativeGroupDimension 

Negative dimension in creation of group.

NoContractionProperty 

Calling a non-exiting special contraciton of ITensors.

BadSelfContraction 

Self-contraction property of TensorParent badely initialized.

BadFieldInitialization 

Bad initilization of field.

OperatorNotImplemented 

Rules for operator not implemented

BadOperator 

Bad initialization of operator

◆ Warning

List of all warning possible.

Enumerator
UnknownType 

The type of an expression is not handled in some function.

InvalidDimension 

Dimension mismatch when using Vectorial.

FactorialFloat 

Evaluating a factorial of non-integer value.

NotValued 

Evaluating a literal that is not valued.

Infinity 

Apparition of infinity or undefined value in calculation.

CopyingBuildingBlock 

Copying building block (should not, they are and should stay shared_from_this)

NCharatersNotImplemented 

The function getNCharacters is not implemented for an object.