<commit_before>// ---------------------------------------------------------------------
//
// Copyright (C) 2004 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------


// check that the kelly error estimator uses correct normals on surfaces
// with kinks by interpolating a function that is inside the FE space
// and should produce zero errors.



#include "../tests.h"
#include <deal.II/base/logstream.h>
#include <deal.II/base/function_lib.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/lac/vector.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/mapping_q.h>
#include <deal.II/numerics/vector_tools.h>
#include <deal.II/numerics/error_estimator.h>
#include <deal.II/numerics/data_out.h>

#include <fstream>


// function is x^2+2xy
template<int dim>
class MyFunction : public Function<dim>
{
public:
  MyFunction () : Function<dim>(1) {}

  virtual double value (const Point<dim>   &p,
                        const unsigned int  component) const
  {
    return p(0)*p(0)+2.0*p(0)*p(1);
  }

  virtual void   vector_value (const Point<dim>   &p,
                               Vector<double>     &values) const
  {
    values(0) = value(p,0);
    values(1) = value(p,1);
  }
};


// normal derivative of function above is 0 except for x=1, y=1 with n=(0,1,0)
template<int dim>
class MyNormalDerivative : public Function<dim>
{
public:
  MyNormalDerivative () : Function<dim>(1) {}

  virtual double value (const Point<dim>   &p,
                        const unsigned int  component) const
  {
    double val = 0.0;
    if (abs(p(1)-1.0)<1e-5)
      val = 2.0;

    deallog << "evaluate normal derivative at " << p << " with value " << val << std::endl;
    return val;
  }

  virtual void   vector_value (const Point<dim>   &p,
                               Vector<double>     &values) const
  {
    values(0) = value(p,0);
    values(1) = value(p,1);
  }
};



template <int dim>
Quadrature<dim-1> &
get_q_face ()
{
  static QGauss<dim-1> q(4);
  return q;
}
<commit_msg>fix test codim_one/error_estimator_02<commit_after>// ---------------------------------------------------------------------
//
// Copyright (C) 2004 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------


// check that the kelly error estimator uses correct normals on surfaces
// with kinks by interpolating a function that is inside the FE space
// and should produce zero errors.



#include "../tests.h"
#include <deal.II/base/logstream.h>
#include <deal.II/base/function_lib.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/lac/vector.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/mapping_q.h>
#include <deal.II/numerics/vector_tools.h>
#include <deal.II/numerics/error_estimator.h>
#include <deal.II/numerics/data_out.h>

#include <fstream>


// function is x^2+2xy
template<int dim>
class MyFunction : public Function<dim>
{
public:
  MyFunction () : Function<dim>(1) {}

  virtual double value (const Point<dim>   &p,
                        const unsigned int  component) const
  {
    return p(0)*p(0)+2.0*p(0)*p(1);
  }

  virtual void   vector_value (const Point<dim>   &p,
                               Vector<double>     &values) const
  {
    values(0) = value(p,0);
    values(1) = value(p,1);
  }
};


// normal derivative of function above is 0 except for x=1, y=1 with n=(0,1,0)
template<int dim>
class MyNormalDerivative : public Function<dim>
{
public:
  MyNormalDerivative () : Function<dim>(1) {}

  virtual double value (const Point<dim>   &p,
                        const unsigned int  component) const
  {
    double val = 0.0;
    if (std::abs(p(1)-1.0)<1e-5)
      val = 2.0;

    deallog << "evaluate normal derivative at " << p << " with value " << val << std::endl;
    return val;
  }

  virtual void   vector_value (const Point<dim>   &p,
                               Vector<double>     &values) const
  {
    values(0) = value(p,0);
    values(1) = value(p,1);
  }
};



template <int dim>
Quadrature<dim-1> &
get_q_face ()
{
  static QGauss<dim-1> q(4);
  return q;
}

{'fraction_non_alphanumeric': 0.18004821064342666, 'fraction_numerical': 0.017430001854255518, 'mean_word_length': 2.3881909547738696, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1771485', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1761, 'n_words': 514}