36 #ifndef MADNESS_TENSOR_TENSOREXCPT_H__INCLUDED
37 #define MADNESS_TENSOR_TENSOREXCPT_H__INCLUDED
52 const char* assertion;
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='" <<
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__); \
138 #endif // MADNESS_TENSOR_TENSOREXCPT_H__INCLUDED
std::complex< double > func(int n, int t1, int t2, int t3, double xx, double yy, double zz)
Definition: wannier.cc:98
long ndim() const
Returns the number of dimensions in the tensor.
Definition: basetensor.h:144
long dim(int i) const
Returns the size of dmension i.
Definition: basetensor.h:147
virtual const char * what() const
Definition: tensorexcept.h:77
long id() const
Returns the typeid of the tensor (c.f., TensorTypeData )
Definition: basetensor.h:141
The base class for tensors defines generic capabilities.
Definition: basetensor.h:85
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
#define TENSOR_MAXDIM
Definition: tensor_macros.h:194
friend std::ostream & operator<<(std::ostream &out, const TensorException &e)
Print a TensorException to the stream (for human consumption)
Definition: tensorexcept.h:84
const char * tensor_type_names[]
TensorException(const char *s, const char *a, int err, const BaseTensor *tp, int lin, const char *func, const char *file)
Definition: tensorexcept.h:62
Tensor is intended to throw only TensorExceptions.
Definition: tensorexcept.h:50
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
virtual ~TensorException()
Definition: tensorexcept.h:81
Function< complexd, 3 > function
Definition: envelopedpulse.h:45
#define TENSOR_MAX_TYPE_ID
Definition: type_data.h:119