ngsolve 6.2.2501.post16.dev1__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2501.post34.dev1__cp313-cp313-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.

Files changed (286) hide show
  1. ngsolve/webgui.py +1 -1
  2. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/METADATA +2 -2
  3. ngsolve-6.2.2501.post34.dev1.dist-info/RECORD +25 -0
  4. netgen/include/arnoldi.hpp +0 -55
  5. netgen/include/bandmatrix.hpp +0 -334
  6. netgen/include/basematrix.hpp +0 -957
  7. netgen/include/basevector.hpp +0 -1268
  8. netgen/include/bdbequations.hpp +0 -2752
  9. netgen/include/bdbintegrator.hpp +0 -1659
  10. netgen/include/bessel.hpp +0 -1064
  11. netgen/include/bilinearform.hpp +0 -963
  12. netgen/include/bla.hpp +0 -29
  13. netgen/include/blockalloc.hpp +0 -95
  14. netgen/include/blockjacobi.hpp +0 -316
  15. netgen/include/bspline.hpp +0 -114
  16. netgen/include/calcinverse.hpp +0 -141
  17. netgen/include/cg.hpp +0 -368
  18. netgen/include/chebyshev.hpp +0 -44
  19. netgen/include/cholesky.hpp +0 -720
  20. netgen/include/clapack.h +0 -7254
  21. netgen/include/code_generation.hpp +0 -296
  22. netgen/include/coefficient.hpp +0 -2006
  23. netgen/include/coefficient_impl.hpp +0 -18
  24. netgen/include/coefficient_stdmath.hpp +0 -157
  25. netgen/include/commutingAMG.hpp +0 -106
  26. netgen/include/comp.hpp +0 -79
  27. netgen/include/compatibility.hpp +0 -41
  28. netgen/include/complex_wrapper.hpp +0 -73
  29. netgen/include/compressedfespace.hpp +0 -110
  30. netgen/include/contact.hpp +0 -231
  31. netgen/include/diagonalmatrix.hpp +0 -154
  32. netgen/include/differentialoperator.hpp +0 -276
  33. netgen/include/diffop.hpp +0 -1286
  34. netgen/include/diffop_impl.hpp +0 -326
  35. netgen/include/discontinuous.hpp +0 -84
  36. netgen/include/dump.hpp +0 -949
  37. netgen/include/eigen.hpp +0 -60
  38. netgen/include/eigensystem.hpp +0 -18
  39. netgen/include/elasticity_equations.hpp +0 -595
  40. netgen/include/elementbyelement.hpp +0 -195
  41. netgen/include/elementtopology.hpp +0 -1760
  42. netgen/include/elementtransformation.hpp +0 -339
  43. netgen/include/evalfunc.hpp +0 -405
  44. netgen/include/expr.hpp +0 -1655
  45. netgen/include/facetfe.hpp +0 -175
  46. netgen/include/facetfespace.hpp +0 -178
  47. netgen/include/facethofe.hpp +0 -111
  48. netgen/include/facetsurffespace.hpp +0 -112
  49. netgen/include/fe_interfaces.hpp +0 -32
  50. netgen/include/fem.hpp +0 -87
  51. netgen/include/fesconvert.hpp +0 -14
  52. netgen/include/fespace.hpp +0 -1445
  53. netgen/include/finiteelement.hpp +0 -286
  54. netgen/include/globalinterfacespace.hpp +0 -77
  55. netgen/include/globalspace.hpp +0 -115
  56. netgen/include/gridfunction.hpp +0 -525
  57. netgen/include/h1amg.hpp +0 -41
  58. netgen/include/h1hofe.hpp +0 -188
  59. netgen/include/h1hofe_impl.hpp +0 -1262
  60. netgen/include/h1hofefo.hpp +0 -148
  61. netgen/include/h1hofefo_impl.hpp +0 -185
  62. netgen/include/h1hofespace.hpp +0 -167
  63. netgen/include/h1lofe.hpp +0 -1237
  64. netgen/include/h1lumping.hpp +0 -35
  65. netgen/include/hcurl_equations.hpp +0 -1352
  66. netgen/include/hcurlcurlfe.hpp +0 -2221
  67. netgen/include/hcurlcurlfespace.hpp +0 -78
  68. netgen/include/hcurlfe.hpp +0 -259
  69. netgen/include/hcurlfe_utils.hpp +0 -107
  70. netgen/include/hcurlhdiv_dshape.hpp +0 -857
  71. netgen/include/hcurlhdivfes.hpp +0 -308
  72. netgen/include/hcurlhofe.hpp +0 -175
  73. netgen/include/hcurlhofe_impl.hpp +0 -1871
  74. netgen/include/hcurlhofespace.hpp +0 -193
  75. netgen/include/hcurllofe.hpp +0 -1146
  76. netgen/include/hdiv_equations.hpp +0 -865
  77. netgen/include/hdivdivfe.hpp +0 -2923
  78. netgen/include/hdivdivsurfacespace.hpp +0 -76
  79. netgen/include/hdivfe.hpp +0 -206
  80. netgen/include/hdivfe_utils.hpp +0 -716
  81. netgen/include/hdivfes.hpp +0 -75
  82. netgen/include/hdivhofe.hpp +0 -447
  83. netgen/include/hdivhofe_impl.hpp +0 -1107
  84. netgen/include/hdivhofefo.hpp +0 -229
  85. netgen/include/hdivhofespace.hpp +0 -175
  86. netgen/include/hdivhosurfacefespace.hpp +0 -106
  87. netgen/include/hdivlofe.hpp +0 -773
  88. netgen/include/hidden.hpp +0 -74
  89. netgen/include/householder.hpp +0 -181
  90. netgen/include/hypre_ams_precond.hpp +0 -123
  91. netgen/include/hypre_precond.hpp +0 -73
  92. netgen/include/integrator.hpp +0 -2024
  93. netgen/include/integratorcf.hpp +0 -253
  94. netgen/include/interpolate.hpp +0 -49
  95. netgen/include/intrule.hpp +0 -2541
  96. netgen/include/irspace.hpp +0 -49
  97. netgen/include/jacobi.hpp +0 -136
  98. netgen/include/l2hofe.hpp +0 -193
  99. netgen/include/l2hofe_impl.hpp +0 -564
  100. netgen/include/l2hofefo.hpp +0 -542
  101. netgen/include/l2hofespace.hpp +0 -344
  102. netgen/include/la.hpp +0 -38
  103. netgen/include/linearform.hpp +0 -266
  104. netgen/include/matrix.hpp +0 -2140
  105. netgen/include/memusage.hpp +0 -41
  106. netgen/include/meshaccess.hpp +0 -1358
  107. netgen/include/mgpre.hpp +0 -204
  108. netgen/include/mptools.hpp +0 -2145
  109. netgen/include/multigrid.hpp +0 -42
  110. netgen/include/multivector.hpp +0 -447
  111. netgen/include/mumpsinverse.hpp +0 -187
  112. netgen/include/mycomplex.hpp +0 -361
  113. netgen/include/ng_lapack.hpp +0 -1661
  114. netgen/include/ngblas.hpp +0 -1099
  115. netgen/include/ngs_defines.hpp +0 -30
  116. netgen/include/ngs_stdcpp_include.hpp +0 -106
  117. netgen/include/ngs_utils.hpp +0 -121
  118. netgen/include/ngsobject.hpp +0 -1019
  119. netgen/include/ngsstream.hpp +0 -113
  120. netgen/include/ngstd.hpp +0 -72
  121. netgen/include/nodalhofe.hpp +0 -96
  122. netgen/include/nodalhofe_impl.hpp +0 -141
  123. netgen/include/normalfacetfe.hpp +0 -223
  124. netgen/include/normalfacetfespace.hpp +0 -98
  125. netgen/include/normalfacetsurfacefespace.hpp +0 -84
  126. netgen/include/order.hpp +0 -251
  127. netgen/include/parallel_matrices.hpp +0 -222
  128. netgen/include/paralleldofs.hpp +0 -340
  129. netgen/include/parallelngs.hpp +0 -23
  130. netgen/include/parallelvector.hpp +0 -269
  131. netgen/include/pardisoinverse.hpp +0 -200
  132. netgen/include/periodic.hpp +0 -125
  133. netgen/include/plateaufespace.hpp +0 -25
  134. netgen/include/pml.hpp +0 -275
  135. netgen/include/pmltrafo.hpp +0 -631
  136. netgen/include/postproc.hpp +0 -142
  137. netgen/include/precomp.hpp +0 -60
  138. netgen/include/preconditioner.hpp +0 -602
  139. netgen/include/prolongation.hpp +0 -235
  140. netgen/include/python_comp.hpp +0 -107
  141. netgen/include/python_fem.hpp +0 -89
  142. netgen/include/python_linalg.hpp +0 -58
  143. netgen/include/python_ngstd.hpp +0 -385
  144. netgen/include/recursive_pol.hpp +0 -4844
  145. netgen/include/recursive_pol_tet.hpp +0 -395
  146. netgen/include/recursive_pol_trig.hpp +0 -492
  147. netgen/include/reorderedfespace.hpp +0 -81
  148. netgen/include/sample_sort.hpp +0 -105
  149. netgen/include/scalarfe.hpp +0 -335
  150. netgen/include/shapefunction_utils.hpp +0 -113
  151. netgen/include/simd_complex.hpp +0 -284
  152. netgen/include/smoother.hpp +0 -253
  153. netgen/include/solve.hpp +0 -89
  154. netgen/include/sparsecholesky.hpp +0 -313
  155. netgen/include/sparsematrix.hpp +0 -1038
  156. netgen/include/sparsematrix_dyn.hpp +0 -91
  157. netgen/include/sparsematrix_impl.hpp +0 -920
  158. netgen/include/special_matrix.hpp +0 -461
  159. netgen/include/specialelement.hpp +0 -125
  160. netgen/include/statushandler.hpp +0 -33
  161. netgen/include/stringops.hpp +0 -12
  162. netgen/include/superluinverse.hpp +0 -136
  163. netgen/include/symbolicintegrator.hpp +0 -849
  164. netgen/include/symmetricmatrix.hpp +0 -144
  165. netgen/include/tangentialfacetfe.hpp +0 -224
  166. netgen/include/tangentialfacetfespace.hpp +0 -106
  167. netgen/include/tensor.hpp +0 -522
  168. netgen/include/tensorcoefficient.hpp +0 -446
  169. netgen/include/tensorproductintegrator.hpp +0 -113
  170. netgen/include/thcurlfe.hpp +0 -128
  171. netgen/include/thcurlfe_impl.hpp +0 -380
  172. netgen/include/thdivfe.hpp +0 -80
  173. netgen/include/thdivfe_impl.hpp +0 -426
  174. netgen/include/tpdiffop.hpp +0 -461
  175. netgen/include/tpfes.hpp +0 -133
  176. netgen/include/tpintrule.hpp +0 -224
  177. netgen/include/triangular.hpp +0 -465
  178. netgen/include/tscalarfe.hpp +0 -245
  179. netgen/include/tscalarfe_impl.hpp +0 -1029
  180. netgen/include/umfpackinverse.hpp +0 -148
  181. netgen/include/vector.hpp +0 -1219
  182. netgen/include/voxelcoefficientfunction.hpp +0 -41
  183. netgen/include/vtkoutput.hpp +0 -198
  184. netgen/include/vvector.hpp +0 -208
  185. netgen/include/webgui.hpp +0 -92
  186. netgen/libngbla.dylib +0 -0
  187. netgen/libngcomp.dylib +0 -0
  188. netgen/libngfem.dylib +0 -0
  189. netgen/libngla.dylib +0 -0
  190. netgen/libngsolve.dylib +0 -0
  191. netgen/libngstd.dylib +0 -0
  192. ngsolve/__init__.pyi +0 -231
  193. ngsolve/bla.pyi +0 -1139
  194. ngsolve/bvp.pyi +0 -32
  195. ngsolve/cmake/NGSolveConfig.cmake +0 -102
  196. ngsolve/cmake/ngsolve-targets-release.cmake +0 -69
  197. ngsolve/cmake/ngsolve-targets.cmake +0 -163
  198. ngsolve/comp/__init__.pyi +0 -5382
  199. ngsolve/comp/pml.pyi +0 -89
  200. ngsolve/config/__init__.py +0 -1
  201. ngsolve/config/__init__.pyi +0 -43
  202. ngsolve/config/__main__.py +0 -4
  203. ngsolve/config/config.py +0 -60
  204. ngsolve/config/config.pyi +0 -45
  205. ngsolve/demos/TensorProduct/__init__.py +0 -0
  206. ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +0 -80
  207. ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +0 -73
  208. ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +0 -72
  209. ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +0 -66
  210. ngsolve/demos/__init__.py +0 -0
  211. ngsolve/demos/howto/__init__.py +0 -0
  212. ngsolve/demos/howto/hhj.py +0 -44
  213. ngsolve/demos/howto/hybrid_dg.py +0 -53
  214. ngsolve/demos/howto/mixed.py +0 -30
  215. ngsolve/demos/howto/nonlin.py +0 -29
  216. ngsolve/demos/howto/pickling.py +0 -26
  217. ngsolve/demos/howto/pml.py +0 -31
  218. ngsolve/demos/howto/taskmanager.py +0 -20
  219. ngsolve/demos/howto/tdnns.py +0 -47
  220. ngsolve/demos/howto/timeDG-skeleton.py +0 -45
  221. ngsolve/demos/howto/timeDG.py +0 -38
  222. ngsolve/demos/howto/timeDGlap.py +0 -42
  223. ngsolve/demos/howto/timeDGwave.py +0 -61
  224. ngsolve/demos/intro/__init__.py +0 -0
  225. ngsolve/demos/intro/adaptive.py +0 -123
  226. ngsolve/demos/intro/cmagnet.py +0 -62
  227. ngsolve/demos/intro/elasticity.py +0 -76
  228. ngsolve/demos/intro/navierstokes.py +0 -74
  229. ngsolve/demos/intro/poisson.ipynb +0 -170
  230. ngsolve/demos/intro/poisson.py +0 -41
  231. ngsolve/demos/mpi/__init__.py +0 -0
  232. ngsolve/demos/mpi/mpi_cmagnet.py +0 -87
  233. ngsolve/demos/mpi/mpi_navierstokes.py +0 -117
  234. ngsolve/demos/mpi/mpi_poisson.py +0 -89
  235. ngsolve/demos/mpi/mpi_timeDG.py +0 -82
  236. ngsolve/directsolvers.pyi +0 -18
  237. ngsolve/eigenvalues.pyi +0 -30
  238. ngsolve/fem.pyi +0 -1707
  239. ngsolve/krylovspace.pyi +0 -309
  240. ngsolve/la.pyi +0 -1218
  241. ngsolve/ngslib.so +0 -0
  242. ngsolve/ngstd.pyi +0 -58
  243. ngsolve/nonlinearsolvers.pyi +0 -98
  244. ngsolve/preconditioners.pyi +0 -6
  245. ngsolve/solve.pyi +0 -108
  246. ngsolve/solvers.pyi +0 -14
  247. ngsolve/timestepping.pyi +0 -34
  248. ngsolve/timing.pyi +0 -57
  249. ngsolve/utils.pyi +0 -279
  250. ngsolve-6.2.2501.post16.dev1.data/data/Netgen.icns +0 -0
  251. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngscxx +0 -17
  252. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngsld +0 -13
  253. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngsolve.tcl +0 -648
  254. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngspy +0 -2
  255. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/beam.geo +0 -17
  256. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/beam.vol +0 -240
  257. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/chip.in2d +0 -41
  258. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/chip.vol +0 -614
  259. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coil.geo +0 -12
  260. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coil.vol +0 -2560
  261. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coilshield.geo +0 -24
  262. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coilshield.vol +0 -3179
  263. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/cube.geo +0 -19
  264. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/cube.vol +0 -1832
  265. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -50
  266. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d11_chip_nitsche.pde +0 -40
  267. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d1_square.pde +0 -43
  268. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d2_chip.pde +0 -35
  269. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d3_helmholtz.pde +0 -22
  270. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d4_cube.pde +0 -46
  271. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d5_beam.pde +0 -74
  272. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d6_shaft.pde +0 -73
  273. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d7_coil.pde +0 -50
  274. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d8_coilshield.pde +0 -49
  275. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d9_hybridDG.pde +0 -72
  276. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/doubleglazing.in2d +0 -27
  277. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/doubleglazing.vol +0 -737
  278. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  279. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/shaft.geo +0 -73
  280. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/shaft.vol +0 -4291
  281. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/square.in2d +0 -17
  282. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/square.vol +0 -149
  283. ngsolve-6.2.2501.post16.dev1.dist-info/RECORD +0 -304
  284. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/LICENSE +0 -0
  285. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/WHEEL +0 -0
  286. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/top_level.txt +0 -0
@@ -1,1659 +0,0 @@
1
- #ifndef FILE_BDBINTEGRATOR
2
- #define FILE_BDBINTEGRATOR
3
-
4
- /*********************************************************************/
5
- /* File: bdbintegrator.hpp */
6
- /* Author: Joachim Schoeberl */
7
- /* Date: 25. Mar. 2000 */
8
- /*********************************************************************/
9
-
10
- // #include "fastmat.hpp"
11
-
12
- #include "integrator.hpp"
13
- #include "diffop.hpp"
14
-
15
-
16
- namespace ngfem
17
- {
18
-
19
-
20
-
21
-
22
-
23
-
24
- /**
25
- Coefficient tensor.
26
- Base-class for template-polymorphismus.
27
- Provides application and transpose-application
28
- */
29
- template <class DMO, int DIM_DMAT>
30
- class DMatOp
31
- {
32
- public:
33
- // typedef double TSCAL;
34
- /// is coefficient tensor symmetric ?
35
- enum { SYMMETRIC = 1 };
36
-
37
- template <typename SCAL>
38
- static Mat<DIM_DMAT,DIM_DMAT,SCAL> GetMatrixType(SCAL s) { return SCAL(0); }
39
-
40
- template <typename FEL, typename MIR, typename MAT>
41
- void GenerateMatrixIR (const FEL & fel, const MIR & mir,
42
- const FlatArray<MAT> & dmats,
43
- LocalHeap & lh) const
44
- {
45
- for (int i = 0; i < mir.IR().GetNIP(); i++)
46
- static_cast<const DMO*>(this) -> GenerateMatrix (fel, mir[i], dmats[i], lh);
47
- }
48
-
49
-
50
- /// generate linearized matrix in linearization point vec
51
- template <typename FEL, typename MIP, typename VEC, typename MAT>
52
- void GenerateLinearizedMatrix (const FEL & fel, const MIP & mip, VEC & vec,
53
- MAT & mat, LocalHeap & lh) const
54
- {
55
- static_cast<const DMO*>(this) -> GenerateMatrix (fel, mip, mat, lh);
56
- }
57
-
58
- /// apply coefficient matrix.
59
- template <typename FEL, typename MIP, class TVX, class TVY>
60
- void Apply (const FEL & fel, const MIP & mip,
61
- const TVX & x, TVY && y,
62
- LocalHeap & lh) const
63
- {
64
- Mat<DMO::DIM_DMAT, DMO::DIM_DMAT, double> mat;
65
- static_cast<const DMO*>(this) -> GenerateMatrix (fel, mip, mat, lh);
66
- y = mat * x;
67
- }
68
-
69
-
70
- template <typename FEL, typename MIP, class TVX, class TVY>
71
- void ApplyLinearized (const FEL & fel, const MIP & mip,
72
- const TVX & lin, const TVX & x, TVY & y,
73
- LocalHeap & lh) const
74
- {
75
- Mat<DMO::DIM_DMAT, DMO::DIM_DMAT, typename TVX::TSCAL> mat;
76
- static_cast<const DMO*>(this) -> GenerateLinearizedMatrix (fel, mip, lin, mat, lh);
77
- y = mat * x;
78
- }
79
-
80
- template <typename FEL, typename MIP, class TVX>
81
- void Apply1 (const FEL & fel, const MIP & mip,
82
- TVX && x, LocalHeap & lh) const
83
- {
84
- Vec<DMO::DIM_DMAT, typename remove_reference<TVX>::type::TSCAL> y;
85
- static_cast<const DMO*>(this) -> Apply (fel, mip, x, y, lh);
86
- x = y;
87
- }
88
-
89
- template <typename FEL, typename MIR, typename TVX>
90
- void ApplyIR (const FEL & fel, const MIR & mir,
91
- TVX & x, LocalHeap & lh) const
92
- {
93
- for (int i = 0; i < mir.Size(); i++)
94
- static_cast<const DMO*>(this) -> Apply1 (fel, mir[i], x.Row(i), lh);
95
- }
96
-
97
-
98
- template <typename FEL, typename MIP, class TVX, class TVY>
99
- void ApplyInv (const FEL & fel, const MIP & mip,
100
- const TVX & x, TVY && y,
101
- LocalHeap & lh) const
102
- {
103
- Mat<DMO::DIM_DMAT, DMO::DIM_DMAT, double> mat;
104
- Mat<DMO::DIM_DMAT, DMO::DIM_DMAT, double> inv;
105
-
106
- static_cast<const DMO*>(this) -> GenerateMatrix (fel, mip, mat, lh);
107
- CalcInverse (mat, inv);
108
- y = inv * x;
109
- }
110
-
111
- /// apply transpose coefficient tensor
112
- template <typename FEL, typename MIP, class TVX, class TVY>
113
- void ApplyTrans (const FEL & fel, const MIP & mip,
114
- const TVX & x, TVY & y,
115
- LocalHeap & lh) const
116
- {
117
- Mat<DMO::DIM_DMAT, DMO::DIM_DMAT, double> mat;
118
- static_cast<const DMO*>(this) -> GenerateMatrix (fel, mip, mat, lh);
119
- y = Trans (mat) * x;
120
- }
121
-
122
- /// computes energy
123
- template <typename FEL, typename MIP, class TVX>
124
- double Energy (const FEL & fel, const MIP & mip,
125
- const TVX & x, LocalHeap & lh) const
126
- {
127
- TVX y;
128
- static_cast<const DMO*>(this) -> Apply (fel, mip, x, y, lh);
129
- return 0.5 * InnerProduct (x,y);
130
- }
131
- };
132
-
133
-
134
- /*
135
- template <int H, int DIST, typename T1, typename T2, typename T3>
136
- void FastMat (FlatMatrixFixHeight<H,T1,DIST> a,
137
- FlatMatrixFixHeight<H,T2,DIST> b,
138
- FlatMatrix<T3> c)
139
- {
140
- FastMat<H> (a.Width(), DIST, a.Data(), b.Data(), c.Data());
141
- }
142
- */
143
-
144
-
145
- template <class DMATOP> // , int DIM_ELEMENT, int DIM_SPACE>
146
- class T_BDBIntegrator_DMat : public BilinearFormIntegrator
147
- {
148
- protected:
149
- DMATOP dmatop;
150
- DifferentialOperator * diffop = NULL;
151
- enum { DIM_DMAT = DMATOP::DIM_DMAT };
152
-
153
- public:
154
-
155
- T_BDBIntegrator_DMat (const Array<shared_ptr<CoefficientFunction>> & coeffs);
156
- // : dmatop(coeffs) { ; }
157
-
158
-
159
- /*
160
- T_BDBIntegrator_DMat (shared_ptr<CoefficientFunction> & c1)
161
- : dmatop(c1) { ; }
162
- */
163
-
164
- /*
165
- template <typename ... TMORE>
166
- T_BDBIntegrator_DMat (shared_ptr<CoefficientFunction> c1, TMORE ... more_coefs);
167
- // : dmatop(c1, more_coefs ...) { ; }
168
- */
169
-
170
- /*
171
- T_BDBIntegrator_DMat (const CoefficientFunction * coef)
172
- : dmatop(shared_ptr<CoefficientFunction> (const_cast<CoefficientFunction*>(coef), NOOP_Deleter))
173
- { ; }
174
- */
175
- ///
176
- T_BDBIntegrator_DMat (const DMATOP & admat);
177
- // : dmatop(admat) { ; }
178
-
179
- virtual ~T_BDBIntegrator_DMat () { delete diffop; }
180
-
181
- virtual xbool IsSymmetric () const override
182
- { return DMATOP::SYMMETRIC; }
183
-
184
- virtual int DimFlux () const override
185
- { return DMATOP::DIM_DMAT; }
186
-
187
- DMATOP & DMat () { return dmatop; }
188
- const DMATOP & DMat () const { return dmatop; }
189
-
190
-
191
- int GetIntegrationOrder (const FiniteElement & fel,
192
- const bool use_higher_integration_order = false) const
193
- {
194
- int order = 2 * fel.Order();
195
-
196
- ELEMENT_TYPE et = fel.ElementType();
197
-
198
- if (et == ET_TET || et == ET_TRIG || et == ET_SEGM)
199
- order -= 2 * diffop->DiffOrder();
200
-
201
- if (common_integration_order >= 0)
202
- order = common_integration_order;
203
-
204
- if (integration_order >= 0)
205
- order = integration_order;
206
-
207
- if(use_higher_integration_order && higher_integration_order > order)
208
- order = higher_integration_order;
209
-
210
- return order;
211
- }
212
-
213
-
214
- IntegrationRule GetIntegrationRule (const FiniteElement & fel,
215
- const bool use_higher_integration_order = false) const
216
- {
217
- // return std::move(IntegrationRule (fel.ElementType(), GetIntegrationOrder(fel, use_higher_integration_order)));
218
- // return IntegrationRule (fel.ElementType(), GetIntegrationOrder(fel, use_higher_integration_order));
219
- return { fel.ElementType(), GetIntegrationOrder(fel, use_higher_integration_order) };
220
- }
221
-
222
-
223
-
224
- virtual void ApplyDMat (const FiniteElement & bfel,
225
- const BaseMappedIntegrationPoint & bmip,
226
- FlatVector<double> elx,
227
- FlatVector<double> eldx,
228
- LocalHeap & lh) const override
229
- {
230
- dmatop.Apply(bfel, bmip,
231
- // static_cast<const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> &>(bmip),
232
- elx, eldx ,lh);
233
- }
234
-
235
- virtual void ApplyDMat (const FiniteElement & bfel,
236
- const BaseMappedIntegrationPoint & bmip,
237
- FlatVector<Complex> elx,
238
- FlatVector<Complex> eldx,
239
- LocalHeap & lh) const override
240
- {
241
- dmatop.Apply(bfel, bmip,
242
- // static_cast<const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> &>(bmip),
243
- elx,eldx,lh);
244
- }
245
-
246
- virtual void ApplyDMat (const FiniteElement & bfel,
247
- const BaseMappedIntegrationRule & bmir,
248
- FlatMatrix<double> elx,
249
- FlatMatrix<double> eldx,
250
- LocalHeap & lh) const override
251
- {
252
- // const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE> & mir =
253
- // static_cast<const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE>&> (bmir);
254
-
255
- for (int i = 0; i < bmir.Size(); i++)
256
- dmatop.Apply (bfel, bmir[i], elx.Row(i), eldx.Row(i), lh);
257
- }
258
-
259
- virtual void ApplyDMatInv (const FiniteElement & bfel,
260
- const BaseMappedIntegrationRule & bmir,
261
- FlatMatrix<double> elx,
262
- FlatMatrix<double> eldx,
263
- LocalHeap & lh) const override
264
- {
265
- // const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE> & mir =
266
- // static_cast<const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE>&> (bmir);
267
-
268
- for (int i = 0; i < bmir.Size(); i++)
269
- dmatop.ApplyInv (bfel, bmir[i], elx.Row(i), eldx.Row(i), lh);
270
- }
271
-
272
-
273
- virtual void ApplyDMat (const FiniteElement & bfel,
274
- const BaseMappedIntegrationRule & bmir,
275
- FlatMatrix<Complex> elx,
276
- FlatMatrix<Complex> eldx,
277
- LocalHeap & lh) const override
278
- {
279
- // const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE> & mir =
280
- // static_cast<const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE>&> (bmir);
281
-
282
- for (int i = 0; i < bmir.Size(); i++)
283
- dmatop.Apply (bfel, bmir[i], elx.Row(i), eldx.Row(i), lh);
284
- }
285
-
286
-
287
-
288
-
289
-
290
- virtual void
291
- CalcFlux (const FiniteElement & fel,
292
- const BaseMappedIntegrationPoint & bmip,
293
- BareSliceVector<double> elx,
294
- FlatVector<double> flux,
295
- bool applyd,
296
- LocalHeap & lh) const override
297
- {
298
- diffop -> Apply (fel, bmip, elx, flux, lh);
299
-
300
- FlatVec<DMATOP::DIM_DMAT,double> hflux(&flux(0));
301
- if (applyd)
302
- dmatop.Apply1 (fel, bmip, hflux, lh);
303
- }
304
-
305
- virtual void
306
- CalcFlux (const FiniteElement & fel,
307
- const BaseMappedIntegrationRule & bmir,
308
- BareSliceVector<double> elx,
309
- BareSliceMatrix<double> flux,
310
- bool applyd,
311
- LocalHeap & lh) const override
312
- {
313
- diffop->Apply (fel, bmir, elx, flux, lh);
314
-
315
- FlatMatrixFixWidth<DMATOP::DIM_DMAT,double> hflux(bmir.Size(), &flux(0,0));
316
- if (applyd)
317
- dmatop.ApplyIR (fel, bmir, hflux, lh);
318
- }
319
-
320
- virtual void
321
- CalcFlux (const FiniteElement & fel,
322
- const BaseMappedIntegrationPoint & bmip,
323
- BareSliceVector<Complex> elx,
324
- FlatVector<Complex> flux,
325
- bool applyd,
326
- LocalHeap & lh) const override
327
- {
328
- diffop->Apply (fel, bmip, elx, flux, lh);
329
-
330
- FlatVec<DMATOP::DIM_DMAT,Complex> hflux(&flux(0));
331
- if (applyd)
332
- dmatop.Apply1 (fel, bmip, hflux, lh);
333
- }
334
-
335
- virtual void
336
- CalcFlux (const FiniteElement & fel,
337
- const BaseMappedIntegrationRule & bmir,
338
- BareSliceVector<Complex> elx,
339
- BareSliceMatrix<Complex> flux,
340
- bool applyd,
341
- LocalHeap & lh) const override
342
- {
343
- diffop->Apply (fel, bmir, elx, flux, lh);
344
-
345
- FlatMatrixFixWidth<DMATOP::DIM_DMAT,Complex> hflux(bmir.Size(), &flux(0,0));
346
- if (applyd)
347
- dmatop.ApplyIR (fel, bmir, hflux, lh);
348
- }
349
-
350
-
351
-
352
-
353
- virtual void
354
- CalcFluxMulti (const FiniteElement & fel,
355
- const BaseMappedIntegrationPoint & mip,
356
- int m,
357
- FlatVector<double> elx,
358
- FlatVector<double> flux,
359
- bool applyd,
360
- LocalHeap & lh) const override
361
- {
362
- int ndof = fel.GetNDof();
363
- int dimension = this->GetDimension();
364
- FlatMatrixFixHeight<DIM_DMAT> bmat (ndof * dimension, lh);
365
-
366
- diffop->CalcMatrix (fel, mip, bmat, lh);
367
-
368
- if (applyd)
369
- {
370
- Vec<DIM_DMAT> hv1;
371
- Mat<DIM_DMAT,DIM_DMAT> dmat;
372
- dmatop.GenerateMatrix (fel, mip, dmat, lh);
373
-
374
- for (int i = 0; i < m; i++)
375
- {
376
- SliceVector<double> slice_x (ndof*dimension, m, &const_cast<double&> (elx(i)));
377
- SliceVector<double> slice_flux (DIM_DMAT, m, &flux(i));
378
- hv1 = bmat * slice_x;
379
- slice_flux = dmat * hv1;
380
- }
381
- }
382
- else
383
- {
384
- for (int i = 0; i < m; i++)
385
- {
386
- // SliceVector<double> slice_x (ndof*DIM, m, &const_cast<double&> (elx(i)));
387
- SliceVector<double> slice_x (ndof*dimension, m, &elx(i));
388
- SliceVector<double> slice_flux (DIM_DMAT, m, &flux(i));
389
- slice_flux = bmat * slice_x;
390
- }
391
- }
392
- }
393
-
394
-
395
-
396
- virtual void
397
- ApplyBTrans (const FiniteElement & fel,
398
- const BaseMappedIntegrationPoint & bmip,
399
- FlatVector<double> elx,
400
- FlatVector<double> ely,
401
- LocalHeap & lh) const override
402
- {
403
- diffop->ApplyTrans (fel, bmip, elx, ely, lh);
404
- }
405
-
406
-
407
- virtual void
408
- ApplyBTrans (const FiniteElement & fel,
409
- const BaseMappedIntegrationPoint & bmip,
410
- FlatVector<Complex> elx,
411
- FlatVector<Complex> ely,
412
- LocalHeap & lh) const override
413
- {
414
- diffop->ApplyTrans (fel, bmip, elx, ely, lh);
415
- }
416
-
417
-
418
- virtual void
419
- ApplyBTrans (const FiniteElement & fel,
420
- const BaseMappedIntegrationRule & bmir,
421
- FlatMatrix<double> elx,
422
- FlatVector<double> ely,
423
- LocalHeap & lh) const override
424
- {
425
- // const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE> & mir =
426
- // static_cast<const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE>&> (bmir);
427
- diffop->ApplyTrans (fel, bmir, elx, ely, lh);
428
- }
429
-
430
-
431
- virtual void
432
- ApplyElementMatrix (const FiniteElement & bfel,
433
- const ElementTransformation & eltrans,
434
- const FlatVector<double> elx,
435
- FlatVector<double> ely,
436
- void * precomputed,
437
- LocalHeap & lh) const override
438
- {
439
- T_ApplyElementMatrix<double> (bfel, eltrans, elx, ely, precomputed, lh);
440
- }
441
-
442
- virtual void
443
- ApplyElementMatrix (const FiniteElement & bfel,
444
- const ElementTransformation & eltrans,
445
- FlatVector<Complex> elx,
446
- FlatVector<Complex> ely,
447
- void * precomputed,
448
- LocalHeap & lh) const override
449
- {
450
- T_ApplyElementMatrix<Complex> (bfel, eltrans, elx, ely, precomputed, lh);
451
- }
452
-
453
-
454
- template <typename TSCAL>
455
- void T_ApplyElementMatrix (const FiniteElement & fel,
456
- const ElementTransformation & eltrans,
457
- FlatVector<TSCAL> elx,
458
- FlatVector<TSCAL> ely,
459
- void * precomputed,
460
- LocalHeap & lh) const
461
- {
462
- const IntegrationRule & ir = GetIntegrationRule (fel,eltrans.HigherIntegrationOrderSet());
463
- BaseMappedIntegrationRule & mir = eltrans(ir, lh);
464
-
465
- FlatMatrixFixWidth<DMATOP::DIM_DMAT, TSCAL> hv1(ir.GetNIP(), lh);
466
- diffop->Apply (fel, mir, elx, hv1, lh);
467
- dmatop.ApplyIR (fel, mir, hv1, lh);
468
- for (int i = 0; i < mir.Size(); i++)
469
- hv1.Row(i) *= mir[i].GetWeight();
470
- diffop->ApplyTrans (fel, mir, hv1, ely, lh);
471
- }
472
-
473
-
474
- ///
475
- virtual void
476
- ApplyMixedElementMatrix (const FiniteElement & bfel1,
477
- const FiniteElement & bfel2,
478
- const ElementTransformation & eltrans,
479
- FlatVector<double> elx,
480
- FlatVector<double> ely,
481
- LocalHeap & lh) const
482
- {
483
- HeapReset hr1 (lh);
484
-
485
- ely = 0;
486
-
487
- Vec<DIM_DMAT,double> hv1;
488
- Vec<DIM_DMAT,double> hv2;
489
-
490
- FlatVector<double> hely (ely.Size(), lh);
491
-
492
- const IntegrationRule & ir = GetIntegrationRule (bfel2,eltrans.HigherIntegrationOrderSet());
493
-
494
- for (int i = 0; i < ir.GetNIP(); i++)
495
- {
496
- HeapReset hr (lh);
497
- BaseMappedIntegrationPoint & mip = eltrans(ir[i], lh);
498
- // MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> mip (ir[i], eltrans);
499
-
500
- diffop->Apply (bfel1, mip, elx, hv1, lh);
501
- dmatop.Apply (bfel1, mip, hv1, hv2, lh);
502
- diffop->ApplyTrans (bfel2, mip, hv2, hely, lh);
503
-
504
- ely += mip.GetWeight() * hely;
505
- }
506
- }
507
-
508
-
509
-
510
-
511
-
512
- virtual void
513
- CalcElementMatrixDiag (const FiniteElement & fel,
514
- const ElementTransformation & eltrans,
515
- FlatVector<double> diag,
516
- LocalHeap & lh) const override
517
- {
518
- try
519
- {
520
- // diag.AssignMemory (ndof*DIM, lh);
521
- diag = 0.0;
522
-
523
- FlatMatrixFixHeight<DIM_DMAT, double> bmat (diag.Size(), lh);
524
- Mat<DIM_DMAT,DIM_DMAT> dmat;
525
-
526
- const IntegrationRule & ir = GetIntegrationRule (fel,eltrans.HigherIntegrationOrderSet());
527
-
528
- for (int i = 0; i < ir.GetNIP(); i++)
529
- {
530
- HeapReset hr(lh);
531
- BaseMappedIntegrationPoint & mip = eltrans(ir[i], lh);
532
-
533
- diffop->CalcMatrix (fel, mip, bmat, lh);
534
- dmatop.GenerateMatrix (fel, mip, dmat, lh);
535
-
536
- double fac = mip.GetWeight();
537
- for (int j = 0; j < diag.Size(); j++)
538
- {
539
- Vec<DIM_DMAT> hv = dmat * bmat.Col(j);
540
- diag(j) += fac * InnerProduct (bmat.Col(j), hv);
541
- }
542
- }
543
- }
544
-
545
- catch (Exception & e)
546
- {
547
- e.Append ("in CalcElementMatrixDiag, type = ");
548
- e.Append (typeid(*this).name());
549
- e.Append ("\n");
550
- throw;
551
- }
552
- catch (exception & e)
553
- {
554
- Exception e2(e.what());
555
- e2.Append ("\nin CalcElementMatrixDiag, type = ");
556
- e2.Append (typeid(*this).name());
557
- e2.Append ("\n");
558
- throw e2;
559
- }
560
- }
561
-
562
-
563
-
564
- };
565
-
566
-
567
-
568
- /*
569
- template <class DMATOP, int DIM_ELEMENT, int DIM_SPACE>
570
- T_BDBIntegrator_DMat<DMATOP,DIM_ELEMENT, DIM_SPACE>::
571
- T_BDBIntegrator_DMat (const Array<shared_ptr<CoefficientFunction>> & coeffs)
572
- : dmatop(coeffs) { ; }
573
-
574
- template <class DMATOP, int DIM_ELEMENT, int DIM_SPACE> template <typename ... TMORE>
575
- T_BDBIntegrator_DMat<DMATOP,DIM_ELEMENT, DIM_SPACE>::
576
- T_BDBIntegrator_DMat (shared_ptr<CoefficientFunction> c1, TMORE ... more_coefs)
577
- : dmatop(c1, more_coefs ...) { ; }
578
-
579
-
580
- template <class DMATOP, int DIM_ELEMENT, int DIM_SPACE>
581
- T_BDBIntegrator_DMat<DMATOP,DIM_ELEMENT, DIM_SPACE>::
582
- T_BDBIntegrator_DMat (const DMATOP & admat)
583
- : dmatop(admat) { ; }
584
- */
585
-
586
- template <class DMATOP>
587
- T_BDBIntegrator_DMat<DMATOP>::
588
- T_BDBIntegrator_DMat (const Array<shared_ptr<CoefficientFunction>> & coeffs)
589
- : dmatop(coeffs) { ; }
590
-
591
- /*
592
- template <class DMATOP> template <typename ... TMORE>
593
- T_BDBIntegrator_DMat<DMATOP>::
594
- T_BDBIntegrator_DMat (shared_ptr<CoefficientFunction> c1, TMORE ... more_coefs)
595
- : dmatop(c1, more_coefs ...) { ; }
596
- */
597
-
598
- template <class DMATOP>
599
- T_BDBIntegrator_DMat<DMATOP>::
600
- T_BDBIntegrator_DMat (const DMATOP & admat)
601
- : dmatop(admat) { ; }
602
-
603
-
604
-
605
-
606
-
607
- /**
608
- Element assembling.
609
- Assembling for bilinear-forms of type $\int (B v) : D (B u) dx$. \\
610
- Template argument DiffOp provides differential operator, i.e. B matrix,
611
- (e.g. gradient, strain operator, curl,...) \\
612
- DmatOp provides d-matrix (e.g. diagonal, anisotropic, plane stress, ...) \\
613
- FEL is element type to assemble matrix for (ScalarFiniteElement,
614
- HCurlFiniteElement, FE_Trig1, ...)
615
- */
616
- template <class DIFFOP, class DMATOP, class FEL = FiniteElement>
617
- class T_BDBIntegrator : public T_BDBIntegrator_DMat<DMATOP /* , DIFFOP::DIM_ELEMENT, DIFFOP::DIM_SPACE */ >
618
- {
619
- protected:
620
- typedef T_BDBIntegrator_DMat<DMATOP /* , DIFFOP::DIM_ELEMENT, DIFFOP::DIM_SPACE */ > BASE;
621
-
622
- using BASE::diffop;
623
-
624
- public:
625
-
626
- enum { DIM_SPACE = DIFFOP::DIM_SPACE };
627
- enum { DIM_ELEMENT = DIFFOP::DIM_ELEMENT };
628
- enum { DIM_DMAT = DIFFOP::DIM_DMAT };
629
- enum { DIM = DIFFOP::DIM };
630
-
631
- using BASE::Name;
632
- using BASE::integration_order;
633
- using BASE::higher_integration_order;
634
- using BASE::common_integration_order;
635
- using BASE::GetIntegrationOrder;
636
- using BASE::GetIntegrationRule;
637
-
638
- using BASE::dmatop;
639
-
640
- /// inherited constructors
641
- // using BASE::T_BDBIntegrator_DMat;
642
-
643
-
644
- T_BDBIntegrator (const Array<shared_ptr<CoefficientFunction>> & coeffs)
645
- : BASE(coeffs)
646
- {
647
- diffop = new T_DifferentialOperator<DIFFOP>;
648
- }
649
-
650
- T_BDBIntegrator (const shared_ptr<CoefficientFunction> & c1)
651
- : BASE(c1)
652
- {
653
- diffop = new T_DifferentialOperator<DIFFOP>;
654
- }
655
-
656
- /*
657
- template <typename ... TMORE>
658
- T_BDBIntegrator (shared_ptr<CoefficientFunction> c1, TMORE ... more_coefs)
659
- : BASE(c1, more_coefs ...)
660
- {
661
- diffop = new T_DifferentialOperator<DIFFOP>;
662
- }
663
- */
664
-
665
- /*
666
- T_BDBIntegrator (const CoefficientFunction * coef)
667
- : BASE (coef)
668
- {
669
- diffop = new T_DifferentialOperator<DIFFOP>;
670
- }
671
- */
672
-
673
- T_BDBIntegrator (const DMATOP & admat)
674
- : BASE(admat)
675
- {
676
- diffop = new T_DifferentialOperator<DIFFOP>;
677
- }
678
-
679
-
680
-
681
- /*
682
- template <typename ... ARGS>
683
- T_BDBIntegrator (ARGS ... args)
684
- : BASE(args...)
685
- {
686
- diffop = make_shared<T_DifferentialOperator<DIFFOP>>();
687
- }
688
- */
689
-
690
- ///
691
- virtual ~T_BDBIntegrator () { ; }
692
-
693
- ///
694
- virtual int GetDimension () const { return DIM; }
695
-
696
- ///
697
- //virtual bool BoundaryForm () const
698
- //{ return int(DIM_SPACE) > int(DIM_ELEMENT); }
699
- virtual VorB VB() const
700
- { return VorB(int(DIM_SPACE)-int(DIM_ELEMENT)); }
701
- virtual int DimElement () const
702
- { return DIM_ELEMENT; }
703
-
704
- virtual int DimSpace () const
705
- { return DIM_SPACE; }
706
-
707
- virtual void CheckElement (const FiniteElement & el) const
708
- {
709
- if (!dynamic_cast<const FEL*> (&el) )
710
- {
711
- string err("Element does not match integrator\n");
712
- err += "element type is ";
713
- err += typeid(el).name();
714
- err += " expected type is ";
715
- err += typeid(FEL).name();
716
- err += " integrator is ";
717
- err += Name();
718
- throw Exception (err);
719
- /*
720
- throw Exception (string ("Element does not match integrator\n") +
721
- string ("element type is ") + typeid(el).name() +
722
- string (" expected type is ") + typeid(FEL).name() +
723
- string (" integrator is ") + Name());
724
- */
725
- }
726
- }
727
-
728
- virtual void
729
- CalcElementMatrix (const FiniteElement & bfel,
730
- const ElementTransformation & eltrans,
731
- FlatMatrix<double> elmat,
732
- LocalHeap & lh) const
733
- {
734
- T_CalcElementMatrix<double> (bfel, eltrans, elmat, lh);
735
- }
736
-
737
- virtual void
738
- CalcElementMatrix (const FiniteElement & bfel,
739
- const ElementTransformation & eltrans,
740
- FlatMatrix<Complex> elmat,
741
- LocalHeap & lh) const
742
- {
743
- T_CalcElementMatrix<Complex> (bfel, eltrans, elmat, lh);
744
- }
745
-
746
-
747
- #ifdef TEXT_BOOK_VERSION
748
-
749
- template <typename TSCAL>
750
- void T_CalcElementMatrix (const FiniteElement & fel,
751
- const ElementTransformation & eltrans,
752
- FlatMatrix<TSCAL> elmat,
753
- LocalHeap & lh) const
754
- {
755
- try
756
- {
757
- // const FEL & fel = static_cast<const FEL&> (bfel);
758
- int ndof = fel.GetNDof();
759
-
760
- elmat = 0;
761
-
762
- FlatMatrixFixHeight<DIM_DMAT, TSCAL> bmat (ndof * DIM, lh);
763
- FlatMatrixFixHeight<DIM_DMAT, TSCAL> dbmat (ndof * DIM, lh);
764
- Mat<DIM_DMAT,DIM_DMAT,TSCAL> dmat;
765
-
766
- const IntegrationRule & ir = GetIntegrationRule (fel,eltrans.HigherIntegrationOrderSet());
767
-
768
- for (int i = 0 ; i < ir.GetNIP(); i++)
769
- {
770
- HeapReset hr(lh);
771
-
772
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE>
773
- mip(ir[i], eltrans, lh);
774
-
775
- dmatop.GenerateMatrix (fel, mip, dmat, lh);
776
-
777
- DIFFOP::GenerateMatrix (fel, mip, bmat, lh);
778
- double fac = mip.GetMeasure() * mip.IP().Weight();
779
-
780
- dbmat = fac * (dmat * bmat);
781
- elmat += Trans (bmat) * dbmat;
782
- }
783
- }
784
-
785
- catch (Exception & e)
786
- {
787
- e.Append ("in CalcElementMatrix - textbook, type = ");
788
- e.Append (typeid(*this).name());
789
- e.Append ("\n");
790
- throw;
791
- }
792
- catch (exception & e)
793
- {
794
- Exception e2(e.what());
795
- e2.Append ("\nin CalcElementMatrix - textbook, type = ");
796
- e2.Append (typeid(*this).name());
797
- e2.Append ("\n");
798
- throw e2;
799
- }
800
- }
801
- #endif
802
-
803
-
804
-
805
-
806
- #ifdef __SSE3__
807
- // #define BLOCK_VERSION
808
- #endif
809
-
810
- // #ifdef __MIC__
811
- // #define BLOCK_VERSION
812
- // #endif
813
-
814
-
815
-
816
- #ifdef BLOCK_VERSION
817
-
818
- template <typename TSCAL>
819
- void T_CalcElementMatrix (const FiniteElement & fel,
820
- const ElementTransformation & eltrans,
821
- FlatMatrix<TSCAL> elmat,
822
- LocalHeap & lh) const
823
- {
824
- // static Timer timer(string ("Elementmatrix, ") + Name()); RegionTimer reg (timer);
825
- try
826
- {
827
- int ndof = fel.GetNDof();
828
- elmat = 0;
829
-
830
- enum { BLOCK = 4 * (6 / DIM_DMAT + 1) };
831
-
832
- HeapReset hr1(lh);
833
-
834
- #ifdef __MIC__
835
- enum { ROUNDUP = (DIM_DMAT*BLOCK+7) & (-8) };
836
- #else
837
- enum { ROUNDUP = (DIM_DMAT*BLOCK+3) & (-4) };
838
- #endif
839
-
840
- FlatMatrixFixHeight<DIM_DMAT*BLOCK, double, ROUNDUP> bbmat (ndof * DIM, lh);
841
- FlatMatrixFixHeight<DIM_DMAT*BLOCK, TSCAL, ROUNDUP> bdbmat (ndof * DIM, lh);
842
-
843
- typedef decltype (DMATOP::GetMatrixType(TSCAL(0))) TDMAT;
844
-
845
- IntegrationRule ir(fel.ElementType(),
846
- GetIntegrationOrder(fel,eltrans.HigherIntegrationOrderSet()));
847
-
848
- MappedIntegrationRule<DIM_ELEMENT, DIM_SPACE> mir(ir, eltrans, lh);
849
-
850
-
851
- FlatArray<TDMAT> dmats(ir.GetNIP(), lh);
852
- dmatop.GenerateMatrixIR (fel, mir, dmats, lh);
853
-
854
- int i = 0;
855
- for (int i1 = 0; i1 < ir.GetNIP() / BLOCK; i1++)
856
- {
857
- DIFFOP::GenerateMatrixIR (fel, mir.Range(i,i+BLOCK), bbmat, lh);
858
-
859
- for (int i2 = 0; i2 < BLOCK; i2++)
860
- {
861
- IntRange rows (i2*DIM_DMAT, (i2+1)*DIM_DMAT);
862
- TDMAT dmat = mir[i+i2].GetWeight() * dmats[i+i2];
863
- bdbmat.Rows(rows) = dmat * bbmat.Rows(rows);
864
- }
865
-
866
- i += BLOCK;
867
-
868
- if (DMATOP::SYMMETRIC)
869
- FastMat (bdbmat, bbmat, elmat);
870
- else
871
- elmat += Trans (bbmat.Rows(0,DIM_DMAT*BLOCK)) * bdbmat.Rows(0,DIM_DMAT*BLOCK);
872
- }
873
-
874
- int rest = ir.GetNIP()-i;
875
- if (rest > 0)
876
- {
877
- DIFFOP::GenerateMatrixIR (fel, mir.Range(i,ir.GetNIP()), bbmat, lh);
878
- for (int i2 = 0; i2 < rest; i2++)
879
- {
880
- IntRange rows (i2*DIM_DMAT, (i2+1)*DIM_DMAT);
881
- TDMAT dmat = mir[i+i2].GetWeight() * dmats[i+i2];
882
- bdbmat.Rows(rows) = dmat * bbmat.Rows(rows);
883
- }
884
-
885
- if (DMATOP::SYMMETRIC)
886
- {
887
- /*
888
- int j = 0;
889
- for ( ; j <= rest-4; j += 4)
890
- FastMat (FlatMatrixFixHeight<4*DIM_DMAT,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j*DIM_DMAT)),
891
- FlatMatrixFixHeight<4*DIM_DMAT,double, ROUNDUP> (ndof*DIM, &bbmat(j*DIM_DMAT)),
892
- elmat);
893
- if (j <= rest-2)
894
- {
895
- FastMat (FlatMatrixFixHeight<2*DIM_DMAT,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j*DIM_DMAT)),
896
- FlatMatrixFixHeight<2*DIM_DMAT,double, ROUNDUP> (ndof*DIM, &bbmat(j*DIM_DMAT)),
897
- elmat);
898
- j += 2;
899
- }
900
- if (j <= rest-1)
901
- FastMat (FlatMatrixFixHeight<DIM_DMAT,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j*DIM_DMAT)),
902
- FlatMatrixFixHeight<DIM_DMAT,double, ROUNDUP> (ndof*DIM, &bbmat(j*DIM_DMAT)),
903
- elmat);
904
- */
905
-
906
-
907
- int j = 0;
908
- int rd = rest*DIM_DMAT;
909
-
910
- for ( ; j <= rd-8; j += 8)
911
- /*
912
- FastMat (FlatMatrixFixHeight<8,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
913
- FlatMatrixFixHeight<8,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
914
- elmat);
915
- */
916
- FastMat(bdbmat.template Rows<8>(j), bbmat.template Rows<8>(j), elmat);
917
-
918
- switch (rd - j)
919
- {
920
- case 1:
921
- /*
922
- FastMat (FlatMatrixFixHeight<1,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
923
- FlatMatrixFixHeight<1,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
924
- elmat);
925
- */
926
- FastMat(bdbmat.template Rows<1>(j), bbmat.template Rows<1>(j), elmat);
927
- break;
928
- case 2:
929
- /*
930
- FastMat (FlatMatrixFixHeight<2,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
931
- FlatMatrixFixHeight<2,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
932
- elmat);
933
- */
934
- FastMat(bdbmat.template Rows<2>(j), bbmat.template Rows<2>(j), elmat);
935
- break;
936
- case 3:
937
- /*
938
- FastMat (FlatMatrixFixHeight<3,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
939
- FlatMatrixFixHeight<3,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
940
- elmat);
941
- */
942
- FastMat (bdbmat.template Rows<3>(j), bbmat.template Rows<3>(j), elmat);
943
- break;
944
- case 4:
945
- /*
946
- FastMat (FlatMatrixFixHeight<4,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
947
- FlatMatrixFixHeight<4,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
948
- elmat);
949
- */
950
- FastMat(bdbmat.template Rows<4>(j), bbmat.template Rows<4>(j), elmat);
951
- break;
952
- case 5:
953
- /*
954
- FastMat (FlatMatrixFixHeight<5,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
955
- FlatMatrixFixHeight<5,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
956
- elmat);
957
- */
958
- FastMat(bdbmat.template Rows<5>(j), bbmat.template Rows<5>(j), elmat);
959
- break;
960
- case 6:
961
- /*
962
- FastMat (FlatMatrixFixHeight<6,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
963
- FlatMatrixFixHeight<6,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
964
- elmat);
965
- */
966
- FastMat(bdbmat.template Rows<6>(j), bbmat.template Rows<6>(j), elmat);
967
- break;
968
- case 7:
969
- /*
970
- FastMat (FlatMatrixFixHeight<7,TSCAL, ROUNDUP> (ndof*DIM, &bdbmat(j)),
971
- FlatMatrixFixHeight<7,double, ROUNDUP> (ndof*DIM, &bbmat(j)),
972
- elmat);
973
- */
974
- FastMat(bdbmat.template Rows<7>(j), bbmat.template Rows<7>(j), elmat);
975
- break;
976
- default:
977
- ;
978
- }
979
- }
980
- else
981
- elmat += Trans (bbmat.Rows(0,rest*DIM_DMAT)) * bdbmat.Rows(0,rest*DIM_DMAT);
982
- }
983
-
984
-
985
- if (DMATOP::SYMMETRIC)
986
- {
987
- for (int i = 0; i < elmat.Height(); i++)
988
- for (int j = 0; j < i; j++)
989
- elmat(j,i) = elmat(i,j);
990
- }
991
-
992
- ir.NothingToDelete();
993
- }
994
-
995
- catch (Exception & e)
996
- {
997
- e.Append ("in CalcElementMatrix - blockversion, type = ");
998
- e.Append (typeid(*this).name());
999
- e.Append ("\n");
1000
- throw;
1001
- }
1002
- catch (exception & e)
1003
- {
1004
- Exception e2(e.what());
1005
- e2.Append ("\nin CalcElementMatrix - blockversion, type = ");
1006
- e2.Append (typeid(*this).name());
1007
- e2.Append ("\n");
1008
- throw e2;
1009
- }
1010
- }
1011
-
1012
-
1013
-
1014
- #else // blockversion
1015
- // one matrix matrix multiplication
1016
- ///
1017
- template <typename TSCAL>
1018
- void T_CalcElementMatrix (const FiniteElement & fel,
1019
- const ElementTransformation & eltrans,
1020
- FlatMatrix<TSCAL> elmat,
1021
- LocalHeap & lh) const
1022
- {
1023
- // static Timer timer (string ("Elementmatrix, ") + Name(), NoTracing);
1024
- // static Timer timer2 (string ("Elementmatrix, ") + Name() + ", Lapack", NoTracing, NoTiming);
1025
- // RegionTimer reg (timer);
1026
-
1027
- // try
1028
- {
1029
- // const FEL & fel = static_cast<const FEL&> (bfel);
1030
- int ndof = fel.GetNDof();
1031
-
1032
- HeapReset hr(lh);
1033
-
1034
- const IntegrationRule & ir = GetIntegrationRule (fel,eltrans.HigherIntegrationOrderSet());
1035
- MappedIntegrationRule<DIM_ELEMENT, DIM_SPACE> mir(ir, eltrans, lh);
1036
-
1037
- FlatMatrixFixHeight<DIM_DMAT> bmat (ndof * DIM, lh);
1038
- Mat<DIM_DMAT,DIM_DMAT,TSCAL> dmat;
1039
-
1040
- FlatMatrix<TSCAL> bbmat (ndof * DIM, DIM_DMAT*ir.GetNIP(), lh);
1041
- FlatMatrix<TSCAL> bdbmat (ndof * DIM, DIM_DMAT*ir.GetNIP(), lh);
1042
-
1043
- for (int i = 0; i < ir.GetNIP(); i++)
1044
- {
1045
- HeapReset hr(lh);
1046
- const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> & mip = mir[i];
1047
-
1048
- DIFFOP::GenerateMatrix (fel, mip, bmat, lh);
1049
- dmatop.GenerateMatrix (fel, mip, dmat, lh);
1050
- dmat *= mip.GetWeight();
1051
-
1052
- bbmat.Cols(i*DIM_DMAT, (i+1)*DIM_DMAT) = Trans (bmat);
1053
- bdbmat.Cols(i*DIM_DMAT, (i+1)*DIM_DMAT) = Trans (dmat * bmat);
1054
- }
1055
-
1056
- // RegionTimer reg2 (timer2);
1057
-
1058
- if (ndof < 20)
1059
- {
1060
- if (DMATOP::SYMMETRIC)
1061
- elmat = Symmetric ( bdbmat * Trans (bbmat));
1062
- else
1063
- elmat = bbmat * Trans (bdbmat);
1064
- }
1065
- else
1066
- elmat = bbmat * Trans(bdbmat) | Lapack;
1067
-
1068
- // timer.AddFlops (long(elmat.Height())*long(elmat.Width())*bbmat.Width());
1069
- }
1070
-
1071
- /*
1072
- catch (Exception & e)
1073
- {
1074
- e.Append (string ("in CalcElementMatrix - lapack, type = ") + typeid(*this).name() + "\n");
1075
- throw;
1076
- }
1077
- catch (exception & e)
1078
- {
1079
- Exception e2(e.what());
1080
- e2.Append (string ("\nin CalcElementMatrix - lapack, type = ") + typeid(*this).name() + "\n");
1081
- throw e2;
1082
- }
1083
- */
1084
- }
1085
-
1086
- #endif
1087
-
1088
-
1089
-
1090
- };
1091
-
1092
-
1093
-
1094
-
1095
-
1096
-
1097
-
1098
-
1099
-
1100
-
1101
-
1102
-
1103
-
1104
-
1105
-
1106
-
1107
-
1108
-
1109
-
1110
-
1111
-
1112
-
1113
-
1114
-
1115
- template <class DIFFOP, class DMATOP, class FEL = FiniteElement>
1116
- class T_NonlinearBDBIntegrator : public T_BDBIntegrator<DIFFOP, DMATOP, FEL>
1117
- {
1118
- protected:
1119
- enum { DIM_SPACE = DIFFOP::DIM_SPACE };
1120
- enum { DIM_ELEMENT = DIFFOP::DIM_ELEMENT };
1121
- enum { DIM_DMAT = DIFFOP::DIM_DMAT };
1122
- enum { DIM = DIFFOP::DIM };
1123
-
1124
- using T_BDBIntegrator<DIFFOP,DMATOP,FEL>::GetIntegrationRule;
1125
- using T_BDBIntegrator<DIFFOP,DMATOP,FEL>::diffop;
1126
-
1127
- public:
1128
- ///
1129
- T_NonlinearBDBIntegrator (const DMATOP & admat)
1130
- : T_BDBIntegrator<DIFFOP,DMATOP,FEL> (admat)
1131
- { ; }
1132
-
1133
- ///
1134
- virtual ~T_NonlinearBDBIntegrator ()
1135
- { ; }
1136
-
1137
-
1138
- virtual void
1139
- CalcLinearizedElementMatrix (const FiniteElement & fel,
1140
- const ElementTransformation & eltrans,
1141
- FlatVector<double> elveclin,
1142
- FlatMatrix<double> elmat,
1143
- LocalHeap & lh) const
1144
- {
1145
- // static Timer maintimer (string ("NonlinearBDB, CalcLinearized, ") + this->Name(), NoTracing);
1146
- // static Timer bdbtimer ("NonlinearBDB, bdb product", NoTracing, NoTiming);
1147
- // RegionTimer reg(maintimer);
1148
-
1149
- try
1150
- {
1151
- int ndof = fel.GetNDof();
1152
-
1153
- elmat = 0;
1154
-
1155
- FlatMatrixFixHeight<DIM_DMAT, double> bmat (ndof * DIM, lh);
1156
- FlatMatrixFixHeight<DIM_DMAT, double> dbmat (ndof * DIM, lh);
1157
- Vec<DIM_DMAT,double> hvlin;
1158
-
1159
- Mat<DIM_DMAT,DIM_DMAT> dmat;
1160
-
1161
- const IntegrationRule & ir = GetIntegrationRule (fel);
1162
-
1163
- for (int i = 0; i < ir.GetNIP(); i++)
1164
- {
1165
- HeapReset hr(lh);
1166
-
1167
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> mip(ir[i], eltrans);
1168
-
1169
- DIFFOP::Apply (fel, mip, elveclin, hvlin, lh);
1170
- DIFFOP::GenerateMatrix (fel, mip, bmat, lh);
1171
-
1172
- this->dmatop . GenerateLinearizedMatrix (fel, mip, hvlin, dmat, lh);
1173
-
1174
- double fac = mip.GetWeight();
1175
-
1176
- {
1177
- // NgProfiler::RegionTimer reg(bdbtimer);
1178
- dbmat = fac * (dmat * bmat);
1179
- elmat += Trans (bmat) * dbmat;
1180
- }
1181
- }
1182
- }
1183
-
1184
- catch (Exception & e)
1185
- {
1186
- e.Append ("in CalcLinearizedElementMatrix, type = ");
1187
- e.Append (typeid(*this).name());
1188
- e.Append ("\n");
1189
- throw;
1190
- }
1191
- catch (exception & e)
1192
- {
1193
- Exception e2(e.what());
1194
- e2.Append ("\nin CalcLinearizedElementMatrix, type = ");
1195
- e2.Append (typeid(*this).name());
1196
- e2.Append ("\n");
1197
- throw e2;
1198
- }
1199
- }
1200
-
1201
-
1202
-
1203
- virtual void
1204
- CalcLinearizedElementMatrix (const FiniteElement & bfel,
1205
- const ElementTransformation & eltrans,
1206
- FlatVector<Complex> elveclin,
1207
- FlatMatrix<Complex> elmat,
1208
- LocalHeap & lh) const
1209
- {
1210
- // static Timer maintimer (string ("NonlinearBDB, CalcLinearized<Complex>, ") + this->Name(), NoTracing);
1211
- // static Timer bdbtimer ("NonlinearBDB, bdb product", NoTracing, NoTiming);
1212
- // RegionTimer reg(maintimer);
1213
-
1214
- try
1215
- {
1216
- const FEL & fel = static_cast<const FEL&> (bfel);
1217
- int ndof = fel.GetNDof();
1218
-
1219
- elmat = 0;
1220
-
1221
- FlatMatrixFixHeight<DIM_DMAT, Complex> bmat (ndof * DIM, lh);
1222
- FlatMatrixFixHeight<DIM_DMAT, Complex> dbmat (ndof * DIM, lh);
1223
- Vec<DIM_DMAT,Complex> hvlin;
1224
-
1225
- Mat<DIM_DMAT,DIM_DMAT, Complex> dmat;
1226
-
1227
- const IntegrationRule & ir = GetIntegrationRule (fel);
1228
- MappedIntegrationRule<DIM_ELEMENT, DIM_SPACE> mir(ir, eltrans, lh);
1229
-
1230
-
1231
- FlatMatrix<Complex> bbmat (ndof * DIM, DIM_DMAT*ir.GetNIP(), lh);
1232
- FlatMatrix<Complex> bdbmat (ndof * DIM, DIM_DMAT*ir.GetNIP(), lh);
1233
-
1234
-
1235
- for (int i = 0; i < ir.GetNIP(); i++)
1236
- {
1237
- HeapReset hr(lh);
1238
-
1239
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> & mip = mir[i];
1240
-
1241
- diffop->Apply (fel, mip, elveclin, hvlin, lh);
1242
- DIFFOP::GenerateMatrix (fel, mip, bmat, lh);
1243
- this->dmatop . GenerateLinearizedMatrix (fel, mip, hvlin, dmat, lh);
1244
-
1245
- dmat *= mip.GetWeight();
1246
- bbmat.Cols(i*DIM_DMAT, (i+1)*DIM_DMAT) = Trans (bmat);
1247
- bdbmat.Cols(i*DIM_DMAT, (i+1)*DIM_DMAT) = Trans (dmat * bmat);
1248
- }
1249
-
1250
-
1251
- // RegionTimer reg(bdbtimer);
1252
-
1253
- if (ndof < 20)
1254
- {
1255
- if (DMATOP::SYMMETRIC)
1256
- elmat = Symmetric ( bdbmat * Trans (bbmat));
1257
- else
1258
- elmat = bbmat * Trans (bdbmat);
1259
- }
1260
- else
1261
- // LapackMultABt (bbmat, bdbmat, elmat);
1262
- // LapackMult (bbmat, Trans(bdbmat), elmat);
1263
- elmat = bbmat * Trans (bdbmat) | Lapack;
1264
- }
1265
-
1266
- catch (Exception & e)
1267
- {
1268
- e.Append ("in CalcLinearizedElementMatrix, type = ");
1269
- e.Append (typeid(*this).name());
1270
- e.Append ("\n");
1271
- throw;
1272
- }
1273
- catch (exception & e)
1274
- {
1275
- Exception e2(e.what());
1276
- e2.Append ("\nin CalcLinearizedElementMatrix, type = ");
1277
- e2.Append (typeid(*this).name());
1278
- e2.Append ("\n");
1279
- throw e2;
1280
- }
1281
- }
1282
-
1283
-
1284
-
1285
-
1286
-
1287
-
1288
-
1289
- ///
1290
- virtual void
1291
- ApplyLinearizedElementMatrix (const FiniteElement & fel,
1292
- const ElementTransformation & eltrans,
1293
- FlatVector<double> ellin,
1294
- FlatVector<double> elx,
1295
- FlatVector<double> ely,
1296
- LocalHeap & lh) const
1297
- {
1298
- // const FEL & fel = dynamic_cast<const FEL&> (bfel);
1299
- int ndof = fel.GetNDof ();
1300
-
1301
- ely = 0;
1302
-
1303
- Vec<DIM_DMAT,double> hvlin;
1304
- Vec<DIM_DMAT,double> hvx;
1305
- Vec<DIM_DMAT,double> hvy;
1306
-
1307
- FlatVector<double> hely (ndof*DIM, lh);
1308
-
1309
- const IntegrationRule & ir = GetIntegrationRule (fel);
1310
-
1311
- for (int i = 0; i < ir.GetNIP(); i++)
1312
- {
1313
- const IntegrationPoint & ip = ir[i];
1314
-
1315
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> mip (ir[i], eltrans);
1316
-
1317
- diffop->Apply (fel, mip, ellin, hvlin, lh);
1318
- diffop->Apply (fel, mip, elx, hvx, lh);
1319
- this->dmatop.ApplyLinearized (fel, mip, hvlin, hvx, hvy, lh);
1320
- diffop->ApplyTrans (fel, mip, hvy, hely, lh);
1321
-
1322
- double fac = fabs (mip.GetJacobiDet()) * ip.Weight();
1323
- ely += fac * hely;
1324
- }
1325
- }
1326
-
1327
-
1328
-
1329
- ///
1330
- virtual void
1331
- ApplyLinearizedElementMatrix (const FiniteElement & bfel,
1332
- const ElementTransformation & eltrans,
1333
- FlatVector<Complex> ellin,
1334
- FlatVector<Complex> elx,
1335
- FlatVector<Complex> ely,
1336
- LocalHeap & lh) const
1337
- {
1338
- const FEL & fel = dynamic_cast<const FEL&> (bfel);
1339
- int ndof = fel.GetNDof ();
1340
-
1341
- ely = 0;
1342
-
1343
- Vec<DIM_DMAT,Complex> hvlin;
1344
- Vec<DIM_DMAT,Complex> hvx;
1345
- Vec<DIM_DMAT,Complex> hvy;
1346
-
1347
- FlatVector<Complex> hely (ndof*DIM, lh);
1348
-
1349
- /*
1350
- int order = IntegrationOrder (fel);
1351
- const IntegrationRule & ir =
1352
- GetIntegrationRules().SelectIntegrationRule (fel.ElementType(), order);
1353
- */
1354
- const IntegrationRule & ir = GetIntegrationRule (fel);
1355
-
1356
-
1357
-
1358
- for (int i = 0; i < ir.GetNIP(); i++)
1359
- {
1360
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> mip (ir[i], eltrans);
1361
-
1362
- DIFFOP::Apply (fel, mip, ellin, hvlin, lh);
1363
- DIFFOP::Apply (fel, mip, elx, hvx, lh);
1364
- this->dmatop.ApplyLinearized (fel, mip, hvlin, hvx, hvy, lh);
1365
- DIFFOP::ApplyTrans (fel, mip, hvy, hely, lh);
1366
-
1367
- double fac = fabs (mip.GetJacobiDet()) * mip.IP().Weight();
1368
- ely += fac * hely;
1369
- }
1370
- }
1371
-
1372
-
1373
-
1374
- virtual double Energy (const FiniteElement & bfel,
1375
- const ElementTransformation & eltrans,
1376
- FlatVector<double> elx,
1377
- LocalHeap & lh) const
1378
- {
1379
- const FEL & fel = dynamic_cast<const FEL&> (bfel);
1380
-
1381
- Vec<DIM_DMAT,double> hvx;
1382
- const IntegrationRule & ir = GetIntegrationRule (fel);
1383
-
1384
- double energy = 0;
1385
-
1386
- for (int i = 0; i < ir.GetNIP(); i++)
1387
- {
1388
- const IntegrationPoint & ip = ir[i];
1389
-
1390
- MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> mip (ir[i], eltrans);
1391
- DIFFOP::Apply (fel, mip, elx, hvx, lh);
1392
-
1393
- double fac = fabs (mip.GetJacobiDet()) * ip.Weight();
1394
- energy += fac * this->dmatop.Energy (fel, mip, hvx, lh);
1395
- }
1396
-
1397
- return energy;
1398
- }
1399
-
1400
- };
1401
-
1402
-
1403
-
1404
-
1405
-
1406
-
1407
-
1408
-
1409
-
1410
-
1411
-
1412
-
1413
-
1414
-
1415
-
1416
-
1417
-
1418
-
1419
-
1420
-
1421
-
1422
-
1423
-
1424
-
1425
-
1426
-
1427
- /**
1428
- Element vector assembling.
1429
- Assembling for linear-forms of type $\int D (B u) dx$.
1430
- */
1431
- template <class DIFFOP, class DVecOp, class FEL = FiniteElement>
1432
- class T_BIntegrator : public LinearFormIntegrator
1433
- {
1434
- protected:
1435
- DVecOp dvecop;
1436
- DifferentialOperator * diffop = new T_DifferentialOperator<DIFFOP>;
1437
- public:
1438
- enum { DIM_SPACE = DIFFOP::DIM_SPACE };
1439
- enum { DIM_ELEMENT = DIFFOP::DIM_ELEMENT };
1440
- enum { DIM_DMAT = DIFFOP::DIM_DMAT };
1441
- enum { DIM = DIFFOP::DIM };
1442
- // typedef typename DVecOp::TSCAL TSCAL;
1443
-
1444
- ///
1445
- T_BIntegrator (const Array<shared_ptr<CoefficientFunction>> & coeffs)
1446
- : dvecop(coeffs)
1447
- { ; }
1448
-
1449
- T_BIntegrator (shared_ptr<CoefficientFunction> coef)
1450
- : dvecop(coef)
1451
- { ; }
1452
-
1453
- T_BIntegrator (const CoefficientFunction * coef)
1454
- : dvecop(shared_ptr<CoefficientFunction> (const_cast<CoefficientFunction*>(coef), NOOP_Deleter))
1455
- { ; }
1456
-
1457
- T_BIntegrator (const DVecOp & advec)
1458
- : dvecop(advec)
1459
- { ; }
1460
-
1461
- ///
1462
- virtual ~T_BIntegrator ()
1463
- { ; }
1464
- ///
1465
- void CheckElement (const FiniteElement & el) const override
1466
- {
1467
- if (!dynamic_cast<const FEL*> (&el) )
1468
- {
1469
- string err("Element does not match integrator\n");
1470
- err += "element type is ";
1471
- err += typeid(el).name();
1472
- err += " expected type is ";
1473
- err += typeid(FEL).name();
1474
- err += " integrator is ";
1475
- err += Name();
1476
- throw Exception (err);
1477
- /*
1478
- throw Exception (string ("Element does not match integrator\n") +
1479
- string ("element type is ") + typeid(el).name() +
1480
- string (" expected type is ") + typeid(FEL).name() +
1481
- string ("integrator is ") + Name());
1482
- */
1483
- }
1484
-
1485
- }
1486
- ///
1487
- //virtual bool BoundaryForm () const
1488
- //{ return int(DIM_SPACE) > int(DIM_ELEMENT); }
1489
- VorB VB() const override
1490
- { return VorB(int(DIM_SPACE)-int(DIM_ELEMENT)); }
1491
- int DimElement () const override
1492
- { return DIM_ELEMENT; }
1493
-
1494
- int DimSpace () const override
1495
- { return DIM_SPACE; }
1496
-
1497
-
1498
-
1499
- void
1500
- CalcElementVector (const FiniteElement & bfel,
1501
- const ElementTransformation & eltrans,
1502
- FlatVector<double> elvec,
1503
- LocalHeap & lh) const override
1504
- {
1505
- T_CalcElementVector<double> (bfel, eltrans, elvec, lh);
1506
- }
1507
-
1508
- void
1509
- CalcElementVector (const FiniteElement & bfel,
1510
- const ElementTransformation & eltrans,
1511
- FlatVector<Complex> elvec,
1512
- LocalHeap & lh) const override
1513
- {
1514
- T_CalcElementVector<Complex> (bfel, eltrans, elvec, lh);
1515
- }
1516
-
1517
-
1518
- ///
1519
- template <typename TSCAL>
1520
- void T_CalcElementVector (const FiniteElement & fel,
1521
- const ElementTransformation & eltrans,
1522
- FlatVector<TSCAL> elvec,
1523
- LocalHeap & lh) const
1524
- {
1525
- try
1526
- {
1527
- IntegrationRule ir(fel.ElementType(), IntegrationOrder(fel));
1528
- MappedIntegrationRule<DIM_ELEMENT, DIM_SPACE> mir(ir, eltrans, lh);
1529
-
1530
- FlatMatrixFixWidth<DIM_DMAT, TSCAL> dvecs(ir.GetNIP(), lh);
1531
- dvecop.GenerateVectorIR (fel, mir, dvecs, lh);
1532
- for (int i = 0; i < ir.GetNIP(); i++)
1533
- dvecs.Row(i) *= mir[i].GetWeight();
1534
-
1535
- // DIFFOP::ApplyTransIR (fel, mir, dvecs, elvec, lh);
1536
- diffop->ApplyTrans (fel, mir, dvecs, elvec, lh);
1537
- }
1538
- catch (Exception & e)
1539
- {
1540
- e.Append (string ("in CalcElementVector <")+typeid(TSCAL).name()+
1541
- ">, type = " + typeid(*this).name() + "\n");
1542
- throw;
1543
- }
1544
- catch (exception & e)
1545
- {
1546
- Exception e2(e.what());
1547
- e2.Append ("\nin CalcElementVector, type = ");
1548
- e2.Append (typeid(*this).name());
1549
- e2.Append ("\n");
1550
- throw e2;
1551
- }
1552
- }
1553
-
1554
-
1555
-
1556
-
1557
-
1558
- virtual void
1559
- CalcElementVectorIndependent (const FiniteElement & gfel,
1560
- const BaseMappedIntegrationPoint & s_mip,
1561
- const BaseMappedIntegrationPoint & g_mip,
1562
- FlatVector<double> & elvec,
1563
- LocalHeap & lh,
1564
- const bool curveint = false) const override
1565
- {
1566
- T_CalcElementVectorIndependent (gfel, s_mip, g_mip, elvec, lh, curveint);
1567
- }
1568
-
1569
- virtual void
1570
- CalcElementVectorIndependent (const FiniteElement & gfel,
1571
- const BaseMappedIntegrationPoint & s_mip,
1572
- const BaseMappedIntegrationPoint & g_mip,
1573
- FlatVector<Complex> & elvec,
1574
- LocalHeap & lh,
1575
- const bool curveint = false) const override
1576
- {
1577
- T_CalcElementVectorIndependent (gfel, s_mip, g_mip, elvec, lh, curveint);
1578
- }
1579
-
1580
-
1581
- template <typename TSCAL>
1582
- void T_CalcElementVectorIndependent (const FiniteElement & gfel,
1583
- const BaseMappedIntegrationPoint & s_mip,
1584
- const BaseMappedIntegrationPoint & g_mip,
1585
- FlatVector<TSCAL> & elvec,
1586
- LocalHeap & lh,
1587
- const bool curveint = false) const
1588
- {
1589
- const FEL & fel = dynamic_cast<const FEL&> (gfel);
1590
- int ndof = fel.GetNDof();
1591
-
1592
- elvec.AssignMemory (ndof * DIM, lh);
1593
- //elvec = 0;
1594
-
1595
- Vec<DIM_DMAT, TSCAL> dvec;
1596
-
1597
- const MappedIntegrationPoint< DIM_SPACE, DIM_SPACE > & d_g_mip
1598
- (static_cast<const MappedIntegrationPoint< DIM_SPACE, DIM_SPACE > &>(g_mip));
1599
-
1600
- if(curveint)
1601
- {
1602
- const MappedIntegrationPoint< 1, DIM_SPACE > & d_s_mip
1603
- (static_cast<const MappedIntegrationPoint< 1, DIM_SPACE > &>(s_mip));
1604
-
1605
- dvecop.GenerateVector (fel, d_s_mip, dvec, lh);
1606
- }
1607
- else
1608
- {
1609
- enum { HDIM = (DIM_SPACE > 1) ? DIM_SPACE-1 : 1 };
1610
-
1611
- const MappedIntegrationPoint< HDIM, DIM_SPACE > & d_s_mip
1612
- (static_cast<const MappedIntegrationPoint< HDIM, DIM_SPACE > &>(s_mip));
1613
-
1614
- dvecop.GenerateVector (fel, d_s_mip, dvec, lh);
1615
- }
1616
-
1617
- diffop->ApplyTrans (fel, d_g_mip, dvec, elvec, lh);
1618
-
1619
- //(*testout) << "dvec " << dvec << " elvec " << elvec << endl;
1620
-
1621
- }
1622
-
1623
-
1624
-
1625
-
1626
- int IntegrationOrder (const FiniteElement & fel) const
1627
- {
1628
- // int order = fel.Order()+2; // low order case
1629
- int order = 2*fel.Order()+1; // high order case
1630
-
1631
- ELEMENT_TYPE et = fel.ElementType();
1632
-
1633
- if (et == ET_TET || et == ET_TRIG || et == ET_SEGM)
1634
- order -= DIFFOP::DIFFORDER;
1635
-
1636
- /*
1637
- if (common_integration_order >= 0)
1638
- order = common_integration_order;
1639
- */
1640
- if (integration_order >= 0)
1641
- order = integration_order;
1642
-
1643
- return order;
1644
- }
1645
-
1646
-
1647
- ///
1648
- int GetDimension () const override { return DIM; }
1649
-
1650
- ///
1651
- string Name () const override { return "B integrator"; }
1652
- };
1653
-
1654
-
1655
-
1656
- }
1657
-
1658
-
1659
- #endif