ngsolve 6.2.2506.post74.dev0__cp314-cp314-macosx_10_15_universal2.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.
Potentially problematic release.
This version of ngsolve might be problematic. Click here for more details.
- netgen/include/analytic_integrals.hpp +10 -0
- netgen/include/arnoldi.hpp +55 -0
- netgen/include/bandmatrix.hpp +334 -0
- netgen/include/basematrix.hpp +957 -0
- netgen/include/basevector.hpp +1268 -0
- netgen/include/bdbequations.hpp +2805 -0
- netgen/include/bdbintegrator.hpp +1660 -0
- netgen/include/bem_diffops.hpp +475 -0
- netgen/include/bessel.hpp +1064 -0
- netgen/include/bilinearform.hpp +963 -0
- netgen/include/bla.hpp +29 -0
- netgen/include/blockalloc.hpp +95 -0
- netgen/include/blockjacobi.hpp +328 -0
- netgen/include/bspline.hpp +116 -0
- netgen/include/calcinverse.hpp +141 -0
- netgen/include/cg.hpp +368 -0
- netgen/include/chebyshev.hpp +44 -0
- netgen/include/cholesky.hpp +720 -0
- netgen/include/clapack.h +7254 -0
- netgen/include/code_generation.hpp +296 -0
- netgen/include/coefficient.hpp +2033 -0
- netgen/include/coefficient_impl.hpp +19 -0
- netgen/include/coefficient_stdmath.hpp +167 -0
- netgen/include/commutingAMG.hpp +106 -0
- netgen/include/comp.hpp +79 -0
- netgen/include/compatibility.hpp +41 -0
- netgen/include/complex_wrapper.hpp +73 -0
- netgen/include/compressedfespace.hpp +110 -0
- netgen/include/contact.hpp +235 -0
- netgen/include/diagonalmatrix.hpp +154 -0
- netgen/include/differentialoperator.hpp +276 -0
- netgen/include/diffop.hpp +1286 -0
- netgen/include/diffop_impl.hpp +328 -0
- netgen/include/diffopwithfactor.hpp +123 -0
- netgen/include/discontinuous.hpp +84 -0
- netgen/include/dump.hpp +949 -0
- netgen/include/ectypes.hpp +121 -0
- netgen/include/eigen.hpp +60 -0
- netgen/include/eigensystem.hpp +18 -0
- netgen/include/elasticity_equations.hpp +595 -0
- netgen/include/elementbyelement.hpp +195 -0
- netgen/include/elementtopology.hpp +1760 -0
- netgen/include/elementtransformation.hpp +339 -0
- netgen/include/evalfunc.hpp +405 -0
- netgen/include/expr.hpp +1686 -0
- netgen/include/facetfe.hpp +175 -0
- netgen/include/facetfespace.hpp +180 -0
- netgen/include/facethofe.hpp +111 -0
- netgen/include/facetsurffespace.hpp +112 -0
- netgen/include/fe_interfaces.hpp +32 -0
- netgen/include/fem.hpp +87 -0
- netgen/include/fesconvert.hpp +14 -0
- netgen/include/fespace.hpp +1449 -0
- netgen/include/finiteelement.hpp +286 -0
- netgen/include/globalinterfacespace.hpp +77 -0
- netgen/include/globalspace.hpp +115 -0
- netgen/include/gridfunction.hpp +525 -0
- netgen/include/h1amg.hpp +124 -0
- netgen/include/h1hofe.hpp +188 -0
- netgen/include/h1hofe_impl.hpp +1262 -0
- netgen/include/h1hofefo.hpp +148 -0
- netgen/include/h1hofefo_impl.hpp +185 -0
- netgen/include/h1hofespace.hpp +167 -0
- netgen/include/h1lofe.hpp +1240 -0
- netgen/include/h1lumping.hpp +41 -0
- netgen/include/hcurl_equations.hpp +1381 -0
- netgen/include/hcurlcurlfe.hpp +2241 -0
- netgen/include/hcurlcurlfespace.hpp +78 -0
- netgen/include/hcurlfe.hpp +259 -0
- netgen/include/hcurlfe_utils.hpp +107 -0
- netgen/include/hcurlhdiv_dshape.hpp +857 -0
- netgen/include/hcurlhdivfes.hpp +308 -0
- netgen/include/hcurlhofe.hpp +175 -0
- netgen/include/hcurlhofe_impl.hpp +1871 -0
- netgen/include/hcurlhofespace.hpp +193 -0
- netgen/include/hcurllofe.hpp +1146 -0
- netgen/include/hdiv_equations.hpp +880 -0
- netgen/include/hdivdivfe.hpp +2923 -0
- netgen/include/hdivdivsurfacespace.hpp +76 -0
- netgen/include/hdivfe.hpp +206 -0
- netgen/include/hdivfe_utils.hpp +717 -0
- netgen/include/hdivfes.hpp +75 -0
- netgen/include/hdivhofe.hpp +447 -0
- netgen/include/hdivhofe_impl.hpp +1107 -0
- netgen/include/hdivhofefo.hpp +229 -0
- netgen/include/hdivhofespace.hpp +177 -0
- netgen/include/hdivhosurfacefespace.hpp +106 -0
- netgen/include/hdivlofe.hpp +773 -0
- netgen/include/hidden.hpp +74 -0
- netgen/include/householder.hpp +181 -0
- netgen/include/hypre_ams_precond.hpp +123 -0
- netgen/include/hypre_precond.hpp +73 -0
- netgen/include/integrator.hpp +2012 -0
- netgen/include/integratorcf.hpp +253 -0
- netgen/include/interpolate.hpp +49 -0
- netgen/include/intrule.hpp +2542 -0
- netgen/include/intrules_SauterSchwab.hpp +25 -0
- netgen/include/irspace.hpp +49 -0
- netgen/include/jacobi.hpp +153 -0
- netgen/include/kernels.hpp +762 -0
- netgen/include/l2hofe.hpp +194 -0
- netgen/include/l2hofe_impl.hpp +564 -0
- netgen/include/l2hofefo.hpp +542 -0
- netgen/include/l2hofespace.hpp +344 -0
- netgen/include/la.hpp +38 -0
- netgen/include/linearform.hpp +266 -0
- netgen/include/matrix.hpp +2140 -0
- netgen/include/memusage.hpp +41 -0
- netgen/include/meshaccess.hpp +1359 -0
- netgen/include/mgpre.hpp +204 -0
- netgen/include/mp_coefficient.hpp +145 -0
- netgen/include/mptools.hpp +2281 -0
- netgen/include/multigrid.hpp +42 -0
- netgen/include/multivector.hpp +447 -0
- netgen/include/mumpsinverse.hpp +187 -0
- netgen/include/mycomplex.hpp +361 -0
- netgen/include/ng_lapack.hpp +1661 -0
- netgen/include/ngblas.hpp +1232 -0
- netgen/include/ngs_defines.hpp +30 -0
- netgen/include/ngs_stdcpp_include.hpp +106 -0
- netgen/include/ngs_utils.hpp +121 -0
- netgen/include/ngsobject.hpp +1019 -0
- netgen/include/ngsstream.hpp +113 -0
- netgen/include/ngstd.hpp +72 -0
- netgen/include/nodalhofe.hpp +96 -0
- netgen/include/nodalhofe_impl.hpp +141 -0
- netgen/include/normalfacetfe.hpp +223 -0
- netgen/include/normalfacetfespace.hpp +98 -0
- netgen/include/normalfacetsurfacefespace.hpp +84 -0
- netgen/include/order.hpp +251 -0
- netgen/include/parallel_matrices.hpp +222 -0
- netgen/include/paralleldofs.hpp +340 -0
- netgen/include/parallelngs.hpp +23 -0
- netgen/include/parallelvector.hpp +269 -0
- netgen/include/pardisoinverse.hpp +200 -0
- netgen/include/periodic.hpp +129 -0
- netgen/include/plateaufespace.hpp +25 -0
- netgen/include/pml.hpp +275 -0
- netgen/include/pmltrafo.hpp +631 -0
- netgen/include/postproc.hpp +142 -0
- netgen/include/potentialtools.hpp +22 -0
- netgen/include/precomp.hpp +60 -0
- netgen/include/preconditioner.hpp +602 -0
- netgen/include/prolongation.hpp +377 -0
- netgen/include/python_comp.hpp +107 -0
- netgen/include/python_fem.hpp +89 -0
- netgen/include/python_linalg.hpp +58 -0
- netgen/include/python_ngstd.hpp +386 -0
- netgen/include/recursive_pol.hpp +4896 -0
- netgen/include/recursive_pol_tet.hpp +395 -0
- netgen/include/recursive_pol_trig.hpp +492 -0
- netgen/include/reorderedfespace.hpp +81 -0
- netgen/include/sample_sort.hpp +105 -0
- netgen/include/scalarfe.hpp +335 -0
- netgen/include/shapefunction_utils.hpp +113 -0
- netgen/include/simd_complex.hpp +329 -0
- netgen/include/smoother.hpp +253 -0
- netgen/include/solve.hpp +89 -0
- netgen/include/sparsecholesky.hpp +313 -0
- netgen/include/sparsematrix.hpp +1038 -0
- netgen/include/sparsematrix_dyn.hpp +90 -0
- netgen/include/sparsematrix_impl.hpp +1013 -0
- netgen/include/special_matrix.hpp +463 -0
- netgen/include/specialelement.hpp +125 -0
- netgen/include/statushandler.hpp +33 -0
- netgen/include/stringops.hpp +12 -0
- netgen/include/superluinverse.hpp +136 -0
- netgen/include/symbolicintegrator.hpp +850 -0
- netgen/include/symmetricmatrix.hpp +144 -0
- netgen/include/tangentialfacetfe.hpp +224 -0
- netgen/include/tangentialfacetfespace.hpp +91 -0
- netgen/include/tensor.hpp +522 -0
- netgen/include/tensorcoefficient.hpp +446 -0
- netgen/include/tensorproductintegrator.hpp +113 -0
- netgen/include/thcurlfe.hpp +128 -0
- netgen/include/thcurlfe_impl.hpp +380 -0
- netgen/include/thdivfe.hpp +80 -0
- netgen/include/thdivfe_impl.hpp +492 -0
- netgen/include/tpdiffop.hpp +461 -0
- netgen/include/tpfes.hpp +133 -0
- netgen/include/tpintrule.hpp +224 -0
- netgen/include/triangular.hpp +465 -0
- netgen/include/tscalarfe.hpp +245 -0
- netgen/include/tscalarfe_impl.hpp +1029 -0
- netgen/include/umfpackinverse.hpp +148 -0
- netgen/include/vector.hpp +1273 -0
- netgen/include/voxelcoefficientfunction.hpp +41 -0
- netgen/include/vtkoutput.hpp +198 -0
- netgen/include/vvector.hpp +208 -0
- netgen/include/webgui.hpp +92 -0
- netgen/libngbla.dylib +0 -0
- netgen/libngcomp.dylib +0 -0
- netgen/libngfem.dylib +0 -0
- netgen/libngla.dylib +0 -0
- netgen/libngsbem.dylib +0 -0
- netgen/libngsolve.dylib +0 -0
- netgen/libngstd.dylib +0 -0
- ngsolve/TensorProductTools.py +210 -0
- ngsolve/__console.py +94 -0
- ngsolve/__expr.py +181 -0
- ngsolve/__init__.py +148 -0
- ngsolve/__init__.pyi +233 -0
- ngsolve/_scikit_build_core_dependencies.py +30 -0
- ngsolve/bla.pyi +1153 -0
- ngsolve/bvp.py +78 -0
- ngsolve/bvp.pyi +32 -0
- ngsolve/cmake/NGSolveConfig.cmake +102 -0
- ngsolve/cmake/ngsolve-targets-release.cmake +79 -0
- ngsolve/cmake/ngsolve-targets.cmake +163 -0
- ngsolve/comp/__init__.pyi +5449 -0
- ngsolve/comp/pml.pyi +89 -0
- ngsolve/config/__init__.py +1 -0
- ngsolve/config/__init__.pyi +43 -0
- ngsolve/config/__main__.py +4 -0
- ngsolve/config/config.py +60 -0
- ngsolve/config/config.pyi +45 -0
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +44 -0
- ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve/demos/howto/mixed.py +30 -0
- ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve/demos/howto/pickling.py +26 -0
- ngsolve/demos/howto/pml.py +31 -0
- ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve/demos/intro/cmagnet.py +59 -0
- ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve/demos/intro/poisson.py +41 -0
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
- ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve/demos/mpi/mpi_timeDG.py +82 -0
- ngsolve/directsolvers.py +26 -0
- ngsolve/directsolvers.pyi +15 -0
- ngsolve/eigenvalues.py +364 -0
- ngsolve/eigenvalues.pyi +30 -0
- ngsolve/fem.pyi +1647 -0
- ngsolve/internal.py +89 -0
- ngsolve/krylovspace.py +1013 -0
- ngsolve/krylovspace.pyi +298 -0
- ngsolve/la.pyi +1230 -0
- ngsolve/meshes.py +748 -0
- ngsolve/ngs2petsc.py +310 -0
- ngsolve/ngscxx.py +42 -0
- ngsolve/ngslib.so +0 -0
- ngsolve/ngstd.pyi +59 -0
- ngsolve/nonlinearsolvers.py +203 -0
- ngsolve/nonlinearsolvers.pyi +95 -0
- ngsolve/preconditioners.py +11 -0
- ngsolve/preconditioners.pyi +7 -0
- ngsolve/solve.pyi +109 -0
- ngsolve/solve_implementation.py +168 -0
- ngsolve/solve_implementation.pyi +42 -0
- ngsolve/solvers.py +7 -0
- ngsolve/solvers.pyi +14 -0
- ngsolve/timestepping.py +185 -0
- ngsolve/timestepping.pyi +28 -0
- ngsolve/timing.py +108 -0
- ngsolve/timing.pyi +54 -0
- ngsolve/utils.py +167 -0
- ngsolve/utils.pyi +273 -0
- ngsolve/webgui.py +670 -0
- ngsolve-6.2.2506.post74.dev0.data/data/Netgen.icns +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngscxx +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsld +13 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsolve.tcl +648 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngspy +2 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.geo +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.vol +240 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.in2d +41 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.vol +614 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.geo +12 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.vol +2560 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.geo +19 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.vol +1832 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.geo +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.in2d +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.vol +149 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/METADATA +13 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/RECORD +315 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/WHEEL +5 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/licenses/LICENSE +504 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
from netgen.meshing import *
|
|
2
|
+
from netgen.csg import *
|
|
3
|
+
#from ngsolve import *
|
|
4
|
+
from ngsolve.comp import TensorProductFESpace, Transfer2StdMesh, SymbolicTPBFI, ProlongateCoefficientFunction, TensorProductIntegrate
|
|
5
|
+
import netgen.meshing as ngmeshing
|
|
6
|
+
from netgen.geom2d import SplineGeometry
|
|
7
|
+
import math
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def AddEdgeEls (p1, dx, facenr, n, pids,mesh):
|
|
12
|
+
for i in range(n):
|
|
13
|
+
base = p1 + i*dx
|
|
14
|
+
pnum = [base, base+dx]
|
|
15
|
+
elpids = [pids[p] for p in pnum]
|
|
16
|
+
mesh.Add (Element1D(elpids,index=1))
|
|
17
|
+
|
|
18
|
+
def SegMesh(n,x0,x1,periodic=False):
|
|
19
|
+
mesh = Mesh(dim=1)
|
|
20
|
+
pids = []
|
|
21
|
+
for i in range(n+1):
|
|
22
|
+
pids.append (mesh.Add (MeshPoint(Pnt(x0+(x1-x0)*i/n, 0, 0))))
|
|
23
|
+
AddEdgeEls(0,1,1,n,pids,mesh)
|
|
24
|
+
mesh.Add (Element0D( pids[0], index=1))
|
|
25
|
+
mesh.Add (Element0D( pids[n], index=2))
|
|
26
|
+
mesh.SetBCName(0,"left")
|
|
27
|
+
mesh.SetBCName(1,"right")
|
|
28
|
+
if periodic == True:
|
|
29
|
+
mesh.AddPointIdentification(pids[0],pids[n],1,2)
|
|
30
|
+
return mesh
|
|
31
|
+
|
|
32
|
+
# create a hexagonal mesh with corner points on the unit circle
|
|
33
|
+
def MakeHexagonalMesh2D(maxh=0.1):
|
|
34
|
+
geo = SplineGeometry()
|
|
35
|
+
pnums = [ geo.AddPoint(math.cos(phi),math.sin(phi)) for phi in [xx*math.pi/3 for xx in range(6)] ]
|
|
36
|
+
l1 = geo.Append(["line", 0, 1], leftdomain=1, rightdomain=0, bc="upperRight")
|
|
37
|
+
geo.Append(["line", 4, 3], leftdomain=0, rightdomain=1, bc="lowerLeft", copy = l1)
|
|
38
|
+
l2 = geo.Append(["line", 1, 2], leftdomain=1, rightdomain=0, bc="upperCenter")
|
|
39
|
+
geo.Append(["line", 5, 4], leftdomain=0, rightdomain=1, bc="lowerCenter", copy = l2)
|
|
40
|
+
l3 = geo.Append(["line", 2, 3], leftdomain=1, rightdomain=0, bc="upperLeft")
|
|
41
|
+
geo.Append(["line", 0, 5], leftdomain=0, rightdomain=1, bc="lowerRight", copy = l3)
|
|
42
|
+
return geo.GenerateMesh(maxh=maxh)
|
|
43
|
+
|
|
44
|
+
def MakeTensorProductMesh(mesh1,mesh2):
|
|
45
|
+
if mesh1.dim + mesh2.dim >3:
|
|
46
|
+
print('MakeMesh only possible if dim<=3!!')
|
|
47
|
+
return
|
|
48
|
+
if mesh1.dim + mesh2.dim == 3:
|
|
49
|
+
tpmesh = MakeMesh3D(mesh1,mesh2)
|
|
50
|
+
if mesh1.dim + mesh2.dim == 2:
|
|
51
|
+
tpmesh = MakeMesh2D(mesh1,mesh2)
|
|
52
|
+
AddSurfElements(tpmesh,mesh1,mesh2)
|
|
53
|
+
return tpmesh
|
|
54
|
+
|
|
55
|
+
def AddSurfElements(tpmesh,mesh1,mesh2):
|
|
56
|
+
if mesh1.dim + mesh2.dim == 3:
|
|
57
|
+
tpmesh = AddSurfElements2D(tpmesh,mesh1,mesh2)
|
|
58
|
+
if mesh1.dim + mesh2.dim == 2:
|
|
59
|
+
tpmesh = AddSurfElements1D(tpmesh,mesh1,mesh2)
|
|
60
|
+
return tpmesh
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def MakeMesh2D(mesh1,mesh2):
|
|
64
|
+
tpmesh = ngmeshing.Mesh(dim = mesh1.dim + mesh2.dim)
|
|
65
|
+
ngm1 = mesh1.ngmesh
|
|
66
|
+
ngm2 = mesh2.ngmesh
|
|
67
|
+
|
|
68
|
+
els1 = ngm1.Elements1D()
|
|
69
|
+
els2 = ngm2.Elements1D()
|
|
70
|
+
vert1 = ngm1.Points()
|
|
71
|
+
vert2 = ngm2.Points()
|
|
72
|
+
pids = []
|
|
73
|
+
for i in range(len(vert1)):
|
|
74
|
+
for j in range(len(vert2)):
|
|
75
|
+
pids.append(tpmesh.Add(MeshPoint(Pnt(vert1[ngmeshing.PointId(i+1)].p[0],vert2[ngmeshing.PointId(j+1)].p[0],0 ))))
|
|
76
|
+
tpmesh.Add (FaceDescriptor(surfnr=1,domin=1,bc=1))
|
|
77
|
+
for elx in els1:
|
|
78
|
+
for ely in els2:
|
|
79
|
+
pnum = [(elx.vertices[1].nr-1) * len(vert2) + ely.vertices[1].nr-1,
|
|
80
|
+
(elx.vertices[0].nr-1) * len(vert2) + ely.vertices[1].nr-1,
|
|
81
|
+
(elx.vertices[0].nr-1) * len(vert2) + ely.vertices[0].nr-1,
|
|
82
|
+
(elx.vertices[1].nr-1) * len(vert2) + ely.vertices[0].nr-1]
|
|
83
|
+
|
|
84
|
+
elpids = [pids[p] for p in pnum]
|
|
85
|
+
tpmesh.Add(Element2D(1,elpids))
|
|
86
|
+
return tpmesh
|
|
87
|
+
|
|
88
|
+
def MakeMesh3D(mesh1,mesh2):
|
|
89
|
+
tpmesh = ngmeshing.Mesh(dim = mesh1.dim + mesh2.dim)
|
|
90
|
+
ngm1 = mesh1.ngmesh
|
|
91
|
+
ngm2 = mesh2.ngmesh
|
|
92
|
+
if mesh1.dim==2:
|
|
93
|
+
els1 = ngm1.Elements2D()
|
|
94
|
+
els2 = ngm2.Elements1D()
|
|
95
|
+
vert1 = ngm1.Points()
|
|
96
|
+
vert2 = ngm2.Points()
|
|
97
|
+
pids = []
|
|
98
|
+
for i in range(len(vert1)):
|
|
99
|
+
for j in range(len(vert2)):
|
|
100
|
+
pids.append(tpmesh.Add(MeshPoint(Pnt(vert1[ngmeshing.PointId(i+1)].p[0],vert1[ngmeshing.PointId(i+1)].p[1],vert2[ngmeshing.PointId(j+1)].p[0]))))
|
|
101
|
+
for elx in els1:
|
|
102
|
+
for ely in els2:
|
|
103
|
+
pnum = []
|
|
104
|
+
for j in reversed(ely.vertices):
|
|
105
|
+
for i in elx.vertices:
|
|
106
|
+
pnum.append((i.nr-1) * len(vert2) + j.nr-1)
|
|
107
|
+
elpids = [pids[p] for p in pnum]
|
|
108
|
+
tpmesh.Add( Element3D(1,elpids) )
|
|
109
|
+
return tpmesh
|
|
110
|
+
else:
|
|
111
|
+
els1 = ngm1.Elements1D()
|
|
112
|
+
els2 = ngm2.Elements2D()
|
|
113
|
+
vert1 = ngm1.Points()
|
|
114
|
+
vert2 = ngm2.Points()
|
|
115
|
+
pids = []
|
|
116
|
+
for i in range(len(vert1)):
|
|
117
|
+
for j in range(len(vert2)):
|
|
118
|
+
pids.append(tpmesh.Add(MeshPoint(Pnt(vert1[ngmeshing.PointId(i+1)].p[0],vert2[ngmeshing.PointId(j+1)].p[0],vert2[ngmeshing.PointId(j+1)].p[1]))))
|
|
119
|
+
for elx in els1:
|
|
120
|
+
for ely in els2:
|
|
121
|
+
pnum = []
|
|
122
|
+
for i in reversed(elx.vertices):
|
|
123
|
+
for j in (ely.vertices):
|
|
124
|
+
pnum.append((i.nr-1) * len(vert2) + j.nr-1)
|
|
125
|
+
elpids = [pids[p] for p in pnum]
|
|
126
|
+
tpmesh.Add( Element3D(1,elpids) )
|
|
127
|
+
return tpmesh
|
|
128
|
+
|
|
129
|
+
def AddSurfElements1D(tpmesh,mesh1,mesh2):
|
|
130
|
+
ngm1 = mesh1.ngmesh;
|
|
131
|
+
ngm2 = mesh2.ngmesh;
|
|
132
|
+
els1 = ngm1.Elements1D()
|
|
133
|
+
els2 = ngm2.Elements1D()
|
|
134
|
+
for ely in els2:
|
|
135
|
+
elpids = ely.vertices
|
|
136
|
+
elpids1=[]
|
|
137
|
+
for i in elpids:
|
|
138
|
+
elpids1.append(PointId((i.nr-1)+(len(ngm1.Points()) -1 )*(len(ngm2.Points())) + 1 ))
|
|
139
|
+
tpmesh.Add(Element1D(elpids))
|
|
140
|
+
tpmesh.Add(Element1D(elpids1))
|
|
141
|
+
for elx in els1:
|
|
142
|
+
elpids = elx.vertices
|
|
143
|
+
elpids1=[]
|
|
144
|
+
elpids2=[]
|
|
145
|
+
for i in elpids:
|
|
146
|
+
elpids1.append(PointId( (i.nr-1)*(len(ngm2.Points()))+1) )
|
|
147
|
+
elpids2.append(PointId( (i.nr-1)*(len(ngm2.Points()))+(len(ngm2.Points()))) )
|
|
148
|
+
tpmesh.Add(Element1D(elpids1))
|
|
149
|
+
tpmesh.Add(Element1D(elpids2))
|
|
150
|
+
|
|
151
|
+
def AddSurfElements2D(tpmesh,mesh1,mesh2):
|
|
152
|
+
ngm1 = mesh1.ngmesh;
|
|
153
|
+
ngm2 = mesh2.ngmesh;
|
|
154
|
+
if mesh1.dim==2:
|
|
155
|
+
els1 = ngm1.Elements2D()
|
|
156
|
+
els2 = ngm2.Elements1D()
|
|
157
|
+
tpmesh.Add (FaceDescriptor(surfnr=1,domin=1,bc=1))
|
|
158
|
+
for elx in els1:
|
|
159
|
+
vert_loc = elx.vertices
|
|
160
|
+
vert_glob = []
|
|
161
|
+
for vx in vert_loc:
|
|
162
|
+
vert_glob.append(PointId((vx.nr-1)*len(ngm2.Points())+len(ngm2.Points())))
|
|
163
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
164
|
+
for elx in els1:
|
|
165
|
+
vert_loc = elx.vertices
|
|
166
|
+
vert_glob = []
|
|
167
|
+
for vx in vert_loc:
|
|
168
|
+
vert_glob = [PointId((vx.nr-1)*len(ngm2.Points())+1)] + vert_glob
|
|
169
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
170
|
+
els1 = ngm1.Elements1D()
|
|
171
|
+
for elx in els1:
|
|
172
|
+
for ely in els2:
|
|
173
|
+
vert_glob=[]
|
|
174
|
+
# for vy in ely.vertices:
|
|
175
|
+
# for vx in elx.vertices:
|
|
176
|
+
vx = elx.vertices
|
|
177
|
+
vy = ely.vertices
|
|
178
|
+
vert_glob = [PointId((vx[1].nr-1)*len(ngm2.Points())+vy[0].nr),
|
|
179
|
+
PointId((vx[1].nr-1)*len(ngm2.Points())+vy[1].nr),
|
|
180
|
+
PointId((vx[0].nr-1)*len(ngm2.Points())+vy[1].nr),
|
|
181
|
+
PointId((vx[0].nr-1)*len(ngm2.Points())+vy[0].nr)]
|
|
182
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
183
|
+
else:
|
|
184
|
+
els1 = ngm1.Elements1D()
|
|
185
|
+
els2 = ngm2.Elements2D()
|
|
186
|
+
tpmesh.Add (FaceDescriptor(surfnr=1,domin=1,bc=1))
|
|
187
|
+
for ely in els2:
|
|
188
|
+
vert_loc = ely.vertices
|
|
189
|
+
vert_glob = []
|
|
190
|
+
for vy in vert_loc:
|
|
191
|
+
vert_glob.append(PointId((vy.nr)+(len(ngm1.Points())-1)*(len(ngm2.Points()))))
|
|
192
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
193
|
+
for ely in els2:
|
|
194
|
+
vert_loc = ely.vertices
|
|
195
|
+
vert_glob = []
|
|
196
|
+
for vy in reversed(vert_loc):
|
|
197
|
+
vert_glob.append(PointId( vy.nr))
|
|
198
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
199
|
+
els2 = ngm2.Elements1D()
|
|
200
|
+
for elx in els1:
|
|
201
|
+
for ely in els2:
|
|
202
|
+
vert_glob=[]
|
|
203
|
+
vx = elx.vertices
|
|
204
|
+
vy = ely.vertices
|
|
205
|
+
vert_glob = [PointId((vx[0].nr-1)*len(ngm2.Points())+vy[0].nr),
|
|
206
|
+
PointId((vx[0].nr-1)*len(ngm2.Points())+vy[1].nr),
|
|
207
|
+
PointId((vx[1].nr-1)*len(ngm2.Points())+vy[1].nr),
|
|
208
|
+
PointId((vx[1].nr-1)*len(ngm2.Points())+vy[0].nr)]
|
|
209
|
+
tpmesh.Add(Element2D(1,vert_glob))
|
|
210
|
+
return tpmesh
|
ngsolve/__console.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import code
|
|
2
|
+
# import ngfemcf
|
|
3
|
+
# import ngmpi
|
|
4
|
+
|
|
5
|
+
def mydir(x=None):
|
|
6
|
+
if x==None:
|
|
7
|
+
return []
|
|
8
|
+
else:
|
|
9
|
+
return [i for i in dir(x) if not '__' in i]
|
|
10
|
+
|
|
11
|
+
def execfile(fname):
|
|
12
|
+
exec(open(fname).read())
|
|
13
|
+
|
|
14
|
+
class InteractiveMPIConsole(code.InteractiveConsole):
|
|
15
|
+
# Function copied from /usr/lib/python3.4/code.py line 38
|
|
16
|
+
def runsource(self, source, filename="<input>", symbol="single"):
|
|
17
|
+
try:
|
|
18
|
+
compiled_code = self.compile(source, filename, symbol)
|
|
19
|
+
except (OverflowError, SyntaxError, ValueError):
|
|
20
|
+
# Case 1
|
|
21
|
+
self.showsyntaxerror(filename)
|
|
22
|
+
return False
|
|
23
|
+
|
|
24
|
+
if compiled_code is None:
|
|
25
|
+
# Case 2
|
|
26
|
+
return True
|
|
27
|
+
|
|
28
|
+
# Case 3 -- first send code to other mpi processes
|
|
29
|
+
ngmpi.SendCommand('ngs_py '+source)
|
|
30
|
+
# then run it on master
|
|
31
|
+
code.InteractiveConsole.runcode(self, compiled_code)
|
|
32
|
+
|
|
33
|
+
# Avoid the prompt to show up before other processes' output
|
|
34
|
+
self.Barrier()
|
|
35
|
+
return False
|
|
36
|
+
|
|
37
|
+
def interact(self):
|
|
38
|
+
import sys
|
|
39
|
+
self.write("MPI Shell\n")
|
|
40
|
+
self.write("================\n")
|
|
41
|
+
self.write("Use pprint(str) to print with MPI ranks\n\n")
|
|
42
|
+
self.runsource("from ngmpi import *\n")
|
|
43
|
+
self.runsource("pprint=lambda p='':print('Process ' + str(ngmpi.Rank()) + '\\n'+str(p)+'\\n')\n")
|
|
44
|
+
self.locals.update(locals())
|
|
45
|
+
self.locals.update(globals())
|
|
46
|
+
sys.ps1 = "MPI >>> "
|
|
47
|
+
sys.ps2 = "MPI ... "
|
|
48
|
+
code.InteractiveConsole.interact(self,'')
|
|
49
|
+
sys.ps1 = ">>> "
|
|
50
|
+
sys.ps2 = "... "
|
|
51
|
+
def Barrier(self):
|
|
52
|
+
source = 'ngmpi.Barrier()'
|
|
53
|
+
ngmpi.SendCommand('ngs_py '+source)
|
|
54
|
+
code.InteractiveConsole.runsource(self, source)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def MpiShell():
|
|
59
|
+
import code
|
|
60
|
+
try:
|
|
61
|
+
import readline
|
|
62
|
+
import rlcompleter
|
|
63
|
+
readline.parse_and_bind("tab:complete") # autocomplete
|
|
64
|
+
except:
|
|
65
|
+
try:
|
|
66
|
+
import pyreadline as readline
|
|
67
|
+
import rlcompleter
|
|
68
|
+
readline.parse_and_bind("tab:complete") # autocomplete
|
|
69
|
+
except:
|
|
70
|
+
print('readline not found')
|
|
71
|
+
vars2 = globals()
|
|
72
|
+
vars2.update(locals())
|
|
73
|
+
mshell = InteractiveMPIConsole(vars2)
|
|
74
|
+
mshell.interact()
|
|
75
|
+
|
|
76
|
+
def startConsole(vars2):
|
|
77
|
+
try:
|
|
78
|
+
import readline
|
|
79
|
+
import rlcompleter
|
|
80
|
+
if 'libedit' in readline.__doc__:
|
|
81
|
+
readline.parse_and_bind("bind ^I rl_complete")
|
|
82
|
+
else:
|
|
83
|
+
readline.parse_and_bind("tab: complete")
|
|
84
|
+
except:
|
|
85
|
+
try:
|
|
86
|
+
import pyreadline as readline
|
|
87
|
+
import rlcompleter
|
|
88
|
+
readline.parse_and_bind("tab:complete") # autocomplete
|
|
89
|
+
except:
|
|
90
|
+
print('readline not found')
|
|
91
|
+
shell = code.InteractiveConsole(vars2)
|
|
92
|
+
shell.push('from netgen import *')
|
|
93
|
+
shell.push('from ngsolve import *')
|
|
94
|
+
shell.interact(banner="NGS-Python console is up ...")
|
ngsolve/__expr.py
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
###############################################
|
|
2
|
+
# Expression classes
|
|
3
|
+
###############################################
|
|
4
|
+
|
|
5
|
+
def Expr(a):
|
|
6
|
+
if isinstance(a, BaseExpr):
|
|
7
|
+
return a
|
|
8
|
+
try:
|
|
9
|
+
return a.expr
|
|
10
|
+
except:
|
|
11
|
+
raise TypeError('cannot convert ' + str(type(a)) + ' to expression')
|
|
12
|
+
|
|
13
|
+
def expr_add(a,b):
|
|
14
|
+
return Expr(a) + Expr(b)
|
|
15
|
+
|
|
16
|
+
def expr_sub(a,b):
|
|
17
|
+
return Expr(a) - Expr(b)
|
|
18
|
+
|
|
19
|
+
def expr_neg(a):
|
|
20
|
+
return -Expr(a)
|
|
21
|
+
|
|
22
|
+
def expr_mul(a,b):
|
|
23
|
+
return Expr(a) * Expr(b)
|
|
24
|
+
|
|
25
|
+
def expr_rmul(b,a): # rmul -> swap a,b
|
|
26
|
+
return a * Expr(b)
|
|
27
|
+
|
|
28
|
+
def expr_data(a,b):
|
|
29
|
+
Expr(b).AssignTo(Expr(a))
|
|
30
|
+
|
|
31
|
+
class BaseExpr:
|
|
32
|
+
def copy(self):
|
|
33
|
+
return self.__class__(self.a, self.s)
|
|
34
|
+
|
|
35
|
+
def Scale(self, s):
|
|
36
|
+
res = self.copy()
|
|
37
|
+
res.s*=s
|
|
38
|
+
return res
|
|
39
|
+
|
|
40
|
+
def __init__(self, a, s=1.0):
|
|
41
|
+
self.a = a
|
|
42
|
+
self.s = s
|
|
43
|
+
|
|
44
|
+
def __rmul__(self, other):
|
|
45
|
+
return self.Scale(other)
|
|
46
|
+
|
|
47
|
+
def __add__(self, other):
|
|
48
|
+
return SumExpr(self, Expr(other))
|
|
49
|
+
|
|
50
|
+
def __sub__(self, other):
|
|
51
|
+
return SumExpr(self, Expr(other).Scale(-1))
|
|
52
|
+
|
|
53
|
+
def __neg__(self):
|
|
54
|
+
return self.Scale(-1)
|
|
55
|
+
|
|
56
|
+
def __str__(self):
|
|
57
|
+
return str(self.s) + '*' +str(self.a)
|
|
58
|
+
|
|
59
|
+
def __len__(self):
|
|
60
|
+
return len(self.a)
|
|
61
|
+
|
|
62
|
+
def T(self):
|
|
63
|
+
return TransExpr(self)
|
|
64
|
+
|
|
65
|
+
class VecExpr(BaseExpr):
|
|
66
|
+
def AssignTo(self, v, s = 1.0):
|
|
67
|
+
v.a.Assign(self.a,s*self.s)
|
|
68
|
+
|
|
69
|
+
def AddTo(self, v, s = 1.0):
|
|
70
|
+
try:
|
|
71
|
+
v.a.Add(self.a,s*self.s)
|
|
72
|
+
except:
|
|
73
|
+
print ("WARNING: add to exception")
|
|
74
|
+
v.a += self.a
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class MatExpr(BaseExpr):
|
|
78
|
+
def MultScale(self, s, x, y):
|
|
79
|
+
self.a.MultScale(s*self.s*x.s,x.a,y.a)
|
|
80
|
+
|
|
81
|
+
def MultTrans(self, s, x, y):
|
|
82
|
+
self.a.MultTrans(s*self.s*x.s,x.a,y.a)
|
|
83
|
+
|
|
84
|
+
def MultAdd(self, s, x, y):
|
|
85
|
+
self.a.MultAdd(s*self.s*x.s,x.a,y.a)
|
|
86
|
+
|
|
87
|
+
def MultTransAdd(self, s, x, y):
|
|
88
|
+
self.a.MultTransAdd(s*self.s*x.s,x.a,y.a)
|
|
89
|
+
|
|
90
|
+
def __mul__(self, other):
|
|
91
|
+
if isinstance(Expr(other), VecExpr):
|
|
92
|
+
return MatVecExpr(self, Expr(other))
|
|
93
|
+
try:
|
|
94
|
+
return self.Scale(float(other))
|
|
95
|
+
except:
|
|
96
|
+
return None
|
|
97
|
+
|
|
98
|
+
def __len__(self):
|
|
99
|
+
return self.a.Height()
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TransExpr(MatExpr):
|
|
103
|
+
def __init__(self, matexpr, s=1.0):
|
|
104
|
+
self.a = Expr(matexpr).a
|
|
105
|
+
self.s = s*Expr(matexpr).s
|
|
106
|
+
|
|
107
|
+
def MultScale(self, s, x, y):
|
|
108
|
+
self.a.MultTrans(s*self.s,x.a,y.a)
|
|
109
|
+
|
|
110
|
+
def MultTrans(self, s, x, y):
|
|
111
|
+
self.a.MultScale(s*self.s,x.a,y.a)
|
|
112
|
+
|
|
113
|
+
def MultAdd(self, s, x, y):
|
|
114
|
+
self.a.MultTransAdd(s*self.s,x.a,y.a)
|
|
115
|
+
|
|
116
|
+
def MultTransAdd(self, s, x, y):
|
|
117
|
+
self.a.MultAdd(s*self.s,x.a,y.a)
|
|
118
|
+
|
|
119
|
+
class BinExpr(BaseExpr):
|
|
120
|
+
def __init__(self, a,b):
|
|
121
|
+
self.a = Expr(a)
|
|
122
|
+
self.b = Expr(b)
|
|
123
|
+
|
|
124
|
+
def copy(self):
|
|
125
|
+
return BinExpr(a,b)
|
|
126
|
+
|
|
127
|
+
def __str__(self):
|
|
128
|
+
return str(self.a) + ' op ' + str(self.b)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class SumExpr(BinExpr):
|
|
132
|
+
def Scale(self, s):
|
|
133
|
+
return SumExpr(self.a.Scale(s), self.b.Scale(s))
|
|
134
|
+
|
|
135
|
+
def AssignTo(self, v, s = 1.0):
|
|
136
|
+
self.a.AssignTo(v, s)
|
|
137
|
+
self.b.AddTo(v, s)
|
|
138
|
+
|
|
139
|
+
def AddTo(self, v, s = 1.0):
|
|
140
|
+
self.a.AddTo(v, s)
|
|
141
|
+
self.b.AddTo(v, s)
|
|
142
|
+
|
|
143
|
+
def __str__(self):
|
|
144
|
+
return str(self.a) + ' + ' + str(self.b)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class MatVecExpr(BinExpr):
|
|
148
|
+
def Scale(self, s):
|
|
149
|
+
return MatVecExpr(self.a.Scale(s), self.b)
|
|
150
|
+
|
|
151
|
+
def AssignTo(self, v, s = 1.0):
|
|
152
|
+
self.a.MultScale(s,self.b,v)
|
|
153
|
+
|
|
154
|
+
def AddTo(self, v, s = 1.0):
|
|
155
|
+
self.a.MultAdd(s,self.b,v)
|
|
156
|
+
|
|
157
|
+
def __str__(self):
|
|
158
|
+
return str(self.a) + ' * ' + str(self.b)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def GetSlice(self, index):
|
|
162
|
+
if not isinstance(index,slice):
|
|
163
|
+
return self.Get(index)
|
|
164
|
+
index = index.indices(len(self))
|
|
165
|
+
if(index[2]!=1):
|
|
166
|
+
print("Slicing with 3 parameters not supported!")
|
|
167
|
+
return none
|
|
168
|
+
return self.Range(index[0], index[1])
|
|
169
|
+
|
|
170
|
+
def SetSlice(self, index, other):
|
|
171
|
+
if not isinstance(index,slice):
|
|
172
|
+
self.Set(index, other)
|
|
173
|
+
return
|
|
174
|
+
index = index.indices(len(self))
|
|
175
|
+
if(index[2]!=1):
|
|
176
|
+
print("Slicing with 3 parameters not supported!")
|
|
177
|
+
return none
|
|
178
|
+
Expr(other).AssignTo(self.Range(index[0], index[1]).expr)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
ngsolve/__init__.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NGSolve
|
|
3
|
+
=======
|
|
4
|
+
|
|
5
|
+
A high order finite element library
|
|
6
|
+
|
|
7
|
+
Modules:
|
|
8
|
+
ngsolve.bla .... simple vectors and matrices
|
|
9
|
+
ngsolve.fem .... finite elements and integrators
|
|
10
|
+
ngsolve.comp ... function spaces, forms
|
|
11
|
+
"""
|
|
12
|
+
import atexit
|
|
13
|
+
import os, sys
|
|
14
|
+
|
|
15
|
+
from . import config
|
|
16
|
+
|
|
17
|
+
import netgen
|
|
18
|
+
|
|
19
|
+
if config.is_python_package and sys.platform.startswith('win'):
|
|
20
|
+
netgen_dir = os.path.dirname(netgen.__file__)
|
|
21
|
+
os.add_dll_directory(netgen_dir)
|
|
22
|
+
os.environ["PATH"] += os.pathsep + netgen_dir
|
|
23
|
+
|
|
24
|
+
if config.USE_MKL and config.MKL_LINK == 'sdl':
|
|
25
|
+
import importlib.metadata
|
|
26
|
+
try:
|
|
27
|
+
importlib.metadata.version('mkl')
|
|
28
|
+
import ctypes
|
|
29
|
+
for f in importlib.metadata.files('intel_openmp'):
|
|
30
|
+
if f.match('*libiomp?.so') or f.match('*libiomp?md.dll'):
|
|
31
|
+
ctypes.CDLL(str(f.locate()), mode=ctypes.RTLD_GLOBAL)
|
|
32
|
+
for f in importlib.metadata.files('mkl'):
|
|
33
|
+
if f.match('*mkl_rt*'):
|
|
34
|
+
ctypes.CDLL(str(f.locate()), mode=ctypes.RTLD_GLOBAL)
|
|
35
|
+
except importlib.metadata.PackageNotFoundError:
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
from .ngslib import __version__, ngstd, bla, la, fem, comp, solve
|
|
39
|
+
|
|
40
|
+
from netgen import Redraw, TimeFunction
|
|
41
|
+
|
|
42
|
+
from pyngcore import BitArray, TaskManager, SetNumThreads, PajeTrace, Timers, Timer
|
|
43
|
+
from .ngstd import IntRange
|
|
44
|
+
from .bla import Matrix, Vector, InnerProduct, Norm
|
|
45
|
+
from .la import BaseMatrix, BaseVector, BlockVector, MultiVector, BlockMatrix, \
|
|
46
|
+
CreateVVector, CGSolver, QMRSolver, GMRESSolver, ArnoldiSolver, \
|
|
47
|
+
Projector, DiagonalMatrix, IdentityMatrix, Embedding, PermutationMatrix, \
|
|
48
|
+
ConstEBEMatrix, ParallelMatrix, PARALLEL_STATUS
|
|
49
|
+
from .fem import BFI, LFI, CoefficientFunction, Parameter, ParameterC, ET, \
|
|
50
|
+
POINT, SEGM, TRIG, QUAD, TET, PRISM, PYRAMID, HEX, CELL, FACE, EDGE, \
|
|
51
|
+
VERTEX, FACET, ELEMENT, sin, cos, tan, atan, acos, asin, sinh, cosh, \
|
|
52
|
+
exp, log, sqrt, erf, floor, ceil, Conj, atan2, pow, Sym, Skew, Id, Trace, Inv, Det, Cof, Cross, \
|
|
53
|
+
Zero as ZeroCF, \
|
|
54
|
+
specialcf, BlockBFI, BlockLFI, CompoundBFI, CompoundLFI, BSpline, \
|
|
55
|
+
IntegrationRule, IfPos, VoxelCoefficient, CacheCF, PlaceholderCF
|
|
56
|
+
from .comp import VOL, BND, BBND, BBBND, COUPLING_TYPE, ElementId, \
|
|
57
|
+
BilinearForm, LinearForm, GridFunction, Preconditioner, \
|
|
58
|
+
MultiGridPreconditioner, ElementId, FESpace, ProductSpace, H1, HCurl, \
|
|
59
|
+
HDiv, L2, VectorH1, VectorL2, SurfaceL2, TangentialSurfaceL2, HDivDiv, HCurlCurl, HCurlDiv, \
|
|
60
|
+
HDivSurface, HDivDivSurface, FacetFESpace, TangentialFacetFESpace, \
|
|
61
|
+
NormalFacetFESpace, NormalFacetSurface, \
|
|
62
|
+
FacetSurface, VectorSurfaceL2, VectorFacetFESpace, VectorFacetSurface, \
|
|
63
|
+
NodalFESpace, VectorNodalFESpace, H1LumpingFESpace, \
|
|
64
|
+
NumberSpace, Periodic, Discontinuous, Hidden, VectorValued, MatrixValued, Compress, \
|
|
65
|
+
CompressCompound, PlateauFESpace, BoundaryFromVolumeCF, Interpolate, Variation, \
|
|
66
|
+
Integrate, Region, SymbolicLFI, SymbolicBFI, \
|
|
67
|
+
SymbolicEnergy, Mesh, NodeId, ConvertOperator, ORDER_POLICY, VTKOutput, SetHeapSize, \
|
|
68
|
+
SetTestoutFile, ngsglobals, pml, ContactBoundary, PatchwiseSolve, \
|
|
69
|
+
HCurlAMG, APhiHCurlAMG
|
|
70
|
+
from .solve import Draw, \
|
|
71
|
+
SetVisualization
|
|
72
|
+
from .utils import x, y, z, dx, ds, grad, Grad, curl, div, Deviator, PyId, PyTrace, \
|
|
73
|
+
PyDet, PyCross, PyCof, PyInv, PySym, PySkew, OuterProduct, PrivateSpace, Normalize, printonce
|
|
74
|
+
|
|
75
|
+
from . import solvers
|
|
76
|
+
from . import preconditioners
|
|
77
|
+
from . import timestepping
|
|
78
|
+
from .solve_implementation import Solve
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
from netgen.occ import unit_square, unit_cube
|
|
82
|
+
except:
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
CF = CoefficientFunction
|
|
86
|
+
|
|
87
|
+
from math import pi
|
|
88
|
+
|
|
89
|
+
from builtins import sum as builtin_sum
|
|
90
|
+
def sum(iterable, start=None):
|
|
91
|
+
"""NGSolve sum function that uses the first element of an iterable as
|
|
92
|
+
start argument if no start argument is provided."""
|
|
93
|
+
if start is not None:
|
|
94
|
+
return builtin_sum(iterable, start)
|
|
95
|
+
generator = iter(iterable)
|
|
96
|
+
try:
|
|
97
|
+
first = next(generator)
|
|
98
|
+
except StopIteration:
|
|
99
|
+
return 0
|
|
100
|
+
return builtin_sum(generator, first)
|
|
101
|
+
|
|
102
|
+
from .timing import Timing
|
|
103
|
+
|
|
104
|
+
# add flags docu to docstring
|
|
105
|
+
def _add_flags_doc(module):
|
|
106
|
+
all_classes = module.__dict__
|
|
107
|
+
for classname in all_classes:
|
|
108
|
+
instance = all_classes[classname]
|
|
109
|
+
try:
|
|
110
|
+
flags_doc = instance.__flags_doc__()
|
|
111
|
+
if instance.__doc__ == None:
|
|
112
|
+
instance.__doc__ = ""
|
|
113
|
+
if not "Keyword arguments can be" in instance.__doc__:
|
|
114
|
+
instance.__doc__ += "\n Keyword arguments can be:\n"
|
|
115
|
+
for name in flags_doc:
|
|
116
|
+
instance.__doc__ += name + ": " + flags_doc[name] + "\n"
|
|
117
|
+
except AttributeError:
|
|
118
|
+
pass
|
|
119
|
+
|
|
120
|
+
_add_flags_doc(comp)
|
|
121
|
+
|
|
122
|
+
# from . import __expr
|
|
123
|
+
# BaseVector.expr = property(__expr.VecExpr)
|
|
124
|
+
# BaseVector.data = property(__expr.Expr, __expr.expr_data)
|
|
125
|
+
# BaseVector.__add__ = __expr.expr_add
|
|
126
|
+
# BaseVector.__sub__ = __expr.expr_sub
|
|
127
|
+
# BaseVector.__neg__ = __expr.expr_neg
|
|
128
|
+
# BaseVector.__rmul__ = __expr.expr_rmul
|
|
129
|
+
|
|
130
|
+
# BaseMatrix.expr = property(__expr.MatExpr)
|
|
131
|
+
# BaseMatrix.data = property(__expr.Expr, __expr.expr_data)
|
|
132
|
+
# BaseMatrix.T = property(__expr.TransExpr)
|
|
133
|
+
# BaseMatrix.__mul__ = __expr.expr_mul
|
|
134
|
+
# BaseMatrix.__rmul__ = __expr.expr_rmul
|
|
135
|
+
# BaseMatrix.__neg__ = __expr.expr_neg
|
|
136
|
+
|
|
137
|
+
def _jupyter_nbextension_paths():
|
|
138
|
+
return [
|
|
139
|
+
{
|
|
140
|
+
"section": "notebook",
|
|
141
|
+
"src": "nbextension/static",
|
|
142
|
+
"dest": "ngsolve_jupyter_widgets",
|
|
143
|
+
"require": "ngsolve_jupyter_widgets/extension",
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
atexit.register(solve.__Cleanup)
|
|
148
|
+
|