17 #ifndef __deal2__exceptions_h 18 #define __deal2__exceptions_h 25 #include <deal.II/base/config.h> 73 const char *exc_name);
79 virtual const char *
what()
const throw();
95 virtual void print_info (std::ostream &out)
const;
117 const char *
function;
141 #ifdef HAVE_GLIBC_STACKTRACE 145 void *raw_stacktrace[25];
248 abort_nothrow_on_exception
261 const char *
function,
263 const char *exc_name,
267 e.set_fields (file, line,
function, cond, exc_name);
271 case abort_on_exception:
274 case abort_nothrow_on_exception:
277 case throw_on_exception:
299 #define Assert(cond, exc) \ 302 ::deal_II_exceptions::internals:: \ 303 issue_error(::deal_II_exceptions::internals::abort_on_exception,\ 304 __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \ 307 #define Assert(cond, exc) \ 327 #define AssertNothrow(cond, exc) \ 330 ::deal_II_exceptions::internals:: \ 332 ::deal_II_exceptions::internals::abort_nothrow_on_exception, \ 333 __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \ 336 #define AssertNothrow(cond, exc) \ 353 #ifdef HAVE_BUILTIN_EXPECT 354 #define AssertThrow(cond, exc) \ 356 if (__builtin_expect(!(cond), false)) \ 357 ::deal_II_exceptions::internals:: \ 358 issue_error(::deal_II_exceptions::internals::throw_on_exception,\ 359 __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \ 362 #define AssertThrow(cond, exc) \ 365 ::deal_II_exceptions::internals:: \ 366 issue_error(::deal_II_exceptions::internals::throw_on_exception,\ 367 __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \ 381 #define DeclException0(Exception0) \ 382 class Exception0 : public ::ExceptionBase {} 391 #define DeclException1(Exception1, type1, outsequence) \ 392 class Exception1 : public ::ExceptionBase { \ 394 Exception1 (const type1 a1) : arg1 (a1) {} \ 395 virtual ~Exception1 () throw () {} \ 396 virtual void print_info (std::ostream &out) const { \ 397 out outsequence << std::endl; \ 410 #define DeclException2(Exception2, type1, type2, outsequence) \ 411 class Exception2 : public ::ExceptionBase { \ 413 Exception2 (const type1 a1, const type2 a2) : \ 414 arg1 (a1), arg2(a2) {} \ 415 virtual ~Exception2 () throw () {} \ 416 virtual void print_info (std::ostream &out) const { \ 417 out outsequence << std::endl; \ 431 #define DeclException3(Exception3, type1, type2, type3, outsequence) \ 432 class Exception3 : public ::ExceptionBase { \ 434 Exception3 (const type1 a1, const type2 a2, const type3 a3) : \ 435 arg1 (a1), arg2(a2), arg3(a3) {} \ 436 virtual ~Exception3 () throw () {} \ 437 virtual void print_info (std::ostream &out) const { \ 438 out outsequence << std::endl; \ 453 #define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \ 454 class Exception4 : public ::ExceptionBase { \ 456 Exception4 (const type1 a1, const type2 a2, \ 457 const type3 a3, const type4 a4) : \ 458 arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {} \ 459 virtual ~Exception4 () throw () {} \ 460 virtual void print_info (std::ostream &out) const { \ 461 out outsequence << std::endl; \ 477 #define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence) \ 478 class Exception5 : public ::ExceptionBase { \ 480 Exception5 (const type1 a1, const type2 a2, const type3 a3, \ 481 const type4 a4, const type5 a5) : \ 482 arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {} \ 483 virtual ~Exception5 () throw () {} \ 484 virtual void print_info (std::ostream &out) const { \ 485 out outsequence << std::endl; \ 505 #define DeclException0(Exception0) \ 506 static ::ExceptionBase& Exception0 () 515 #define DeclException1(Exception1, type1, outsequence) \ 516 static ::ExceptionBase& Exception1 (type1 arg1) throw (errortext outsequence) 525 #define DeclException2(Exception2, type1, type2, outsequence) \ 526 static ::ExceptionBase& Exception2 (type1 arg1, type2 arg2) throw (errortext outsequence) 535 #define DeclException3(Exception3, type1, type2, type3, outsequence) \ 536 static ::ExceptionBase& Exception3 (type1 arg1, type2 arg2, type3 arg3) throw (errortext outsequence) 545 #define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \ 546 static ::ExceptionBase& Exception4 (type1 arg1, type2 arg2, type3 arg3, type4 arg4) throw (errortext outsequence) 555 #define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence) \ 556 static ::ExceptionBase& Exception5 (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) throw (errortext outsequence) 609 <<
"Destroying memory handler while " << arg1
610 <<
" objects are still allocated");
625 <<
"Could not open file " << arg1);
694 <<
"Impossible in " << arg1 <<
"d.");
715 std::size_t, std::size_t,
716 <<
"Dimension " << arg1 <<
" not equal to " << arg2);
724 <<
"Dimension " << arg1 <<
" neither equal to " << arg2
725 <<
" nor to " << arg3);
741 <<
"Index " << arg1 <<
" is not in [" << arg2 <<
"," 751 <<
"Index " << arg1 <<
" is not in [" << arg2 <<
"," 759 <<
"Number " << arg1 <<
" must be larger or equal " 768 <<
"Number " << arg1 <<
" must be larger or equal " 777 <<
"Division " << arg1 <<
" by " << arg2
778 <<
" has remainder different from zero");
858 #define AssertDimension(dim1,dim2) Assert((dim1) == (dim2), \ 859 ExcDimensionMismatch((dim1),(dim2))) 870 #define AssertVectorVectorDimension(vec,dim1,dim2) AssertDimension((vec).size(), (dim1)) \ 871 for (unsigned int i=0;i<dim1;++i) { AssertDimension((vec)[i].size(), (dim2)); } 888 #define AssertIndexRange(index,range) Assert((index) < (range), \ 889 ExcIndexRange((index),0,(range))) 891 #define AssertGlobalIndexRange(index,range) Assert((index) < (range), \ 892 ExcIndexRange<types::global_dof_index>((index),0,(range))) 896 DEAL_II_NAMESPACE_CLOSE
::ExceptionBase & ExcLowerRangeType(T arg1, T arg2)
::ExceptionBase & ExcPureFunctionCalled()
void print_exc_data(std::ostream &out) const
#define DeclException2(Exception2, type1, type2, outsequence)
void suppress_stacktrace_in_exceptions()
::ExceptionBase & ExcOutOfMemory()
::ExceptionBase & ExcIndexRangeType(T arg1, T arg2, T arg3)
::ExceptionBase & ExcMessage(std::string arg1)
void set_additional_assert_output(const char *const p)
virtual void print_info(std::ostream &out) const
::ExceptionBase & ExcLowerRange(int arg1, int arg2)
::ExceptionBase & ExcInvalidState()
::ExceptionBase & ExcIO()
const char * get_exc_name() const
void abort(const ExceptionBase &exc, bool nothrow=false)
::ExceptionBase & ExcGhostsPresent()
#define DeclException1(Exception1, type1, outsequence)
::ExceptionBase & ExcEmptyObject()
void set_fields(const char *file, const int line, const char *function, const char *cond, const char *exc_name)
void generate_message() const
#define DeclException0(Exception0)
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
::ExceptionBase & ExcInvalidConstructorCall()
::ExceptionBase & ExcNeedsFunctionparser()
::ExceptionBase & ExcNeedsNetCDF()
::ExceptionBase & ExcImpossibleInDim(int arg1)
::ExceptionBase & ExcNeedsLAPACK()
void print_stack_trace(std::ostream &out) const
::ExceptionBase & ExcFileNotOpen(char *arg1)
::ExceptionBase & ExcIteratorPastEnd()
::ExceptionBase & ExcNumberNotFinite()
::ExceptionBase & ExcNotMultiple(int arg1, int arg2)
::ExceptionBase & ExcNotImplemented()
::ExceptionBase & ExcNotInitialized()
::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
::ExceptionBase & ExcDimensionMismatch2(int arg1, int arg2, int arg3)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
virtual const char * what() const
::ExceptionBase & ExcInvalidIterator()
::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
void disable_abort_on_exception()
::ExceptionBase & ExcInternalError()
::ExceptionBase & ExcDivideByZero()
::ExceptionBase & ExcZero()
::ExceptionBase & ExcMemoryLeak(int arg1)
void issue_error(ExceptionHandling handling, const char *file, int line, const char *function, const char *cond, const char *exc_name, exc e)