36 #ifndef MADNESS_TENSOR_TENSOREXCPT_H__INCLUDED
37 #define MADNESS_TENSOR_TENSOREXCPT_H__INCLUDED
63 int lin,
const char *
func,
const char *file)
77 virtual const char*
what()
const throw() {
85 out <<
"TensorException: msg='";
86 if (
e.msg) out <<
e.msg;
88 if (
e.assertion) out <<
" failed assertion='" <<
90 out <<
" value=" <<
e.value <<
"\n";
91 if (
e.line) out <<
" line=" <<
e.line <<
"\n";
92 if (
e.function) out <<
" function='" <<
94 if (
e.filename) out <<
" filename='" <<
96 if (
e.tp !=
nullptr) {
97 out <<
" tensor=Tensor<";
102 out <<
"invalid_type_id>(";
105 for (
int i=0; i<
e.t.ndim(); ++i) {
107 if (i != (
e.t.ndim()-1)) out <<
",";
112 out <<
"invalid_dimensions)";
114 out <<
" at 0x" << (
void *)(
e.tp) <<
"\n";
123 #define TENSOR_STRINGIZE(X) #X
124 #define TENSOR_EXCEPTION_AT(F, L) TENSOR_STRINGIZE(F) "(" TENSOR_STRINGIZE(L) ")"
126 #define TENSOR_EXCEPTION(msg,value,t) \
127 throw ::madness::TensorException("TENSOR EXCEPTION: " TENSOR_EXCEPTION_AT( __FILE__, __LINE__ ) ": " msg , \
128 0,value,t,__LINE__,__FUNCTION__,__FILE__)
130 #define TENSOR_ASSERT(condition,msg,value,t) \
131 do {if (!(condition)) \
132 throw ::madness::TensorException("TENSOR ASSERTION FAILED: " TENSOR_EXCEPTION_AT( __FILE__, __LINE__ ) ": " msg , \
133 #condition,value,t,__LINE__,__FUNCTION__,__FILE__); \
The base class for tensors defines generic capabilities.
Definition: basetensor.h:85
Tensor is intended to throw only TensorExceptions.
Definition: tensorexcept.h:50
virtual const char * what() const
Definition: tensorexcept.h:77
int line
Definition: tensorexcept.h:56
const char * function
Definition: tensorexcept.h:57
const char * filename
Definition: tensorexcept.h:58
const char * msg
Definition: tensorexcept.h:51
friend std::ostream & operator<<(std::ostream &out, const TensorException &e)
Print a TensorException to the stream (for human consumption)
Definition: tensorexcept.h:84
TensorException(const char *s, const char *a, int err, const BaseTensor *tp, int lin, const char *func, const char *file)
Definition: tensorexcept.h:62
virtual ~TensorException()
Definition: tensorexcept.h:81
const BaseTensor * tp
Definition: tensorexcept.h:55
BaseTensor t
Definition: tensorexcept.h:54
int value
Definition: tensorexcept.h:53
const char * assertion
Definition: tensorexcept.h:52
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
const char * tensor_type_names[]
std::shared_ptr< FunctionFunctorInterface< double, 3 > > func(new opT(g))
static const double a
Definition: nonlinschro.cc:118
#define TENSOR_MAXDIM
Definition: tensor_macros.h:194
void e()
Definition: test_sig.cc:75
#define TENSOR_MAX_TYPE_ID
Definition: type_data.h:115