<commit_before>// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 2014 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.
//
// ---------------------------------------------------------------------

#include <deal.II/base/memory_consumption.h>
#include <deal.II/fe/mapping.h>
#include <deal.II/fe/fe.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/base/quadrature.h>
#include <deal.II/base/qprojector.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/grid/tria_boundary.h>

#include <algorithm>
#include <functional>
#include <numeric>

DEAL_II_NAMESPACE_OPEN


/*------------------------------- FiniteElement ----------------------*/


template <int dim, int spacedim>
const double FiniteElement<dim,spacedim>::fd_step_length = 1.0e-6;


template <int dim, int spacedim>
void
FiniteElement<dim,spacedim>::
InternalDataBase::initialize_2nd (const FiniteElement<dim,spacedim> *element,
                                  const Mapping<dim,spacedim>       &mapping,
                                  const Quadrature<dim>    &quadrature)
{
  // if we shall compute second
  // derivatives, then we do so by
  // finite differencing the
  // gradients. that we do by
  // evaluating the gradients of
  // shape values at points shifted
  // star-like a little in each
  // coordinate direction around each
  // quadrature point.
  //
  // therefore generate 2*dim (the
  // number of evaluation points)
  // FEValues objects with slightly
  // shifted positions
  std::vector<Point<dim> > diff_points (quadrature.size());

  differences.resize(2*dim);
  for (unsigned int d=0; d<dim; ++d)
    {
      Point<dim> shift;
      shift (d) = fd_step_length;

      // generate points and FEValues
      // objects shifted in
      // plus-direction. note that
      // they only need to compute
      // gradients, not more
      for (unsigned int i=0; i<diff_points.size(); ++i)
        diff_points[i] = quadrature.point(i) + shift;
      const Quadrature<dim> plus_quad (diff_points, quadrature.get_weights());
      differences[d] = new FEValues<dim,spacedim> (mapping, *element,
                                                   plus_quad, update_gradients);

      // now same in minus-direction
      for (unsigned int i=0; i<diff_points.size(); ++i)
        diff_points[i] = quadrature.point(i) - shift;
      const Quadrature<dim> minus_quad (diff_points, quadrature.get_weights());
      differences[d+dim] = new FEValues<dim,spacedim> (mapping, *element,
                                                       minus_quad, update_gradients);<commit_msg>Either make implicit casts from Tensor<1,dim> to Point<dim> explicit, or correct the data type of where we store the result.<commit_after>// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 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.
//
// ---------------------------------------------------------------------

#include <deal.II/base/memory_consumption.h>
#include <deal.II/fe/mapping.h>
#include <deal.II/fe/fe.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/base/quadrature.h>
#include <deal.II/base/qprojector.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/dofs/dof_accessor.h>
#include <deal.II/grid/tria_boundary.h>

#include <algorithm>
#include <functional>
#include <numeric>

DEAL_II_NAMESPACE_OPEN


/*------------------------------- FiniteElement ----------------------*/


template <int dim, int spacedim>
const double FiniteElement<dim,spacedim>::fd_step_length = 1.0e-6;


template <int dim, int spacedim>
void
FiniteElement<dim,spacedim>::
InternalDataBase::initialize_2nd (const FiniteElement<dim,spacedim> *element,
                                  const Mapping<dim,spacedim>       &mapping,
                                  const Quadrature<dim>    &quadrature)
{
  // if we shall compute second
  // derivatives, then we do so by
  // finite differencing the
  // gradients. that we do by
  // evaluating the gradients of
  // shape values at points shifted
  // star-like a little in each
  // coordinate direction around each
  // quadrature point.
  //
  // therefore generate 2*dim (the
  // number of evaluation points)
  // FEValues objects with slightly
  // shifted positions
  std::vector<Point<dim> > diff_points (quadrature.size());

  differences.resize(2*dim);
  for (unsigned int d=0; d<dim; ++d)
    {
      Tensor<1,dim> shift;
      shift[d] = fd_step_length;

      // generate points and FEValues
      // objects shifted in
      // plus-direction. note that
      // they only need to compute
      // gradients, not more
      for (unsigned int i=0; i<diff_points.size(); ++i)
        diff_points[i] = quadrature.point(i) + shift;
      const Quadrature<dim> plus_quad (diff_points, quadrature.get_weights());
      differences[d] = new FEValues<dim,spacedim> (mapping, *element,
                                                   plus_quad, update_gradients);

      // now same in minus-direction
      for (unsigned int i=0; i<diff_points.size(); ++i)
        diff_points[i] = quadrature.point(i) - shift;
      const Quadrature<dim> minus_quad (diff_points, quadrature.get_weights());
      differences[d+dim] = new FEValues<dim,spacedim> (mapping, *element,
                                                       minus_quad, update_gradients);
{'fraction_non_alphanumeric': 0.16859085876957142, 'fraction_numerical': 0.006326111023248458, 'mean_word_length': 2.200404858299595, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7271316', 'n_tokens_mistral': 1889, 'n_tokens_neox': 1814, 'n_words': 555}