From: heltai Date: Wed, 16 Apr 2008 07:56:21 +0000 (+0000) Subject: Fixed a couple of bugs and completed the implementation of the convergence table. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7484c7649962374a9494433e414ba84081a2ffc;p=dealii-svn.git Fixed a couple of bugs and completed the implementation of the convergence table. git-svn-id: https://svn.dealii.org/trunk@15999 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/convergence_table.h b/deal.II/base/include/base/convergence_table.h index 35202a88e6..401ff0f1d1 100644 --- a/deal.II/base/include/base/convergence_table.h +++ b/deal.II/base/include/base/convergence_table.h @@ -104,7 +104,25 @@ class ConvergenceTable: public TableHandler * the set_tex_supercaption (...) function * of the base class TableHandler. * - * Still not implemented. + * This method behaves in the following way: + * + * If RateMode is reduction_rate, then the computed + * output is + * \f[ \frac{e_{n-1}/k_{n-1}}{e_n/k_n} \f]. + * + * Where \f$k\f$ is the reference column. + * + * If RateMode is reduction_rate_log2, then the + * computed output is: + * \f[ + * 2\frac{\log |e_{n-1}/e_{n}|}{\log |k_n/k_{n-1}|} + * \f]. + * + * This is useful, for example, if we use as + * reference key the number of degrees of freedom. + * Assuming that the error is proportional to + * \f$ C (1/\sqrt{k})^r \f$, then this method will + * produce the rate \f$ r \f$ as a result. */ void evaluate_convergence_rates (const std::string &data_column_key, diff --git a/deal.II/base/source/convergence_table.cc b/deal.II/base/source/convergence_table.cc index c165e73f1f..445320028c 100644 --- a/deal.II/base/source/convergence_table.cc +++ b/deal.II/base/source/convergence_table.cc @@ -34,11 +34,16 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column return; std::vector &entries=columns[data_column_key].entries; + std::vector &ref_entries=columns[reference_column_key].entries; std::string rate_key=data_column_key; const unsigned int n=entries.size(); + const unsigned int n_ref=ref_entries.size(); + Assert(n == n_ref, ExcDimensionMismatch(n, n_ref)); std::vector values(n); + std::vector ref_values(n_ref); + for (unsigned int i=0; i*>(entries[i]) != 0) @@ -51,6 +56,18 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column values[i]=dynamic_cast*>(entries[i])->value(); else Assert(false, ExcWrongValueType()); + + // And now the reference values. + if (dynamic_cast*>(ref_entries[i]) != 0) + ref_values[i]=dynamic_cast*>(ref_entries[i])->value(); + else if (dynamic_cast*>(ref_entries[i]) != 0) + ref_values[i]=dynamic_cast*>(ref_entries[i])->value(); + else if (dynamic_cast*>(ref_entries[i]) != 0) + ref_values[i]=dynamic_cast*>(ref_entries[i])->value(); + else if (dynamic_cast*>(ref_entries[i]) != 0) + ref_values[i]=dynamic_cast*>(ref_entries[i])->value(); + else + Assert(false, ExcWrongValueType()); } switch (rate_mode) @@ -58,7 +75,25 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column case none: break; case reduction_rate: + rate_key+="red.rate"; + Assert(columns.count(rate_key)==0, ExcRateColumnAlreadyExists(rate_key)); + // no value available for the + // first row + add_value(rate_key, std::string("-")); + for (unsigned int i=1; i=100) || (digits==3 && i>=1000) || (digits==4 && i>=10000)|| - (i>=100000)), + (digits==5 && i>=100000)|| + (i>=1000000)), ExcInvalidNumber2StringConversersion(i, digits)); std::string s; switch (digits) { + case 6: + s += '0' + i/100000; + case 5: + s += '0' + (i%100000)/10000; case 4: - s += '0' + i/1000; + s += '0' + (i%10000)/1000; case 3: s += '0' + (i%1000)/100; case 2: diff --git a/deal.II/deal.II/include/numerics/fe_field_function.h b/deal.II/deal.II/include/numerics/fe_field_function.h index 24bb7e48a3..54786fe11e 100644 --- a/deal.II/deal.II/include/numerics/fe_field_function.h +++ b/deal.II/deal.II/include/numerics/fe_field_function.h @@ -153,7 +153,7 @@ namespace Functions * function. This will speed * things up a little. */ - inline void set_active_cell(typename DH::active_cell_iterator &newcell); + void set_active_cell(typename DH::active_cell_iterator &newcell); /** * Get ONE vector value at the diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 3df64c8943..2b0ce30567 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -139,6 +139,21 @@ inconvenience this causes.
    +
  1. New: ConvergenceTable.evaluate_convergence_rates has been incomplete +for a long time. I added an implementation for reduction_rate and +reduction_rate_lo2 in the case where one specifies a reference column +that allows to compute error rates also for local refinement. +
    +(Luca Heltai 2008/04/16) +

  2. + +
  3. Fixed: The Utilities::int_to_string function did not work for 5 or 6 +digits, while its counterpart Utilities::needed_digits does. This is now fixed, +and the two are coherent. +
    +(Luca Heltai 2008/04/16) +

  4. +
  5. New: The SymmetricTensor class now has a constructor that creates an object from an array consisting its independent components.
    @@ -290,6 +305,12 @@ constraints individually.

      +
    1. Fixed: Functions::FEFieldFunction.set_active_cell was declared + inline in the declaration but not in the implementation. This is now fixed. +
      + (Luca Heltai 2008/04/16) +

    2. +
    3. New: The FE_RaviartThomasNodal now supports hp functionality.
      (Zhu Liang, 2008/04/04)