<commit_before>#ifndef DUNE_DETAILED_DISCRETIZATIONS_CONSTRAINTS_DIRICHLET_HH
#define DUNE_DETAILED_DISCRETIZATIONS_CONSTRAINTS_DIRICHLET_HH

// system
#include <set>

// dune-common
#include <dune/common/shared_ptr.hh>

// dune-fem includes
#include <dune/fem/space/lagrangespace/lagrangespace.hh>

// local includes
#include "localdefault.hh"

// dune-stuff
#include <dune/stuff/grid/boundaryinfo.hh>

namespace Dune
{

namespace Detailed {

namespace Discretizations
{

namespace Constraints
{

/** @brief Constraints for zero Dirichlet values on the entire boundary domain
 *
 * This class implements constraints on the degrees of freedom on a @link
 * Subspace::Linear "linear subspace" @endlink.
 *
 * Constraints efficiently implement functionals @f$ f_i:{\cal X}_H \to
 * \mathbb{R}@f$ for each degree of freedom @f$i\in {\cal C} \subset
 * \{1,\dots,H\}@f$, where @f$ H @f$ is the number of degree of freedoms in the
 * underlying discrete function space @f$ {\cal X}_H @f$. In case of this
 * Dirichlet constraints class, the set @f$ {\cal C} @f$ includes all degrees of
 * freedom "lying" on boundary edges and @f$ f_i(u) = 0 @f$ for all @f$ i=\cal
 * C @f$.
 *
 * @note The Dirichlet constraints only make sense on a finite element space,
 * not on a discontinuous discrete function space.
 *
 * @ingroup Constraints
 *
 * @tparam DiscFuncSpace discrete function space on which constraints shall
 * be applied.
 */
template< class DiscreteFunctionSpaceImp >
class DirichletZero
{
public:
  //! Discrete function space on which the Dirichlet constraints are applied
  typedef DiscreteFunctionSpaceImp DiscreteFunctionSpaceType;

  typedef DirichletZero< DiscreteFunctionSpaceType > ThisType;

  //! Underlying grid part
  typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;

  typedef typename DiscreteFunctionSpaceType::GridViewType GridViewType;

  typedef typename Dune::Stuff::Grid::BoundaryInfo::Interface< GridViewType > BoundaryInfoType;

  //! @brief dimension of the grid part
  static const int griddim = GridPartType::GridType::dimension;

  //! @brief Return type of local() method, implementing the LocalConstraints
  //! interface
  typedef Dune::Detailed::Discretizations::Constraints::LocalDefault< double, 2*griddim, 6*griddim >
    LocalConstraintsType;

  /** @brief Constructor for the Dirichlet constraints
   *
   *  @param space    discrete function space object on which the Dirichlet
   *                  constraints are applied
   */
  DirichletZero(const DiscreteFunctionSpaceType& space,
                const BoundaryInfoType& boundaryInfo)
    : space_( space )
    , boundaryInfo_(boundaryInfo)
    , gridPart_( space.gridPart() )
  {
  }

  /** @brief returns a local constraint object for the entity \a en
   *
   * @param en Entity for which the local constraints shall be compted
   *
   * @returns local constraints object (copyable). c.f.
   * Constraints::LocalDefault for more details on the return type
   * implementation.
   */
  template< class Entity >
  LocalConstraintsType local(const Entity& entity) const
  {
    typedef LagrangePointSet< GridPartType, DiscreteFunctionSpaceType::polynomialOrder ><commit_msg>[constarints.dirichlet] fixed estimated local matrix size (would break for polynomial orders > 1)<commit_after>#ifndef DUNE_DETAILED_DISCRETIZATIONS_CONSTRAINTS_DIRICHLET_HH
#define DUNE_DETAILED_DISCRETIZATIONS_CONSTRAINTS_DIRICHLET_HH

// system
#include <set>

// dune-common
#include <dune/common/shared_ptr.hh>

// dune-fem includes
#include <dune/fem/space/lagrangespace/lagrangespace.hh>

// local includes
#include "localdefault.hh"

// dune-stuff
#include <dune/stuff/grid/boundaryinfo.hh>

namespace Dune
{

namespace Detailed {

namespace Discretizations
{

namespace Constraints
{

/** @brief Constraints for zero Dirichlet values on the entire boundary domain
 *
 * This class implements constraints on the degrees of freedom on a @link
 * Subspace::Linear "linear subspace" @endlink.
 *
 * Constraints efficiently implement functionals @f$ f_i:{\cal X}_H \to
 * \mathbb{R}@f$ for each degree of freedom @f$i\in {\cal C} \subset
 * \{1,\dots,H\}@f$, where @f$ H @f$ is the number of degree of freedoms in the
 * underlying discrete function space @f$ {\cal X}_H @f$. In case of this
 * Dirichlet constraints class, the set @f$ {\cal C} @f$ includes all degrees of
 * freedom "lying" on boundary edges and @f$ f_i(u) = 0 @f$ for all @f$ i=\cal
 * C @f$.
 *
 * @note The Dirichlet constraints only make sense on a finite element space,
 * not on a discontinuous discrete function space.
 *
 * @ingroup Constraints
 *
 * @tparam DiscFuncSpace discrete function space on which constraints shall
 * be applied.
 */
template< class DiscreteFunctionSpaceImp >
class DirichletZero
{
public:
  //! Discrete function space on which the Dirichlet constraints are applied
  typedef DiscreteFunctionSpaceImp DiscreteFunctionSpaceType;

  typedef DirichletZero< DiscreteFunctionSpaceType > ThisType;

  //! Underlying grid part
  typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;

  typedef typename DiscreteFunctionSpaceType::GridViewType GridViewType;

  typedef typename Dune::Stuff::Grid::BoundaryInfo::Interface< GridViewType > BoundaryInfoType;

  //! @brief dimension of the grid part
  static const int griddim = GridPartType::GridType::dimension;
  static const int polorder = DiscreteFunctionSpaceType::polynomialOrder;

  //! @brief Return type of local() method, implementing the LocalConstraints
  //! interface
  typedef Dune::Detailed::Discretizations::Constraints::LocalDefault< double, 2*griddim*polorder, 6*griddim*polorder >
    LocalConstraintsType;

  /** @brief Constructor for the Dirichlet constraints
   *
   *  @param space    discrete function space object on which the Dirichlet
   *                  constraints are applied
   */
  DirichletZero(const DiscreteFunctionSpaceType& space,
                const BoundaryInfoType& boundaryInfo)
    : space_( space )
    , boundaryInfo_(boundaryInfo)
    , gridPart_( space.gridPart() )
  {
  }

  /** @brief returns a local constraint object for the entity \a en
   *
   * @param en Entity for which the local constraints shall be compted
   *
   * @returns local constraints object (copyable). c.f.
   * Constraints::LocalDefault for more details on the return type
   * implementation.
   */
  template< class Entity >
  LocalConstraintsType local(const Entity& entity) const
  {
    typedef LagrangePointSet< GridPartType, DiscreteFunctionSpaceType::polynomialOrder >
{'fraction_non_alphanumeric': 0.08788526090936832, 'fraction_numerical': 0.00137320720170888, 'mean_word_length': 4.337947882736156, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, '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': '2976765', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1844, 'n_words': 628}