From c614a7f77bdc1257cfa56db407c8df6cdb8b4204 Mon Sep 17 00:00:00 2001 From: kanschat Date: Tue, 20 Sep 2011 19:07:29 +0000 Subject: [PATCH] documentation of exceptions git-svn-id: https://svn.dealii.org/trunk@24348 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/dofs/dof_handler.h | 21 +++++++----- deal.II/include/deal.II/dofs/dof_tools.h | 30 +++------------- deal.II/source/dofs/dof_renumbering.cc | 6 ++-- deal.II/source/dofs/dof_tools.cc | 40 ++++++++-------------- 4 files changed, 36 insertions(+), 61 deletions(-) diff --git a/deal.II/include/deal.II/dofs/dof_handler.h b/deal.II/include/deal.II/dofs/dof_handler.h index 5daca5c768..b8ee55a3e2 100644 --- a/deal.II/include/deal.II/dofs/dof_handler.h +++ b/deal.II/include/deal.II/dofs/dof_handler.h @@ -1238,26 +1238,28 @@ class DoFHandler : public Subscriptor BOOST_SERIALIZATION_SPLIT_MEMBER() - /** - * @todo Replace by ExcInternalError. + /** + * We are trying to renumber the + * degrees of freedom, but + * somehow did not count + * correctly. + * + * @ingroup Exceptions */ DeclException0 (ExcRenumberingIncomplete); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcGridsDoNotMatch); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcInvalidBoundaryIndicator); /** * Exception - */ - DeclException1 (ExcMatrixHasWrongSize, - int, - << "The matrix has the wrong dimension " << arg1); - /** - * Exception + * @ingroup Exceptions */ DeclException1 (ExcNewNumbersNotConsecutive, int, @@ -1265,6 +1267,7 @@ class DoFHandler : public Subscriptor << "the index " << arg1 << " does not exist."); /** * Exception + * @ingroup Exceptions */ DeclException1 (ExcInvalidLevel, int, @@ -1272,11 +1275,13 @@ class DoFHandler : public Subscriptor << " is not in the valid range!"); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcFacesHaveNoLevel); /** * The triangulation level you * accessed is empty. + * @ingroup Exceptions */ DeclException1 (ExcEmptyLevel, int, diff --git a/deal.II/include/deal.II/dofs/dof_tools.h b/deal.II/include/deal.II/dofs/dof_tools.h index fbdb26a293..6ec1ef45f3 100644 --- a/deal.II/include/deal.II/dofs/dof_tools.h +++ b/deal.II/include/deal.II/dofs/dof_tools.h @@ -2106,49 +2106,29 @@ namespace DoFTools std::vector > dof_couplings_from_component_couplings (const hp::FECollection &fe, const Table<2,Coupling> &component_couplings); - - /** - * Exception - */ - DeclException0 (ExcFEHasNoSupportPoints); - /** - * Exception - */ - DeclException0 (ExcFENotPrimitive); - /** - * Exception - */ - DeclException2 (ExcWrongSize, - int, int, - << "The dimension " << arg1 << " of the vector is wrong. " - << "It should be " << arg2); - /** - * Exception - */ - DeclException2 (ExcInvalidComponent, - int, int, - << "The component you gave (" << arg1 << ") " - << "is invalid with respect to the number " - << "of components in the finite element " - << "(" << arg2 << ")"); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcFiniteElementsDontMatch); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcGridNotCoarser); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcGridsDontMatch); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcNoFESelected); /** * Exception + * @ingroup Exceptions */ DeclException0 (ExcInvalidBoundaryIndicator); } diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index dfa196c5ca..45cbff5082 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -1483,12 +1483,12 @@ namespace DoFRenumbering const hp::FECollection fe_collection (dof.get_fe ()); Assert (fe_collection[0].has_support_points(), - DoFTools::ExcFEHasNoSupportPoints()); + typename FiniteElement::ExcFEHasNoSupportPoints()); hp::QCollection quadrature_collection; for (unsigned int comp=0; comp::ExcFEHasNoSupportPoints()); quadrature_collection.push_back (Quadrature (fe_collection[comp]. get_unit_support_points())); @@ -1614,7 +1614,7 @@ namespace DoFRenumbering else { Assert (dof.get_fe().has_support_points(), - DoFTools::ExcFEHasNoSupportPoints()); + typename FiniteElement::ExcFEHasNoSupportPoints()); const unsigned int n_dofs = dof.n_dofs(level); std::vector,unsigned int> > support_point_list (n_dofs); diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index 62792b0320..637bb7467c 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -3400,16 +3400,15 @@ namespace DoFTools Vector &dof_data, const unsigned int component) { - const Triangulation &tria = dof_handler.get_tria(); - - Assert (cell_data.size()==tria.n_active_cells(), - ExcWrongSize (cell_data.size(), tria.n_active_cells())); - Assert (dof_data.size()==dof_handler.n_dofs(), - ExcWrongSize (dof_data.size(), dof_handler.n_dofs())); - Assert (component < n_components(dof_handler), - ExcInvalidComponent(component, n_components(dof_handler))); + const unsigned int dim = DH::dimension; + const unsigned int spacedim = DH::space_dimension; + const Triangulation &tria = dof_handler.get_tria(); + + AssertDimension (cell_data.size(), tria.n_active_cells()); + AssertDimension (dof_data.size(), dof_handler.n_dofs()); + AssertIndexRange (component, n_components(dof_handler)); Assert (fe_is_primitive(dof_handler) == true, - ExcFENotPrimitive()); + typename FiniteElement::ExcFENotPrimitive()); // store a flag whether we should care // about different components. this is @@ -3733,9 +3732,7 @@ namespace DoFTools std::vector &selected_dofs, const std::set &boundary_indicators) { - Assert (component_select.size() == n_components(dof_handler), - ExcWrongSize (component_select.size(), - n_components(dof_handler))); + AssertDimension (component_select.size(),n_components(dof_handler)); Assert (boundary_indicators.find (255) == boundary_indicators.end(), ExcInvalidBoundaryIndicator()); const unsigned int dim=DH::dimension; @@ -3859,9 +3856,7 @@ namespace DoFTools std::vector &selected_dofs, const std::set &boundary_indicators) { - Assert (component_select.size() == n_components(dof_handler), - ExcWrongSize (component_select.size(), - n_components(dof_handler))); + AssertDimension (component_select.size(), n_components(dof_handler)); Assert (boundary_indicators.find (255) == boundary_indicators.end(), ExcInvalidBoundaryIndicator()); @@ -4263,9 +4258,7 @@ namespace DoFTools get_active_fe_indices (const DH &dof_handler, std::vector &active_fe_indices) { - Assert (active_fe_indices.size() == dof_handler.get_tria().n_active_cells(), - ExcWrongSize (active_fe_indices.size(), - dof_handler.get_tria().n_active_cells())); + AssertDimension (active_fe_indices.size(), dof_handler.get_tria().n_active_cells()); typename DH::active_cell_iterator cell = dof_handler.begin_active(), @@ -5073,10 +5066,8 @@ namespace DoFTools // check whether component numbers // are valid - Assert (coarse_component < coarse_fe.n_components(), - ExcInvalidComponent (coarse_component, coarse_fe.n_components())); - Assert (fine_component < fine_fe.n_components(), - ExcInvalidComponent (fine_component, fine_fe.n_components())); + AssertIndexRange (coarse_component,coarse_fe.n_components()); + AssertIndexRange (fine_component, fine_fe.n_components()); // check whether respective finite // elements are equal Assert (coarse_fe.base_element (coarse_fe.component_to_base_index(coarse_component).first) @@ -5706,9 +5697,8 @@ namespace DoFTools // check whether fe has support // points Assert (dof_handler.get_fe().has_support_points(), - ExcFEHasNoSupportPoints()); - Assert (support_points.size() == dof_handler.n_dofs(), - ExcWrongSize (support_points.size(), dof_handler.n_dofs())); + typename FiniteElement::ExcFEHasNoSupportPoints()); + AssertDimension (support_points.size(), dof_handler.n_dofs()); // now loop over all cells and // enquire the support points on -- 2.39.5