[Dune-devel] [Dune-Commit] [Commit] dune-istl - 23d94ff: [tests] Catch Dune exceptions to ease identifying problems.

Christian Engwer christian.engwer at uni-muenster.de
Wed Oct 21 09:12:53 CEST 2015


Hi Christoph,

if you add a try/catch, please also add an exit code which signals
failure. Also in the general catch, it would be helpful to at least
state that an unknown exception occured.

Ciao
Christian

On Wed, Oct 21, 2015 at 08:34:15AM +0200, Christoph Grüninger wrote:
> New commit, appeared at Wed Oct 21 08:34:15 2015 +0200
> as part of the following ref changes:
> 
>     branch refs/heads/master    updated from 0ec9623 -> 74ed27a
> 
> Browsable version: http://cgit.dune-project.org/repositories/dune-istl/commit/?id=23d94ffb9b5a14a8d9958b8785166244c38ceee1
> 
> ======================================================================
> 
> commit 23d94ffb9b5a14a8d9958b8785166244c38ceee1
> Author: Christoph Grüninger <christoph.grueninger at iws.uni-stuttgart.de>
> Date:   Wed Oct 21 08:27:40 2015 +0200
> 
>     [tests] Catch Dune exceptions to ease identifying problems.
> 
>  dune/istl/paamg/test/amgtest.cc |  9 +++++++--
>  dune/istl/paamg/test/fastamg.cc | 11 +++++++----
>  dune/istl/test/superlutest.cc   |  7 +++++++
>  3 files changed, 21 insertions(+), 6 deletions(-)
> 
> 
> 
> diff --git a/dune/istl/paamg/test/amgtest.cc b/dune/istl/paamg/test/amgtest.cc
> index 9d09fc4..c923e01 100644
> --- a/dune/istl/paamg/test/amgtest.cc
> +++ b/dune/istl/paamg/test/amgtest.cc
> @@ -165,8 +165,8 @@ void testAMG(int N, int coarsenTarget, int ml)
>  
>  
>  int main(int argc, char** argv)
> +try
>  {
> -
>    int N=100;
>    int coarsenTarget=1200;
>    int ml=10;
> @@ -182,5 +182,10 @@ int main(int argc, char** argv)
>  
>    testAMG<1>(N, coarsenTarget, ml);
>    testAMG<2>(N, coarsenTarget, ml);
> -
>  }
> +catch (Dune::Exception &e)
> +{
> +  std::cerr << "Dune reported error: " << e << std::endl;
> +}
> +catch (...)
> +{}
> diff --git a/dune/istl/paamg/test/fastamg.cc b/dune/istl/paamg/test/fastamg.cc
> index 55004fe..9391cf2 100644
> --- a/dune/istl/paamg/test/fastamg.cc
> +++ b/dune/istl/paamg/test/fastamg.cc
> @@ -29,10 +29,8 @@ void randomize(const M& mat, V& b)
>  template <int BS>
>  void testAMG(int N, int coarsenTarget, int ml)
>  {
> -
>    std::cout<<"N="<<N<<" coarsenTarget="<<coarsenTarget<<" maxlevel="<<ml<<std::endl;
>  
> -
>    typedef Dune::ParallelIndexSet<int,LocalIndex,512> ParallelIndexSet;
>  
>    ParallelIndexSet indices;
> @@ -110,8 +108,8 @@ void testAMG(int N, int coarsenTarget, int ml)
>  
>  
>  int main(int argc, char** argv)
> +try
>  {
> -
>    int N=100;
>    int coarsenTarget=1200;
>    int ml=10;
> @@ -127,5 +125,10 @@ int main(int argc, char** argv)
>  
>    testAMG<1>(N, coarsenTarget, ml);
>    testAMG<2>(N, coarsenTarget, ml);
> -
>  }
> +catch (Dune::Exception &e)
> +{
> +  std::cerr << "Dune reported error: " << e << std::endl;
> +}
> +catch (...)
> +{}
> diff --git a/dune/istl/test/superlutest.cc b/dune/istl/test/superlutest.cc
> index 80d6226..78af1f8 100644
> --- a/dune/istl/test/superlutest.cc
> +++ b/dune/istl/test/superlutest.cc
> @@ -35,6 +35,7 @@ typedef std::complex<double> FIELD_TYPE;
>  #endif
>  
>  int main(int argc, char** argv)
> +try
>  {
>    const int BS=1;
>    std::size_t N=100;
> @@ -80,3 +81,9 @@ int main(int argc, char** argv)
>    solver1.apply(x,b, res);
>    solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x[0]), reinterpret_cast<FIELD_TYPE*>(&b[0]));
>  }
> +catch (Dune::Exception &e)
> +{
> +  std::cerr << "Dune reported error: " << e << std::endl;
> +}
> +catch (...)
> +{}
> 
> _______________________________________________
> Dune-Commit mailing list
> Dune-Commit at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-commit

-- 
Prof. Dr. Christian Engwer 
Institut für Numerische und Angewandte Mathematik
Fachbereich Mathematik und Informatik der Universität Münster
Einsteinstrasse 62
48149 Münster

E-Mail  christian.engwer at uni-muenster.de
Telefon +49 251 83-35067
FAX     +49 251 83-32729




More information about the Dune-devel mailing list