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.
- ddfem/__init__.py +72 -0
- ddfem/__main__.py +24 -0
- ddfem/data/adapt_010e1455a389aa01992af42c0a3f4b14.cc +27 -0
- ddfem/data/femscheme_f2a3cb32a864b08c0236366e732fb908.cc +43 -0
- ddfem/data/femspace_4ff9049b6f297245e5d33296d14cd684_d5b136dbe3c5077b69c99b8c322eb563.cc +45 -0
- ddfem/data/generate.py +30 -0
- ddfem/data/hierarchicalgrid_d827e80243feae36e8b9006bb24207e7.cc +26 -0
- ddfem/data/indexset_e9c0cdc96a4fc702a0969c29910954e6.cc +32 -0
- ddfem/data/integrands_008eefa148b772fa3192dd3c1728c140v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +587 -0
- ddfem/data/integrands_00ee9b3b89e4e44212e5b7ad7948a24ev1_3_a524c1196983e65de1c06d7d6afdeb44.cc +587 -0
- ddfem/data/integrands_1da925f6548e47811d4ee37ac8afd85ev1_3_a524c1196983e65de1c06d7d6afdeb44.cc +453 -0
- ddfem/data/integrands_2339be3c67df1d67b18125c34ced69c2v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +244 -0
- ddfem/data/integrands_3a7c822d5ac1692781ee4bcf2964fce7v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +409 -0
- ddfem/data/integrands_3bde0abfafcf45a3cff4d1029568ab5cv1_3_a524c1196983e65de1c06d7d6afdeb44.cc +409 -0
- ddfem/data/integrands_472696f050a50e3f5017ab5ecdab564bv1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
- ddfem/data/integrands_5d65834d43b1dbae0ceafbcc9ec60542v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +453 -0
- ddfem/data/integrands_9fbeb56ff6a7df9b8535d767ca7725d6v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +588 -0
- ddfem/data/integrands_cf38a832d97016edac4179e31ea45a48v1_3_a524c1196983e65de1c06d7d6afdeb44.cc +533 -0
- ddfem/data/localfunction_00f2e5593eeb23f01906255d67244f6e_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_0cb4ca9e24e2891510640b0737aaab21_a524c1196983e65de1c06d7d6afdeb44.cc +170 -0
- ddfem/data/localfunction_0f7b2106478c5d2af781b1f377a180d2_a524c1196983e65de1c06d7d6afdeb44.cc +393 -0
- ddfem/data/localfunction_10ad0a2d88c74db5f4bf5f81e138974f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_191355e6250b2d2e260d96f519ad9976_a524c1196983e65de1c06d7d6afdeb44.cc +192 -0
- ddfem/data/localfunction_1d13146d4bff10e178aba773fe2a9f1d_a524c1196983e65de1c06d7d6afdeb44.cc +263 -0
- ddfem/data/localfunction_1d27a90a52b9053192c9cc902283f79b_a524c1196983e65de1c06d7d6afdeb44.cc +189 -0
- ddfem/data/localfunction_2021505441469e99dd3c9b164e083239_a524c1196983e65de1c06d7d6afdeb44.cc +620 -0
- ddfem/data/localfunction_228c55d163ca194a905826bcc20fcbc0_a524c1196983e65de1c06d7d6afdeb44.cc +903 -0
- ddfem/data/localfunction_22e797a8f3e8c322f33c41e07bd15165_a524c1196983e65de1c06d7d6afdeb44.cc +1445 -0
- ddfem/data/localfunction_2a97db5a6a479d02138a836cb0890cf2_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
- ddfem/data/localfunction_32613626342183eafa360dc1f0f18924_a524c1196983e65de1c06d7d6afdeb44.cc +1425 -0
- ddfem/data/localfunction_33933b99fbea8227fedf6cfb180ea878_a524c1196983e65de1c06d7d6afdeb44.cc +386 -0
- ddfem/data/localfunction_3e323e81c52891c0ecb656eac273e52f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_42ff56710f3bd510798ecabb32a6cbf0_a524c1196983e65de1c06d7d6afdeb44.cc +490 -0
- ddfem/data/localfunction_42ff56710f3bd510798ecabb32a6cbf0_af122c1df944c95cd395ec0f91d0f970.cc +488 -0
- ddfem/data/localfunction_4484607e3f9bd9999dbd7bb9d595a7b2_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
- ddfem/data/localfunction_6363af791dde11d699a9a3d876cc5d9a_a524c1196983e65de1c06d7d6afdeb44.cc +549 -0
- ddfem/data/localfunction_65bda5736a84d4aa0ef2d48ebcc90ed5_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
- ddfem/data/localfunction_762aa49bc5a47ad3d8d8bbde36b42ee5_a524c1196983e65de1c06d7d6afdeb44.cc +723 -0
- ddfem/data/localfunction_7d81d496538f240d504e5597484ee746_a524c1196983e65de1c06d7d6afdeb44.cc +462 -0
- ddfem/data/localfunction_83d9e6dd70d1c31c973224e210cc36b4_a524c1196983e65de1c06d7d6afdeb44.cc +647 -0
- ddfem/data/localfunction_86a0670f34bf2ac8155423a1c1bc2e75_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_a46a988b5d8571e80fd401a36d7341b7_a524c1196983e65de1c06d7d6afdeb44.cc +170 -0
- ddfem/data/localfunction_a854465b265a1a51dacb4f71f7eeb06b_a524c1196983e65de1c06d7d6afdeb44.cc +266 -0
- ddfem/data/localfunction_a8c726f728cd35d137188b33301aeef1_a524c1196983e65de1c06d7d6afdeb44.cc +176 -0
- ddfem/data/localfunction_a9bb07439605d560b583608f20441342_a524c1196983e65de1c06d7d6afdeb44.cc +173 -0
- ddfem/data/localfunction_ae8173bdb67b8ea50ce75c3912841100_a524c1196983e65de1c06d7d6afdeb44.cc +1290 -0
- ddfem/data/localfunction_aeb3d963412cdc65630e0a4c3c0dde0f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_b20910b6c8d57cb5e6a7ff4b89b91618_a524c1196983e65de1c06d7d6afdeb44.cc +437 -0
- ddfem/data/localfunction_b8239bf849ec7c1903f627833e6dac5a_a524c1196983e65de1c06d7d6afdeb44.cc +1270 -0
- ddfem/data/localfunction_bcafb581216501f273e23c0e26cd57af_af122c1df944c95cd395ec0f91d0f970.cc +698 -0
- ddfem/data/localfunction_bdfb7ddf42a423f7d0791458634d4b8f_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_d0f33c2dc1ae0e619d85a7621c8e83a6_a524c1196983e65de1c06d7d6afdeb44.cc +325 -0
- ddfem/data/localfunction_d75993d7ae5919d23117b153e900840d_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_dd1fb4bd60f2d8b3a062dbbdaedb9fee_a524c1196983e65de1c06d7d6afdeb44.cc +869 -0
- ddfem/data/localfunction_e6b6d8d3826590442cc40f3834124254_a524c1196983e65de1c06d7d6afdeb44.cc +553 -0
- ddfem/data/localfunction_e85b93fe9b8fcd40ee82782fc600b65b_a524c1196983e65de1c06d7d6afdeb44.cc +247 -0
- ddfem/data/localfunction_f4b1d42cbb447375f39ed834570cd3f0_a524c1196983e65de1c06d7d6afdeb44.cc +135 -0
- ddfem/data/localfunction_f626cd43dc8558135fe0b32cde016644_a524c1196983e65de1c06d7d6afdeb44.cc +294 -0
- ddfem/data/referenceelements_0fff57b283123cc055345ec95574c857.cc +24 -0
- ddfem/data/referenceelements_de274310a0055100b832a0e8892b0258.cc +24 -0
- ddfem/data/referenceelements_f4457f35395151d83a965d4cf5fce70d.cc +24 -0
- ddfem/data/view_a524c1196983e65de1c06d7d6afdeb44.cc +39 -0
- ddfem/data/view_af122c1df944c95cd395ec0f91d0f970.cc +62 -0
- ddfem/examples/beam.py +2 -2
- ddfem/examples/five_circle_flat.py +18 -37
- ddfem/examples/single_circle.py +1 -1
- ddfem/examples/triple_circle.py +2 -2
- ddfem/examples/triple_circle_beam.py +2 -2
- ddfem/geometry/domain.py +1 -1
- ddfem/geometry/domain_dune.py +46 -28
- ddfem/geometry/primitive_base.py +11 -6
- ddfem/plot.py +67 -7
- {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/METADATA +9 -2
- ddfem-1.0.6.dist-info/RECORD +103 -0
- ddfem-1.0.4.dist-info/RECORD +0 -41
- {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/WHEEL +0 -0
- {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/licenses/LICENSE +0 -0
- {ddfem-1.0.4.dist-info → ddfem-1.0.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
#ifndef GUARD_a8c726f728cd35d137188b33301aeef1
|
2
|
+
#define GUARD_a8c726f728cd35d137188b33301aeef1
|
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/function/virtualizedgridfunction.hh>
|
21
|
+
#include <dune/fempy/py/ufllocalfunction.hh>
|
22
|
+
|
23
|
+
namespace UFLLocalFunctions_a8c726f728cd35d137188b33301aeef1
|
24
|
+
{
|
25
|
+
|
26
|
+
// UFLLocalFunction
|
27
|
+
// ----------------
|
28
|
+
|
29
|
+
template< class GridPart, class Coeffddm >
|
30
|
+
struct UFLLocalFunction
|
31
|
+
: public Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>>
|
32
|
+
{
|
33
|
+
typedef GridPart GridPartType;
|
34
|
+
typedef typename GridPartType::GridViewType GridView;
|
35
|
+
typedef typename GridView::ctype ctype;
|
36
|
+
typedef Dune::Fem::BindableGridFunctionWithSpace<GridPart,Dune::Dim<1>> BaseType;
|
37
|
+
typedef Dune::Fem::GridFunctionSpace<GridPartType,Dune::Dim<1>> FunctionSpaceType;
|
38
|
+
typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
|
39
|
+
typedef typename GridPartType::IntersectionType IntersectionType;
|
40
|
+
typedef typename EntityType::Geometry Geometry;
|
41
|
+
typedef typename Geometry::GlobalCoordinate GlobalCoordinateType;
|
42
|
+
typedef Dune::Fem::IntersectionSide Side;
|
43
|
+
typedef std::tuple<> ConstantTupleType;
|
44
|
+
typedef std::tuple< Dune::Fem::GridFunctionSpace< GridPartType, Dune::FieldVector< double, 1 > > > CoefficientFunctionSpaceTupleType;
|
45
|
+
typedef std::tuple< Coeffddm > CoefficientTupleType;
|
46
|
+
template< std::size_t i >
|
47
|
+
using CoefficientFunctionSpaceType = std::tuple_element_t< i, CoefficientFunctionSpaceTupleType >;
|
48
|
+
template< std::size_t i >
|
49
|
+
using CoefficientRangeType = typename CoefficientFunctionSpaceType< i >::RangeType;
|
50
|
+
template< std::size_t i >
|
51
|
+
using CoefficientJacobianRangeType = typename CoefficientFunctionSpaceType< i >::JacobianRangeType;
|
52
|
+
static constexpr bool gridPartValid = Dune::Fem::checkGridPartValid<GridPartType,Dune::Fem::ConstLocalFunction<Coeffddm>>();
|
53
|
+
template< std::size_t i >
|
54
|
+
using CoefficientType = std::tuple_element_t< i, CoefficientTupleType >;
|
55
|
+
template< std::size_t i >
|
56
|
+
using ConstantType = typename std::tuple_element_t< i, ConstantTupleType >::element_type;
|
57
|
+
using BaseType::entity;
|
58
|
+
using BaseType::geometry;
|
59
|
+
|
60
|
+
UFLLocalFunction ( const GridPartType &gridPart, const std::string &name, int order, const Coeffddm &coeffddm, const Dune::Fem::ParameterReader ¶meter = Dune::Fem::Parameter::container() )
|
61
|
+
: BaseType(gridPart,name,order),
|
62
|
+
coefficients_( Dune::Fem::ConstLocalFunction< Coeffddm >( coeffddm ) )
|
63
|
+
{}
|
64
|
+
|
65
|
+
void bind ( const IntersectionType &intersection, Side side )
|
66
|
+
{
|
67
|
+
BaseType::bind(intersection, side);
|
68
|
+
std::get< 0 >( coefficients_ ).bind( this->entity() );
|
69
|
+
}
|
70
|
+
|
71
|
+
void bind ( const EntityType &entity )
|
72
|
+
{
|
73
|
+
BaseType::bind(entity);
|
74
|
+
std::get< 0 >( coefficients_ ).bind( this->entity() );
|
75
|
+
}
|
76
|
+
|
77
|
+
void unbind ()
|
78
|
+
{
|
79
|
+
BaseType::unbind();
|
80
|
+
std::get< 0 >( coefficients_ ).unbind();
|
81
|
+
}
|
82
|
+
|
83
|
+
template< class Point >
|
84
|
+
void evaluate ( const Point &x, typename FunctionSpaceType::RangeType &result ) const
|
85
|
+
{
|
86
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp0 = jacobianCoefficient< 0 >( x );
|
87
|
+
const auto tmp1 = (tmp0[ 0 ])[ 1 ] * (tmp0[ 0 ])[ 1 ];
|
88
|
+
const auto tmp2 = (tmp0[ 0 ])[ 0 ] * (tmp0[ 0 ])[ 0 ];
|
89
|
+
const auto tmp3 = tmp2 + tmp1;
|
90
|
+
result[ 0 ] = tmp3;
|
91
|
+
}
|
92
|
+
|
93
|
+
template< class Point >
|
94
|
+
void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
|
95
|
+
{
|
96
|
+
typename CoefficientFunctionSpaceType< 0 >::HessianRangeType tmp0 = hessianCoefficient< 0 >( x );
|
97
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp1 = jacobianCoefficient< 0 >( x );
|
98
|
+
const auto tmp2 = (tmp1[ 0 ])[ 1 ] * ((tmp0[ 0 ])[ 1 ])[ 0 ];
|
99
|
+
const auto tmp3 = ((tmp0[ 0 ])[ 1 ])[ 0 ] * (tmp1[ 0 ])[ 1 ];
|
100
|
+
const auto tmp4 = tmp3 + tmp2;
|
101
|
+
const auto tmp5 = (tmp1[ 0 ])[ 0 ] * ((tmp0[ 0 ])[ 0 ])[ 0 ];
|
102
|
+
const auto tmp6 = ((tmp0[ 0 ])[ 0 ])[ 0 ] * (tmp1[ 0 ])[ 0 ];
|
103
|
+
const auto tmp7 = tmp6 + tmp5;
|
104
|
+
const auto tmp8 = tmp7 + tmp4;
|
105
|
+
const auto tmp9 = (tmp1[ 0 ])[ 1 ] * ((tmp0[ 0 ])[ 1 ])[ 1 ];
|
106
|
+
const auto tmp10 = ((tmp0[ 0 ])[ 1 ])[ 1 ] * (tmp1[ 0 ])[ 1 ];
|
107
|
+
const auto tmp11 = tmp10 + tmp9;
|
108
|
+
const auto tmp12 = (tmp1[ 0 ])[ 0 ] * ((tmp0[ 0 ])[ 0 ])[ 1 ];
|
109
|
+
const auto tmp13 = ((tmp0[ 0 ])[ 0 ])[ 1 ] * (tmp1[ 0 ])[ 0 ];
|
110
|
+
const auto tmp14 = tmp13 + tmp12;
|
111
|
+
const auto tmp15 = tmp14 + tmp11;
|
112
|
+
(result[ 0 ])[ 0 ] = tmp8;
|
113
|
+
(result[ 0 ])[ 1 ] = tmp15;
|
114
|
+
}
|
115
|
+
|
116
|
+
template< class Point >
|
117
|
+
void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
|
118
|
+
{
|
119
|
+
DUNE_THROW(Dune::NotImplemented,"hessian method could not be generated for local function (TooHighDerivative('CodeGenerator does not allow for third order derivatives, yet.'))");
|
120
|
+
result=typename FunctionSpaceType::HessianRangeType(0);
|
121
|
+
}
|
122
|
+
|
123
|
+
template< std::size_t i >
|
124
|
+
const ConstantType< i > &constant () const
|
125
|
+
{
|
126
|
+
return *std::get< i >( constants_ );
|
127
|
+
}
|
128
|
+
|
129
|
+
template< std::size_t i >
|
130
|
+
ConstantType< i > &constant ()
|
131
|
+
{
|
132
|
+
return *std::get< i >( constants_ );
|
133
|
+
}
|
134
|
+
|
135
|
+
template< std::size_t i, class Point >
|
136
|
+
typename CoefficientFunctionSpaceType< i >::RangeType evaluateCoefficient ( const Point &x ) const
|
137
|
+
{
|
138
|
+
typename CoefficientFunctionSpaceType< i >::RangeType result;
|
139
|
+
std::get< i >( coefficients_ ).evaluate( x, result );;
|
140
|
+
return result;
|
141
|
+
}
|
142
|
+
|
143
|
+
template< std::size_t i, class Point >
|
144
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType jacobianCoefficient ( const Point &x ) const
|
145
|
+
{
|
146
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType result;
|
147
|
+
std::get< i >( coefficients_ ).jacobian( x, result );;
|
148
|
+
return result;
|
149
|
+
}
|
150
|
+
|
151
|
+
template< std::size_t i, class Point >
|
152
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType hessianCoefficient ( const Point &x ) const
|
153
|
+
{
|
154
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType result;
|
155
|
+
std::get< i >( coefficients_ ).hessian( x, result );;
|
156
|
+
return result;
|
157
|
+
}
|
158
|
+
ConstantTupleType constants_;
|
159
|
+
std::tuple< Dune::Fem::ConstLocalFunction< Coeffddm > > coefficients_;
|
160
|
+
};
|
161
|
+
|
162
|
+
} // namespace UFLLocalFunctions_a8c726f728cd35d137188b33301aeef1
|
163
|
+
|
164
|
+
PYBIND11_MODULE( localfunction_a8c726f728cd35d137188b33301aeef1_a524c1196983e65de1c06d7d6afdeb44, module )
|
165
|
+
{
|
166
|
+
typedef UFLLocalFunctions_a8c726f728cd35d137188b33301aeef1::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::FemPy::VirtualizedGridFunction< 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::FieldVector< double, 1 > > > LocalFunctionType;
|
167
|
+
if constexpr( LocalFunctionType::gridPartValid )
|
168
|
+
{
|
169
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_a8c726f728cd35d137188b33301aeef1::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::FemPy::VirtualizedGridFunction< 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::FieldVector< double, 1 > > >"), Dune::Python::IncludeFiles({"python/dune/generated/localfunction_a8c726f728cd35d137188b33301aeef1_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
170
|
+
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
171
|
+
cls.def( pybind11::init( [] ( pybind11::object gridView, const std::string &name, int order, const Dune::FemPy::VirtualizedGridFunction< 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::FieldVector< double, 1 > > &coeffddm ) {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, coeffddm); } ), pybind11::keep_alive< 1, 2 >(), pybind11::keep_alive< 1, 3 >() );
|
172
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
#endif
|
@@ -0,0 +1,173 @@
|
|
1
|
+
#ifndef GUARD_a9bb07439605d560b583608f20441342
|
2
|
+
#define GUARD_a9bb07439605d560b583608f20441342
|
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_a9bb07439605d560b583608f20441342
|
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 ¶meter = 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 = -1 + tmp0[ 0 ];
|
77
|
+
const auto tmp2 = tmp1 * tmp1;
|
78
|
+
const auto tmp3 = tmp0[ 1 ] * tmp0[ 1 ];
|
79
|
+
const auto tmp4 = tmp3 + tmp2;
|
80
|
+
const auto tmp5 = 1e-10 + tmp4;
|
81
|
+
const auto tmp6 = std::sqrt( tmp5 );
|
82
|
+
const auto tmp7 = -0.5 + tmp6;
|
83
|
+
result[ 0 ] = tmp7;
|
84
|
+
}
|
85
|
+
|
86
|
+
template< class Point >
|
87
|
+
void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
|
88
|
+
{
|
89
|
+
using std::sqrt;
|
90
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
91
|
+
const auto tmp1 = -1 + tmp0[ 0 ];
|
92
|
+
const auto tmp2 = tmp1 * tmp1;
|
93
|
+
const auto tmp3 = tmp0[ 1 ] * tmp0[ 1 ];
|
94
|
+
const auto tmp4 = tmp3 + tmp2;
|
95
|
+
const auto tmp5 = 1e-10 + tmp4;
|
96
|
+
const auto tmp6 = std::sqrt( tmp5 );
|
97
|
+
const auto tmp7 = 2 * tmp6;
|
98
|
+
const auto tmp8 = tmp1 + tmp1;
|
99
|
+
const auto tmp9 = tmp8 / tmp7;
|
100
|
+
const auto tmp10 = tmp0[ 1 ] + tmp0[ 1 ];
|
101
|
+
const auto tmp11 = tmp10 / tmp7;
|
102
|
+
(result[ 0 ])[ 0 ] = tmp9;
|
103
|
+
(result[ 0 ])[ 1 ] = tmp11;
|
104
|
+
}
|
105
|
+
|
106
|
+
template< class Point >
|
107
|
+
void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
|
108
|
+
{
|
109
|
+
using std::sqrt;
|
110
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
111
|
+
const auto tmp1 = -1 + tmp0[ 0 ];
|
112
|
+
const auto tmp2 = tmp1 * tmp1;
|
113
|
+
const auto tmp3 = tmp0[ 1 ] * tmp0[ 1 ];
|
114
|
+
const auto tmp4 = tmp3 + tmp2;
|
115
|
+
const auto tmp5 = 1e-10 + tmp4;
|
116
|
+
const auto tmp6 = std::sqrt( tmp5 );
|
117
|
+
const auto tmp7 = 2 * tmp6;
|
118
|
+
const auto tmp8 = tmp1 + tmp1;
|
119
|
+
const auto tmp9 = tmp8 / tmp7;
|
120
|
+
const auto tmp10 = 2 * tmp9;
|
121
|
+
const auto tmp11 = tmp10 * tmp9;
|
122
|
+
const auto tmp12 = -1 * tmp11;
|
123
|
+
const auto tmp13 = 2 + tmp12;
|
124
|
+
const auto tmp14 = tmp13 / tmp7;
|
125
|
+
const auto tmp15 = tmp0[ 1 ] + tmp0[ 1 ];
|
126
|
+
const auto tmp16 = tmp15 / tmp7;
|
127
|
+
const auto tmp17 = 2 * tmp16;
|
128
|
+
const auto tmp18 = tmp17 * tmp9;
|
129
|
+
const auto tmp19 = -1 * tmp18;
|
130
|
+
const auto tmp20 = tmp19 / tmp7;
|
131
|
+
const auto tmp21 = tmp10 * tmp16;
|
132
|
+
const auto tmp22 = -1 * tmp21;
|
133
|
+
const auto tmp23 = tmp22 / tmp7;
|
134
|
+
const auto tmp24 = tmp17 * tmp16;
|
135
|
+
const auto tmp25 = -1 * tmp24;
|
136
|
+
const auto tmp26 = 2 + tmp25;
|
137
|
+
const auto tmp27 = tmp26 / tmp7;
|
138
|
+
((result[ 0 ])[ 0 ])[ 0 ] = tmp14;
|
139
|
+
((result[ 0 ])[ 0 ])[ 1 ] = tmp20;
|
140
|
+
((result[ 0 ])[ 1 ])[ 0 ] = tmp23;
|
141
|
+
((result[ 0 ])[ 1 ])[ 1 ] = tmp27;
|
142
|
+
}
|
143
|
+
|
144
|
+
template< std::size_t i >
|
145
|
+
const ConstantType< i > &constant () const
|
146
|
+
{
|
147
|
+
return *std::get< i >( constants_ );
|
148
|
+
}
|
149
|
+
|
150
|
+
template< std::size_t i >
|
151
|
+
ConstantType< i > &constant ()
|
152
|
+
{
|
153
|
+
return *std::get< i >( constants_ );
|
154
|
+
}
|
155
|
+
ConstantTupleType constants_;
|
156
|
+
std::tuple< > coefficients_;
|
157
|
+
};
|
158
|
+
|
159
|
+
} // namespace UFLLocalFunctions_a9bb07439605d560b583608f20441342
|
160
|
+
|
161
|
+
PYBIND11_MODULE( localfunction_a9bb07439605d560b583608f20441342_a524c1196983e65de1c06d7d6afdeb44, module )
|
162
|
+
{
|
163
|
+
typedef UFLLocalFunctions_a9bb07439605d560b583608f20441342::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;
|
164
|
+
if constexpr( LocalFunctionType::gridPartValid )
|
165
|
+
{
|
166
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_a9bb07439605d560b583608f20441342::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_a9bb07439605d560b583608f20441342_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
167
|
+
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
168
|
+
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 >() );
|
169
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
#endif
|