#include <deal.II/base/config.h>
#include <exception>
-#include <string>
#include <ostream>
+#include <string>
+#include <type_traits>
#ifdef DEAL_II_WITH_CUDA
#include <cusolverSp.h>
* The actual exception object (the last argument) is typically an unnamed
* object created in place; because we modify it, we can't take it by
* const reference, and temporaries don't bind to non-const references.
- * So take it by value (=copy it) -- the performance implications are
- * pretty minimal anyway.
+ * So take it by value (=copy it) with a templated type to avoid slicing
+ * -- the performance implications are pretty minimal anyway.
*
* @ref ExceptionBase
*/
}
}
+ /**
+ * Internal function that does the work of issue_error_nothrow.
+ */
+ void
+ do_issue_error_nothrow(const ExceptionBase &e) noexcept;
+
/**
* Exception generation mechanism in case we must not throw.
*
* @ref ExceptionBase
+ *
+ * @note This function is defined with a template for the same reasons as
+ * issue_error_noreturn().
*/
+ template <class ExceptionType>
void issue_error_nothrow (ExceptionHandling,
- const char *file,
- int line,
- const char *function,
- const char *cond,
- const char *exc_name,
- ExceptionBase e) noexcept;
+ const char *file,
+ int line,
+ const char *function,
+ const char *cond,
+ const char *exc_name,
+ ExceptionType e) noexcept
+ {
+ static_assert(std::is_base_of<ExceptionBase, ExceptionType>::value,
+ "The provided exception must inherit from ExceptionBase.");
+ // Fill the fields of the exception object
+ e.set_fields (file, line, function, cond, exc_name);
+ // avoid moving a bunch of code into the header by dispatching to
+ // another function:
+ do_issue_error_nothrow(e);
+ }
#ifdef DEAL_II_WITH_CUDA
/**
* Return a string given an error code. This is similar to the cudaGetErrorString
{
namespace internals
{
-
- void issue_error_nothrow (ExceptionHandling,
- const char *file,
- int line,
- const char *function,
- const char *cond,
- const char *exc_name,
- ExceptionBase e) noexcept
+ void do_issue_error_nothrow (const ExceptionBase &exc) noexcept
{
- // Fill the fields of the exception object
- e.set_fields (file, line, function, cond, exc_name);
if (dealii::deal_II_exceptions::abort_on_exception)
- internal_abort(e);
+ internal_abort(exc);
else
{
// We are not allowed to throw, and not allowed to abort.
// Just print the exception name to deallog and continue normally:
- deallog << "Exception: " << e.get_exc_name() << std::endl;
- deallog << e.what() << std::endl;
+ deallog << "Exception: " << exc.get_exc_name() << std::endl;
+ deallog << exc.what() << std::endl;
}
}
The violated condition was:
counter == 0
Additional information:
- (none)
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information:
+ from Subscriber v)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
--------------------------------------------------------
DEAL::Exception: ExcInUse (counter, object_info->name(), infostring)
The violated condition was:
counter == 0
Additional information:
- (none)
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information:
+ from Subscriber v)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
--------------------------------------------------------
DEAL::Exception: ExcInUse (counter, object_info->name(), infostring)
The violated condition was:
counter == 0
Additional information:
- (none)
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information:
+ from Subscriber v)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
--------------------------------------------------------
--- /dev/null
+
+DEAL::Exception: ExcInUse (counter.load(), object_info->name(), infostring)
+DEAL::
+--------------------------------------------------------
+An error occurred in file <subscriptor.cc> in function
+ void dealii::Subscriptor::check_no_subscribers() const
+The violated condition was:
+ counter == 0
+Additional information:
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information: <none>)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
+--------------------------------------------------------
+
+DEAL::Exception: ExcInUse (counter.load(), object_info->name(), infostring)
+DEAL::
+--------------------------------------------------------
+An error occurred in file <subscriptor.cc> in function
+ void dealii::Subscriptor::check_no_subscribers() const
+The violated condition was:
+ counter == 0
+Additional information:
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information: <none>)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
+--------------------------------------------------------
+
+DEAL::Exception: ExcInUse (counter.load(), object_info->name(), infostring)
+DEAL::
+--------------------------------------------------------
+An error occurred in file <subscriptor.cc> in function
+ void dealii::Subscriptor::check_no_subscribers() const
+The violated condition was:
+ counter == 0
+Additional information:
+ Object of class N6dealii11SubscriptorE is still used by 1 other objects.
+
+(Additional information: <none>)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
+--------------------------------------------------------
+
+++ /dev/null
-
-DEAL::Exception: ExcInternalError()
-DEAL::
---------------------------------------------------------
-An error occurred in file <exception_nothrow.cc> in function
- int main()
-The violated condition was:
- 1==2
-Additional information:
- (none)
---------------------------------------------------------
-
--- /dev/null
+
+DEAL::Exception: ExcInternalError()
+DEAL::
+--------------------------------------------------------
+An error occurred in file <exception_nothrow.cc> in function
+ int main()
+The violated condition was:
+ 1==2
+Additional information:
+ This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an element that is not larger than the previous one.
+
+There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help.
+--------------------------------------------------------
+
--- /dev/null
+
+DEAL::Exception: ExcInternalError()
+DEAL::
+--------------------------------------------------------
+An error occurred in file <exception_nothrow.cc> in function
+ int main()
+The violated condition was:
+ 1==2
+Additional information:
+ This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an element that is not larger than the previous one.
+
+There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help.
+--------------------------------------------------------
+
The violated condition was:
counter == 0
Additional information:
- (none)
+ Object of class 4Test is still used by 1 other objects.
+
+(Additional information:
+ from Subscriber Test R)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
--------------------------------------------------------
DEAL::Destruct C
--- /dev/null
+
+DEAL::Construct A
+DEAL::Construct B
+DEAL::a mutable
+DEAL::b const
+DEAL::r mutable
+DEAL::s const
+DEAL::t mutable
+DEAL::u const
+DEAL::Construct C
+DEAL::Construct D
+DEAL::Destruct D
+DEAL::Exception: ExcInUse (counter.load(), object_info->name(), infostring)
+DEAL::
+--------------------------------------------------------
+An error occurred in file <subscriptor.cc> in function
+ void dealii::Subscriptor::check_no_subscribers() const
+The violated condition was:
+ counter == 0
+Additional information:
+ Object of class 4Test is still used by 1 other objects.
+
+(Additional information: <none>)
+
+See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.
+--------------------------------------------------------
+
+DEAL::Destruct C
+DEAL::Destruct B
+DEAL::Destruct A
The violated condition was:
current_alloc == 0
Additional information:
- (none)
+ Destroying memory handler while 1 objects are still allocated.
--------------------------------------------------------
DEAL::Exception: StandardExceptions::ExcMemoryLeak(current_alloc)
The violated condition was:
current_alloc == 0
Additional information:
- (none)
+ Destroying memory handler while 1 objects are still allocated.
--------------------------------------------------------