From: Timo Heister Date: Wed, 4 Mar 2015 15:56:57 +0000 (-0500) Subject: Use and document VectorTools::ExcPointNotAvailableHere X-Git-Tag: v8.3.0-rc1~389^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=404cd232f8db66d7e3c7a8a5cca7c4574d85dc40;p=dealii.git Use and document VectorTools::ExcPointNotAvailableHere ExcPointNotAvailableHere is duplicated in VectorTools and FEFieldFunction and is awkward to use in the latter because of the template arguments. - provide textual description of Exception - deprecate the version in FEFieldFunction - update documentation - update test --- diff --git a/include/deal.II/numerics/fe_field_function.h b/include/deal.II/numerics/fe_field_function.h index 1bd3d875a7..f042766e43 100644 --- a/include/deal.II/numerics/fe_field_function.h +++ b/include/deal.II/numerics/fe_field_function.h @@ -32,6 +32,11 @@ DEAL_II_NAMESPACE_OPEN +namespace VectorTools +{ + class ExcPointNotAvailableHere; +} + namespace Functions { @@ -116,7 +121,7 @@ namespace Functions * @ref GlossGhostCell). * If the cell is artificial, we have no access to the solution there and * functions that evaluate the solution at such a point will trigger an - * exception of type FEFieldFunction::ExcPointNotAvailableHere. The same + * exception of type VectorTools::ExcPointNotAvailableHere. The same * kind of exception will also be produced if the cell is a ghost cell: On * such cells, one could in principle evaluate the solution, but it becomes * easier if we do not allow to do so because then there is exactly one @@ -139,7 +144,7 @@ namespace Functions * { * solution_at_origin = solution_function.value (origin); * } - * catch (const typename Functions::FEFieldFunction,TrilinosWrappers::MPI::Vector>::ExcPointNotAvailableHere &) + * catch (const VectorTools::ExcPointNotAvailableHere &) * { * point_found = false; * } @@ -148,14 +153,6 @@ namespace Functions * ...do something...; * @endcode * - * @note To C++, - * Functions::FEFieldFunction::ExcPointNotAvailableHere - * and Functions::FEFieldFunction, - * TrilinosWrappers::MPI::Vector>::ExcPointNotAvailableHere are - * distinct types. You need to make sure that the type of the exception you - * catch matches the type of the object that throws it, as shown in the - * example above. - * * @ingroup functions * @author Luca Heltai, 2006, Markus Buerg, 2012, Wolfgang Bangerth, 2013 */ @@ -414,9 +411,9 @@ namespace Functions std::vector > &maps) const; /** - * Exception + * @deprecated Use VectorTools::ExcPointNotAvailableHere instead. */ - DeclException0 (ExcPointNotAvailableHere); + typedef VectorTools::ExcPointNotAvailableHere ExcPointNotAvailableHere DEAL_II_DEPRECATED; private: /** diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 558c70df08..00d26cb42a 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -23,6 +23,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -73,7 +74,7 @@ namespace Functions const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); + VectorTools::ExcPointNotAvailableHere()); cell = my_pair.first; qp = my_pair.second; @@ -124,7 +125,7 @@ namespace Functions const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); + VectorTools::ExcPointNotAvailableHere()); cell = my_pair.first; qp = my_pair.second; @@ -177,7 +178,7 @@ namespace Functions const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); + VectorTools::ExcPointNotAvailableHere()); cell = my_pair.first; qp = my_pair.second; @@ -445,7 +446,7 @@ namespace Functions my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[0]); AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); + VectorTools::ExcPointNotAvailableHere()); cell = my_pair.first; qp = my_pair.second; @@ -509,7 +510,7 @@ namespace Functions const std::pair::type, Point > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[first_outside]); AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); + VectorTools::ExcPointNotAvailableHere()); cells.push_back(my_pair.first); qpoints.push_back(std::vector >(1, my_pair.second)); diff --git a/include/deal.II/numerics/vector_tools.h b/include/deal.II/numerics/vector_tools.h index 0274d29689..3264cd2b83 100644 --- a/include/deal.II/numerics/vector_tools.h +++ b/include/deal.II/numerics/vector_tools.h @@ -2208,7 +2208,10 @@ namespace VectorTools /** * Exception */ - DeclException0 (ExcPointNotAvailableHere); + DeclExceptionMsg (ExcPointNotAvailableHere, + "The given point is inside a cell of a " + "parallel::distributed::Triangulation that is not " + "locally owned by this processor."); } diff --git a/tests/mpi/fe_field_function_01.cc b/tests/mpi/fe_field_function_01.cc index 9c182912c0..45de3541e8 100644 --- a/tests/mpi/fe_field_function_01.cc +++ b/tests/mpi/fe_field_function_01.cc @@ -101,7 +101,7 @@ void test() Assert (std::fabs(value - (p[0]+2)) < 1e-8* std::fabs(value + (p[0]+2)), ExcInternalError()); } - catch (typename Functions::FEFieldFunction,TrilinosWrappers::MPI::Vector>::ExcPointNotAvailableHere &) + catch (typename VectorTools::ExcPointNotAvailableHere &) { point_found = false; }