<commit_before>/* $Id$ */
/* Author: <NAME>, <NAME>, University of Heidelberg, 2001 */

/*    $Id$       */
/*    Version: $Name$                                          */
/*                                                                */
/*    Copyright (C) 2001, 2002, 2003 by the deal.II authors */
/*                                                                */
/*    This file is subject to QPL and may not be  distributed     */
/*    without copyright and license information. Please refer     */
/*    to the file deal.II/doc/license.html for the  text  and     */
/*    further information on this license.                        */

				 // The first of the following include
				 // files are probably well-known by
				 // now and need no further
				 // explanation.
#include <base/quadrature_lib.h>
#include <base/convergence_table.h>
#include <grid/grid_generator.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria_boundary_lib.h>
#include <grid/tria.h>
#include <grid/grid_out.h>
#include <dofs/dof_handler.h>
#include <dofs/dof_accessor.h>
#include <fe/fe_q.h>
#include <fe/fe_values.h>

				 // This is the only new one: in it,
				 // we declare the ``MappingQ'' class
				 // which we will use for polynomial
				 // mappings of arbitrary order:
#include <fe/mapping_q.h>

				 // And this again is C++:
#include <iostream>
#include <fstream>
#include <cmath>

				 // Now, as we want to compute the
				 // value of pi, we have to compare to
				 // somewhat. These are the first few
				 // digits of pi, which we define
				 // beforehand for later use. Since we
				 // would like to compute the
				 // difference between two numbers
				 // which are quite accurate, with the
				 // accuracy of the computed
				 // approximation to pi being in the
				 // range of the number of digits
				 // which a double variable can hold,
				 // we rather declare the reference
				 // value as a ``long double'' and
				 // give it a number of extra digits:
const long double pi = 3.141592653589793238462643;



				 // Then, the first task will be to
				 // generate some output. Since this
				 // program is so small, we do not
				 // employ object oriented techniques
				 // in it and do not declare classes
				 // (although, of course, we use the
				 // object oriented features of the
				 // library). Rather, we just pack the
				 // functionality into separate
				 // functions. We make these functions
				 // templates on the number of space
				 // dimensions to conform to usual
				 // practice when using deal.II,
				 // although we will only use them for
				 // two space dimensions.
				 //
				 // The first of these functions just
				 // generates a triangulation of a
				 // circle (hyperball) and outputs the
				 // Qp mapping of its cells for
				 // different values of ``p''. Then,
				 // we refine the grid once and do so
				 // again.
template <int dim>
void gnuplot_output()
{
  std::cout << "Output of grids into gnuplot files:" << std::endl
	    << "===================================" << std::endl;

				   // So first generate a coarse
				   // triangulation of the circle and
				   // associate a suitable boundary
				   // description to it. Note that the
				   // default values of the
				   // HyperBallBoundary constructor
				   // are a center at the origin and a
				   // radius equals one.
  Triangulation<dim> triangulation;
  GridGenerator::hyper_ball (triangulation);
  static const HyperBallBoundary<dim> boundary;
  triangulation.set_boundary (0, boundary);

				   // Next generate output for this
				   // grid and for a once refined
				   // grid. Note that we have hidden
				   // the mesh refinement in the loop
				   // header, which might be uncommon
				   // but nevertheless works. Also it
				   // is strangely consistent with
				   // incrementing the loop index
				   // denoting the refinement level.
  for (unsigned int refinement=0; refinement<2;
       ++refinement, triangulation.refine_global(1))
    {
      std::cout << "Refinement level: " << refinement << std::endl;

				       // Then have a string which
				       // denotes the base part of the
				       // names of the files into
				       // which we write the
				       // output. Note that in the
				       // parentheses in the
				       // initializer we do arithmetic
				       // on characters, which assumes
				       // that first the characters
				       // denoting numbers are placed
				       // consecutively (which is
				       // probably true for all
				       // reasonable character sets
				       // nowadays), but also assumes
				       // that the increment
				       // ``refinement'' is less than
				       // ten. This is therefore more
				       // a quick hack if we know
				       // exactly the values which the
				       // increment can assume. A
				       // better implementation would
				       // use the
				       // ``std::istringstream''
				       // class to generate a name.
      std::string filename_base = std::string("ball");
      filename_base += '0'+refinement;<commit_msg>Simplify code, and thereby also hopefully work around a recent bug in gcc<commit_after>/* $Id$ */
/* Author: <NAME>, <NAME>, University of Heidelberg, 2001 */

/*    $Id$       */
/*    Version: $Name$                                          */
/*                                                                */
/*    Copyright (C) 2001, 2002, 2003 by the deal.II authors */
/*                                                                */
/*    This file is subject to QPL and may not be  distributed     */
/*    without copyright and license information. Please refer     */
/*    to the file deal.II/doc/license.html for the  text  and     */
/*    further information on this license.                        */

				 // The first of the following include
				 // files are probably well-known by
				 // now and need no further
				 // explanation.
#include <base/quadrature_lib.h>
#include <base/convergence_table.h>
#include <grid/grid_generator.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria_boundary_lib.h>
#include <grid/tria.h>
#include <grid/grid_out.h>
#include <dofs/dof_handler.h>
#include <dofs/dof_accessor.h>
#include <fe/fe_q.h>
#include <fe/fe_values.h>

				 // This is the only new one: in it,
				 // we declare the ``MappingQ'' class
				 // which we will use for polynomial
				 // mappings of arbitrary order:
#include <fe/mapping_q.h>

				 // And this again is C++:
#include <iostream>
#include <fstream>
#include <cmath>

				 // Now, as we want to compute the
				 // value of pi, we have to compare to
				 // somewhat. These are the first few
				 // digits of pi, which we define
				 // beforehand for later use. Since we
				 // would like to compute the
				 // difference between two numbers
				 // which are quite accurate, with the
				 // accuracy of the computed
				 // approximation to pi being in the
				 // range of the number of digits
				 // which a double variable can hold,
				 // we rather declare the reference
				 // value as a ``long double'' and
				 // give it a number of extra digits:
const long double pi = 3.141592653589793238462643;



				 // Then, the first task will be to
				 // generate some output. Since this
				 // program is so small, we do not
				 // employ object oriented techniques
				 // in it and do not declare classes
				 // (although, of course, we use the
				 // object oriented features of the
				 // library). Rather, we just pack the
				 // functionality into separate
				 // functions. We make these functions
				 // templates on the number of space
				 // dimensions to conform to usual
				 // practice when using deal.II,
				 // although we will only use them for
				 // two space dimensions.
				 //
				 // The first of these functions just
				 // generates a triangulation of a
				 // circle (hyperball) and outputs the
				 // Qp mapping of its cells for
				 // different values of ``p''. Then,
				 // we refine the grid once and do so
				 // again.
template <int dim>
void gnuplot_output()
{
  std::cout << "Output of grids into gnuplot files:" << std::endl
	    << "===================================" << std::endl;

				   // So first generate a coarse
				   // triangulation of the circle and
				   // associate a suitable boundary
				   // description to it. Note that the
				   // default values of the
				   // HyperBallBoundary constructor
				   // are a center at the origin and a
				   // radius equals one.
  Triangulation<dim> triangulation;
  GridGenerator::hyper_ball (triangulation);
  static const HyperBallBoundary<dim> boundary;
  triangulation.set_boundary (0, boundary);

				   // Next generate output for this
				   // grid and for a once refined
				   // grid. Note that we have hidden
				   // the mesh refinement in the loop
				   // header, which might be uncommon
				   // but nevertheless works. Also it
				   // is strangely consistent with
				   // incrementing the loop index
				   // denoting the refinement level.
  for (unsigned int refinement=0; refinement<2;
       ++refinement, triangulation.refine_global(1))
    {
      std::cout << "Refinement level: " << refinement << std::endl;

				       // Then have a string which
				       // denotes the base part of the
				       // names of the files into
				       // which we write the
				       // output. Note that in the
				       // parentheses in the
				       // initializer we do arithmetic
				       // on characters, which assumes
				       // that first the characters
				       // denoting numbers are placed
				       // consecutively (which is
				       // probably true for all
				       // reasonable character sets
				       // nowadays), but also assumes
				       // that the increment
				       // ``refinement'' is less than
				       // ten. This is therefore more
				       // a quick hack if we know
				       // exactly the values which the
				       // increment can assume. A
				       // better implementation would
				       // use the
				       // ``std::istringstream''
				       // class to generate a name.
      std::string filename_base = "ball";
      filename_base += '0'+refinement;
{'fraction_non_alphanumeric': 0.09910257647399402, 'fraction_numerical': 0.008877738106725852, 'mean_word_length': 1.8048714479025711, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505438', 'n_tokens_mistral': 3364, 'n_tokens_neox': 2499, 'n_words': 1127}