<commit_before>//----------------------------  function_lib.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal 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.
//
//----------------------------  function_lib.cc  ---------------------------


#include <base/tensor.h>
#include <base/point.h>
#include <base/function_lib.h>
#include <lac/vector.h>

#include <cmath>


// in strict ANSI C mode, the following constants are not defined by
// default, so we do it ourselves
//TODO:[?] Unify the various places where PI is defined to a central instance 
#ifndef M_PI
#  define	M_PI		3.14159265358979323846
#endif

#ifndef M_PI_2
#  define	M_PI_2		1.57079632679489661923
#endif

#ifndef M_E
#  define       M_E             2.7182818284590452354
#endif

namespace Functions
{

  using namespace std;


  
  template<int dim>
  CutOffFunctionBase<dim>::CutOffFunctionBase (const double r,
					       const Point<dim> p,
					       const unsigned int n_components,
					       const unsigned int select)
		  :
		  Function<dim> (n_components),
                  center(p),
                  radius(r),
                  selected(select)
  {}


  template<int dim>
  void
  CutOffFunctionBase<dim>::new_center (const Point<dim>& p)
  {
    center = p;
  }


  template<int dim>
  void
  CutOffFunctionBase<dim>::new_radius (const double r)
  {
    radius = r;
  }

//////////////////////////////////////////////////////////////////////
  
  template<int dim>
  CutOffFunctionLinfty<dim>::CutOffFunctionLinfty (const double r,
						   const Point<dim> p,
						   const unsigned int n_components,
						   unsigned int select)
		  :
		  CutOffFunctionBase<dim> (r, p, n_components, select)
  {}


  template<int dim>
  double
  CutOffFunctionLinfty<dim>::value (const Point<dim>   &p,
				    const unsigned int component) const
  {
    if (selected==no_component || component==selected)
      return ((center.distance(p)<radius) ? 1. : 0.);
    return 0.;
  }


  template<int dim>
  void 
  CutOffFunctionLinfty<dim>::value_list (const typename std::vector<Point<dim> > &points,
					 std::vector<double>                     &values,
					 const unsigned int component) const
  {
    Assert (values.size() == points.size(),
	    ExcDimensionMismatch(values.size(), points.size()));
    Assert (component < n_components,<commit_msg>Make parameter const to make Intel icc happier.<commit_after>//----------------------------  function_lib.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal 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.
//
//----------------------------  function_lib.cc  ---------------------------


#include <base/tensor.h>
#include <base/point.h>
#include <base/function_lib.h>
#include <lac/vector.h>

#include <cmath>


// in strict ANSI C mode, the following constants are not defined by
// default, so we do it ourselves
//TODO:[?] Unify the various places where PI is defined to a central instance 
#ifndef M_PI
#  define	M_PI		3.14159265358979323846
#endif

#ifndef M_PI_2
#  define	M_PI_2		1.57079632679489661923
#endif

#ifndef M_E
#  define       M_E             2.7182818284590452354
#endif

namespace Functions
{

  using namespace std;


  
  template<int dim>
  CutOffFunctionBase<dim>::CutOffFunctionBase (const double r,
					       const Point<dim> p,
					       const unsigned int n_components,
					       const unsigned int select)
		  :
		  Function<dim> (n_components),
                  center(p),
                  radius(r),
                  selected(select)
  {}


  template<int dim>
  void
  CutOffFunctionBase<dim>::new_center (const Point<dim>& p)
  {
    center = p;
  }


  template<int dim>
  void
  CutOffFunctionBase<dim>::new_radius (const double r)
  {
    radius = r;
  }

//////////////////////////////////////////////////////////////////////
  
  template<int dim>
  CutOffFunctionLinfty<dim>::CutOffFunctionLinfty (const double r,
						   const Point<dim> p,
						   const unsigned int n_components,
						   const unsigned int select)
		  :
		  CutOffFunctionBase<dim> (r, p, n_components, select)
  {}


  template<int dim>
  double
  CutOffFunctionLinfty<dim>::value (const Point<dim>   &p,
				    const unsigned int component) const
  {
    if (selected==no_component || component==selected)
      return ((center.distance(p)<radius) ? 1. : 0.);
    return 0.;
  }


  template<int dim>
  void 
  CutOffFunctionLinfty<dim>::value_list (const typename std::vector<Point<dim> > &points,
					 std::vector<double>                     &values,
					 const unsigned int component) const
  {
    Assert (values.size() == points.size(),
	    ExcDimensionMismatch(values.size(), points.size()));
    Assert (component < n_components,
{'fraction_non_alphanumeric': 0.16781477229238423, 'fraction_numerical': 0.03329506314580941, 'mean_word_length': 2.1187350835322194, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 55, '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': '4728141', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1533, 'n_words': 441}