ddfem 1.0.4__py3-none-any.whl → 1.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. ddfem/__init__.py +72 -0
  2. ddfem/__main__.py +24 -0
  3. ddfem/data/adapt_010e1455a389aa01992af42c0a3f4b14.cc +27 -0
  4. ddfem/data/femscheme_f2a3cb32a864b08c0236366e732fb908.cc +43 -0
  5. ddfem/data/femspace_4ff9049b6f297245e5d33296d14cd684_d5b136dbe3c5077b69c99b8c322eb563.cc +45 -0
  6. ddfem/data/generate.py +30 -0
  7. ddfem/data/hierarchicalgrid_d827e80243feae36e8b9006bb24207e7.cc +26 -0
  8. ddfem/data/indexset_e9c0cdc96a4fc702a0969c29910954e6.cc +32 -0
  9. ddfem/data/integrands_008eefa148b772fa3192dd3c1728c140v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +587 -0
  10. ddfem/data/integrands_00ee9b3b89e4e44212e5b7ad7948a24ev1_3_a524c1196983e65de1c06d7d6afdeb44.cc +587 -0
  11. ddfem/data/integrands_1da925f6548e47811d4ee37ac8afd85ev1_3_a524c1196983e65de1c06d7d6afdeb44.cc +453 -0
  12. ddfem/data/integrands_2339be3c67df1d67b18125c34ced69c2v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +244 -0
  13. ddfem/data/integrands_3a7c822d5ac1692781ee4bcf2964fce7v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +409 -0
  14. ddfem/data/integrands_3bde0abfafcf45a3cff4d1029568ab5cv1_3_a524c1196983e65de1c06d7d6afdeb44.cc +409 -0
  15. ddfem/data/integrands_472696f050a50e3f5017ab5ecdab564bv1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
  16. ddfem/data/integrands_5d65834d43b1dbae0ceafbcc9ec60542v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +453 -0
  17. ddfem/data/integrands_9fbeb56ff6a7df9b8535d767ca7725d6v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +588 -0
  18. ddfem/data/integrands_cf38a832d97016edac4179e31ea45a48v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
  19. ddfem/data/localfunction_00f2e5593eeb23f01906255d67244f6e_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  20. ddfem/data/localfunction_0cb4ca9e24e2891510640b0737aaab21_a524c1196983e65de1c06d7d6afdeb44.cc +170 -0
  21. ddfem/data/localfunction_0f7b2106478c5d2af781b1f377a180d2_a524c1196983e65de1c06d7d6afdeb44.cc +393 -0
  22. ddfem/data/localfunction_10ad0a2d88c74db5f4bf5f81e138974f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  23. ddfem/data/localfunction_191355e6250b2d2e260d96f519ad9976_a524c1196983e65de1c06d7d6afdeb44.cc +192 -0
  24. ddfem/data/localfunction_1d13146d4bff10e178aba773fe2a9f1d_a524c1196983e65de1c06d7d6afdeb44.cc +263 -0
  25. ddfem/data/localfunction_1d27a90a52b9053192c9cc902283f79b_a524c1196983e65de1c06d7d6afdeb44.cc +189 -0
  26. ddfem/data/localfunction_2021505441469e99dd3c9b164e083239_a524c1196983e65de1c06d7d6afdeb44.cc +620 -0
  27. ddfem/data/localfunction_228c55d163ca194a905826bcc20fcbc0_a524c1196983e65de1c06d7d6afdeb44.cc +903 -0
  28. ddfem/data/localfunction_22e797a8f3e8c322f33c41e07bd15165_a524c1196983e65de1c06d7d6afdeb44.cc +1445 -0
  29. ddfem/data/localfunction_2a97db5a6a479d02138a836cb0890cf2_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
  30. ddfem/data/localfunction_32613626342183eafa360dc1f0f18924_a524c1196983e65de1c06d7d6afdeb44.cc +1425 -0
  31. ddfem/data/localfunction_33933b99fbea8227fedf6cfb180ea878_a524c1196983e65de1c06d7d6afdeb44.cc +386 -0
  32. ddfem/data/localfunction_3e323e81c52891c0ecb656eac273e52f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  33. ddfem/data/localfunction_42ff56710f3bd510798ecabb32a6cbf0_a524c1196983e65de1c06d7d6afdeb44.cc +490 -0
  34. ddfem/data/localfunction_42ff56710f3bd510798ecabb32a6cbf0_af122c1df944c95cd395ec0f91d0f970.cc +488 -0
  35. ddfem/data/localfunction_4484607e3f9bd9999dbd7bb9d595a7b2_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
  36. ddfem/data/localfunction_6363af791dde11d699a9a3d876cc5d9a_a524c1196983e65de1c06d7d6afdeb44.cc +549 -0
  37. ddfem/data/localfunction_65bda5736a84d4aa0ef2d48ebcc90ed5_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
  38. ddfem/data/localfunction_762aa49bc5a47ad3d8d8bbde36b42ee5_a524c1196983e65de1c06d7d6afdeb44.cc +723 -0
  39. ddfem/data/localfunction_7d81d496538f240d504e5597484ee746_a524c1196983e65de1c06d7d6afdeb44.cc +462 -0
  40. ddfem/data/localfunction_83d9e6dd70d1c31c973224e210cc36b4_a524c1196983e65de1c06d7d6afdeb44.cc +647 -0
  41. ddfem/data/localfunction_86a0670f34bf2ac8155423a1c1bc2e75_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  42. ddfem/data/localfunction_a46a988b5d8571e80fd401a36d7341b7_a524c1196983e65de1c06d7d6afdeb44.cc +170 -0
  43. ddfem/data/localfunction_a854465b265a1a51dacb4f71f7eeb06b_a524c1196983e65de1c06d7d6afdeb44.cc +266 -0
  44. ddfem/data/localfunction_a8c726f728cd35d137188b33301aeef1_a524c1196983e65de1c06d7d6afdeb44.cc +176 -0
  45. ddfem/data/localfunction_a9bb07439605d560b583608f20441342_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
  46. ddfem/data/localfunction_ae8173bdb67b8ea50ce75c3912841100_a524c1196983e65de1c06d7d6afdeb44.cc +1290 -0
  47. ddfem/data/localfunction_aeb3d963412cdc65630e0a4c3c0dde0f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  48. ddfem/data/localfunction_b20910b6c8d57cb5e6a7ff4b89b91618_a524c1196983e65de1c06d7d6afdeb44.cc +437 -0
  49. ddfem/data/localfunction_b8239bf849ec7c1903f627833e6dac5a_a524c1196983e65de1c06d7d6afdeb44.cc +1270 -0
  50. ddfem/data/localfunction_bcafb581216501f273e23c0e26cd57af_af122c1df944c95cd395ec0f91d0f970.cc +698 -0
  51. ddfem/data/localfunction_bdfb7ddf42a423f7d0791458634d4b8f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  52. ddfem/data/localfunction_d0f33c2dc1ae0e619d85a7621c8e83a6_a524c1196983e65de1c06d7d6afdeb44.cc +325 -0
  53. ddfem/data/localfunction_d75993d7ae5919d23117b153e900840d_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  54. ddfem/data/localfunction_dd1fb4bd60f2d8b3a062dbbdaedb9fee_a524c1196983e65de1c06d7d6afdeb44.cc +869 -0
  55. ddfem/data/localfunction_e6b6d8d3826590442cc40f3834124254_a524c1196983e65de1c06d7d6afdeb44.cc +553 -0
  56. ddfem/data/localfunction_e85b93fe9b8fcd40ee82782fc600b65b_a524c1196983e65de1c06d7d6afdeb44.cc +247 -0
  57. ddfem/data/localfunction_f4b1d42cbb447375f39ed834570cd3f0_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
  58. ddfem/data/localfunction_f626cd43dc8558135fe0b32cde016644_a524c1196983e65de1c06d7d6afdeb44.cc +294 -0
  59. ddfem/data/referenceelements_0fff57b283123cc055345ec95574c857.cc +24 -0
  60. ddfem/data/referenceelements_de274310a0055100b832a0e8892b0258.cc +24 -0
  61. ddfem/data/referenceelements_f4457f35395151d83a965d4cf5fce70d.cc +24 -0
  62. ddfem/data/view_a524c1196983e65de1c06d7d6afdeb44.cc +39 -0
  63. ddfem/data/view_af122c1df944c95cd395ec0f91d0f970.cc +62 -0
  64. ddfem/examples/beam.py +2 -2
  65. ddfem/examples/five_circle_flat.py +18 -37
  66. ddfem/examples/single_circle.py +1 -1
  67. ddfem/examples/triple_circle.py +2 -2
  68. ddfem/examples/triple_circle_beam.py +2 -2
  69. ddfem/geometry/domain.py +1 -1
  70. ddfem/geometry/domain_dune.py +46 -28
  71. ddfem/geometry/primitive_base.py +11 -6
  72. ddfem/plot.py +67 -7
  73. {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/METADATA +9 -2
  74. ddfem-1.0.6.dist-info/RECORD +103 -0
  75. ddfem-1.0.4.dist-info/RECORD +0 -41
  76. {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/WHEEL +0 -0
  77. {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/licenses/LICENSE +0 -0
  78. {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,135 @@
1
+ #ifndef GUARD_86a0670f34bf2ac8155423a1c1bc2e75
2
+ #define GUARD_86a0670f34bf2ac8155423a1c1bc2e75
3
+
4
+ #define USING_DUNE_PYTHON 1
5
+ #include <config.h>
6
+ #include <dune/alugrid/dgf.hh>
7
+ #include <dune/alugrid/grid.hh>
8
+ #include <dune/fem/gridpart/adaptiveleafgridpart.hh>
9
+ #include <dune/fem/gridpart/filter/simple.hh>
10
+ #include <dune/fem/gridpart/filteredgridpart.hh>
11
+ #include <dune/fempy/py/gridview.hh>
12
+ #include <dune/python/grid/gridview.hh>
13
+ #include <dune/python/grid/hierarchical.hh>
14
+ #include <dune/fem/function/localfunction/bindable.hh>
15
+ #include <dune/fem/common/intersectionside.hh>
16
+ #include <dune/python/pybind11/pybind11.h>
17
+ #include <dune/python/pybind11/extensions.h>
18
+ #include <dune/fempy/py/grid/gridpart.hh>
19
+ #include <dune/common/exceptions.hh>
20
+ #include <dune/fempy/py/ufllocalfunction.hh>
21
+
22
+ namespace UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75
23
+ {
24
+
25
+ // UFLLocalFunction
26
+ // ----------------
27
+
28
+ template< class GridPart >
29
+ struct UFLLocalFunction
30
+ : public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>>
31
+ {
32
+ typedef GridPart GridPartType;
33
+ typedef typename GridPartType::GridViewType GridView;
34
+ typedef typename GridView::ctype ctype;
35
+ typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>> BaseType;
36
+ typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<1>> FunctionSpaceType;
37
+ typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
38
+ typedef typename GridPartType::IntersectionType IntersectionType;
39
+ typedef typename EntityType::Geometry Geometry;
40
+ typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
41
+ typedef Dune::Fem::IntersectionSide Side;
42
+ typedef double Conc6;
43
+ typedef std::tuple< std::shared_ptr< Conc6 > > ConstantTupleType;
44
+ template< std::size_t i >
45
+ using ConstantsRangeType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
46
+ typedef std::tuple<> CoefficientTupleType;
47
+ static constexpr bool gridPartValid = true;
48
+ template< std::size_t i >
49
+ using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
50
+ template< std::size_t i >
51
+ using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
52
+ using BaseType::entity;
53
+ using BaseType::geometry;
54
+
55
+ UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Dune::Fem::ParameterReader &parameter = Dune::Fem::Parameter::container() )
56
+ : BaseType(gridPart,name,order)
57
+ {
58
+ std::get< 0 >( constants_ ) = std::make_shared< Conc6 >( (Conc6(0)) );
59
+ }
60
+
61
+ void bind ( const IntersectionType &intersection, Side side )
62
+ {
63
+ BaseType::bind(intersection, side);
64
+ }
65
+
66
+ void bind ( const EntityType &entity )
67
+ {
68
+ BaseType::bind(entity);
69
+ }
70
+
71
+ void unbind ()
72
+ {
73
+ BaseType::unbind();
74
+ }
75
+
76
+ template< class Point >
77
+ void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
78
+ {
79
+ double tmp0 = constant< 0 >();
80
+ result[ 0 ] = tmp0;
81
+ }
82
+
83
+ template< class Point >
84
+ void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
85
+ {
86
+ result=typename FunctionSpaceType::JacobianRangeType(0);
87
+ }
88
+
89
+ template< class Point >
90
+ void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
91
+ {
92
+ result=typename FunctionSpaceType::HessianRangeType(0);
93
+ }
94
+
95
+ template< std::size_t i >
96
+ const ConstantType< i > &constant () const
97
+ {
98
+ return *std::get< i >( constants_ );
99
+ }
100
+
101
+ template< std::size_t i >
102
+ ConstantType< i > &constant ()
103
+ {
104
+ return *std::get< i >( constants_ );
105
+ }
106
+
107
+ const Conc6 &conc6 () const
108
+ {
109
+ return *std::get< 0 >( constants_ );
110
+ }
111
+
112
+ Conc6 &conc6 ()
113
+ {
114
+ return *std::get< 0 >( constants_ );
115
+ }
116
+ ConstantTupleType constants_;
117
+ std::tuple< > coefficients_;
118
+ };
119
+
120
+ } // namespace UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75
121
+
122
+ PYBIND11_MODULE( localfunction_86a0670f34bf2ac8155423a1c1bc2e75_a524c1196983e65de1c06d7d6afdeb44, module )
123
+ {
124
+ typedef UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75::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;
125
+ if constexpr( LocalFunctionType::gridPartValid )
126
+ {
127
+ auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75::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_86a0670f34bf2ac8155423a1c1bc2e75_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
128
+ Dune::FemPy::registerUFLLocalFunction( module, cls );
129
+ 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 >() );
130
+ cls.def_property( "c6", [] ( LocalFunctionType &self ) -> UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75::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 > > >::Conc6 { return self.conc6(); }, [] ( LocalFunctionType &self, const UFLLocalFunctions_86a0670f34bf2ac8155423a1c1bc2e75::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 > > >::Conc6 &v ) { self.conc6() = v; } );
131
+ cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
132
+ }
133
+ }
134
+
135
+ #endif
@@ -0,0 +1,170 @@
1
+ #ifndef GUARD_a46a988b5d8571e80fd401a36d7341b7
2
+ #define GUARD_a46a988b5d8571e80fd401a36d7341b7
3
+
4
+ #define USING_DUNE_PYTHON 1
5
+ #include <config.h>
6
+ #include <dune/alugrid/dgf.hh>
7
+ #include <dune/alugrid/grid.hh>
8
+ #include <dune/fem/gridpart/adaptiveleafgridpart.hh>
9
+ #include <dune/fem/gridpart/filter/simple.hh>
10
+ #include <dune/fem/gridpart/filteredgridpart.hh>
11
+ #include <dune/fempy/py/gridview.hh>
12
+ #include <dune/python/grid/gridview.hh>
13
+ #include <dune/python/grid/hierarchical.hh>
14
+ #include <dune/fem/function/localfunction/bindable.hh>
15
+ #include <dune/fem/common/intersectionside.hh>
16
+ #include <dune/python/pybind11/pybind11.h>
17
+ #include <dune/python/pybind11/extensions.h>
18
+ #include <dune/fempy/py/grid/gridpart.hh>
19
+ #include <dune/common/exceptions.hh>
20
+ #include <dune/fempy/py/ufllocalfunction.hh>
21
+
22
+ namespace UFLLocalFunctions_a46a988b5d8571e80fd401a36d7341b7
23
+ {
24
+
25
+ // UFLLocalFunction
26
+ // ----------------
27
+
28
+ template< class GridPart >
29
+ struct UFLLocalFunction
30
+ : public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>>
31
+ {
32
+ typedef GridPart GridPartType;
33
+ typedef typename GridPartType::GridViewType GridView;
34
+ typedef typename GridView::ctype ctype;
35
+ typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>> BaseType;
36
+ typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<1>> FunctionSpaceType;
37
+ typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
38
+ typedef typename GridPartType::IntersectionType IntersectionType;
39
+ typedef typename EntityType::Geometry Geometry;
40
+ typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
41
+ typedef Dune::Fem::IntersectionSide Side;
42
+ typedef std::tuple<> ConstantTupleType;
43
+ typedef std::tuple<> CoefficientTupleType;
44
+ static constexpr bool gridPartValid = true;
45
+ template< std::size_t i >
46
+ using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
47
+ template< std::size_t i >
48
+ using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
49
+ using BaseType::entity;
50
+ using BaseType::geometry;
51
+
52
+ UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Dune::Fem::ParameterReader &parameter = Dune::Fem::Parameter::container() )
53
+ : BaseType(gridPart,name,order)
54
+ {}
55
+
56
+ void bind ( const IntersectionType &intersection, Side side )
57
+ {
58
+ BaseType::bind(intersection, side);
59
+ }
60
+
61
+ void bind ( const EntityType &entity )
62
+ {
63
+ BaseType::bind(entity);
64
+ }
65
+
66
+ void unbind ()
67
+ {
68
+ BaseType::unbind();
69
+ }
70
+
71
+ template< class Point >
72
+ void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
73
+ {
74
+ using std::sqrt;
75
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
76
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
77
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
78
+ const auto tmp3 = tmp2 + tmp1;
79
+ const auto tmp4 = 1e-10 + tmp3;
80
+ const auto tmp5 = std::sqrt( tmp4 );
81
+ const auto tmp6 = -1 + tmp5;
82
+ result[ 0 ] = tmp6;
83
+ }
84
+
85
+ template< class Point >
86
+ void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
87
+ {
88
+ using std::sqrt;
89
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
90
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
91
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
92
+ const auto tmp3 = tmp2 + tmp1;
93
+ const auto tmp4 = 1e-10 + tmp3;
94
+ const auto tmp5 = std::sqrt( tmp4 );
95
+ const auto tmp6 = 2 * tmp5;
96
+ const auto tmp7 = tmp0[ 0 ] + tmp0[ 0 ];
97
+ const auto tmp8 = tmp7 / tmp6;
98
+ const auto tmp9 = tmp0[ 1 ] + tmp0[ 1 ];
99
+ const auto tmp10 = tmp9 / tmp6;
100
+ (result[ 0 ])[ 0 ] = tmp8;
101
+ (result[ 0 ])[ 1 ] = tmp10;
102
+ }
103
+
104
+ template< class Point >
105
+ void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
106
+ {
107
+ using std::sqrt;
108
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
109
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
110
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
111
+ const auto tmp3 = tmp2 + tmp1;
112
+ const auto tmp4 = 1e-10 + tmp3;
113
+ const auto tmp5 = std::sqrt( tmp4 );
114
+ const auto tmp6 = 2 * tmp5;
115
+ const auto tmp7 = tmp0[ 0 ] + tmp0[ 0 ];
116
+ const auto tmp8 = tmp7 / tmp6;
117
+ const auto tmp9 = 2 * tmp8;
118
+ const auto tmp10 = tmp9 * tmp8;
119
+ const auto tmp11 = -1 * tmp10;
120
+ const auto tmp12 = 2 + tmp11;
121
+ const auto tmp13 = tmp12 / tmp6;
122
+ const auto tmp14 = tmp0[ 1 ] + tmp0[ 1 ];
123
+ const auto tmp15 = tmp14 / tmp6;
124
+ const auto tmp16 = 2 * tmp15;
125
+ const auto tmp17 = tmp16 * tmp8;
126
+ const auto tmp18 = -1 * tmp17;
127
+ const auto tmp19 = tmp18 / tmp6;
128
+ const auto tmp20 = tmp9 * tmp15;
129
+ const auto tmp21 = -1 * tmp20;
130
+ const auto tmp22 = tmp21 / tmp6;
131
+ const auto tmp23 = tmp16 * tmp15;
132
+ const auto tmp24 = -1 * tmp23;
133
+ const auto tmp25 = 2 + tmp24;
134
+ const auto tmp26 = tmp25 / tmp6;
135
+ ((result[ 0 ])[ 0 ])[ 0 ] = tmp13;
136
+ ((result[ 0 ])[ 0 ])[ 1 ] = tmp19;
137
+ ((result[ 0 ])[ 1 ])[ 0 ] = tmp22;
138
+ ((result[ 0 ])[ 1 ])[ 1 ] = tmp26;
139
+ }
140
+
141
+ template< std::size_t i >
142
+ const ConstantType< i > &constant () const
143
+ {
144
+ return *std::get< i >( constants_ );
145
+ }
146
+
147
+ template< std::size_t i >
148
+ ConstantType< i > &constant ()
149
+ {
150
+ return *std::get< i >( constants_ );
151
+ }
152
+ ConstantTupleType constants_;
153
+ std::tuple< > coefficients_;
154
+ };
155
+
156
+ } // namespace UFLLocalFunctions_a46a988b5d8571e80fd401a36d7341b7
157
+
158
+ PYBIND11_MODULE( localfunction_a46a988b5d8571e80fd401a36d7341b7_a524c1196983e65de1c06d7d6afdeb44, module )
159
+ {
160
+ typedef UFLLocalFunctions_a46a988b5d8571e80fd401a36d7341b7::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;
161
+ if constexpr( LocalFunctionType::gridPartValid )
162
+ {
163
+ auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_a46a988b5d8571e80fd401a36d7341b7::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_a46a988b5d8571e80fd401a36d7341b7_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
164
+ Dune::FemPy::registerUFLLocalFunction( module, cls );
165
+ 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 >() );
166
+ cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
167
+ }
168
+ }
169
+
170
+ #endif
@@ -0,0 +1,266 @@
1
+ #ifndef GUARD_a854465b265a1a51dacb4f71f7eeb06b
2
+ #define GUARD_a854465b265a1a51dacb4f71f7eeb06b
3
+
4
+ #define USING_DUNE_PYTHON 1
5
+ #include <config.h>
6
+ #include <dune/alugrid/dgf.hh>
7
+ #include <dune/alugrid/grid.hh>
8
+ #include <dune/fem/gridpart/adaptiveleafgridpart.hh>
9
+ #include <dune/fem/gridpart/filter/simple.hh>
10
+ #include <dune/fem/gridpart/filteredgridpart.hh>
11
+ #include <dune/fempy/py/gridview.hh>
12
+ #include <dune/python/grid/gridview.hh>
13
+ #include <dune/python/grid/hierarchical.hh>
14
+ #include <dune/fem/function/localfunction/bindable.hh>
15
+ #include <dune/fem/common/intersectionside.hh>
16
+ #include <dune/python/pybind11/pybind11.h>
17
+ #include <dune/python/pybind11/extensions.h>
18
+ #include <dune/fempy/py/grid/gridpart.hh>
19
+ #include <dune/common/exceptions.hh>
20
+ #include <dune/fempy/py/ufllocalfunction.hh>
21
+
22
+ namespace UFLLocalFunctions_a854465b265a1a51dacb4f71f7eeb06b
23
+ {
24
+
25
+ // UFLLocalFunction
26
+ // ----------------
27
+
28
+ template< class GridPart >
29
+ struct UFLLocalFunction
30
+ : public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>>
31
+ {
32
+ typedef GridPart GridPartType;
33
+ typedef typename GridPartType::GridViewType GridView;
34
+ typedef typename GridView::ctype ctype;
35
+ typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>> BaseType;
36
+ typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<1>> FunctionSpaceType;
37
+ typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
38
+ typedef typename GridPartType::IntersectionType IntersectionType;
39
+ typedef typename EntityType::Geometry Geometry;
40
+ typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
41
+ typedef Dune::Fem::IntersectionSide Side;
42
+ typedef std::tuple<> ConstantTupleType;
43
+ typedef std::tuple<> CoefficientTupleType;
44
+ static constexpr bool gridPartValid = true;
45
+ template< std::size_t i >
46
+ using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
47
+ template< std::size_t i >
48
+ using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
49
+ using BaseType::entity;
50
+ using BaseType::geometry;
51
+
52
+ UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Dune::Fem::ParameterReader &parameter = Dune::Fem::Parameter::container() )
53
+ : BaseType(gridPart,name,order)
54
+ {}
55
+
56
+ void bind ( const IntersectionType &intersection, Side side )
57
+ {
58
+ BaseType::bind(intersection, side);
59
+ }
60
+
61
+ void bind ( const EntityType &entity )
62
+ {
63
+ BaseType::bind(entity);
64
+ }
65
+
66
+ void unbind ()
67
+ {
68
+ BaseType::unbind();
69
+ }
70
+
71
+ template< class Point >
72
+ void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
73
+ {
74
+ using std::sqrt;
75
+ using std::tanh;
76
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
77
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
78
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
79
+ const auto tmp3 = tmp2 + tmp1;
80
+ const auto tmp4 = 1e-10 + tmp3;
81
+ const auto tmp5 = std::sqrt( tmp4 );
82
+ const auto tmp6 = -1 + tmp5;
83
+ const auto tmp7 = 3 * tmp6;
84
+ const auto tmp8 = tmp7 / 0.225;
85
+ const auto tmp9 = std::tanh( tmp8 );
86
+ const auto tmp10 = -1 * tmp9;
87
+ const auto tmp11 = 1 + tmp10;
88
+ const auto tmp12 = 0.5 * tmp11;
89
+ result[ 0 ] = tmp12;
90
+ }
91
+
92
+ template< class Point >
93
+ void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
94
+ {
95
+ using std::cosh;
96
+ using std::pow;
97
+ using std::sqrt;
98
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
99
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
100
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
101
+ const auto tmp3 = tmp2 + tmp1;
102
+ const auto tmp4 = 1e-10 + tmp3;
103
+ const auto tmp5 = std::sqrt( tmp4 );
104
+ const auto tmp6 = -1 + tmp5;
105
+ const auto tmp7 = 3 * tmp6;
106
+ const auto tmp8 = tmp7 / 0.225;
107
+ const auto tmp9 = 2.0 * tmp8;
108
+ const auto tmp10 = std::cosh( tmp9 );
109
+ const auto tmp11 = 1.0 + tmp10;
110
+ const auto tmp12 = std::cosh( tmp8 );
111
+ const auto tmp13 = 2.0 * tmp12;
112
+ const auto tmp14 = tmp13 / tmp11;
113
+ const auto tmp15 = std::pow( tmp14, 2 );
114
+ const auto tmp16 = 2 * tmp5;
115
+ const auto tmp17 = tmp0[ 0 ] + tmp0[ 0 ];
116
+ const auto tmp18 = tmp17 / tmp16;
117
+ const auto tmp19 = 3 * tmp18;
118
+ const auto tmp20 = tmp19 / 0.225;
119
+ const auto tmp21 = tmp20 * tmp15;
120
+ const auto tmp22 = -1 * tmp21;
121
+ const auto tmp23 = 0.5 * tmp22;
122
+ const auto tmp24 = tmp0[ 1 ] + tmp0[ 1 ];
123
+ const auto tmp25 = tmp24 / tmp16;
124
+ const auto tmp26 = 3 * tmp25;
125
+ const auto tmp27 = tmp26 / 0.225;
126
+ const auto tmp28 = tmp27 * tmp15;
127
+ const auto tmp29 = -1 * tmp28;
128
+ const auto tmp30 = 0.5 * tmp29;
129
+ (result[ 0 ])[ 0 ] = tmp23;
130
+ (result[ 0 ])[ 1 ] = tmp30;
131
+ }
132
+
133
+ template< class Point >
134
+ void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
135
+ {
136
+ using std::cosh;
137
+ using std::pow;
138
+ using std::sinh;
139
+ using std::sqrt;
140
+ GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
141
+ const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
142
+ const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
143
+ const auto tmp3 = tmp2 + tmp1;
144
+ const auto tmp4 = 1e-10 + tmp3;
145
+ const auto tmp5 = std::sqrt( tmp4 );
146
+ const auto tmp6 = -1 + tmp5;
147
+ const auto tmp7 = 3 * tmp6;
148
+ const auto tmp8 = tmp7 / 0.225;
149
+ const auto tmp9 = 2.0 * tmp8;
150
+ const auto tmp10 = std::cosh( tmp9 );
151
+ const auto tmp11 = 1.0 + tmp10;
152
+ const auto tmp12 = std::cosh( tmp8 );
153
+ const auto tmp13 = 2.0 * tmp12;
154
+ const auto tmp14 = tmp13 / tmp11;
155
+ const auto tmp15 = std::pow( tmp14, 2 );
156
+ const auto tmp16 = 2 * tmp5;
157
+ const auto tmp17 = tmp0[ 0 ] + tmp0[ 0 ];
158
+ const auto tmp18 = tmp17 / tmp16;
159
+ const auto tmp19 = 2 * tmp18;
160
+ const auto tmp20 = tmp19 * tmp18;
161
+ const auto tmp21 = -1 * tmp20;
162
+ const auto tmp22 = 2 + tmp21;
163
+ const auto tmp23 = tmp22 / tmp16;
164
+ const auto tmp24 = 3 * tmp23;
165
+ const auto tmp25 = tmp24 / 0.225;
166
+ const auto tmp26 = tmp25 * tmp15;
167
+ const auto tmp27 = 3 * tmp18;
168
+ const auto tmp28 = tmp27 / 0.225;
169
+ const auto tmp29 = std::sinh( tmp8 );
170
+ const auto tmp30 = tmp28 * tmp29;
171
+ const auto tmp31 = 2.0 * tmp30;
172
+ const auto tmp32 = std::sinh( tmp9 );
173
+ const auto tmp33 = 2.0 * tmp28;
174
+ const auto tmp34 = tmp33 * tmp32;
175
+ const auto tmp35 = tmp34 * tmp14;
176
+ const auto tmp36 = -1 * tmp35;
177
+ const auto tmp37 = tmp36 + tmp31;
178
+ const auto tmp38 = tmp37 / tmp11;
179
+ const auto tmp39 = 2 * tmp38;
180
+ const auto tmp40 = tmp39 * tmp14;
181
+ const auto tmp41 = tmp40 * tmp28;
182
+ const auto tmp42 = tmp41 + tmp26;
183
+ const auto tmp43 = -1 * tmp42;
184
+ const auto tmp44 = 0.5 * tmp43;
185
+ const auto tmp45 = tmp0[ 1 ] + tmp0[ 1 ];
186
+ const auto tmp46 = tmp45 / tmp16;
187
+ const auto tmp47 = 2 * tmp46;
188
+ const auto tmp48 = tmp47 * tmp18;
189
+ const auto tmp49 = -1 * tmp48;
190
+ const auto tmp50 = tmp49 / tmp16;
191
+ const auto tmp51 = 3 * tmp50;
192
+ const auto tmp52 = tmp51 / 0.225;
193
+ const auto tmp53 = tmp52 * tmp15;
194
+ const auto tmp54 = 3 * tmp46;
195
+ const auto tmp55 = tmp54 / 0.225;
196
+ const auto tmp56 = tmp55 * tmp29;
197
+ const auto tmp57 = 2.0 * tmp56;
198
+ const auto tmp58 = 2.0 * tmp55;
199
+ const auto tmp59 = tmp58 * tmp32;
200
+ const auto tmp60 = tmp59 * tmp14;
201
+ const auto tmp61 = -1 * tmp60;
202
+ const auto tmp62 = tmp61 + tmp57;
203
+ const auto tmp63 = tmp62 / tmp11;
204
+ const auto tmp64 = 2 * tmp63;
205
+ const auto tmp65 = tmp64 * tmp14;
206
+ const auto tmp66 = tmp65 * tmp28;
207
+ const auto tmp67 = tmp66 + tmp53;
208
+ const auto tmp68 = -1 * tmp67;
209
+ const auto tmp69 = 0.5 * tmp68;
210
+ const auto tmp70 = tmp19 * tmp46;
211
+ const auto tmp71 = -1 * tmp70;
212
+ const auto tmp72 = tmp71 / tmp16;
213
+ const auto tmp73 = 3 * tmp72;
214
+ const auto tmp74 = tmp73 / 0.225;
215
+ const auto tmp75 = tmp74 * tmp15;
216
+ const auto tmp76 = tmp40 * tmp55;
217
+ const auto tmp77 = tmp76 + tmp75;
218
+ const auto tmp78 = -1 * tmp77;
219
+ const auto tmp79 = 0.5 * tmp78;
220
+ const auto tmp80 = tmp47 * tmp46;
221
+ const auto tmp81 = -1 * tmp80;
222
+ const auto tmp82 = 2 + tmp81;
223
+ const auto tmp83 = tmp82 / tmp16;
224
+ const auto tmp84 = 3 * tmp83;
225
+ const auto tmp85 = tmp84 / 0.225;
226
+ const auto tmp86 = tmp85 * tmp15;
227
+ const auto tmp87 = tmp65 * tmp55;
228
+ const auto tmp88 = tmp87 + tmp86;
229
+ const auto tmp89 = -1 * tmp88;
230
+ const auto tmp90 = 0.5 * tmp89;
231
+ ((result[ 0 ])[ 0 ])[ 0 ] = tmp44;
232
+ ((result[ 0 ])[ 0 ])[ 1 ] = tmp69;
233
+ ((result[ 0 ])[ 1 ])[ 0 ] = tmp79;
234
+ ((result[ 0 ])[ 1 ])[ 1 ] = tmp90;
235
+ }
236
+
237
+ template< std::size_t i >
238
+ const ConstantType< i > &constant () const
239
+ {
240
+ return *std::get< i >( constants_ );
241
+ }
242
+
243
+ template< std::size_t i >
244
+ ConstantType< i > &constant ()
245
+ {
246
+ return *std::get< i >( constants_ );
247
+ }
248
+ ConstantTupleType constants_;
249
+ std::tuple< > coefficients_;
250
+ };
251
+
252
+ } // namespace UFLLocalFunctions_a854465b265a1a51dacb4f71f7eeb06b
253
+
254
+ PYBIND11_MODULE( localfunction_a854465b265a1a51dacb4f71f7eeb06b_a524c1196983e65de1c06d7d6afdeb44, module )
255
+ {
256
+ typedef UFLLocalFunctions_a854465b265a1a51dacb4f71f7eeb06b::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;
257
+ if constexpr( LocalFunctionType::gridPartValid )
258
+ {
259
+ auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_a854465b265a1a51dacb4f71f7eeb06b::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_a854465b265a1a51dacb4f71f7eeb06b_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
260
+ Dune::FemPy::registerUFLLocalFunction( module, cls );
261
+ 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 >() );
262
+ cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
263
+ }
264
+ }
265
+
266
+ #endif