#ifndef GUARD_10f9d7a54f79c12d6ca923b9ee56b80d
#define GUARD_10f9d7a54f79c12d6ca923b9ee56b80d

#define USING_DUNE_PYTHON 1
#include <config.h>
#include <dune/alugrid/dgf.hh>
#include <dune/alugrid/grid.hh>
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
#include <dune/fem/gridpart/filter/simple.hh>
#include <dune/fem/gridpart/filteredgridpart.hh>
#include <dune/fempy/py/gridview.hh>
#include <dune/python/grid/gridview.hh>
#include <dune/python/grid/hierarchical.hh>
#include <dune/fem/function/localfunction/bindable.hh>
#include <dune/fem/common/intersectionside.hh>
#include <dune/python/pybind11/pybind11.h>
#include <dune/python/pybind11/extensions.h>
#include <dune/fempy/py/grid/gridpart.hh>
#include <dune/common/exceptions.hh>
#include <dune/fempy/py/ufllocalfunction.hh>

namespace UFLLocalFunctions_10f9d7a54f79c12d6ca923b9ee56b80d
{

  // UFLLocalFunction
// ----------------

template< class GridPart >
struct UFLLocalFunction
  : public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>>
{
  typedef GridPart GridPartType;
  typedef typename GridPartType::GridViewType GridView;
  typedef typename GridView::ctype ctype;
  typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>> BaseType;
  typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<1>> FunctionSpaceType;
  typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
  typedef typename GridPartType::IntersectionType IntersectionType;
  typedef typename EntityType::Geometry Geometry;
  typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
  typedef Dune::Fem::IntersectionSide Side;
  typedef std::tuple<> ConstantTupleType;
  typedef std::tuple<> CoefficientTupleType;
  static constexpr bool gridPartValid = true;
  template< std::size_t i >
  using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
  template< std::size_t i >
  using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
  using BaseType::entity;
  using BaseType::geometry;

  UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Dune::Fem::ParameterReader &parameter = Dune::Fem::Parameter::container() )
    : BaseType(gridPart,name,order)
  {}

  void bind ( const IntersectionType &intersection, Side side )
  {
    BaseType::bind(intersection, side);
  }

  void bind ( const EntityType &entity )
  {
    BaseType::bind(entity);
  }

  void unbind ()
  {
    BaseType::unbind();
  }

  template< class Point >
  void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
  {
    using std::max;
    using std::min;
    using std::sqrt;
    GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
    const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
    const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
    const auto tmp3 = tmp2 + tmp1;
    const auto tmp4 = 1e-10 + tmp3;
    const auto tmp5 = std::sqrt( tmp4 );
    const auto tmp6 = -0.4 + tmp5;
    const auto tmp7 = 0.15 + tmp0[ 1 ];
    const auto tmp8 = tmp7 * tmp7;
    const auto tmp9 = 0.15 + tmp0[ 0 ];
    const auto tmp10 = tmp9 * tmp9;
    const auto tmp11 = tmp10 + tmp8;
    const auto tmp12 = 1e-10 + tmp11;
    const auto tmp13 = std::sqrt( tmp12 );
    const auto tmp14 = -0.3 + tmp13;
    const auto tmp15 = -0.15 + tmp0[ 1 ];
    const auto tmp16 = tmp15 * tmp15;
    const auto tmp17 = -0.15 + tmp0[ 0 ];
    const auto tmp18 = tmp17 * tmp17;
    const auto tmp19 = tmp18 + tmp16;
    const auto tmp20 = 1e-10 + tmp19;
    const auto tmp21 = std::sqrt( tmp20 );
    const auto tmp22 = -0.3 + tmp21;
    const auto tmp23 = std::min( tmp22, tmp14 );
    const auto tmp24 = std::max( tmp23, tmp6 );
    result[ 0 ] = tmp24;
  }

  template< class Point >
  void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
  {
    using std::min;
    using std::sqrt;
    GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
    const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
    const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
    const auto tmp3 = tmp2 + tmp1;
    const auto tmp4 = 1e-10 + tmp3;
    const auto tmp5 = std::sqrt( tmp4 );
    const auto tmp6 = -0.4 + tmp5;
    const auto tmp7 = 0.15 + tmp0[ 1 ];
    const auto tmp8 = tmp7 * tmp7;
    const auto tmp9 = 0.15 + tmp0[ 0 ];
    const auto tmp10 = tmp9 * tmp9;
    const auto tmp11 = tmp10 + tmp8;
    const auto tmp12 = 1e-10 + tmp11;
    const auto tmp13 = std::sqrt( tmp12 );
    const auto tmp14 = -0.3 + tmp13;
    const auto tmp15 = -0.15 + tmp0[ 1 ];
    const auto tmp16 = tmp15 * tmp15;
    const auto tmp17 = -0.15 + tmp0[ 0 ];
    const auto tmp18 = tmp17 * tmp17;
    const auto tmp19 = tmp18 + tmp16;
    const auto tmp20 = 1e-10 + tmp19;
    const auto tmp21 = std::sqrt( tmp20 );
    const auto tmp22 = -0.3 + tmp21;
    const auto tmp23 = std::min( tmp22, tmp14 );
    const auto tmp24 = 2 * tmp21;
    const auto tmp25 = tmp17 + tmp17;
    const auto tmp26 = tmp25 / tmp24;
    const auto tmp27 = tmp26 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp28 = 2 * tmp13;
    const auto tmp29 = tmp9 + tmp9;
    const auto tmp30 = tmp29 / tmp28;
    const auto tmp31 = -1 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp32 = 1.0 + tmp31;
    const auto tmp33 = tmp32 * tmp30;
    const auto tmp34 = tmp33 + tmp27;
    const auto tmp35 = tmp34 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp36 = 2 * tmp5;
    const auto tmp37 = tmp0[ 0 ] + tmp0[ 0 ];
    const auto tmp38 = tmp37 / tmp36;
    const auto tmp39 = -1 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp40 = 1.0 + tmp39;
    const auto tmp41 = tmp40 * tmp38;
    const auto tmp42 = tmp41 + tmp35;
    const auto tmp43 = tmp15 + tmp15;
    const auto tmp44 = tmp43 / tmp24;
    const auto tmp45 = tmp44 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp46 = tmp7 + tmp7;
    const auto tmp47 = tmp46 / tmp28;
    const auto tmp48 = tmp32 * tmp47;
    const auto tmp49 = tmp48 + tmp45;
    const auto tmp50 = tmp49 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp51 = tmp0[ 1 ] + tmp0[ 1 ];
    const auto tmp52 = tmp51 / tmp36;
    const auto tmp53 = tmp40 * tmp52;
    const auto tmp54 = tmp53 + tmp50;
    (result[ 0 ])[ 0 ] = tmp42;
    (result[ 0 ])[ 1 ] = tmp54;
  }

  template< class Point >
  void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
  {
    using std::min;
    using std::sqrt;
    GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
    const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
    const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
    const auto tmp3 = tmp2 + tmp1;
    const auto tmp4 = 1e-10 + tmp3;
    const auto tmp5 = std::sqrt( tmp4 );
    const auto tmp6 = -0.4 + tmp5;
    const auto tmp7 = 0.15 + tmp0[ 1 ];
    const auto tmp8 = tmp7 * tmp7;
    const auto tmp9 = 0.15 + tmp0[ 0 ];
    const auto tmp10 = tmp9 * tmp9;
    const auto tmp11 = tmp10 + tmp8;
    const auto tmp12 = 1e-10 + tmp11;
    const auto tmp13 = std::sqrt( tmp12 );
    const auto tmp14 = -0.3 + tmp13;
    const auto tmp15 = -0.15 + tmp0[ 1 ];
    const auto tmp16 = tmp15 * tmp15;
    const auto tmp17 = -0.15 + tmp0[ 0 ];
    const auto tmp18 = tmp17 * tmp17;
    const auto tmp19 = tmp18 + tmp16;
    const auto tmp20 = 1e-10 + tmp19;
    const auto tmp21 = std::sqrt( tmp20 );
    const auto tmp22 = -0.3 + tmp21;
    const auto tmp23 = std::min( tmp22, tmp14 );
    const auto tmp24 = 2 * tmp21;
    const auto tmp25 = tmp17 + tmp17;
    const auto tmp26 = tmp25 / tmp24;
    const auto tmp27 = 2 * tmp26;
    const auto tmp28 = tmp27 * tmp26;
    const auto tmp29 = -1 * tmp28;
    const auto tmp30 = 2 + tmp29;
    const auto tmp31 = tmp30 / tmp24;
    const auto tmp32 = tmp31 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp33 = 2 * tmp13;
    const auto tmp34 = tmp9 + tmp9;
    const auto tmp35 = tmp34 / tmp33;
    const auto tmp36 = 2 * tmp35;
    const auto tmp37 = tmp36 * tmp35;
    const auto tmp38 = -1 * tmp37;
    const auto tmp39 = 2 + tmp38;
    const auto tmp40 = tmp39 / tmp33;
    const auto tmp41 = -1 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp42 = 1.0 + tmp41;
    const auto tmp43 = tmp42 * tmp40;
    const auto tmp44 = tmp43 + tmp32;
    const auto tmp45 = tmp44 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp46 = 2 * tmp5;
    const auto tmp47 = tmp0[ 0 ] + tmp0[ 0 ];
    const auto tmp48 = tmp47 / tmp46;
    const auto tmp49 = 2 * tmp48;
    const auto tmp50 = tmp49 * tmp48;
    const auto tmp51 = -1 * tmp50;
    const auto tmp52 = 2 + tmp51;
    const auto tmp53 = tmp52 / tmp46;
    const auto tmp54 = -1 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp55 = 1.0 + tmp54;
    const auto tmp56 = tmp55 * tmp53;
    const auto tmp57 = tmp56 + tmp45;
    const auto tmp58 = tmp15 + tmp15;
    const auto tmp59 = tmp58 / tmp24;
    const auto tmp60 = 2 * tmp59;
    const auto tmp61 = tmp60 * tmp26;
    const auto tmp62 = -1 * tmp61;
    const auto tmp63 = tmp62 / tmp24;
    const auto tmp64 = tmp63 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp65 = tmp7 + tmp7;
    const auto tmp66 = tmp65 / tmp33;
    const auto tmp67 = 2 * tmp66;
    const auto tmp68 = tmp67 * tmp35;
    const auto tmp69 = -1 * tmp68;
    const auto tmp70 = tmp69 / tmp33;
    const auto tmp71 = tmp42 * tmp70;
    const auto tmp72 = tmp71 + tmp64;
    const auto tmp73 = tmp72 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp74 = tmp0[ 1 ] + tmp0[ 1 ];
    const auto tmp75 = tmp74 / tmp46;
    const auto tmp76 = 2 * tmp75;
    const auto tmp77 = tmp76 * tmp48;
    const auto tmp78 = -1 * tmp77;
    const auto tmp79 = tmp78 / tmp46;
    const auto tmp80 = tmp55 * tmp79;
    const auto tmp81 = tmp80 + tmp73;
    const auto tmp82 = tmp27 * tmp59;
    const auto tmp83 = -1 * tmp82;
    const auto tmp84 = tmp83 / tmp24;
    const auto tmp85 = tmp84 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp86 = tmp36 * tmp66;
    const auto tmp87 = -1 * tmp86;
    const auto tmp88 = tmp87 / tmp33;
    const auto tmp89 = tmp42 * tmp88;
    const auto tmp90 = tmp89 + tmp85;
    const auto tmp91 = tmp90 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp92 = tmp49 * tmp75;
    const auto tmp93 = -1 * tmp92;
    const auto tmp94 = tmp93 / tmp46;
    const auto tmp95 = tmp55 * tmp94;
    const auto tmp96 = tmp95 + tmp91;
    const auto tmp97 = tmp60 * tmp59;
    const auto tmp98 = -1 * tmp97;
    const auto tmp99 = 2 + tmp98;
    const auto tmp100 = tmp99 / tmp24;
    const auto tmp101 = tmp100 * (tmp22 < tmp14 ? 1 : 0.0);
    const auto tmp102 = tmp67 * tmp66;
    const auto tmp103 = -1 * tmp102;
    const auto tmp104 = 2 + tmp103;
    const auto tmp105 = tmp104 / tmp33;
    const auto tmp106 = tmp42 * tmp105;
    const auto tmp107 = tmp106 + tmp101;
    const auto tmp108 = tmp107 * (tmp23 > tmp6 ? 1 : 0.0);
    const auto tmp109 = tmp76 * tmp75;
    const auto tmp110 = -1 * tmp109;
    const auto tmp111 = 2 + tmp110;
    const auto tmp112 = tmp111 / tmp46;
    const auto tmp113 = tmp55 * tmp112;
    const auto tmp114 = tmp113 + tmp108;
    ((result[ 0 ])[ 0 ])[ 0 ] = tmp57;
    ((result[ 0 ])[ 0 ])[ 1 ] = tmp81;
    ((result[ 0 ])[ 1 ])[ 0 ] = tmp96;
    ((result[ 0 ])[ 1 ])[ 1 ] = tmp114;
  }

  template< std::size_t i >
  const ConstantType< i > &constant () const
  {
    return *std::get< i >( constants_ );
  }

  template< std::size_t i >
  ConstantType< i > &constant ()
  {
    return *std::get< i >( constants_ );
  }
  ConstantTupleType constants_;
  std::tuple<  > coefficients_;
};

} // namespace UFLLocalFunctions_10f9d7a54f79c12d6ca923b9ee56b80d

PYBIND11_MODULE( localfunction_10f9d7a54f79c12d6ca923b9ee56b80d_a524c1196983e65de1c06d7d6afdeb44, module )
{
  typedef UFLLocalFunctions_10f9d7a54f79c12d6ca923b9ee56b80d::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > > LocalFunctionType;
  if constexpr( LocalFunctionType::gridPartValid )
  {
      auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_10f9d7a54f79c12d6ca923b9ee56b80d::UFLLocalFunction< typename Dune::FemPy::GridPart< Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true > > >"), Dune::Python::IncludeFiles({"python/dune/generated/localfunction_10f9d7a54f79c12d6ca923b9ee56b80d_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
      Dune::FemPy::registerUFLLocalFunction( module, cls );
      cls.def( pybind11::init( [] ( pybind11::object gridView, const std::string &name, int order ) {return new LocalFunctionType( Dune::FemPy::gridPart<Dune::Fem::FilteredGridPart< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > >, Dune::Fem::SimpleFilter< Dune::FemPy::GridPart< Dune::Fem::AdaptiveLeafGridPart< Dune::ALUGrid< 2, 2, Dune::simplex > > > >, true >>(gridView),name,order); } ), pybind11::keep_alive< 1, 2 >() );
      cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
  }
}

#endif
