#ifdef DEBUG
if (q.state() != IteratorState::past_the_end)
- Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsNeighbor());
+ Assert (q->used(), ExcInternalError());
#endif
return q;
}
#ifdef DEBUG
if (q.state() != IteratorState::past_the_end)
- Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsChild());
+ Assert (q->used(), ExcInternalError());
#endif
return q;
}
*/
namespace TriaAccessorExceptions
{
-//TODO: Write documentation!
/**
* @ingroup Exceptions
*/
- DeclException0 (ExcCellNotUsed);
+ DeclExceptionMsg (ExcCellNotUsed,
+ "The operation you are attempting can only be performed for "
+ "(cell, face, or edge) iterators that point to valid "
+ "objects. These objects need not necessarily be active, "
+ "i.e., have no children, but they need to be part of a "
+ "triangulation. (The objects pointed to by an iterator "
+ "may -- after coarsening -- also be objects that used "
+ "to be part of a triangulation, but are now no longer "
+ "used. Their memory location may have been retained "
+ "for re-use upon the next mesh refinement, but is "
+ "currently unused.)");
/**
* The cell is not an
* @ref GlossActive "active"
*
* @ingroup Exceptions
*/
- DeclException0 (ExcCellNotActive);
+ DeclExceptionMsg (ExcCellNotActive,
+ "The operation you are attempting can only be performed for "
+ "(cell, face, or edge) iterators that point to 'active' "
+ "objects. 'Active' objects are those that do not have "
+ "children (in the case of cells), or that are part of "
+ "an active cell (in the case of faces or edges). However, "
+ "the object on which you are trying the current "
+ "operation is not 'active' in this sense.");
/**
* Trying to access the children of a cell which is in fact active.
*
* @ingroup Exceptions
*/
- DeclException0 (ExcCellHasNoChildren);
+ DeclExceptionMsg (ExcCellHasNoChildren,
+ "The operation you are attempting can only be performed for "
+ "(cell, face, or edge) iterators that have children, "
+ "but the object on which you are trying the current "
+ "operation does not have any.");
/**
* Trying to access the parent of a cell which is in the coarsest level of
* the triangulation.
*
* @ingroup Exceptions
*/
- DeclException0 (ExcCellHasNoParent);
-//TODO: Write documentation!
- /**
- * @ingroup Exceptions
- */
- DeclException0 (ExcUnusedCellAsChild);
-//TODO: Write documentation!
+ DeclExceptionMsg (ExcCellHasNoParent,
+ "The operation you are attempting can only be performed for "
+ "(cell, face, or edge) iterators that have a parent object, "
+ "but the object on which you are trying the current "
+ "operation does not have one -- i.e., it is on the "
+ "coarsest level of the triangulation.");
/**
* @ingroup Exceptions
*/
DeclException1 (ExcCantSetChildren,
int,
- << "You can only set the child index if the cell has no "
- << "children, or clear it. The given "
- << "index was " << arg1 << " (-1 means: clear children)");
-//TODO: Write documentation!
- /**
- * @ingroup Exceptions
- */
- DeclException0 (ExcUnusedCellAsNeighbor);
-//TODO: Write documentation!
- /**
- * @ingroup Exceptions
- */
- DeclException0 (ExcUncaughtCase);
-//TODO: Write documentation!
+ << "You can only set the child index if the cell does not "
+ << "currently have children registered; or you can clear it. "
+ << "The given index was " << arg1 << " (-1 means: clear children).");
/**
* @ingroup Exceptions
*/
- DeclException0 (ExcDereferenceInvalidObject);
-//TODO: Write documentation!
+ template <typename AccessorType>
+ DeclException1 (ExcDereferenceInvalidObject,
+ AccessorType,
+ << "You tried to dereference an iterator for which this "
+ << "is not possible. More information on this iterator: "
+ << "index=" << arg1.index()
+ << ", state="
+ << (arg1.state() == IteratorState::valid ? "valid" :
+ (arg1.state() == IteratorState::past_the_end ?
+ "past_the_end" : "invalid")));
/**
* @ingroup Exceptions
*/
- DeclException0 (ExcCantCompareIterators);
+ DeclExceptionMsg (ExcCantCompareIterators,
+ "Iterators can only be compared if they point to the same "
+ "triangulation, or if neither of them are associated "
+ "with a triangulation.");
//TODO: Write documentation!
/**
* @ingroup Exceptions
TriaAccessor<structdim,dim,spacedim>::used () const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
return this->objects().used[this->present_index];
}
void TriaAccessor<structdim, dim, spacedim>::set_used_flag () const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
this->objects().used[this->present_index] = true;
}
TriaAccessor<structdim, dim, spacedim>::clear_used_flag () const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
this->objects().used[this->present_index] = false;
}
TriaAccessor<structdim, dim, spacedim>::refinement_case() const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
switch (structdim)
{
child_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
- TriaAccessorExceptions::ExcUnusedCellAsChild());
+ ExcInternalError());
return q;
}
TriaAccessor<structdim,dim,spacedim>::has_children () const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
// each set of two children are stored
// consecutively, so we only have to find
set_refinement_case (const RefinementCase<structdim> &refinement_case) const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
Assert (static_cast<unsigned int> (this->present_index) <
this->objects().refinement_cases.size(),
ExcIndexRange(this->present_index, 0,
TriaAccessor<structdim, dim, spacedim>::clear_refinement_case () const
{
Assert (this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject());
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
Assert (static_cast<unsigned int> (this->present_index) <
this->objects().refinement_cases.size(),
ExcIndexRange(this->present_index, 0,
// the location of the set of children
const unsigned int n_sets_of_two = GeometryInfo<structdim>::max_children_per_cell/2;
- Assert ((index==-1) ||
- (i==0 && !this->has_children() && (index>=0)) ||
- (i>0 && this->has_children() && (index>=0) &&
- this->objects().children[n_sets_of_two*this->present_index+i/2] == -1),
- TriaAccessorExceptions::ExcCantSetChildren(index));
+ Assert (
+ // clearing the child index for a cell
+ (index==-1)
+ ||
+ // if setting the child index for the i'th child (with i==0),
+ // then the index must be a non-negative number
+ (i==0 && !this->has_children() && (index>=0))
+ ||
+ // if setting the child index for the i'th child (with i>0),
+ // then the previously stored index must be the invalid
+ // index
+ (i>0 && this->has_children() && (index>=0) &&
+ this->objects().children[n_sets_of_two*this->present_index+i/2] == -1),
+ TriaAccessorExceptions::ExcCantSetChildren(index));
this->objects().children[n_sets_of_two*this->present_index+i/2] = index;
}
q (this->tria, neighbor_level (i), neighbor_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
- TriaAccessorExceptions::ExcUnusedCellAsNeighbor());
+ ExcInternalError());
return q;
}
q (this->tria, this->present_level+1, this->child_index (i));
Assert ((q.state() == IteratorState::past_the_end) || q->used(),
- TriaAccessorExceptions::ExcUnusedCellAsChild());
+ ExcInternalError());
return q;
}
"past_the_end" : "invalid")));
/**
- * Exception for lower-dimensional TriaObjects without level, i.e. objects
- * faces are constructed with.
+ * Exception.
*/
DeclException1 (ExcDereferenceInvalidObject,
Accessor,