Reference documentation for deal.II version 9.0.0
exceptions.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_exceptions_h
17 #define dealii_exceptions_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <exception>
22 #include <ostream>
23 #include <string>
24 #include <type_traits>
25 
26 #ifdef DEAL_II_WITH_CUDA
27 #include <cusolverSp.h>
28 #include <cusparse.h>
29 #endif
30 
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 
49 class ExceptionBase : public std::exception
50 {
51 public:
55  ExceptionBase ();
56 
61 
65  virtual ~ExceptionBase () noexcept;
66 
71  ExceptionBase operator= (const ExceptionBase &) = delete;
72 
78  void set_fields (const char *file,
79  const int line,
80  const char *function,
81  const char *cond,
82  const char *exc_name);
83 
84 
88  virtual const char *what() const noexcept;
89 
93  const char *get_exc_name() const;
94 
98  void print_exc_data (std::ostream &out) const;
99 
104  virtual void print_info (std::ostream &out) const;
105 
110  void print_stack_trace (std::ostream &out) const;
111 
112 protected:
116  const char *file;
117 
121  unsigned int line;
122 
126  const char *function;
127 
131  const char *cond;
132 
136  const char *exc;
137 
142  mutable char **stacktrace;
143 
149 
150 #ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
151 
154  void *raw_stacktrace[25];
155 #endif
156 
157 private:
161  void generate_message() const;
162 
167  mutable std::string what_str;
168 };
169 
170 #ifndef DOXYGEN
171 
178 #define DeclException0(Exception0) \
179  class Exception0 : public ::ExceptionBase {}
180 
181 
190 #define DeclExceptionMsg(Exception, defaulttext) \
191  class Exception : public ::ExceptionBase \
192  { \
193  public: \
194  Exception (const std::string &msg = defaulttext) : arg (msg) {} \
195  virtual ~Exception () noexcept {} \
196  virtual void print_info (std::ostream &out) const { \
197  out << " " << arg << std::endl; \
198  } \
199  private: \
200  const std::string arg; \
201  }
202 
209 #define DeclException1(Exception1, type1, outsequence) \
210  class Exception1 : public ::ExceptionBase { \
211  public: \
212  Exception1 (const type1 a1) : arg1 (a1) {} /*NOLINT*/ \
213  virtual ~Exception1 () noexcept {} \
214  virtual void print_info (std::ostream &out) const { \
215  out << " " outsequence << std::endl; \
216  } \
217  private: \
218  const type1 arg1; \
219  }
220 
221 
228 #define DeclException2(Exception2, type1, type2, outsequence) \
229  class Exception2 : public ::ExceptionBase { \
230  public: \
231  Exception2 (const type1 a1, const type2 a2) : /*NOLINT*/ \
232  arg1 (a1), arg2(a2) {} \
233  virtual ~Exception2 () noexcept {} \
234  virtual void print_info (std::ostream &out) const { \
235  out << " " outsequence << std::endl; \
236  } \
237  private: \
238  const type1 arg1; \
239  const type2 arg2; \
240  }
241 
242 
249 #define DeclException3(Exception3, type1, type2, type3, outsequence) \
250  class Exception3 : public ::ExceptionBase { \
251  public: \
252  Exception3 (const type1 a1, const type2 a2, const type3 a3) : /*NOLINT*/ \
253  arg1 (a1), arg2(a2), arg3(a3) {} \
254  virtual ~Exception3 () noexcept {} \
255  virtual void print_info (std::ostream &out) const { \
256  out << " " outsequence << std::endl; \
257  } \
258  private: \
259  const type1 arg1; \
260  const type2 arg2; \
261  const type3 arg3; \
262  }
263 
264 
271 #define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \
272  class Exception4 : public ::ExceptionBase { \
273  public: \
274  Exception4 (const type1 a1, const type2 a2, /*NOLINT*/ \
275  const type3 a3, const type4 a4) : /*NOLINT*/ \
276  arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {} \
277  virtual ~Exception4 () noexcept {} \
278  virtual void print_info (std::ostream &out) const { \
279  out << " " outsequence << std::endl; \
280  } \
281  private: \
282  const type1 arg1; \
283  const type2 arg2; \
284  const type3 arg3; \
285  const type4 arg4; \
286  }
287 
288 
295 #define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence) \
296  class Exception5 : public ::ExceptionBase { \
297  public: \
298  Exception5 (const type1 a1, const type2 a2, const type3 a3,/*NOLINT*/ \
299  const type4 a4, const type5 a5) : /*NOLINT*/ \
300  arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {} \
301  virtual ~Exception5 () noexcept {} \
302  virtual void print_info (std::ostream &out) const { \
303  out << " " outsequence << std::endl; \
304  } \
305  private: \
306  const type1 arg1; \
307  const type2 arg2; \
308  const type3 arg3; \
309  const type4 arg4; \
310  const type5 arg5; \
311  }
312 
313 #else /*ifndef DOXYGEN*/
314 
315 // Dummy definitions for doxygen:
316 
323 #define DeclException0(Exception0) \
324  \
325  static ::ExceptionBase& Exception0 ()
326 
335 #define DeclExceptionMsg(Exception, defaulttext) \
336  \
337  \
338  static ::ExceptionBase& Exception ()
339 
346 #define DeclException1(Exception1, type1, outsequence) \
347  \
348  \
349  static ::ExceptionBase& Exception1 (type1 arg1)
350 
351 
358 #define DeclException2(Exception2, type1, type2, outsequence) \
359  \
360  \
361  static ::ExceptionBase& Exception2 (type1 arg1, type2 arg2)
362 
363 
370 #define DeclException3(Exception3, type1, type2, type3, outsequence) \
371  \
372  \
373  static ::ExceptionBase& Exception3 (type1 arg1, type2 arg2, type3 arg3)
374 
375 
382 #define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \
383  \
384  \
385  static ::ExceptionBase& Exception4 (type1 arg1, type2 arg2, type3 arg3, type4 arg4)
386 
387 
394 #define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence) \
395  \
396  \
397  static ::ExceptionBase& Exception5 (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)
398 
399 #endif /*ifndef DOXYGEN*/
400 
401 
414 {
419 
424  "A piece of code is attempting a division by zero. This is "
425  "likely going to lead to results that make no sense.");
426 
438  std::complex<double>,
439  << "In a significant number of places, deal.II checks that some intermediate "
440  << "value is a finite number (as opposed to plus or minus infinity, or "
441  << "NaN/Not a Number). In the current function, we encountered a number "
442  << "that is not finite (its value is " << arg1 << " and therefore "
443  << "violates the current assertion).\n\n"
444  << "This may be due to the fact that some operation in this function "
445  << "created such a value, or because one of the arguments you passed "
446  << "to the function already had this value from some previous "
447  << "operation. In the latter case, this function only triggered the "
448  << "error but may not actually be responsible for the computation of "
449  << "the number that is not finite.\n\n"
450  << "There are two common cases where this situation happens. First, your "
451  << "code (or something in deal.II) divides by zero in a place where this "
452  << "should not happen. Or, you are trying to solve a linear system "
453  << "with an unsuitable solver (such as an indefinite or non-symmetric "
454  << "linear system using a Conjugate Gradient solver); such attempts "
455  << "oftentimes yield an operation somewhere that tries to divide "
456  << "by zero or take the square root of a negative value.\n\n"
457  << "In any case, when trying to find the source of the error, "
458  << "recall that the location where you are getting this error is "
459  << "simply the first place in the program where there is a check "
460  << "that a number (e.g., an element of a solution vector) is in fact "
461  << "finite, but that the actual error that computed the number "
462  << "may have happened far earlier. To find this location, you "
463  << "may want to add checks for finiteness in places of your "
464  << "program visited before the place where this error is produced."
465  << "One way to check for finiteness is to use the 'AssertIsFinite' "
466  << "macro.");
467 
472  "Your program tried to allocate some memory but this "
473  "allocation failed. Typically, this either means that "
474  "you simply do not have enough memory in your system, "
475  "or that you are (erroneously) trying to allocate "
476  "a chunk of memory that is simply beyond all reasonable "
477  "size, for example because the size of the object has "
478  "been computed incorrectly.");
479 
485  << "Destroying memory handler while " << arg1
486  << " objects are still allocated.");
487 
492  "An input/output error has occurred. There are a number of "
493  "reasons why this may be happening, both for reading and "
494  "writing operations."
495  "\n\n"
496  "If this happens during an operation that tries to read "
497  "data: First, you may be "
498  "trying to read from a file that doesn't exist or that is "
499  "not readable given its file permissions. Second, deal.II "
500  "uses this error at times if it tries to "
501  "read information from a file but where the information "
502  "in the file does not correspond to the expected format. "
503  "An example would be a truncated file, or a mesh file "
504  "that contains not only sections that describe the "
505  "vertices and cells, but also sections for additional "
506  "data that deal.II does not understand."
507  "\n\n"
508  "If this happens during an operation that tries to write "
509  "data: you may be trying to write to a file to which file "
510  "or directory permissions do not allow you to write. A "
511  "typical example is where you specify an output file in "
512  "a directory that does not exist.");
513 
521  char *,
522  << "Could not open file " << arg1 << ".");
523 
533  "You are trying to use functionality in deal.II that is "
534  "currently not implemented. In many cases, this indicates "
535  "that there simply didn't appear much of a need for it, or "
536  "that the author of the original code did not have the "
537  "time to implement a particular case. If you hit this "
538  "exception, it is therefore worth the time to look into "
539  "the code to find out whether you may be able to "
540  "implement the missing functionality. If you do, please "
541  "consider providing a patch to the deal.II development "
542  "sources (see the deal.II website on how to contribute).");
543 
565  "This exception -- which is used in many places in the "
566  "library -- usually indicates that some condition which "
567  "the author of the code thought must be satisfied at a "
568  "certain point in an algorithm, is not fulfilled. An "
569  "example would be that the first part of an algorithm "
570  "sorts elements of an array in ascending order, and "
571  "a second part of the algorithm later encounters an "
572  "element that is not larger than the previous one."
573  "\n\n"
574  "There is usually not very much you can do if you "
575  "encounter such an exception since it indicates an error "
576  "in deal.II, not in your own program. Try to come up with "
577  "the smallest possible program that still demonstrates "
578  "the error and contact the deal.II mailing lists with it "
579  "to obtain help.");
580 
588  "You (or a place in the library) are trying to call a "
589  "function that is declared as a virtual function in a "
590  "base class but that has not been overridden in your "
591  "derived class."
592  "\n\n"
593  "This exception happens in cases where the base class "
594  "cannot provide a useful default implementation for "
595  "the virtual function, but where we also do not want "
596  "to mark the function as abstract (i.e., with '=0' at the end) "
597  "because the function is not essential to the class in many "
598  "contexts. In cases like this, the base class provides "
599  "a dummy implementation that makes the compiler happy, but "
600  "that then throws the current exception."
601  "\n\n"
602  "A concrete example would be the 'Function' class. It declares "
603  "the existence of 'value()' and 'gradient()' member functions, "
604  "and both are marked as 'virtual'. Derived classes have to "
605  "override these functions for the values and gradients of a "
606  "particular function. On the other hand, not every function "
607  "has a gradient, and even for those that do, not every program "
608  "actually needs to evaluate it. Consequently, there is no "
609  "*requirement* that a derived class actually override the "
610  "'gradient()' function (as there would be had it been marked "
611  "as abstract). But, since the base class cannot know how to "
612  "compute the gradient, if a derived class does not override "
613  "the 'gradient()' function and it is called anyway, then the "
614  "default implementation in the base class will simply throw "
615  "an exception."
616  "\n\n"
617  "The exception you see is what happens in cases such as the "
618  "one just illustrated. To fix the problem, you need to "
619  "investigate whether the function being called should indeed have "
620  "been called; if the answer is 'yes', then you need to "
621  "implement the missing override in your class.");
622 
627 
632 
640  int,
641  << "You are trying to execute functionality that is "
642  << "impossible in " << arg1
643  << "d or simply does not make any sense.");
644 
653  int, int,
654  << "You are trying to execute functionality that is "
655  << "impossible in dimensions <" << arg1 << "," << arg2
656  << "> or simply does not make any sense.");
657 
658 
663  "In a check in the code, deal.II encountered a zero in "
664  "a place where this does not make sense. See the condition "
665  "that was being checked and that is printed further up "
666  "in the error message to get more information on what "
667  "the erroneous zero corresponds to.");
668 
674  "The object you are trying to access is empty but it makes "
675  "no sense to attempt the operation you are trying on an "
676  "empty object.");
677 
686  std::size_t, std::size_t,
687  << "Dimension " << arg1 << " not equal to " << arg2 << ".");
688 
694  int, int, int,
695  << "Dimension " << arg1 << " neither equal to " << arg2
696  << " nor to " << arg3 << ".");
697 
711  int, int, int,
712  << "Index " << arg1 << " is not in the half-open range [" << arg2 << ","
713  << arg3 << ")."
714  << (arg2==arg3 ?
715  " In the current case, this half-open range is in fact empty, "
716  "suggesting that you are accessing an element of an empty "
717  "collection such as a vector that has not been set to the "
718  "correct size."
719  :
720  ""));
721 
737  template <typename T>
739  T,T,T,
740  << "Index " << arg1 << " is not in the half-open range [" << arg2 << ","
741  << arg3 << ")."
742  << (arg2==arg3 ?
743  " In the current case, this half-open range is in fact empty, "
744  "suggesting that you are accessing an element of an empty "
745  "collection such as a vector that has not been set to the "
746  "correct size."
747  :
748  ""));
749 
754  int, int,
755  << "Number " << arg1 << " must be larger than or equal "
756  << arg2 << ".");
757 
761  template <typename T>
763  T, T,
764  << "Number " << arg1 << " must be larger than or equal "
765  << arg2 << ".");
766 
772  int, int,
773  << "Division " << arg1 << " by " << arg2
774  << " has remainder different from zero.");
775 
785  "You are trying to use an iterator, but the iterator is "
786  "in an invalid state. This may indicate that the iterator "
787  "object has not been initialized, or that it has been "
788  "moved beyond the end of the range of valid elements.");
789 
795  "You are trying to use an iterator, but the iterator is "
796  "pointing past the end of the range of valid elements. "
797  "It is not valid to dereference the iterator in this "
798  "case.");
799 
814  std::string,
815  << arg1);
816 
821  "You are trying an operation on a vector that is only "
822  "allowed if the vector has no ghost elements, but the "
823  "vector you are operating on does have ghost elements. "
824  "Specifically, vectors with ghost elements are read-only "
825  "and cannot appear in operations that write into these "
826  "vectors."
827  "\n\n"
828  "See the glossary entry on 'Ghosted vectors' for more "
829  "information.");
830 
839  "You are trying an operation of the form 'vector=s' with "
840  "a nonzero scalar value 's'. However, such assignments "
841  "are only allowed if the right hand side is zero.");
842 
847  "You are attempting to use functionality that is only available "
848  "if deal.II was configured to use LAPACK, but cmake did not "
849  "find a valid LAPACK library.");
850 
855  "You are attempting to use functionality that is only available "
856  "if deal.II was configured to use NetCDF, but cmake did not "
857  "find a valid NetCDF library.");
858 
863  "You are attempting to use functionality that is only available "
864  "if deal.II was configured to use the function parser which "
865  "relies on the muparser library, but cmake did not "
866  "find a valid muparser library on your system and also did "
867  "not choose the one that comes bundled with deal.II.");
868 
873  "You are attempting to use functionality that is only available "
874  "if deal.II was configured to use Assimp, but cmake did not "
875  "find a valid Assimp library.");
876 
877 #ifdef DEAL_II_WITH_CUDA
878 
885  char *,
886  << arg1);
891  std::string,
892  << "There was an error in a cuSPARSE function: "
893  << arg1);
894 #endif
895 
896 
897 #ifdef DEAL_II_WITH_MPI
898 
920  class ExcMPI : public ::ExceptionBase
921  {
922  public:
923  ExcMPI (const int error_code);
924 
925  virtual void print_info (std::ostream &out) const;
926 
927  const int error_code;
928  };
929 #endif // DEAL_II_WITH_MPI
930 } /*namespace StandardExceptions*/
931 
932 
933 
941 {
942 
961  void set_additional_assert_output (const char *const p);
962 
974 
989 
997  namespace internals
998  {
999 
1008  [[noreturn]]
1009  void abort (const ExceptionBase &exc);
1010 
1015  {
1032  };
1033 
1048  template <class ExceptionType>
1049  [[noreturn]]
1051  const char *file,
1052  int line,
1053  const char *function,
1054  const char *cond,
1055  const char *exc_name,
1056  ExceptionType e)
1057  {
1058  // Fill the fields of the exception object
1059  e.set_fields (file, line, function, cond, exc_name);
1060 
1061  switch (handling)
1062  {
1063  case abort_on_exception:
1064  ::deal_II_exceptions::internals::abort(e);
1065  case throw_on_exception:
1066  throw e;
1067  // this function should never return (and AssertNothrow can);
1068  // something must have gone wrong in the error handling code for us
1069  // to get this far, so throw an exception.
1071  default:
1073  }
1074  }
1075 
1079  void
1080  do_issue_error_nothrow(const ExceptionBase &e) noexcept;
1081 
1090  template <class ExceptionType>
1092  const char *file,
1093  int line,
1094  const char *function,
1095  const char *cond,
1096  const char *exc_name,
1097  ExceptionType e) noexcept
1098  {
1099  static_assert(std::is_base_of<ExceptionBase, ExceptionType>::value,
1100  "The provided exception must inherit from ExceptionBase.");
1101  // Fill the fields of the exception object
1102  e.set_fields (file, line, function, cond, exc_name);
1103  // avoid moving a bunch of code into the header by dispatching to
1104  // another function:
1106  }
1107 #ifdef DEAL_II_WITH_CUDA
1108 
1112  std::string get_cusparse_error_string(const cusparseStatus_t error_code);
1113 
1118  std::string get_cusolver_error_string(const cusolverStatus_t error_code);
1119 #endif
1120  } /*namespace internals*/
1121 
1122 } /*namespace deal_II_exceptions*/
1123 
1124 
1125 
1140 #ifdef DEBUG
1141 # ifdef DEAL_II_HAVE_BUILTIN_EXPECT
1142 # define Assert(cond, exc) \
1143 { \
1144  if (__builtin_expect(!(cond), false)) \
1145  ::deal_II_exceptions::internals:: issue_error_noreturn( \
1146  ::deal_II_exceptions::internals::abort_on_exception, \
1147  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1148 }
1149 # else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1150 # define Assert(cond, exc) \
1151 { \
1152  if (!(cond)) \
1153  ::deal_II_exceptions::internals:: issue_error_noreturn( \
1154  ::deal_II_exceptions::internals::abort_on_exception, \
1155  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1156 }
1157 # endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1158 #else
1159 #define Assert(cond, exc) \
1160  {}
1161 #endif
1162 
1163 
1164 
1181 #ifdef DEBUG
1182 # ifdef DEAL_II_HAVE_BUILTIN_EXPECT
1183 # define AssertNothrow(cond, exc) \
1184 { \
1185  if (__builtin_expect(!(cond), false)) \
1186  ::deal_II_exceptions::internals::issue_error_nothrow( \
1187  ::deal_II_exceptions::internals::abort_nothrow_on_exception, \
1188  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1189 }
1190 # else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1191 # define AssertNothrow(cond, exc) \
1192 { \
1193  if (!(cond)) \
1194  ::deal_II_exceptions::internals::issue_error_nothrow( \
1195  ::deal_II_exceptions::internals::abort_nothrow_on_exception, \
1196  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1197 }
1198 # endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1199 #else
1200 #define AssertNothrow(cond, exc) \
1201  {}
1202 #endif
1203 
1220 #ifdef DEAL_II_HAVE_BUILTIN_EXPECT
1221 #define AssertThrow(cond, exc) \
1222 { \
1223  if (__builtin_expect(!(cond), false)) \
1224  ::deal_II_exceptions::internals:: issue_error_noreturn( \
1225  ::deal_II_exceptions::internals::throw_on_exception, \
1226  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1227 }
1228 #else /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1229 #define AssertThrow(cond, exc) \
1230 { \
1231  if (!(cond)) \
1232  ::deal_II_exceptions::internals::issue_error_noreturn( \
1233  ::deal_II_exceptions::internals::throw_on_exception, \
1234  __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #exc, exc); \
1235 }
1236 #endif /*ifdef DEAL_II_HAVE_BUILTIN_EXPECT*/
1237 
1248 #define AssertDimension(dim1,dim2) \
1249  Assert((dim1) == (dim2), ::ExcDimensionMismatch((dim1),(dim2)))
1250 
1251 
1259 #define AssertVectorVectorDimension(vec,dim1,dim2) \
1260  AssertDimension((vec).size(), (dim1)); \
1261  for (unsigned int i=0;i<dim1;++i) {AssertDimension((vec)[i].size(), (dim2));}
1262 
1263 namespace internal
1264 {
1265  // Workaround to allow for commas in template parameter lists
1266  // in preprocessor macros as found in
1267  // https://stackoverflow.com/questions/13842468/comma-in-c-c-macro
1268  template<typename T> struct argument_type;
1269  template<typename T, typename U> struct argument_type<T(U)>
1270  {
1271  typedef U type;
1272  };
1273 }
1274 
1284 #define AssertIndexRange(index,range) \
1285 Assert((index) < (range), \
1286  ExcIndexRangeType<typename ::internal::argument_type< \
1287  void(typename std::common_type<decltype(index), \
1288  decltype(range)>::type)>::type>((index),0,(range)))
1289 
1299 #define AssertIsFinite(number) \
1300 Assert(::numbers::is_finite(number), \
1301  ::ExcNumberNotFinite(std::complex<double>(number)))
1302 
1303 #ifdef DEAL_II_WITH_MPI
1304 
1314 #define AssertThrowMPI(error_code) \
1315 AssertThrow(error_code == MPI_SUCCESS, ::ExcMPI(error_code))
1316 #else
1317 #define AssertThrowMPI(error_code) {}
1318 #endif // DEAL_II_WITH_MPI
1319 
1320 #ifdef DEAL_II_WITH_CUDA
1321 
1328 #ifdef DEBUG
1329 #define AssertCuda(error_code) Assert(error_code == cudaSuccess, \
1330  ::ExcCudaError(cudaGetErrorString(error_code)))
1331 #else
1332 #define AssertCuda(error_code) { (void) (error_code); }
1333 #endif
1334 
1342 #ifdef DEBUG
1343 #define AssertCusparse(error_code) Assert(error_code == CUSPARSE_STATUS_SUCCESS, \
1344  ExcCusparseError( \
1345  deal_II_exceptions::internals:: \
1346  get_cusparse_error_string(error_code)))
1347 #else
1348 #define AssertCusparse(error_code) { (void) (error_code); }
1349 #endif
1350 
1351 #ifdef DEBUG
1352 #define AssertCusolver(error_code) Assert(error_code == CUSOLVER_STATUS_SUCCESS, \
1353  ExcCusparseError( \
1354  deal_II_exceptions::internals:: \
1355  get_cusolver_error_string(error_code)))
1356 #else
1357 #define AssertCusolver(error_code) { (void) (error_code); }
1358 #endif
1359 
1360 #endif
1361 
1362 using namespace StandardExceptions;
1363 
1364 DEAL_II_NAMESPACE_CLOSE
1365 
1366 #endif
virtual void print_info(std::ostream &out) const
Definition: exceptions.cc:345
virtual const char * what() const noexcept
Definition: exceptions.cc:138
static ::ExceptionBase & ExcPureFunctionCalled()
static ::ExceptionBase & ExcNeedsFunctionparser()
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:358
static ::ExceptionBase & ExcFileNotOpen(char *arg1)
static ::ExceptionBase & ExcImpossibleInDimSpacedim(int arg1, int arg2)
void suppress_stacktrace_in_exceptions()
Definition: exceptions.cc:54
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
static ::ExceptionBase & ExcDimensionMismatch2(int arg1, int arg2, int arg3)
std::string get_cusolver_error_string(const cusolverStatus_t error_code)
Definition: exceptions.cc:519
void set_additional_assert_output(const char *const p)
Definition: exceptions.cc:47
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcOutOfMemory()
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcDivideByZero()
void * raw_stacktrace[25]
Definition: exceptions.h:154
virtual void print_info(std::ostream &out) const
Definition: exceptions.cc:199
static ::ExceptionBase & ExcInvalidIterator()
static ::ExceptionBase & ExcNeedsLAPACK()
ExceptionBase operator=(const ExceptionBase &)=delete
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
static ::ExceptionBase & ExcNeedsNetCDF()
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:346
static ::ExceptionBase & ExcMemoryLeak(int arg1)
void set_fields(const char *file, const int line, const char *function, const char *cond, const char *exc_name)
Definition: exceptions.cc:116
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void do_issue_error_nothrow(const ExceptionBase &e) noexcept
Definition: exceptions.cc:444
std::string get_cusparse_error_string(const cusparseStatus_t error_code)
Definition: exceptions.cc:474
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
#define DeclException0(Exception0)
Definition: exceptions.h:323
static ::ExceptionBase & ExcNeedsAssimp()
static ::ExceptionBase & ExcCudaError(char *arg1)
static ::ExceptionBase & ExcIndexRangeType(T arg1, T arg2, T arg3)
std::string what_str
Definition: exceptions.h:167
unsigned int line
Definition: exceptions.h:121
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
void issue_error_nothrow(ExceptionHandling, const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e) noexcept
Definition: exceptions.h:1091
void print_stack_trace(std::ostream &out) const
Definition: exceptions.cc:206
static ::ExceptionBase & ExcGhostsPresent()
static ::ExceptionBase & ExcIteratorPastEnd()
const char * exc
Definition: exceptions.h:136
const char * cond
Definition: exceptions.h:131
static ::ExceptionBase & ExcNumberNotFinite(std::complex< double > arg1)
void issue_error_noreturn(ExceptionHandling handling, const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e)
Definition: exceptions.h:1050
const char * file
Definition: exceptions.h:116
void abort(const ExceptionBase &exc)
Definition: exceptions.cc:460
static ::ExceptionBase & ExcCusparseError(std::string arg1)
static ::ExceptionBase & ExcEmptyObject()
void print_exc_data(std::ostream &out) const
Definition: exceptions.cc:167
static ::ExceptionBase & ExcNotMultiple(int arg1, int arg2)
static ::ExceptionBase & ExcNotImplemented()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:370
void generate_message() const
Definition: exceptions.cc:296
virtual ~ExceptionBase() noexcept
Definition: exceptions.cc:108
char ** stacktrace
Definition: exceptions.h:142
void disable_abort_on_exception()
Definition: exceptions.cc:61
const char * get_exc_name() const
Definition: exceptions.cc:160
static ::ExceptionBase & ExcZero()
int n_stacktrace_frames
Definition: exceptions.h:148
static ::ExceptionBase & ExcLowerRangeType(T arg1, T arg2)
static ::ExceptionBase & ExcInternalError()