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,135 @@
|
|
1
|
+
#ifndef GUARD_10ad0a2d88c74db5f4bf5f81e138974f
|
2
|
+
#define GUARD_10ad0a2d88c74db5f4bf5f81e138974f
|
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_10ad0a2d88c74db5f4bf5f81e138974f
|
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 Conc4;
|
43
|
+
typedef std::tuple< std::shared_ptr< Conc4 > > 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 ¶meter = Dune::Fem::Parameter::container() )
|
56
|
+
: BaseType(gridPart,name,order)
|
57
|
+
{
|
58
|
+
std::get< 0 >( constants_ ) = std::make_shared< Conc4 >( (Conc4(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 Conc4 &conc4 () const
|
108
|
+
{
|
109
|
+
return *std::get< 0 >( constants_ );
|
110
|
+
}
|
111
|
+
|
112
|
+
Conc4 &conc4 ()
|
113
|
+
{
|
114
|
+
return *std::get< 0 >( constants_ );
|
115
|
+
}
|
116
|
+
ConstantTupleType constants_;
|
117
|
+
std::tuple< > coefficients_;
|
118
|
+
};
|
119
|
+
|
120
|
+
} // namespace UFLLocalFunctions_10ad0a2d88c74db5f4bf5f81e138974f
|
121
|
+
|
122
|
+
PYBIND11_MODULE( localfunction_10ad0a2d88c74db5f4bf5f81e138974f_a524c1196983e65de1c06d7d6afdeb44, module )
|
123
|
+
{
|
124
|
+
typedef UFLLocalFunctions_10ad0a2d88c74db5f4bf5f81e138974f::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_10ad0a2d88c74db5f4bf5f81e138974f::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_10ad0a2d88c74db5f4bf5f81e138974f_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( "c4", [] ( LocalFunctionType &self ) -> UFLLocalFunctions_10ad0a2d88c74db5f4bf5f81e138974f::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 > > >::Conc4 { return self.conc4(); }, [] ( LocalFunctionType &self, const UFLLocalFunctions_10ad0a2d88c74db5f4bf5f81e138974f::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 > > >::Conc4 &v ) { self.conc4() = v; } );
|
131
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
#endif
|
@@ -0,0 +1,192 @@
|
|
1
|
+
#ifndef GUARD_191355e6250b2d2e260d96f519ad9976
|
2
|
+
#define GUARD_191355e6250b2d2e260d96f519ad9976
|
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_191355e6250b2d2e260d96f519ad9976
|
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
|
+
using std::sqrt;
|
87
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
88
|
+
const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
|
89
|
+
const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
|
90
|
+
const auto tmp3 = tmp2 + tmp1;
|
91
|
+
const auto tmp4 = 1e-10 + tmp3;
|
92
|
+
const auto tmp5 = std::sqrt( tmp4 );
|
93
|
+
const auto tmp6 = -1 + tmp5;
|
94
|
+
typename CoefficientFunctionSpaceType< 0 >::RangeType tmp7 = evaluateCoefficient< 0 >( x );
|
95
|
+
const auto tmp8 = tmp7[ 0 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
96
|
+
result[ 0 ] = tmp8;
|
97
|
+
}
|
98
|
+
|
99
|
+
template< class Point >
|
100
|
+
void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
|
101
|
+
{
|
102
|
+
using std::sqrt;
|
103
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
104
|
+
const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
|
105
|
+
const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
|
106
|
+
const auto tmp3 = tmp2 + tmp1;
|
107
|
+
const auto tmp4 = 1e-10 + tmp3;
|
108
|
+
const auto tmp5 = std::sqrt( tmp4 );
|
109
|
+
const auto tmp6 = -1 + tmp5;
|
110
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp7 = jacobianCoefficient< 0 >( x );
|
111
|
+
const auto tmp8 = (tmp7[ 0 ])[ 0 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
112
|
+
const auto tmp9 = (tmp7[ 0 ])[ 1 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
113
|
+
(result[ 0 ])[ 0 ] = tmp8;
|
114
|
+
(result[ 0 ])[ 1 ] = tmp9;
|
115
|
+
}
|
116
|
+
|
117
|
+
template< class Point >
|
118
|
+
void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
|
119
|
+
{
|
120
|
+
using std::sqrt;
|
121
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
122
|
+
const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
|
123
|
+
const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
|
124
|
+
const auto tmp3 = tmp2 + tmp1;
|
125
|
+
const auto tmp4 = 1e-10 + tmp3;
|
126
|
+
const auto tmp5 = std::sqrt( tmp4 );
|
127
|
+
const auto tmp6 = -1 + tmp5;
|
128
|
+
typename CoefficientFunctionSpaceType< 0 >::HessianRangeType tmp7 = hessianCoefficient< 0 >( x );
|
129
|
+
const auto tmp8 = ((tmp7[ 0 ])[ 0 ])[ 0 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
130
|
+
const auto tmp9 = ((tmp7[ 0 ])[ 0 ])[ 1 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
131
|
+
const auto tmp10 = ((tmp7[ 0 ])[ 1 ])[ 0 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
132
|
+
const auto tmp11 = ((tmp7[ 0 ])[ 1 ])[ 1 ] * (tmp6 <= 0.0 ? 1 : 0.0);
|
133
|
+
((result[ 0 ])[ 0 ])[ 0 ] = tmp8;
|
134
|
+
((result[ 0 ])[ 0 ])[ 1 ] = tmp9;
|
135
|
+
((result[ 0 ])[ 1 ])[ 0 ] = tmp10;
|
136
|
+
((result[ 0 ])[ 1 ])[ 1 ] = tmp11;
|
137
|
+
}
|
138
|
+
|
139
|
+
template< std::size_t i >
|
140
|
+
const ConstantType< i > &constant () const
|
141
|
+
{
|
142
|
+
return *std::get< i >( constants_ );
|
143
|
+
}
|
144
|
+
|
145
|
+
template< std::size_t i >
|
146
|
+
ConstantType< i > &constant ()
|
147
|
+
{
|
148
|
+
return *std::get< i >( constants_ );
|
149
|
+
}
|
150
|
+
|
151
|
+
template< std::size_t i, class Point >
|
152
|
+
typename CoefficientFunctionSpaceType< i >::RangeType evaluateCoefficient ( const Point &x ) const
|
153
|
+
{
|
154
|
+
typename CoefficientFunctionSpaceType< i >::RangeType result;
|
155
|
+
std::get< i >( coefficients_ ).evaluate( x, result );;
|
156
|
+
return result;
|
157
|
+
}
|
158
|
+
|
159
|
+
template< std::size_t i, class Point >
|
160
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType jacobianCoefficient ( const Point &x ) const
|
161
|
+
{
|
162
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType result;
|
163
|
+
std::get< i >( coefficients_ ).jacobian( x, result );;
|
164
|
+
return result;
|
165
|
+
}
|
166
|
+
|
167
|
+
template< std::size_t i, class Point >
|
168
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType hessianCoefficient ( const Point &x ) const
|
169
|
+
{
|
170
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType result;
|
171
|
+
std::get< i >( coefficients_ ).hessian( x, result );;
|
172
|
+
return result;
|
173
|
+
}
|
174
|
+
ConstantTupleType constants_;
|
175
|
+
std::tuple< Dune::Fem::ConstLocalFunction< Coeffddm > > coefficients_;
|
176
|
+
};
|
177
|
+
|
178
|
+
} // namespace UFLLocalFunctions_191355e6250b2d2e260d96f519ad9976
|
179
|
+
|
180
|
+
PYBIND11_MODULE( localfunction_191355e6250b2d2e260d96f519ad9976_a524c1196983e65de1c06d7d6afdeb44, module )
|
181
|
+
{
|
182
|
+
typedef UFLLocalFunctions_191355e6250b2d2e260d96f519ad9976::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;
|
183
|
+
if constexpr( LocalFunctionType::gridPartValid )
|
184
|
+
{
|
185
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_191355e6250b2d2e260d96f519ad9976::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_191355e6250b2d2e260d96f519ad9976_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
186
|
+
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
187
|
+
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 >() );
|
188
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
#endif
|
@@ -0,0 +1,263 @@
|
|
1
|
+
#ifndef GUARD_1d13146d4bff10e178aba773fe2a9f1d
|
2
|
+
#define GUARD_1d13146d4bff10e178aba773fe2a9f1d
|
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_1d13146d4bff10e178aba773fe2a9f1d
|
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
|
+
using std::max;
|
87
|
+
using std::min;
|
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 = -1.4 + tmp5;
|
96
|
+
const auto tmp7 = 1 + tmp0[ 0 ];
|
97
|
+
const auto tmp8 = tmp7 * tmp7;
|
98
|
+
const auto tmp9 = tmp1 + tmp8;
|
99
|
+
const auto tmp10 = 1e-10 + tmp9;
|
100
|
+
const auto tmp11 = std::sqrt( tmp10 );
|
101
|
+
const auto tmp12 = -0.5 + tmp11;
|
102
|
+
const auto tmp13 = -1 + tmp0[ 0 ];
|
103
|
+
const auto tmp14 = tmp13 * tmp13;
|
104
|
+
const auto tmp15 = tmp1 + tmp14;
|
105
|
+
const auto tmp16 = 1e-10 + tmp15;
|
106
|
+
const auto tmp17 = std::sqrt( tmp16 );
|
107
|
+
const auto tmp18 = -0.5 + tmp17;
|
108
|
+
const auto tmp19 = 0.8 + tmp0[ 1 ];
|
109
|
+
const auto tmp20 = tmp19 * tmp19;
|
110
|
+
const auto tmp21 = tmp2 + tmp20;
|
111
|
+
const auto tmp22 = 1e-10 + tmp21;
|
112
|
+
const auto tmp23 = std::sqrt( tmp22 );
|
113
|
+
const auto tmp24 = -0.5 + tmp23;
|
114
|
+
const auto tmp25 = -1 * tmp24;
|
115
|
+
const auto tmp26 = -0.8 + tmp0[ 1 ];
|
116
|
+
const auto tmp27 = tmp26 * tmp26;
|
117
|
+
const auto tmp28 = tmp2 + tmp27;
|
118
|
+
const auto tmp29 = 1e-10 + tmp28;
|
119
|
+
const auto tmp30 = std::sqrt( tmp29 );
|
120
|
+
const auto tmp31 = -0.5 + tmp30;
|
121
|
+
const auto tmp32 = -1 * tmp31;
|
122
|
+
const auto tmp33 = -1 + tmp5;
|
123
|
+
const auto tmp34 = std::max( tmp33, tmp32 );
|
124
|
+
const auto tmp35 = std::max( tmp34, tmp25 );
|
125
|
+
const auto tmp36 = std::min( tmp35, tmp18 );
|
126
|
+
const auto tmp37 = std::min( tmp36, tmp12 );
|
127
|
+
const auto tmp38 = std::max( tmp37, tmp6 );
|
128
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp39 = jacobianCoefficient< 0 >( x );
|
129
|
+
const auto tmp40 = (tmp39[ 0 ])[ 1 ] * (tmp39[ 0 ])[ 1 ];
|
130
|
+
const auto tmp41 = (tmp39[ 0 ])[ 0 ] * (tmp39[ 0 ])[ 0 ];
|
131
|
+
const auto tmp42 = tmp41 + tmp40;
|
132
|
+
const auto tmp43 = tmp42 * (tmp38 <= 0.0 ? 1 : 0.0);
|
133
|
+
result[ 0 ] = tmp43;
|
134
|
+
}
|
135
|
+
|
136
|
+
template< class Point >
|
137
|
+
void jacobian ( const Point &x, typename FunctionSpaceType::JacobianRangeType &result ) const
|
138
|
+
{
|
139
|
+
using std::max;
|
140
|
+
using std::min;
|
141
|
+
using std::sqrt;
|
142
|
+
GlobalCoordinateType tmp0 = geometry().global( Dune::Fem::coordinate( x ) );
|
143
|
+
const auto tmp1 = tmp0[ 1 ] * tmp0[ 1 ];
|
144
|
+
const auto tmp2 = tmp0[ 0 ] * tmp0[ 0 ];
|
145
|
+
const auto tmp3 = tmp2 + tmp1;
|
146
|
+
const auto tmp4 = 1e-10 + tmp3;
|
147
|
+
const auto tmp5 = std::sqrt( tmp4 );
|
148
|
+
const auto tmp6 = -1.4 + tmp5;
|
149
|
+
const auto tmp7 = 1 + tmp0[ 0 ];
|
150
|
+
const auto tmp8 = tmp7 * tmp7;
|
151
|
+
const auto tmp9 = tmp1 + tmp8;
|
152
|
+
const auto tmp10 = 1e-10 + tmp9;
|
153
|
+
const auto tmp11 = std::sqrt( tmp10 );
|
154
|
+
const auto tmp12 = -0.5 + tmp11;
|
155
|
+
const auto tmp13 = -1 + tmp0[ 0 ];
|
156
|
+
const auto tmp14 = tmp13 * tmp13;
|
157
|
+
const auto tmp15 = tmp1 + tmp14;
|
158
|
+
const auto tmp16 = 1e-10 + tmp15;
|
159
|
+
const auto tmp17 = std::sqrt( tmp16 );
|
160
|
+
const auto tmp18 = -0.5 + tmp17;
|
161
|
+
const auto tmp19 = 0.8 + tmp0[ 1 ];
|
162
|
+
const auto tmp20 = tmp19 * tmp19;
|
163
|
+
const auto tmp21 = tmp2 + tmp20;
|
164
|
+
const auto tmp22 = 1e-10 + tmp21;
|
165
|
+
const auto tmp23 = std::sqrt( tmp22 );
|
166
|
+
const auto tmp24 = -0.5 + tmp23;
|
167
|
+
const auto tmp25 = -1 * tmp24;
|
168
|
+
const auto tmp26 = -0.8 + tmp0[ 1 ];
|
169
|
+
const auto tmp27 = tmp26 * tmp26;
|
170
|
+
const auto tmp28 = tmp2 + tmp27;
|
171
|
+
const auto tmp29 = 1e-10 + tmp28;
|
172
|
+
const auto tmp30 = std::sqrt( tmp29 );
|
173
|
+
const auto tmp31 = -0.5 + tmp30;
|
174
|
+
const auto tmp32 = -1 * tmp31;
|
175
|
+
const auto tmp33 = -1 + tmp5;
|
176
|
+
const auto tmp34 = std::max( tmp33, tmp32 );
|
177
|
+
const auto tmp35 = std::max( tmp34, tmp25 );
|
178
|
+
const auto tmp36 = std::min( tmp35, tmp18 );
|
179
|
+
const auto tmp37 = std::min( tmp36, tmp12 );
|
180
|
+
const auto tmp38 = std::max( tmp37, tmp6 );
|
181
|
+
typename CoefficientFunctionSpaceType< 0 >::HessianRangeType tmp39 = hessianCoefficient< 0 >( x );
|
182
|
+
typename CoefficientFunctionSpaceType< 0 >::JacobianRangeType tmp40 = jacobianCoefficient< 0 >( x );
|
183
|
+
const auto tmp41 = (tmp40[ 0 ])[ 1 ] * ((tmp39[ 0 ])[ 1 ])[ 0 ];
|
184
|
+
const auto tmp42 = ((tmp39[ 0 ])[ 1 ])[ 0 ] * (tmp40[ 0 ])[ 1 ];
|
185
|
+
const auto tmp43 = tmp42 + tmp41;
|
186
|
+
const auto tmp44 = (tmp40[ 0 ])[ 0 ] * ((tmp39[ 0 ])[ 0 ])[ 0 ];
|
187
|
+
const auto tmp45 = ((tmp39[ 0 ])[ 0 ])[ 0 ] * (tmp40[ 0 ])[ 0 ];
|
188
|
+
const auto tmp46 = tmp45 + tmp44;
|
189
|
+
const auto tmp47 = tmp46 + tmp43;
|
190
|
+
const auto tmp48 = tmp47 * (tmp38 <= 0.0 ? 1 : 0.0);
|
191
|
+
const auto tmp49 = (tmp40[ 0 ])[ 1 ] * ((tmp39[ 0 ])[ 1 ])[ 1 ];
|
192
|
+
const auto tmp50 = ((tmp39[ 0 ])[ 1 ])[ 1 ] * (tmp40[ 0 ])[ 1 ];
|
193
|
+
const auto tmp51 = tmp50 + tmp49;
|
194
|
+
const auto tmp52 = (tmp40[ 0 ])[ 0 ] * ((tmp39[ 0 ])[ 0 ])[ 1 ];
|
195
|
+
const auto tmp53 = ((tmp39[ 0 ])[ 0 ])[ 1 ] * (tmp40[ 0 ])[ 0 ];
|
196
|
+
const auto tmp54 = tmp53 + tmp52;
|
197
|
+
const auto tmp55 = tmp54 + tmp51;
|
198
|
+
const auto tmp56 = tmp55 * (tmp38 <= 0.0 ? 1 : 0.0);
|
199
|
+
(result[ 0 ])[ 0 ] = tmp48;
|
200
|
+
(result[ 0 ])[ 1 ] = tmp56;
|
201
|
+
}
|
202
|
+
|
203
|
+
template< class Point >
|
204
|
+
void hessian ( const Point &x, typename FunctionSpaceType::HessianRangeType &result ) const
|
205
|
+
{
|
206
|
+
DUNE_THROW(Dune::NotImplemented,"hessian method could not be generated for local function (TooHighDerivative('CodeGenerator does not allow for third order derivatives, yet.'))");
|
207
|
+
result=typename FunctionSpaceType::HessianRangeType(0);
|
208
|
+
}
|
209
|
+
|
210
|
+
template< std::size_t i >
|
211
|
+
const ConstantType< i > &constant () const
|
212
|
+
{
|
213
|
+
return *std::get< i >( constants_ );
|
214
|
+
}
|
215
|
+
|
216
|
+
template< std::size_t i >
|
217
|
+
ConstantType< i > &constant ()
|
218
|
+
{
|
219
|
+
return *std::get< i >( constants_ );
|
220
|
+
}
|
221
|
+
|
222
|
+
template< std::size_t i, class Point >
|
223
|
+
typename CoefficientFunctionSpaceType< i >::RangeType evaluateCoefficient ( const Point &x ) const
|
224
|
+
{
|
225
|
+
typename CoefficientFunctionSpaceType< i >::RangeType result;
|
226
|
+
std::get< i >( coefficients_ ).evaluate( x, result );;
|
227
|
+
return result;
|
228
|
+
}
|
229
|
+
|
230
|
+
template< std::size_t i, class Point >
|
231
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType jacobianCoefficient ( const Point &x ) const
|
232
|
+
{
|
233
|
+
typename CoefficientFunctionSpaceType< i >::JacobianRangeType result;
|
234
|
+
std::get< i >( coefficients_ ).jacobian( x, result );;
|
235
|
+
return result;
|
236
|
+
}
|
237
|
+
|
238
|
+
template< std::size_t i, class Point >
|
239
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType hessianCoefficient ( const Point &x ) const
|
240
|
+
{
|
241
|
+
typename CoefficientFunctionSpaceType< i >::HessianRangeType result;
|
242
|
+
std::get< i >( coefficients_ ).hessian( x, result );;
|
243
|
+
return result;
|
244
|
+
}
|
245
|
+
ConstantTupleType constants_;
|
246
|
+
std::tuple< Dune::Fem::ConstLocalFunction< Coeffddm > > coefficients_;
|
247
|
+
};
|
248
|
+
|
249
|
+
} // namespace UFLLocalFunctions_1d13146d4bff10e178aba773fe2a9f1d
|
250
|
+
|
251
|
+
PYBIND11_MODULE( localfunction_1d13146d4bff10e178aba773fe2a9f1d_a524c1196983e65de1c06d7d6afdeb44, module )
|
252
|
+
{
|
253
|
+
typedef UFLLocalFunctions_1d13146d4bff10e178aba773fe2a9f1d::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;
|
254
|
+
if constexpr( LocalFunctionType::gridPartValid )
|
255
|
+
{
|
256
|
+
auto cls = Dune::Python::insertClass<LocalFunctionType>(module,"UFLLocalFunction",Dune::Python::GenerateTypeName("UFLLocalFunctions_1d13146d4bff10e178aba773fe2a9f1d::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_1d13146d4bff10e178aba773fe2a9f1d_a524c1196983e65de1c06d7d6afdeb44.cc"})).first;
|
257
|
+
Dune::FemPy::registerUFLLocalFunction( module, cls );
|
258
|
+
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 >() );
|
259
|
+
cls.def_property_readonly( "virtualized", [] ( LocalFunctionType& ) -> bool { return true;});
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
263
|
+
#endif
|