ddfem 1.0.3__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.3.dist-info → ddfem-1.0.6.dist-info}/METADATA +10 -1
- ddfem-1.0.6.dist-info/RECORD +103 -0
- ddfem-1.0.3.dist-info/RECORD +0 -41
- {ddfem-1.0.3.dist-info → ddfem-1.0.6.dist-info}/WHEEL +0 -0
- {ddfem-1.0.3.dist-info → ddfem-1.0.6.dist-info}/licenses/LICENSE +0 -0
- {ddfem-1.0.3.dist-info → ddfem-1.0.6.dist-info}/top_level.txt +0 -0
ddfem/__init__.py
CHANGED
@@ -3,3 +3,75 @@ from . import transformers
|
|
3
3
|
from . import boundary
|
4
4
|
from .model2ufl import model2ufl
|
5
5
|
from .plot import plotSolution
|
6
|
+
|
7
|
+
# a utility method to construct a suitable grid
|
8
|
+
def GridView(domain, omega=None, *,
|
9
|
+
filterTolerance=0,
|
10
|
+
factor=0, refinements=0,
|
11
|
+
adaptLevels=0):
|
12
|
+
import dune.ufl
|
13
|
+
from dune.fem.function import gridFunction
|
14
|
+
from dune.fem import adapt, mark, markNeighbors
|
15
|
+
from dune.fem.view import adaptiveLeafGridView, filteredGridView
|
16
|
+
from dune.grid import cartesianDomain, Marker
|
17
|
+
from dune.alugrid import aluConformGrid as GridView
|
18
|
+
import ufl
|
19
|
+
if hasattr(domain,"indexSet"):
|
20
|
+
return domain
|
21
|
+
if type(domain) == list:
|
22
|
+
domain = cartesianDomain(*domain)
|
23
|
+
gridView = adaptiveLeafGridView( GridView(domain) )
|
24
|
+
dims = (gridView.dimGrid, gridView.dimWorld)
|
25
|
+
x = ufl.SpatialCoordinate(dune.ufl.domain(dims))
|
26
|
+
|
27
|
+
if omega and factor>0 and refinements>0:
|
28
|
+
startEps = omega.epsilon.value * factor
|
29
|
+
region = gridFunction(
|
30
|
+
omega.phi(x) * (1 - omega.phi(x)), gridView=gridView
|
31
|
+
) # interface
|
32
|
+
for j in range(1, refinements + 1):
|
33
|
+
omega.epsilon.value = startEps * j / refinements
|
34
|
+
mark(region, 0.00247262315663, maxLevel=refinements) # 1 epsilon
|
35
|
+
adapt(gridView.hierarchicalGrid)
|
36
|
+
omega.epsilon.value = startEps/factor * 0.5**(refinements/dims[0])
|
37
|
+
if adaptLevels>0:
|
38
|
+
sd = gridFunction(omega(x), gridView=gridView)
|
39
|
+
bary = dims[0] * [1.0 / (dims[0]+1)]
|
40
|
+
lowerTol=-0.1
|
41
|
+
upperTol=0.1
|
42
|
+
for _ in range(adaptLevels):
|
43
|
+
def markStrategy(e):
|
44
|
+
v = sd(e, bary)
|
45
|
+
return (
|
46
|
+
Marker.refine
|
47
|
+
if v > lowerTol and v < upperTol
|
48
|
+
else Marker.keep
|
49
|
+
)
|
50
|
+
gridView.hierarchicalGrid.adapt(markStrategy)
|
51
|
+
lowerTol /= 2
|
52
|
+
upperTol /= 2
|
53
|
+
|
54
|
+
if filterTolerance<0:
|
55
|
+
return gridView
|
56
|
+
if omega and filterTolerance>0:
|
57
|
+
sd = gridFunction(omega(x), gridView=gridView)
|
58
|
+
bary = dims[0] * [1.0 / (dims[0]+1)]
|
59
|
+
filter = lambda e: 1 if sd(e, bary) < filterTolerance else 2
|
60
|
+
else:
|
61
|
+
filter = lambda e: 1
|
62
|
+
return filteredGridView(
|
63
|
+
gridView, filter, domainId=1, useFilteredIndexSet=True)
|
64
|
+
|
65
|
+
def solve(uflModel, domain):
|
66
|
+
# we use a Lagrange space
|
67
|
+
from dune.fem.space import lagrange
|
68
|
+
# and the build-in solver
|
69
|
+
from dune.fem.scheme import galerkin
|
70
|
+
|
71
|
+
gridView = GridView(domain)
|
72
|
+
space = lagrange(gridView, dimRange=1)
|
73
|
+
scheme = galerkin(uflModel, space=space,
|
74
|
+
solver=("suitesparse","umfpack"))
|
75
|
+
uh = space.interpolate(0,name="ddm")
|
76
|
+
scheme.solve(target=uh)
|
77
|
+
return uh
|
ddfem/__main__.py
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import sys, os
|
2
|
+
try:
|
3
|
+
import dune
|
4
|
+
except ImportError:
|
5
|
+
dune = None
|
6
|
+
import ddfem
|
7
|
+
|
8
|
+
def main():
|
9
|
+
if dune:
|
10
|
+
from dune.fem.utility import FemThreadPoolExecutor
|
11
|
+
from dune.generator import builder
|
12
|
+
builder.initialize()
|
13
|
+
|
14
|
+
dataPath = os.path.join(ddfem.__path__[0],"data")
|
15
|
+
with FemThreadPoolExecutor(max_workers=8) as executor:
|
16
|
+
for file in os.listdir(dataPath):
|
17
|
+
filename = os.path.join(dataPath,os.fsdecode(file))
|
18
|
+
if filename.endswith(".cc"):
|
19
|
+
with open(filename,"r") as f:
|
20
|
+
executor.submit( builder.load, file.replace(".cc",""), f.read(), None )
|
21
|
+
|
22
|
+
if __name__ == "__main__":
|
23
|
+
main()
|
24
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#ifndef Guard_adapt_010e1455a389aa01992af42c0a3f4b14
|
2
|
+
#define Guard_adapt_010e1455a389aa01992af42c0a3f4b14
|
3
|
+
|
4
|
+
#include <config.h>
|
5
|
+
|
6
|
+
#define USING_DUNE_PYTHON 1
|
7
|
+
|
8
|
+
#include <dune/alugrid/dgf.hh>
|
9
|
+
#include <dune/alugrid/grid.hh>
|
10
|
+
#include <dune/fempy/py/grid/adaptation.hh>
|
11
|
+
#include <dune/python/grid/hierarchical.hh>
|
12
|
+
|
13
|
+
#include <dune/python/common/typeregistry.hh>
|
14
|
+
#include <dune/python/pybind11/pybind11.h>
|
15
|
+
#include <dune/python/pybind11/stl.h>
|
16
|
+
|
17
|
+
PYBIND11_MODULE( adapt_010e1455a389aa01992af42c0a3f4b14, module )
|
18
|
+
{
|
19
|
+
using pybind11::operator""_a;
|
20
|
+
pybind11::module cls0 = module;
|
21
|
+
{
|
22
|
+
using DuneType = Dune::FemPy::GridAdaptation< Dune::ALUGrid< 2, 2, Dune::simplex > >;
|
23
|
+
auto cls = Dune::Python::insertClass< DuneType >( cls0, "GridAdaptation", Dune::Python::GenerateTypeName("Dune::FemPy::GridAdaptation< Dune::ALUGrid< 2, 2, Dune::simplex > >"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/fempy/py/grid/adaptation.hh","dune/python/grid/hierarchical.hh"}).first;
|
24
|
+
Dune::FemPy::registerGridAdaptation( cls0, cls );
|
25
|
+
}
|
26
|
+
}
|
27
|
+
#endif
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#ifndef Guard_femscheme_f2a3cb32a864b08c0236366e732fb908
|
2
|
+
#define Guard_femscheme_f2a3cb32a864b08c0236366e732fb908
|
3
|
+
|
4
|
+
#include <config.h>
|
5
|
+
|
6
|
+
#define USING_DUNE_PYTHON 1
|
7
|
+
|
8
|
+
#include <dune/alugrid/dgf.hh>
|
9
|
+
#include <dune/alugrid/grid.hh>
|
10
|
+
#include <dune/fem/function/adaptivefunction.hh>
|
11
|
+
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
|
12
|
+
#include <dune/fem/gridpart/filter/simple.hh>
|
13
|
+
#include <dune/fem/gridpart/filteredgridpart.hh>
|
14
|
+
#include <dune/fem/operator/linear/spoperator.hh>
|
15
|
+
#include <dune/fem/schemes/dirichletwrapper.hh>
|
16
|
+
#include <dune/fem/schemes/molgalerkin.hh>
|
17
|
+
#include <dune/fem/solver/ldlsolver.hh>
|
18
|
+
#include <dune/fem/solver/spqrsolver.hh>
|
19
|
+
#include <dune/fem/solver/umfpacksolver.hh>
|
20
|
+
#include <dune/fem/space/lagrange.hh>
|
21
|
+
#include <dune/fempy/parameter.hh>
|
22
|
+
#include <dune/fempy/py/discretefunction.hh>
|
23
|
+
#include <dune/fempy/py/gridview.hh>
|
24
|
+
#include <dune/fempy/py/scheme.hh>
|
25
|
+
#include <dune/fempy/py/space.hh>
|
26
|
+
#include <dune/python/grid/gridview.hh>
|
27
|
+
#include <dune/python/grid/hierarchical.hh>
|
28
|
+
|
29
|
+
#include <dune/python/common/typeregistry.hh>
|
30
|
+
#include <dune/python/pybind11/pybind11.h>
|
31
|
+
#include <dune/python/pybind11/stl.h>
|
32
|
+
|
33
|
+
PYBIND11_MODULE( femscheme_f2a3cb32a864b08c0236366e732fb908, module )
|
34
|
+
{
|
35
|
+
using pybind11::operator""_a;
|
36
|
+
pybind11::module cls0 = module;
|
37
|
+
{
|
38
|
+
using DuneType = Dune::Fem::GalerkinScheme< Dune::Fem::VirtualizedIntegrands< typename Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage>::GridPartType, std::tuple< Dune::FieldVector< double, 1 >, Dune::FieldMatrix< double, 1, 2 > >, std::tuple< Dune::FieldVector< double, 1 >, Dune::FieldMatrix< double, 1, 2 > > >, Dune::Fem::SparseRowLinearOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::SparseRowMatrix<double,int>>, Dune::Fem::UMFPACKInverseOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >, typename Dune::Fem::SparseRowLinearOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::SparseRowMatrix<double,int>>::MatrixType >, true >;
|
39
|
+
auto cls = Dune::Python::insertClass< DuneType >( cls0, "Scheme",pybind11::dynamic_attr(), Dune::Python::GenerateTypeName("Dune::Fem::GalerkinScheme< Dune::Fem::VirtualizedIntegrands< typename Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage>::GridPartType, std::tuple< Dune::FieldVector< double, 1 >, Dune::FieldMatrix< double, 1, 2 > >, std::tuple< Dune::FieldVector< double, 1 >, Dune::FieldMatrix< double, 1, 2 > > >, Dune::Fem::SparseRowLinearOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::SparseRowMatrix<double,int>>, Dune::Fem::UMFPACKInverseOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >, typename Dune::Fem::SparseRowLinearOperator< Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >,Dune::Fem::SparseRowMatrix<double,int>>::MatrixType >, true >"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/fem/function/adaptivefunction.hh","dune/fem/gridpart/adaptiveleafgridpart.hh","dune/fem/gridpart/filter/simple.hh","dune/fem/gridpart/filteredgridpart.hh","dune/fem/operator/linear/spoperator.hh","dune/fem/schemes/dirichletwrapper.hh","dune/fem/schemes/molgalerkin.hh","dune/fem/solver/ldlsolver.hh","dune/fem/solver/spqrsolver.hh","dune/fem/solver/umfpacksolver.hh","dune/fem/space/lagrange.hh","dune/fempy/parameter.hh","dune/fempy/py/discretefunction.hh","dune/fempy/py/gridview.hh","dune/fempy/py/scheme.hh","dune/fempy/py/space.hh","dune/python/grid/gridview.hh","dune/python/grid/hierarchical.hh"}).first;
|
40
|
+
Dune::FemPy::registerScheme( cls0, cls );
|
41
|
+
}
|
42
|
+
}
|
43
|
+
#endif
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#ifndef Guard_femspace_4ff9049b6f297245e5d33296d14cd684_d5b136dbe3c5077b69c99b8c322eb563
|
2
|
+
#define Guard_femspace_4ff9049b6f297245e5d33296d14cd684_d5b136dbe3c5077b69c99b8c322eb563
|
3
|
+
|
4
|
+
#include <config.h>
|
5
|
+
|
6
|
+
#define USING_DUNE_PYTHON 1
|
7
|
+
|
8
|
+
#define BACKENDNAME "as_numpy"
|
9
|
+
#include <dune/alugrid/dgf.hh>
|
10
|
+
#include <dune/alugrid/grid.hh>
|
11
|
+
#include <dune/fem/function/adaptivefunction.hh>
|
12
|
+
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
|
13
|
+
#include <dune/fem/gridpart/filter/simple.hh>
|
14
|
+
#include <dune/fem/gridpart/filteredgridpart.hh>
|
15
|
+
#include <dune/fem/space/lagrange.hh>
|
16
|
+
#include <dune/fempy/py/discretefunction.hh>
|
17
|
+
#include <dune/fempy/py/gridview.hh>
|
18
|
+
#include <dune/fempy/py/space.hh>
|
19
|
+
#include <dune/python/grid/gridview.hh>
|
20
|
+
#include <dune/python/grid/hierarchical.hh>
|
21
|
+
|
22
|
+
#include <dune/python/common/typeregistry.hh>
|
23
|
+
#include <dune/python/pybind11/pybind11.h>
|
24
|
+
#include <dune/python/pybind11/stl.h>
|
25
|
+
|
26
|
+
PYBIND11_MODULE( femspace_4ff9049b6f297245e5d33296d14cd684_d5b136dbe3c5077b69c99b8c322eb563, module )
|
27
|
+
{
|
28
|
+
using pybind11::operator""_a;
|
29
|
+
pybind11::module cls0 = module;
|
30
|
+
{
|
31
|
+
using DuneType = Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage>;
|
32
|
+
auto cls = Dune::Python::insertClass< DuneType, std::shared_ptr<DuneType> >( cls0, "Space",pybind11::dynamic_attr(), Dune::Python::GenerateTypeName("Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage>"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/fem/function/adaptivefunction.hh","dune/fem/gridpart/adaptiveleafgridpart.hh","dune/fem/gridpart/filter/simple.hh","dune/fem/gridpart/filteredgridpart.hh","dune/fem/space/lagrange.hh","dune/fempy/py/discretefunction.hh","dune/fempy/py/gridview.hh","dune/fempy/py/space.hh","dune/python/grid/gridview.hh","dune/python/grid/hierarchical.hh"}).first;
|
33
|
+
Dune::FemPy::registerSpace( cls0, cls );
|
34
|
+
}
|
35
|
+
using pybind11::operator""_a;
|
36
|
+
{
|
37
|
+
using DuneType = Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >;
|
38
|
+
auto cls = Dune::Python::insertClass< DuneType >( cls0, "DiscreteFunction",pybind11::buffer_protocol(),pybind11::dynamic_attr(), Dune::Python::GenerateTypeName("Dune::Fem::AdaptiveDiscreteFunction< Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage> >"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/fem/function/adaptivefunction.hh","dune/fem/gridpart/adaptiveleafgridpart.hh","dune/fem/gridpart/filter/simple.hh","dune/fem/gridpart/filteredgridpart.hh","dune/fem/space/lagrange.hh","dune/fempy/py/discretefunction.hh","dune/fempy/py/gridview.hh","dune/fempy/py/space.hh","dune/python/grid/gridview.hh","dune/python/grid/hierarchical.hh"}).first;
|
39
|
+
Dune::FemPy::registerDiscreteFunction( cls0, cls );
|
40
|
+
cls.def( pybind11::init( [] ( const std::string &name, const Dune::Fem::DynamicLagrangeDiscreteFunctionSpace< Dune::Fem::FunctionSpace< double, double, 2, 1 >, 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::Fem::CodegenStorage>&space, pybind11::array_t<double> dofVector ) {double *dof = static_cast< double* >( dofVector.request(false).ptr );
|
41
|
+
return new DuneType(name,space,dof);
|
42
|
+
} ), "name"_a, "space"_a, "dofVector"_a, pybind11::keep_alive< 1, 3 >(), pybind11::keep_alive< 1, 4 >() );
|
43
|
+
}
|
44
|
+
}
|
45
|
+
#endif
|
ddfem/data/generate.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Step 1: in the doc folder run
|
2
|
+
# make clean
|
3
|
+
# DUNE_LOGMODULES=8 make -ij8
|
4
|
+
# Step 2: in this folder run
|
5
|
+
# python generate.py
|
6
|
+
|
7
|
+
import os, shutil
|
8
|
+
from dune.common.module import getDunePyDir
|
9
|
+
def main():
|
10
|
+
dunepy = getDunePyDir()
|
11
|
+
docPath = os.path.join("..","..","doc")
|
12
|
+
names = set()
|
13
|
+
for file in os.listdir(docPath):
|
14
|
+
filename = os.path.join(docPath,os.fsdecode(file))
|
15
|
+
if filename.endswith(".modules"):
|
16
|
+
with open(filename,"r") as f:
|
17
|
+
names.update(f.readlines())
|
18
|
+
for name in names:
|
19
|
+
name = name.strip()
|
20
|
+
print(name)
|
21
|
+
src = os.path.join(dunepy,"python","dune","generated",name+".cc")
|
22
|
+
try:
|
23
|
+
shutil.copy(src, ".")
|
24
|
+
except FileNotFoundError:
|
25
|
+
print(f"Error: can't copy {src}",flush=True)
|
26
|
+
pass
|
27
|
+
|
28
|
+
if __name__ == "__main__":
|
29
|
+
main()
|
30
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#ifndef Guard_hierarchicalgrid_d827e80243feae36e8b9006bb24207e7
|
2
|
+
#define Guard_hierarchicalgrid_d827e80243feae36e8b9006bb24207e7
|
3
|
+
|
4
|
+
#include <config.h>
|
5
|
+
|
6
|
+
#define USING_DUNE_PYTHON 1
|
7
|
+
|
8
|
+
#include <dune/alugrid/dgf.hh>
|
9
|
+
#include <dune/alugrid/grid.hh>
|
10
|
+
#include <dune/python/grid/hierarchical.hh>
|
11
|
+
|
12
|
+
#include <dune/python/common/typeregistry.hh>
|
13
|
+
#include <dune/python/pybind11/pybind11.h>
|
14
|
+
#include <dune/python/pybind11/stl.h>
|
15
|
+
|
16
|
+
PYBIND11_MODULE( hierarchicalgrid_d827e80243feae36e8b9006bb24207e7, module )
|
17
|
+
{
|
18
|
+
using pybind11::operator""_a;
|
19
|
+
pybind11::module cls0 = module;
|
20
|
+
{
|
21
|
+
using DuneType = Dune::ALUGrid< 2, 2, Dune::simplex >;
|
22
|
+
auto cls = Dune::Python::insertClass< DuneType, std::shared_ptr<DuneType> >( cls0, "HierarchicalGrid",pybind11::dynamic_attr(), Dune::Python::GenerateTypeName("Dune::ALUGrid< 2, 2, Dune::simplex >"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/python/grid/hierarchical.hh"}).first;
|
23
|
+
Dune::Python::registerHierarchicalGrid( cls0, cls );
|
24
|
+
}
|
25
|
+
}
|
26
|
+
#endif
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#ifndef Guard_indexset_e9c0cdc96a4fc702a0969c29910954e6
|
2
|
+
#define Guard_indexset_e9c0cdc96a4fc702a0969c29910954e6
|
3
|
+
|
4
|
+
#include <config.h>
|
5
|
+
|
6
|
+
#define USING_DUNE_PYTHON 1
|
7
|
+
|
8
|
+
#include <dune/alugrid/dgf.hh>
|
9
|
+
#include <dune/alugrid/grid.hh>
|
10
|
+
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
|
11
|
+
#include <dune/fem/gridpart/filter/simple.hh>
|
12
|
+
#include <dune/fem/gridpart/filteredgridpart.hh>
|
13
|
+
#include <dune/fempy/py/gridview.hh>
|
14
|
+
#include <dune/python/grid/gridview.hh>
|
15
|
+
#include <dune/python/grid/hierarchical.hh>
|
16
|
+
#include <dune/python/grid/indexset.hh>
|
17
|
+
|
18
|
+
#include <dune/python/common/typeregistry.hh>
|
19
|
+
#include <dune/python/pybind11/pybind11.h>
|
20
|
+
#include <dune/python/pybind11/stl.h>
|
21
|
+
|
22
|
+
PYBIND11_MODULE( indexset_e9c0cdc96a4fc702a0969c29910954e6, module )
|
23
|
+
{
|
24
|
+
using pybind11::operator""_a;
|
25
|
+
pybind11::module cls0 = module;
|
26
|
+
{
|
27
|
+
using DuneType = 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 >::IndexSet;
|
28
|
+
auto cls = Dune::Python::insertClass< DuneType >( cls0, "GridViewIndexSet", Dune::Python::GenerateTypeName("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 >::IndexSet"), Dune::Python::IncludeFiles{"dune/alugrid/dgf.hh","dune/alugrid/grid.hh","dune/fem/gridpart/adaptiveleafgridpart.hh","dune/fem/gridpart/filter/simple.hh","dune/fem/gridpart/filteredgridpart.hh","dune/fempy/py/gridview.hh","dune/python/grid/gridview.hh","dune/python/grid/hierarchical.hh","dune/python/grid/indexset.hh"}).first;
|
29
|
+
Dune::Python::registerGridViewIndexSet( cls0, cls );
|
30
|
+
}
|
31
|
+
}
|
32
|
+
#endif
|