SparseMatrix.
The stacktrace gives an indication of where the problem happened. We
-see that the exception was triggered in the
+see that the AssertNothrow macro was triggered in the
destructor of the SparseMatrix class (which inherits from Subscriptor) that was called
through a few more functions from the destructor of the
<code>Step6</code> class, exactly where we have commented out
}
}
@endcode
-(Adding the <code>Assert</code> at the end ensures that an exception
-is thrown if we ever get to that point -- which of course we shouldn't,
+(Adding the <code>Assert</code> at the end ensures that either an exception
+is thrown or that the program aborts if we ever get to that point
+-- which of course we shouldn't,
but this is a good way to insure yourself: we all make mistakes by
sometimes not thinking of all cases, for example by checking
for <code>p[0]</code> to be less than and greater than zero,
// their declaration in the class), as always in C++. Thus, the
// SparsityPattern will be destroyed before the SparseMatrix, since its
// declaration is below the declaration of the sparsity pattern. This triggers
-// the situation above, and without manual intervention an exception will be
-// raised when the SparsityPattern is destroyed. What needs to be done is to
+// the situation above, and without manual intervention the program will abort
+// when the SparsityPattern is destroyed. What needs to be done is to
// tell the SparseMatrix to release its pointer to the SparsityPattern. Of
// course, the SparseMatrix will only release its pointer if it really does
// not need the SparsityPattern any more. For this purpose, the SparseMatrix
// the SparsityPattern to 0. After this, you can safely destruct the
// SparsityPattern since its internal counter will be zero.
//
-// For completeness, we add the output of the exception that would have been
-// triggered without this destructor, to the end of the results section of
-// this example.
+// We show the output of the other case (where we do not call
+// SparseMatrix::clear()) in the results section below.
template <int dim>
Step6<dim>::~Step6 ()
{
// boundary conditions after assembly, like we did in earlier steps: instead
// we put all constraints on our function space in the ConstraintMatrix. We
// can add constraints to the ConstraintMatrix in either order: if two
- // constraints conflict then the constraint matrix will throw an exception.
+ // constraints conflict then the constraint matrix either abort or throw an
+ // exception via the Assert macro.
VectorTools::interpolate_boundary_values (dof_handler,
0,
Functions::ZeroFunction<dim>(),