From 63a1cd1095b387021043821651ada7a2621f63a6 Mon Sep 17 00:00:00 2001 From: kanschat Date: Fri, 16 May 2014 07:49:06 +0000 Subject: [PATCH] typo in anydata removed and new function try_read tested git-svn-id: https://svn.dealii.org/trunk@32919 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 9 ++++++++- deal.II/include/deal.II/algorithms/any_data.h | 2 +- tests/algorithms/any_data_01.cc | 6 +++++- tests/algorithms/any_data_01.output | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) 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 -- 2.39.5