From: kanschat Date: Fri, 16 May 2014 07:49:06 +0000 (+0000) Subject: typo in anydata removed and new function try_read tested X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63a1cd1095b387021043821651ada7a2621f63a6;p=dealii-svn.git typo in anydata removed and new function try_read tested git-svn-id: https://svn.dealii.org/trunk@32919 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 8e6275ff0b..180f5f88d7 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -148,7 +148,14 @@ inconvenience this causes.

Specific improvements

    -
  1. New: The GMRES solver of deal.II can now write an estimate of +
  2. New: AnyData::try_read() is a function that allows users to check +whether an entry exists and get a pointer to it without throwing an +exception in case of failure. +
    +(Guido Kanschat, 2014/05/16) +
  3. + +
  4. New: The GMRES solver of deal.II can now write an estimate of eigenvalues to the log file, in analogy to the CG solver. This is enabled by the flag SolverGMRES<>::AdditionalData::compute_eigenvalues.
    diff --git a/deal.II/include/deal.II/algorithms/any_data.h b/deal.II/include/deal.II/algorithms/any_data.h index 8eab3cb3f1..4f5550e9e3 100644 --- a/deal.II/include/deal.II/algorithms/any_data.h +++ b/deal.II/include/deal.II/algorithms/any_data.h @@ -274,7 +274,7 @@ AnyData::try_read(const std::string& n) const // Compute index and return casted pointer unsigned int i=it-names.begin(); const type* p = boost::any_cast(&data[i]); - return *p; + return p; } diff --git a/tests/algorithms/any_data_01.cc b/tests/algorithms/any_data_01.cc index 6f8a3de80c..eb284c9f5c 100644 --- a/tests/algorithms/any_data_01.cc +++ b/tests/algorithms/any_data_01.cc @@ -62,7 +62,11 @@ void extract(const AnyData& data) << d << std::endl << *p2 << std::endl << *p3 << std::endl; - // try + + deallog << *data.try_read(" d 17.") << std::endl + << data.try_read(" d 17.") << std::endl + << data.try_read("does not exist") << std::endl; +// try // { // double* p3a = data.entry("cd* 17."); // deallog << p3a; diff --git a/tests/algorithms/any_data_01.output b/tests/algorithms/any_data_01.output index 0a9f80057e..9e180107c2 100644 --- a/tests/algorithms/any_data_01.output +++ b/tests/algorithms/any_data_01.output @@ -12,3 +12,6 @@ DEAL::7 DEAL::17.0000 DEAL::18.0000 DEAL::18.0000 +DEAL::17.0000 +DEAL::0 +DEAL::0