Skip to content
Snippets Groups Projects
Select Git revision
  • eb33f3e4ea307dc27aa21ba4a6ac00e466b3ae47
  • 2016-PippingKornhuberRosenauOncken default
  • 2022-Strikeslip-Benchmark
  • 2021-GraeserKornhuberPodlesny
  • Dissertation2021 protected
  • separate-deformation
  • AverageCrosspoints
  • old_solver_new_datastructure
  • last_working
  • 2014-Dissertation-Pipping
  • 2013-PippingSanderKornhuber
11 results

test-gradient-method-helper.hh

Blame
  • Forked from agnumpde / dune-tectonic
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test-gradient-method-helper.hh 1.95 KiB
    #ifndef TEST_GRADIENT_METHOD_HELPER_HH
    #define TEST_GRADIENT_METHOD_HELPER_HH
    
    #include <boost/format.hpp>
    
    #include <dune/tnnmg/problem-classes/bisection.hh>
    
    #include <dune/tectonic/ellipticenergy.hh>
    #include <dune/tectonic/minimisation.hh>
    #include <dune/tectonic/minimisation2.hh>
    
    template <int dim>
    double functionTester(Dune::EllipticEnergy<dim> J,
                          typename Dune::EllipticEnergy<dim>::SmallVector &start,
                          size_t runs) {
      Bisection const bisection(
          0.0,   // acceptError: Stop if the search interval has
                 //              become smaller than this number
          1.0,   // acceptFactor: ?
          1e-12, // requiredResidual: ?
          true,  // fastQuadratic
          0);    // safety: acceptance factor for inexact minimization
      double const original = J(start);
      Dune::minimise(J, start, runs, bisection);
      double const final = J(start);
      std::cout << boost::format("%8g -> %e (%e)") % original % final % start
                << std::endl;
      return final;
    }
    
    template <int dim>
    double functionTester2(Dune::EllipticEnergy<dim> J,
                           typename Dune::EllipticEnergy<dim>::SmallVector &start,
                           size_t runs) {
      Bisection const bisection(
          0.0,   // acceptError: Stop if the search interval has
                 //              become smaller than this number
          1.0,   // acceptFactor: ?
          1e-12, // requiredResidual: ?
          true,  // fastQuadratic
          0);    // safety: acceptance factor for inexact minimization
      Dune::minimise2(J, start, runs, bisection);
      double const final = J(start);
      std::cout << boost::format("         -> %e (%e)") % final % start
                << std::endl;
      return final;
    }
    
    template <int dim>
    double two_distance(typename Dune::EllipticEnergy<dim>::SmallVector const &x,
                        typename Dune::EllipticEnergy<dim>::SmallVector const &y) {
      typename Dune::EllipticEnergy<dim>::SmallVector tmp = x;
      tmp -= y;
      return tmp.two_norm();
    }
    #endif