ngsolve 6.2.2501.post47.dev1__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2501.post55.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 (285) hide show
  1. netgen/include/arnoldi.hpp +55 -0
  2. netgen/include/bandmatrix.hpp +334 -0
  3. netgen/include/basematrix.hpp +957 -0
  4. netgen/include/basevector.hpp +1268 -0
  5. netgen/include/bdbequations.hpp +2752 -0
  6. netgen/include/bdbintegrator.hpp +1660 -0
  7. netgen/include/bessel.hpp +1064 -0
  8. netgen/include/bilinearform.hpp +963 -0
  9. netgen/include/bla.hpp +29 -0
  10. netgen/include/blockalloc.hpp +95 -0
  11. netgen/include/blockjacobi.hpp +316 -0
  12. netgen/include/bspline.hpp +114 -0
  13. netgen/include/calcinverse.hpp +141 -0
  14. netgen/include/cg.hpp +368 -0
  15. netgen/include/chebyshev.hpp +44 -0
  16. netgen/include/cholesky.hpp +720 -0
  17. netgen/include/clapack.h +7254 -0
  18. netgen/include/code_generation.hpp +296 -0
  19. netgen/include/coefficient.hpp +2033 -0
  20. netgen/include/coefficient_impl.hpp +19 -0
  21. netgen/include/coefficient_stdmath.hpp +167 -0
  22. netgen/include/commutingAMG.hpp +106 -0
  23. netgen/include/comp.hpp +79 -0
  24. netgen/include/compatibility.hpp +41 -0
  25. netgen/include/complex_wrapper.hpp +73 -0
  26. netgen/include/compressedfespace.hpp +110 -0
  27. netgen/include/contact.hpp +231 -0
  28. netgen/include/diagonalmatrix.hpp +154 -0
  29. netgen/include/differentialoperator.hpp +276 -0
  30. netgen/include/diffop.hpp +1286 -0
  31. netgen/include/diffop_impl.hpp +326 -0
  32. netgen/include/discontinuous.hpp +84 -0
  33. netgen/include/dump.hpp +949 -0
  34. netgen/include/eigen.hpp +60 -0
  35. netgen/include/eigensystem.hpp +18 -0
  36. netgen/include/elasticity_equations.hpp +595 -0
  37. netgen/include/elementbyelement.hpp +195 -0
  38. netgen/include/elementtopology.hpp +1760 -0
  39. netgen/include/elementtransformation.hpp +339 -0
  40. netgen/include/evalfunc.hpp +405 -0
  41. netgen/include/expr.hpp +1655 -0
  42. netgen/include/facetfe.hpp +175 -0
  43. netgen/include/facetfespace.hpp +178 -0
  44. netgen/include/facethofe.hpp +111 -0
  45. netgen/include/facetsurffespace.hpp +112 -0
  46. netgen/include/fe_interfaces.hpp +32 -0
  47. netgen/include/fem.hpp +87 -0
  48. netgen/include/fesconvert.hpp +14 -0
  49. netgen/include/fespace.hpp +1445 -0
  50. netgen/include/finiteelement.hpp +286 -0
  51. netgen/include/globalinterfacespace.hpp +77 -0
  52. netgen/include/globalspace.hpp +115 -0
  53. netgen/include/gridfunction.hpp +525 -0
  54. netgen/include/h1amg.hpp +41 -0
  55. netgen/include/h1hofe.hpp +188 -0
  56. netgen/include/h1hofe_impl.hpp +1262 -0
  57. netgen/include/h1hofefo.hpp +148 -0
  58. netgen/include/h1hofefo_impl.hpp +185 -0
  59. netgen/include/h1hofespace.hpp +167 -0
  60. netgen/include/h1lofe.hpp +1237 -0
  61. netgen/include/h1lumping.hpp +35 -0
  62. netgen/include/hcurl_equations.hpp +1352 -0
  63. netgen/include/hcurlcurlfe.hpp +2221 -0
  64. netgen/include/hcurlcurlfespace.hpp +78 -0
  65. netgen/include/hcurlfe.hpp +259 -0
  66. netgen/include/hcurlfe_utils.hpp +107 -0
  67. netgen/include/hcurlhdiv_dshape.hpp +857 -0
  68. netgen/include/hcurlhdivfes.hpp +308 -0
  69. netgen/include/hcurlhofe.hpp +175 -0
  70. netgen/include/hcurlhofe_impl.hpp +1871 -0
  71. netgen/include/hcurlhofespace.hpp +193 -0
  72. netgen/include/hcurllofe.hpp +1146 -0
  73. netgen/include/hdiv_equations.hpp +865 -0
  74. netgen/include/hdivdivfe.hpp +2923 -0
  75. netgen/include/hdivdivsurfacespace.hpp +76 -0
  76. netgen/include/hdivfe.hpp +206 -0
  77. netgen/include/hdivfe_utils.hpp +716 -0
  78. netgen/include/hdivfes.hpp +75 -0
  79. netgen/include/hdivhofe.hpp +447 -0
  80. netgen/include/hdivhofe_impl.hpp +1107 -0
  81. netgen/include/hdivhofefo.hpp +229 -0
  82. netgen/include/hdivhofespace.hpp +175 -0
  83. netgen/include/hdivhosurfacefespace.hpp +106 -0
  84. netgen/include/hdivlofe.hpp +773 -0
  85. netgen/include/hidden.hpp +74 -0
  86. netgen/include/householder.hpp +181 -0
  87. netgen/include/hypre_ams_precond.hpp +123 -0
  88. netgen/include/hypre_precond.hpp +73 -0
  89. netgen/include/integrator.hpp +2024 -0
  90. netgen/include/integratorcf.hpp +253 -0
  91. netgen/include/interpolate.hpp +49 -0
  92. netgen/include/intrule.hpp +2541 -0
  93. netgen/include/irspace.hpp +49 -0
  94. netgen/include/jacobi.hpp +136 -0
  95. netgen/include/l2hofe.hpp +193 -0
  96. netgen/include/l2hofe_impl.hpp +564 -0
  97. netgen/include/l2hofefo.hpp +542 -0
  98. netgen/include/l2hofespace.hpp +344 -0
  99. netgen/include/la.hpp +38 -0
  100. netgen/include/linearform.hpp +266 -0
  101. netgen/include/matrix.hpp +2140 -0
  102. netgen/include/memusage.hpp +41 -0
  103. netgen/include/meshaccess.hpp +1358 -0
  104. netgen/include/mgpre.hpp +204 -0
  105. netgen/include/mptools.hpp +2187 -0
  106. netgen/include/multigrid.hpp +42 -0
  107. netgen/include/multivector.hpp +447 -0
  108. netgen/include/mumpsinverse.hpp +187 -0
  109. netgen/include/mycomplex.hpp +361 -0
  110. netgen/include/ng_lapack.hpp +1661 -0
  111. netgen/include/ngblas.hpp +1109 -0
  112. netgen/include/ngs_defines.hpp +30 -0
  113. netgen/include/ngs_stdcpp_include.hpp +106 -0
  114. netgen/include/ngs_utils.hpp +121 -0
  115. netgen/include/ngsobject.hpp +1019 -0
  116. netgen/include/ngsstream.hpp +113 -0
  117. netgen/include/ngstd.hpp +72 -0
  118. netgen/include/nodalhofe.hpp +96 -0
  119. netgen/include/nodalhofe_impl.hpp +141 -0
  120. netgen/include/normalfacetfe.hpp +223 -0
  121. netgen/include/normalfacetfespace.hpp +98 -0
  122. netgen/include/normalfacetsurfacefespace.hpp +84 -0
  123. netgen/include/order.hpp +251 -0
  124. netgen/include/parallel_matrices.hpp +222 -0
  125. netgen/include/paralleldofs.hpp +340 -0
  126. netgen/include/parallelngs.hpp +23 -0
  127. netgen/include/parallelvector.hpp +269 -0
  128. netgen/include/pardisoinverse.hpp +200 -0
  129. netgen/include/periodic.hpp +125 -0
  130. netgen/include/plateaufespace.hpp +25 -0
  131. netgen/include/pml.hpp +275 -0
  132. netgen/include/pmltrafo.hpp +631 -0
  133. netgen/include/postproc.hpp +142 -0
  134. netgen/include/precomp.hpp +60 -0
  135. netgen/include/preconditioner.hpp +602 -0
  136. netgen/include/prolongation.hpp +235 -0
  137. netgen/include/python_comp.hpp +107 -0
  138. netgen/include/python_fem.hpp +89 -0
  139. netgen/include/python_linalg.hpp +58 -0
  140. netgen/include/python_ngstd.hpp +385 -0
  141. netgen/include/recursive_pol.hpp +4844 -0
  142. netgen/include/recursive_pol_tet.hpp +395 -0
  143. netgen/include/recursive_pol_trig.hpp +492 -0
  144. netgen/include/reorderedfespace.hpp +81 -0
  145. netgen/include/sample_sort.hpp +105 -0
  146. netgen/include/scalarfe.hpp +335 -0
  147. netgen/include/shapefunction_utils.hpp +113 -0
  148. netgen/include/simd_complex.hpp +284 -0
  149. netgen/include/smoother.hpp +253 -0
  150. netgen/include/solve.hpp +89 -0
  151. netgen/include/sparsecholesky.hpp +313 -0
  152. netgen/include/sparsematrix.hpp +1038 -0
  153. netgen/include/sparsematrix_dyn.hpp +91 -0
  154. netgen/include/sparsematrix_impl.hpp +920 -0
  155. netgen/include/special_matrix.hpp +461 -0
  156. netgen/include/specialelement.hpp +125 -0
  157. netgen/include/statushandler.hpp +33 -0
  158. netgen/include/stringops.hpp +12 -0
  159. netgen/include/superluinverse.hpp +136 -0
  160. netgen/include/symbolicintegrator.hpp +849 -0
  161. netgen/include/symmetricmatrix.hpp +144 -0
  162. netgen/include/tangentialfacetfe.hpp +224 -0
  163. netgen/include/tangentialfacetfespace.hpp +106 -0
  164. netgen/include/tensor.hpp +522 -0
  165. netgen/include/tensorcoefficient.hpp +446 -0
  166. netgen/include/tensorproductintegrator.hpp +113 -0
  167. netgen/include/thcurlfe.hpp +128 -0
  168. netgen/include/thcurlfe_impl.hpp +380 -0
  169. netgen/include/thdivfe.hpp +80 -0
  170. netgen/include/thdivfe_impl.hpp +426 -0
  171. netgen/include/tpdiffop.hpp +461 -0
  172. netgen/include/tpfes.hpp +133 -0
  173. netgen/include/tpintrule.hpp +224 -0
  174. netgen/include/triangular.hpp +465 -0
  175. netgen/include/tscalarfe.hpp +245 -0
  176. netgen/include/tscalarfe_impl.hpp +1029 -0
  177. netgen/include/umfpackinverse.hpp +148 -0
  178. netgen/include/vector.hpp +1219 -0
  179. netgen/include/voxelcoefficientfunction.hpp +41 -0
  180. netgen/include/vtkoutput.hpp +198 -0
  181. netgen/include/vvector.hpp +208 -0
  182. netgen/include/webgui.hpp +92 -0
  183. netgen/libngbla.dylib +0 -0
  184. netgen/libngcomp.dylib +0 -0
  185. netgen/libngfem.dylib +0 -0
  186. netgen/libngla.dylib +0 -0
  187. netgen/libngsolve.dylib +0 -0
  188. netgen/libngstd.dylib +0 -0
  189. ngsolve/__init__.pyi +231 -0
  190. ngsolve/bla.pyi +1139 -0
  191. ngsolve/bvp.pyi +32 -0
  192. ngsolve/cmake/NGSolveConfig.cmake +102 -0
  193. ngsolve/cmake/ngsolve-targets-release.cmake +69 -0
  194. ngsolve/cmake/ngsolve-targets.cmake +163 -0
  195. ngsolve/comp/__init__.pyi +5382 -0
  196. ngsolve/comp/pml.pyi +89 -0
  197. ngsolve/config/__init__.py +1 -0
  198. ngsolve/config/__init__.pyi +43 -0
  199. ngsolve/config/__main__.py +4 -0
  200. ngsolve/config/config.py +60 -0
  201. ngsolve/config/config.pyi +45 -0
  202. ngsolve/demos/TensorProduct/__init__.py +0 -0
  203. ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
  204. ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
  205. ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
  206. ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
  207. ngsolve/demos/__init__.py +0 -0
  208. ngsolve/demos/howto/__init__.py +0 -0
  209. ngsolve/demos/howto/hhj.py +44 -0
  210. ngsolve/demos/howto/hybrid_dg.py +53 -0
  211. ngsolve/demos/howto/mixed.py +30 -0
  212. ngsolve/demos/howto/nonlin.py +29 -0
  213. ngsolve/demos/howto/pickling.py +26 -0
  214. ngsolve/demos/howto/pml.py +31 -0
  215. ngsolve/demos/howto/taskmanager.py +20 -0
  216. ngsolve/demos/howto/tdnns.py +47 -0
  217. ngsolve/demos/howto/timeDG-skeleton.py +45 -0
  218. ngsolve/demos/howto/timeDG.py +38 -0
  219. ngsolve/demos/howto/timeDGlap.py +42 -0
  220. ngsolve/demos/howto/timeDGwave.py +61 -0
  221. ngsolve/demos/intro/__init__.py +0 -0
  222. ngsolve/demos/intro/adaptive.py +123 -0
  223. ngsolve/demos/intro/cmagnet.py +62 -0
  224. ngsolve/demos/intro/elasticity.py +76 -0
  225. ngsolve/demos/intro/navierstokes.py +74 -0
  226. ngsolve/demos/intro/poisson.ipynb +170 -0
  227. ngsolve/demos/intro/poisson.py +41 -0
  228. ngsolve/demos/mpi/__init__.py +0 -0
  229. ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
  230. ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
  231. ngsolve/demos/mpi/mpi_poisson.py +89 -0
  232. ngsolve/demos/mpi/mpi_timeDG.py +82 -0
  233. ngsolve/directsolvers.pyi +18 -0
  234. ngsolve/eigenvalues.pyi +30 -0
  235. ngsolve/fem.pyi +1707 -0
  236. ngsolve/krylovspace.pyi +309 -0
  237. ngsolve/la.pyi +1218 -0
  238. ngsolve/ngslib.so +0 -0
  239. ngsolve/ngstd.pyi +58 -0
  240. ngsolve/nonlinearsolvers.pyi +98 -0
  241. ngsolve/preconditioners.pyi +6 -0
  242. ngsolve/solve.pyi +108 -0
  243. ngsolve/solvers.pyi +14 -0
  244. ngsolve/timestepping.pyi +34 -0
  245. ngsolve/timing.pyi +57 -0
  246. ngsolve/utils.pyi +279 -0
  247. ngsolve-6.2.2501.post55.dev1.data/data/Netgen.icns +0 -0
  248. ngsolve-6.2.2501.post55.dev1.data/data/bin/ngscxx +17 -0
  249. ngsolve-6.2.2501.post55.dev1.data/data/bin/ngsld +13 -0
  250. ngsolve-6.2.2501.post55.dev1.data/data/bin/ngsolve.tcl +648 -0
  251. ngsolve-6.2.2501.post55.dev1.data/data/bin/ngspy +2 -0
  252. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/beam.geo +17 -0
  253. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/beam.vol +240 -0
  254. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/chip.in2d +41 -0
  255. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/chip.vol +614 -0
  256. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/coil.geo +12 -0
  257. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/coil.vol +2560 -0
  258. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/coilshield.geo +24 -0
  259. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/coilshield.vol +3179 -0
  260. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/cube.geo +19 -0
  261. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/cube.vol +1832 -0
  262. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
  263. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
  264. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d1_square.pde +43 -0
  265. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d2_chip.pde +35 -0
  266. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
  267. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d4_cube.pde +46 -0
  268. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d5_beam.pde +74 -0
  269. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d6_shaft.pde +73 -0
  270. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d7_coil.pde +50 -0
  271. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d8_coilshield.pde +49 -0
  272. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
  273. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/doubleglazing.in2d +27 -0
  274. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/doubleglazing.vol +737 -0
  275. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  276. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/shaft.geo +73 -0
  277. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/shaft.vol +4291 -0
  278. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/square.in2d +17 -0
  279. ngsolve-6.2.2501.post55.dev1.data/data/share/ngsolve/square.vol +149 -0
  280. {ngsolve-6.2.2501.post47.dev1.dist-info → ngsolve-6.2.2501.post55.dev1.dist-info}/METADATA +2 -2
  281. ngsolve-6.2.2501.post55.dev1.dist-info/RECORD +304 -0
  282. ngsolve-6.2.2501.post47.dev1.dist-info/RECORD +0 -25
  283. {ngsolve-6.2.2501.post47.dev1.dist-info → ngsolve-6.2.2501.post55.dev1.dist-info}/LICENSE +0 -0
  284. {ngsolve-6.2.2501.post47.dev1.dist-info → ngsolve-6.2.2501.post55.dev1.dist-info}/WHEEL +0 -0
  285. {ngsolve-6.2.2501.post47.dev1.dist-info → ngsolve-6.2.2501.post55.dev1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2024 @@
1
+ #ifndef FILE_INTEGRATOR
2
+ #define FILE_INTEGRATOR
3
+
4
+ /*********************************************************************/
5
+ /* File: integrator.hpp */
6
+ /* Author: Joachim Schoeberl */
7
+ /* Date: 25. Mar. 2000 */
8
+ /*********************************************************************/
9
+
10
+
11
+ // #include "elementtransformation.hpp"
12
+ #include "finiteelement.hpp"
13
+ #include "differentialoperator.hpp"
14
+
15
+ namespace ngfem
16
+ {
17
+
18
+ /*
19
+ bilinear-form and linear-form integrators
20
+ */
21
+
22
+
23
+ // enum FORM_TYPE { VOLUME_FORM, BOUNDARY_FORM, SKELETON_FORM, CURVE_FORM };
24
+
25
+
26
+ /**
27
+ Base class for linear-form and bilinear-form integrators.
28
+ Provides integration order, restriction to subdomains
29
+ */
30
+ class NGS_DLL_HEADER Integrator
31
+ {
32
+ protected:
33
+ /// define only on some sub-domains
34
+ BitArray definedon;
35
+
36
+ /// if >= 0, use this order of integration
37
+ int integration_order;
38
+
39
+ // lower bound for the integration order
40
+ int higher_integration_order;
41
+
42
+ /// if >= 0, use this order of integration for all terms
43
+ static int common_integration_order;
44
+
45
+ /// plane element and constant coefficients
46
+ bool const_coef;
47
+
48
+ ///
49
+ string name;
50
+
51
+ /// integration only along curve
52
+ bool is_curve_integrator = false;
53
+ Array < FlatVector < double > * > curve_ips;
54
+ Array < FlatVector < double > * > curve_ip_tangents;
55
+ Array <int> continuous_curveparts;
56
+
57
+ int cachecomp;
58
+ int bonus_intorder = 0;
59
+
60
+ /// define only on some sub-domains
61
+ shared_ptr<BitArray> definedon_element = nullptr;
62
+ std::array<unique_ptr<IntegrationRule>,25> userdefined_intrules;
63
+ std::array<unique_ptr<SIMD_IntegrationRule>,25> userdefined_simd_intrules;
64
+
65
+ mutable bool simd_evaluate = true;
66
+
67
+ shared_ptr<ngcomp::GridFunction> deformation; // ALE for this integrator
68
+
69
+ protected:
70
+ void DeleteCurveIPs ( void );
71
+
72
+ public:
73
+ /// constructor
74
+ Integrator() throw ();
75
+
76
+ /// destructor
77
+ virtual ~Integrator();
78
+
79
+ /// integrates on the boundary, or on the domain ?
80
+ //[[deprecated("Use VB() instead")]]
81
+ virtual bool BoundaryForm () const
82
+ { return VB() == BND; }
83
+
84
+ virtual VorB VB() const = 0;
85
+
86
+ class DGFormulation
87
+ {
88
+ public:
89
+ bool neighbor_testfunction = true; // trivially parallel if no neighbor testfunction
90
+ bool element_boundary = false; // loop over edges, or loop over element-boundaries
91
+ DGFormulation(bool nbtest=true, bool eb=false)
92
+ : neighbor_testfunction(nbtest), element_boundary(eb) { ; }
93
+ };
94
+ virtual DGFormulation GetDGFormulation() const { return DGFormulation(); }
95
+
96
+ /// integrates just on the skeleton, standard is NO
97
+ virtual bool SkeletonForm () const { return false; }
98
+
99
+ virtual bool VolumeForm () const
100
+ {
101
+ if ( VB() != VOL || SkeletonForm() || IntegrationAlongCurve()) return false;
102
+ return true;
103
+ }
104
+
105
+ /// Is Integrator defined on this sub-domain ?
106
+ bool DefinedOn (int mat) const;
107
+
108
+ /// defined only on some subdomains
109
+ void SetDefinedOn (const BitArray & adefinedon);
110
+
111
+ /// defined only on elements (elements/boundary elements/facets/..)
112
+ void SetDefinedOnElements (shared_ptr<BitArray> adefinedonelem)
113
+ {
114
+ definedon_element = adefinedonelem;
115
+ }
116
+
117
+ void SetIntegrationRule(ELEMENT_TYPE et, const IntegrationRule& ir)
118
+ {
119
+ userdefined_intrules[int(et)] = make_unique<IntegrationRule>(ir.Copy());
120
+ userdefined_simd_intrules[int(et)] = make_unique<SIMD_IntegrationRule>(*userdefined_intrules[int(et)]);
121
+ }
122
+
123
+ void SetIntegrationRule(const IntegrationRule& ir)
124
+ {
125
+ for(auto i : Range(25))
126
+ {
127
+ userdefined_intrules[i] = make_unique<IntegrationRule>(ir.Copy());
128
+ userdefined_simd_intrules[i] = make_unique<SIMD_IntegrationRule>(*userdefined_intrules[i]);
129
+ }
130
+ }
131
+
132
+ inline const IntegrationRule& GetIntegrationRule(ELEMENT_TYPE et, int order) const
133
+ {
134
+ return userdefined_intrules[et] ? *userdefined_intrules[et] : SelectIntegrationRule(et,order);
135
+ }
136
+ inline const SIMD_IntegrationRule& GetSIMDIntegrationRule(ELEMENT_TYPE et, int order) const
137
+ {
138
+ return userdefined_simd_intrules[et] ? *userdefined_simd_intrules[et] : SIMD_SelectIntegrationRule(et,order);
139
+ }
140
+
141
+ /// defined only on some elements/facets/boundary elements
142
+ shared_ptr<BitArray> GetDefinedOnElements () const { return definedon_element; }
143
+
144
+ /// Is Integrator defined on this element ?
145
+ bool DefinedOnElement (int elem) const
146
+ {
147
+ if (definedon_element != nullptr && !definedon_element->Test(elem))
148
+ return false;
149
+ else
150
+ return true;
151
+ }
152
+
153
+ /// defined only on some subdomains
154
+ const BitArray & GetDefinedOn () const { return definedon; }
155
+
156
+ /// defined only on some subdomains (0-based)
157
+ void SetDefinedOn (const Array<int> & regions);
158
+
159
+ bool DefinedOnSubdomainsOnly() const
160
+ { return definedon.Size() != 0; }
161
+
162
+
163
+
164
+ /// use exactly this integration order for all integrals
165
+ static void SetCommonIntegrationOrder (int cio)
166
+ {
167
+ common_integration_order = cio;
168
+ }
169
+
170
+ static int GetCommonIntegrationOrder ()
171
+ {
172
+ return common_integration_order;
173
+ }
174
+
175
+ /// set minimal integration order
176
+ void SetHigherIntegrationOrder (int io)
177
+ {
178
+ higher_integration_order = io;
179
+ }
180
+
181
+ /// set integration order
182
+ void SetIntegrationOrder (int io)
183
+ {
184
+ integration_order = io;
185
+ }
186
+
187
+ /// returns integration order
188
+ int GetIntegrationOrder (void) const
189
+ {
190
+ return integration_order;
191
+ }
192
+
193
+ void SetBonusIntegrationOrder (int bo) { bonus_intorder = bo; }
194
+ int GetBonusIntegrationOrder() const { return bonus_intorder; }
195
+
196
+ /// benefit from constant coefficient
197
+ void SetConstantCoefficient (bool acc = 1)
198
+ { const_coef = acc; }
199
+
200
+ /// dimension of element
201
+ virtual int DimElement () const { return -1; }
202
+
203
+ /// dimension of space
204
+ virtual int DimSpace () const { return -1; }
205
+
206
+ /// how many copies of the same element (e.g. elasticity)
207
+ virtual int GetDimension () const { return 1; }
208
+
209
+ ///
210
+ void SetName (const string & aname);
211
+ ///
212
+ virtual string Name () const;
213
+
214
+ /// does element match integrator ?
215
+ virtual void CheckElement (const FiniteElement & el) const { ; }
216
+
217
+
218
+
219
+ // special hacks by Markus
220
+ bool IntegrationAlongCurve (void) const
221
+ { return is_curve_integrator; }
222
+
223
+ void SetIntegrationAlongCurve ( const int npoints );
224
+
225
+ void UnSetIntegrationAlongCurve ( void );
226
+
227
+ virtual int NumCurvePoints() const
228
+ { return curve_ips.Size(); }
229
+
230
+ virtual FlatVector<double> CurvePoint(int i)
231
+ { return *(curve_ips[i]); }
232
+
233
+ virtual FlatVector<double> CurvePointTangent(int i)
234
+ { return *(curve_ip_tangents[i]); }
235
+
236
+ virtual int GetNumCurveParts() const;
237
+ virtual int GetStartOfCurve(int i) const;
238
+ virtual int GetEndOfCurve(int i) const;
239
+
240
+ virtual void AppendCurvePoint(const FlatVector<double> & point);
241
+ virtual void AppendCurvePoint(const FlatVector<double> & point, const FlatVector<double> & tangent);
242
+ virtual void SetCurveClearance();
243
+
244
+
245
+
246
+ virtual void SetCacheComp(const int comp)
247
+ { cachecomp = comp; }
248
+
249
+ virtual int CacheComp(void) const
250
+ { return cachecomp; }
251
+
252
+ virtual void SetFileName(const string & filename);
253
+
254
+ virtual void SetFlags (const Flags & flags) { ; }
255
+
256
+ bool SimdEvaluate () const { return simd_evaluate; }
257
+ void SetSimdEvaluate (bool b = true) { simd_evaluate = b; }
258
+
259
+ void SetDeformation (shared_ptr<ngcomp::GridFunction> adeform) { deformation = adeform; }
260
+ const shared_ptr<ngcomp::GridFunction> & GetDeformation() const { return deformation; }
261
+ };
262
+
263
+
264
+ ostream & operator << (ostream & ost, const Integrator & igt);
265
+
266
+ /**
267
+ A BilinearFormIntegrator computes the element matrices. Different
268
+ equations are provided by derived classes. An Integrator can be defined
269
+ in the domain or at the boundary.
270
+ */
271
+ class NGS_DLL_HEADER BilinearFormIntegrator : public Integrator
272
+ {
273
+ protected:
274
+ // evaluate something, e.g. energy, ...
275
+ SymbolTable<shared_ptr<DifferentialOperator>> evaluators;
276
+
277
+ public:
278
+ // typedef double TSCAL;
279
+ ///
280
+ BilinearFormIntegrator () throw () { ; }
281
+ ///
282
+ virtual ~BilinearFormIntegrator ();
283
+
284
+ /// generates symmetric matrix ?
285
+ virtual xbool IsSymmetric () const = 0;
286
+
287
+ /// components of flux
288
+ virtual int DimFlux () const { return -1; }
289
+
290
+ /**
291
+ Computes the element matrix.
292
+ */
293
+ virtual void
294
+ CalcElementMatrix (const FiniteElement & fel,
295
+ const ElementTransformation & eltrans,
296
+ FlatMatrix<double> elmat,
297
+ LocalHeap & lh) const = 0;
298
+
299
+ /**
300
+ Computes the element matrix.
301
+ Complex version
302
+ */
303
+ virtual void
304
+ CalcElementMatrix (const FiniteElement & fel,
305
+ const ElementTransformation & eltrans,
306
+ FlatMatrix<Complex> elmat,
307
+ LocalHeap & lh) const;
308
+
309
+ /**
310
+ Computes the element matrix.
311
+ Add the element to elmat
312
+ */
313
+ virtual void
314
+ CalcElementMatrixAdd (const FiniteElement & fel,
315
+ const ElementTransformation & eltrans,
316
+ FlatMatrix<double> elmat,
317
+ bool & symmetric_so_far,
318
+ LocalHeap & lh) const;
319
+
320
+ /**
321
+ Computes the element matrix.
322
+ Complex version
323
+ Add the element to elmat
324
+ */
325
+ virtual void
326
+ CalcElementMatrixAdd (const FiniteElement & fel,
327
+ const ElementTransformation & eltrans,
328
+ FlatMatrix<Complex> elmat,
329
+ bool & symmetric_so_far,
330
+ LocalHeap & lh) const;
331
+
332
+
333
+
334
+ virtual void
335
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
336
+ const FiniteElement & bfel_master_element,
337
+ const FiniteElement & bfel_other,
338
+ const ElementTransformation & eltrans_master,
339
+ const ElementTransformation & eltrans_master_element,
340
+ const ElementTransformation & eltrans_other,
341
+ const IntegrationPoint & ip_master,
342
+ const IntegrationPoint & ip_master_element,
343
+ const IntegrationPoint & ip_other,
344
+ FlatMatrix<double> & elmat,
345
+ LocalHeap & lh) const
346
+ {;}
347
+ virtual void
348
+ ApplyElementMatrixIndependent (const FiniteElement & bfel_master,
349
+ const FiniteElement & bfel_master_element,
350
+ const FiniteElement & bfel_other,
351
+ const ElementTransformation & eltrans_master,
352
+ const ElementTransformation & eltrans_master_element,
353
+ const ElementTransformation & eltrans_other,
354
+ const IntegrationPoint & ip_master,
355
+ const IntegrationPoint & ip_master_element,
356
+ const IntegrationPoint & ip_other,
357
+ const FlatVector<double> & elx,
358
+ Vector<double> & result,
359
+ LocalHeap & lh) const
360
+ {;}
361
+ virtual void
362
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
363
+ const FiniteElement & bfel_master_element,
364
+ const FiniteElement & bfel_other,
365
+ const ElementTransformation & eltrans_master,
366
+ const ElementTransformation & eltrans_master_element,
367
+ const ElementTransformation & eltrans_other,
368
+ const IntegrationPoint & ip_master,
369
+ const IntegrationPoint & ip_master_element,
370
+ const IntegrationPoint & ip_other,
371
+ FlatMatrix<Complex> & elmat,
372
+ LocalHeap & lh) const
373
+ {
374
+ FlatMatrix<double> rmat;
375
+ CalcElementMatrixIndependent(bfel_master,bfel_master_element,bfel_other,
376
+ eltrans_master, eltrans_master_element, eltrans_other,
377
+ ip_master, ip_master_element, ip_other,
378
+ rmat, lh);
379
+ elmat.AssignMemory(rmat.Height(), rmat.Width(), lh);
380
+ elmat = rmat;
381
+ }
382
+
383
+ virtual void
384
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
385
+ const FiniteElement & bfel_other,
386
+ const ElementTransformation & eltrans_master,
387
+ const ElementTransformation & eltrans_other,
388
+ const IntegrationPoint & ip_master,
389
+ const IntegrationPoint & ip_other,
390
+ FlatMatrix<double> & elmat,
391
+ LocalHeap & lh) const
392
+ {;}
393
+ virtual void
394
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
395
+ const FiniteElement & bfel_other,
396
+ const ElementTransformation & eltrans_master,
397
+ const ElementTransformation & eltrans_other,
398
+ const IntegrationPoint & ip_master,
399
+ const IntegrationPoint & ip_other,
400
+ FlatMatrix<Complex> & elmat,
401
+ LocalHeap & lh) const
402
+ {
403
+ FlatMatrix<double> rmat;
404
+ CalcElementMatrixIndependent(bfel_master,bfel_other,
405
+ eltrans_master, eltrans_other,
406
+ ip_master, ip_other,
407
+ rmat, lh);
408
+ elmat.AssignMemory(rmat.Height(), rmat.Width(), lh);
409
+ elmat = rmat;
410
+ }
411
+
412
+
413
+ virtual void
414
+ CalcElementMatrixDiag (const FiniteElement & fel,
415
+ const ElementTransformation & eltrans,
416
+ FlatVector<double> diag,
417
+ LocalHeap & lh) const;
418
+
419
+
420
+
421
+
422
+ virtual void
423
+ CalcLinearizedElementMatrix (const FiniteElement & fel,
424
+ const ElementTransformation & eltrans,
425
+ FlatVector<double> elveclin,
426
+ FlatMatrix<double> elmat,
427
+ LocalHeap & lh) const;
428
+
429
+ virtual void
430
+ CalcLinearizedElementMatrix (const FiniteElement & fel,
431
+ const ElementTransformation & eltrans,
432
+ FlatVector<Complex> elveclin,
433
+ FlatMatrix<Complex> elmat,
434
+ LocalHeap & lh) const;
435
+
436
+
437
+ virtual void *
438
+ PrecomputeData (const FiniteElement & fel,
439
+ const ElementTransformation & eltrans,
440
+ LocalHeap & lh) const { return 0; }
441
+
442
+
443
+ virtual void
444
+ ApplyElementMatrix (const FiniteElement & fel,
445
+ const ElementTransformation & eltrans,
446
+ const FlatVector<double> elx,
447
+ FlatVector<double> ely,
448
+ void * precomputed,
449
+ LocalHeap & lh) const;
450
+
451
+ virtual void
452
+ ApplyElementMatrix (const FiniteElement & fel,
453
+ const ElementTransformation & eltrans,
454
+ const FlatVector<Complex> elx,
455
+ FlatVector<Complex> ely,
456
+ void * precomputed,
457
+ LocalHeap & lh) const;
458
+
459
+ virtual void
460
+ ApplyElementMatrixTrans (const FiniteElement & fel,
461
+ const ElementTransformation & eltrans,
462
+ const FlatVector<double> elx,
463
+ FlatVector<double> ely,
464
+ void * precomputed,
465
+ LocalHeap & lh) const;
466
+
467
+ virtual void
468
+ ApplyElementMatrixTrans (const FiniteElement & fel,
469
+ const ElementTransformation & eltrans,
470
+ const FlatVector<Complex> elx,
471
+ FlatVector<Complex> ely,
472
+ void * precomputed,
473
+ LocalHeap & lh) const;
474
+
475
+
476
+
477
+
478
+ /*
479
+ template < int S, class T>
480
+ void ApplyElementMatrix (const FiniteElement & fel,
481
+ const ElementTransformation & eltrans,
482
+ const FlatVector< Vec<S,T> > & elx,
483
+ FlatVector< Vec<S,T> > & ely,
484
+ void * precomputed,
485
+ LocalHeap & lh) const
486
+ {
487
+ //cout << "call baseclass ApplyElementMatrix, type = " << typeid(*this).name() << endl;
488
+ FlatMatrix<T> mat;
489
+ CalcElementMatrix (fel, eltrans, mat, lh);
490
+ ely = mat * elx;
491
+ }
492
+ */
493
+
494
+
495
+ virtual void
496
+ ApplyLinearizedElementMatrix (const FiniteElement & fel,
497
+ const ElementTransformation & eltrans,
498
+ FlatVector<double> ellin,
499
+ FlatVector<double> elx,
500
+ FlatVector<double> ely,
501
+ LocalHeap & lh) const;
502
+
503
+ virtual void
504
+ ApplyLinearizedElementMatrix (const FiniteElement & fel,
505
+ const ElementTransformation & eltrans,
506
+ FlatVector<Complex> ellin,
507
+ FlatVector<Complex> elx,
508
+ FlatVector<Complex> ely,
509
+ LocalHeap & lh) const;
510
+
511
+
512
+
513
+ virtual double Energy (const FiniteElement & fel,
514
+ const ElementTransformation & eltrans,
515
+ FlatVector<double> elx,
516
+ LocalHeap & lh) const;
517
+
518
+ virtual double Energy (const FiniteElement & fel,
519
+ const ElementTransformation & eltrans,
520
+ FlatVector<Complex> elx,
521
+ LocalHeap & lh) const;
522
+
523
+
524
+
525
+
526
+ virtual void
527
+ CalcFlux (const FiniteElement & fel,
528
+ const BaseMappedIntegrationPoint & bmip,
529
+ BareSliceVector<double> elx,
530
+ FlatVector<double> flux,
531
+ bool applyd,
532
+ LocalHeap & lh) const;
533
+
534
+
535
+ virtual void
536
+ CalcFlux (const FiniteElement & fel,
537
+ const BaseMappedIntegrationPoint & bmip,
538
+ BareSliceVector<Complex> elx,
539
+ FlatVector<Complex> flux,
540
+ bool applyd,
541
+ LocalHeap & lh) const;
542
+
543
+
544
+ virtual void
545
+ CalcFlux (const FiniteElement & fel,
546
+ const BaseMappedIntegrationRule & mir,
547
+ BareSliceVector<double> elx,
548
+ BareSliceMatrix<double> flux,
549
+ bool applyd,
550
+ LocalHeap & lh) const;
551
+
552
+
553
+ virtual void
554
+ CalcFlux (const FiniteElement & fel,
555
+ const BaseMappedIntegrationRule & mir,
556
+ BareSliceVector<Complex> elx,
557
+ BareSliceMatrix<Complex> flux,
558
+ bool applyd,
559
+ LocalHeap & lh) const;
560
+
561
+
562
+ virtual void
563
+ CalcFlux (const FiniteElement & fel,
564
+ const FiniteElement & felflux,
565
+ const ElementTransformation & eltrans,
566
+ BareSliceVector<> elx,
567
+ FlatVector<> flux,
568
+ bool applyd,
569
+ LocalHeap & lh) const;
570
+
571
+
572
+ virtual void
573
+ CalcFluxMulti (const FiniteElement & fel,
574
+ const BaseMappedIntegrationPoint & bmip,
575
+ int m,
576
+ FlatVector<double> elx,
577
+ FlatVector<double> flux,
578
+ bool applyd,
579
+ LocalHeap & lh) const;
580
+
581
+
582
+ virtual void
583
+ CalcFluxMulti (const FiniteElement & fel,
584
+ const BaseMappedIntegrationPoint & bmip,
585
+ int m,
586
+ FlatVector<Complex> elx,
587
+ FlatVector<Complex> flux,
588
+ bool applyd,
589
+ LocalHeap & lh) const;
590
+
591
+
592
+ virtual void
593
+ ApplyBTrans (const FiniteElement & fel,
594
+ const BaseMappedIntegrationPoint & bmip,
595
+ FlatVector<double> elx,
596
+ FlatVector<double> ely,
597
+ LocalHeap & lh) const;
598
+
599
+ virtual void
600
+ ApplyBTrans (const FiniteElement & fel,
601
+ const BaseMappedIntegrationPoint & bmip,
602
+ FlatVector<Complex> elx,
603
+ FlatVector<Complex> ely,
604
+ LocalHeap & lh) const;
605
+
606
+
607
+ virtual void
608
+ ApplyBTrans (const FiniteElement & fel,
609
+ const BaseMappedIntegrationRule & mir,
610
+ FlatMatrix<double> elx,
611
+ FlatVector<double> ely,
612
+ LocalHeap & lh) const;
613
+
614
+ virtual void
615
+ ApplyBTrans (const FiniteElement & fel,
616
+ const BaseMappedIntegrationRule & mir,
617
+ FlatMatrix<Complex> elx,
618
+ FlatVector<Complex> ely,
619
+ LocalHeap & lh) const;
620
+
621
+
622
+ virtual void ApplyDMat (const FiniteElement & bfel,
623
+ const BaseMappedIntegrationPoint & bmip,
624
+ FlatVector<double> elx,
625
+ FlatVector<double> eldx,
626
+ LocalHeap & lh) const;
627
+
628
+ virtual void ApplyDMat (const FiniteElement & bfel,
629
+ const BaseMappedIntegrationPoint & bmip,
630
+ FlatVector<Complex> elx,
631
+ FlatVector<Complex> eldx,
632
+ LocalHeap & lh) const;
633
+
634
+ virtual void ApplyDMat (const FiniteElement & bfel,
635
+ const BaseMappedIntegrationRule & mir,
636
+ FlatMatrix<double> elx,
637
+ FlatMatrix<double> eldx,
638
+ LocalHeap & lh) const;
639
+
640
+ virtual void ApplyDMat (const FiniteElement & bfel,
641
+ const BaseMappedIntegrationRule & mir,
642
+ FlatMatrix<Complex> elx,
643
+ FlatMatrix<Complex> eldx,
644
+ LocalHeap & lh) const;
645
+
646
+ virtual void ApplyDMatInv (const FiniteElement & bfel,
647
+ const BaseMappedIntegrationPoint & bmip,
648
+ FlatVector<double> elx,
649
+ FlatVector<double> eldx,
650
+ LocalHeap & lh) const;
651
+
652
+ virtual void ApplyDMatInv (const FiniteElement & bfel,
653
+ const BaseMappedIntegrationPoint & bmip,
654
+ FlatVector<Complex> elx,
655
+ FlatVector<Complex> eldx,
656
+ LocalHeap & lh) const;
657
+
658
+ virtual void ApplyDMatInv (const FiniteElement & bfel,
659
+ const BaseMappedIntegrationRule & mir,
660
+ FlatMatrix<double> elx,
661
+ FlatMatrix<double> eldx,
662
+ LocalHeap & lh) const;
663
+
664
+ virtual void ApplyDMatInv (const FiniteElement & bfel,
665
+ const BaseMappedIntegrationRule & mir,
666
+ FlatMatrix<Complex> elx,
667
+ FlatMatrix<Complex> eldx,
668
+ LocalHeap & lh) const;
669
+
670
+
671
+ shared_ptr<DifferentialOperator> GetEvaluator(string name) const
672
+ {
673
+ return evaluators[name];
674
+ }
675
+
676
+ const auto & GetEvaluators() const { return evaluators; }
677
+ /*
678
+ virtual const IntegrationRule & GetIntegrationRule (const FiniteElement & fel,
679
+ const bool use_higher_integration_order = false) const;
680
+ */
681
+ bool geom_free = false;
682
+ };
683
+
684
+
685
+ /*
686
+ class FacetNeighbourElInfo{
687
+ public:
688
+ //finite Element of the neighbour element
689
+ const FiniteElement & volumefel;
690
+ //local Facet Number from volumeElements view
691
+ int LocalFacetNr;
692
+ //Transformation of the neighbouring element
693
+ const ElementTransformation & eltrans;
694
+ //Vertices of the Element
695
+ FlatArray<int> & ElVertices;
696
+ bool nonempty;
697
+ FacetNeighbourElInfo(const FiniteElement & vvolumefel, int lLocalFacetNr,
698
+ const ElementTransformation & eeltrans,
699
+ FlatArray<int> & eElVertices):volumefel(vvolumefel),
700
+ LocalFacetNr(lLocalFacetNr), eltrans(eeltrans),
701
+ ElVertices(eElVertices), nonempty(true)
702
+ {;}
703
+ FacetNeighbourElInfo():nonempty(false){;};
704
+ bool IsEmpty(){return !nonempty;}
705
+ };
706
+ */
707
+
708
+ class NGS_DLL_HEADER FacetBilinearFormIntegrator : public BilinearFormIntegrator
709
+ {
710
+ public:
711
+
712
+ FacetBilinearFormIntegrator() // const Array<shared_ptr<CoefficientFunction>> & coeffs)
713
+ : BilinearFormIntegrator() { ; }
714
+
715
+ ~FacetBilinearFormIntegrator() { ; }
716
+
717
+
718
+
719
+
720
+ virtual VorB VB () const
721
+ { return VOL; }
722
+
723
+ virtual bool SkeletonForm () const
724
+ { return 1; }
725
+
726
+ virtual void CalcElementMatrix (const FiniteElement & fel,
727
+ const ElementTransformation & eltrans,
728
+ FlatMatrix<double> elmat,
729
+ LocalHeap & lh) const {
730
+ throw Exception ("FacetBilinearFormIntegrator can not assemble volumetric element matrices!");
731
+ }
732
+
733
+
734
+ virtual void
735
+ CalcFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
736
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
737
+ const FiniteElement & volumefel2, int LocalFacetNr2,
738
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
739
+ FlatMatrix<double> elmat,
740
+ LocalHeap & lh) const{
741
+ throw Exception ("FacetBilinearFormIntegrator::CalcFacetMatrix for inner facets not implemented!");
742
+ }
743
+
744
+ virtual void
745
+ CalcFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
746
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
747
+ const FiniteElement & volumefel2, int LocalFacetNr2,
748
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
749
+ FlatMatrix<Complex> elmat,
750
+ LocalHeap & lh) const{
751
+ throw Exception ("FacetBilinearFormIntegrator::CalcFacetMatrix<Complex> for inner facets not implemented!");
752
+ }
753
+
754
+ virtual void
755
+ CalcLinearizedFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
756
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
757
+ const FiniteElement & volumefel2, int LocalFacetNr2,
758
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
759
+ FlatVector<double> elvec,
760
+ FlatMatrix<double> elmat,
761
+ LocalHeap & lh) const{
762
+ CalcFacetMatrix (volumefel1, LocalFacetNr1, eltrans1, ElVertices1, volumefel2, LocalFacetNr2, eltrans2, ElVertices2, elmat, lh);
763
+ // throw Exception ("FacetBilinearFormIntegrator::CalcLinearizedFacetMatrix for inner facets not implemented!");
764
+ }
765
+
766
+ virtual void
767
+ CalcLinearizedFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
768
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
769
+ const FiniteElement & volumefel2, int LocalFacetNr2,
770
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
771
+ FlatVector<Complex> elvec,
772
+ FlatMatrix<Complex> elmat,
773
+ LocalHeap & lh) const{
774
+ throw Exception ("FacetBilinearFormIntegrator::CalcLinearizedFacetMatrix<Complex> for inner facets not implemented!");
775
+ }
776
+
777
+
778
+ virtual void
779
+ ApplyFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
780
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
781
+ const FiniteElement & volumefel2, int LocalFacetNr2,
782
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
783
+ FlatVector<double> elx, FlatVector<double> ely,
784
+ LocalHeap & lh) const
785
+ {
786
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for inner facets not implemented!");
787
+ }
788
+ virtual void
789
+ ApplyFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
790
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
791
+ const FiniteElement & volumefel2, int LocalFacetNr2,
792
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
793
+ FlatVector<Complex> elx, FlatVector<Complex> ely,
794
+ LocalHeap & lh) const
795
+ {
796
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for inner facets not implemented!");
797
+ }
798
+
799
+
800
+ virtual void
801
+ CalcFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
802
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
803
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
804
+ FlatMatrix<double> elmat,
805
+ LocalHeap & lh) const{
806
+ throw Exception ("FacetBilinearFormIntegrator::CalcFacetMatrix for boundary facets not implemented!");
807
+ }
808
+ virtual void
809
+ CalcFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
810
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
811
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
812
+ FlatMatrix<Complex> elmat,
813
+ LocalHeap & lh) const{
814
+ throw Exception ("FacetBilinearFormIntegrator::CalcFacetMatrix<Complex> for boundary facets not implemented!");
815
+ }
816
+
817
+ virtual void
818
+ CalcLinearizedFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
819
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
820
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
821
+ FlatVector<double> vec, FlatMatrix<double> elmat,
822
+ LocalHeap & lh) const
823
+ {
824
+ CalcFacetMatrix (volumefel, LocalFacetNr,
825
+ eltrans, ElVertices, seltrans, SElVertices, elmat, lh);
826
+ }
827
+
828
+ virtual void
829
+ CalcLinearizedFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
830
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
831
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
832
+ FlatVector<Complex> vec, FlatMatrix<Complex> elmat,
833
+ LocalHeap & lh) const
834
+ {
835
+ throw Exception ("CalcLinearizedFacetMatrix<Complex> not available");
836
+ }
837
+
838
+
839
+ virtual void
840
+ ApplyFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
841
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
842
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
843
+ FlatVector<double> elx, FlatVector<double> ely,
844
+ LocalHeap & lh) const
845
+ {
846
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
847
+ }
848
+ virtual void
849
+ ApplyFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
850
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
851
+ const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
852
+ FlatVector<Complex> elx, FlatVector<Complex> ely,
853
+ LocalHeap & lh) const
854
+ {
855
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
856
+ }
857
+
858
+
859
+ // calculate traces in integration points
860
+ virtual void
861
+ CalcTraceValues (const FiniteElement & volumefel, int LocalFacetNr,
862
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
863
+ FlatVector<double> & trace, FlatVector<double> elx, LocalHeap & lh) const
864
+ {
865
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
866
+ }
867
+
868
+ virtual void
869
+ CalcTraceValues (const FiniteElement & volumefel, int LocalFacetNr,
870
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
871
+ FlatVector<Complex> & trace, FlatVector<Complex> elx, LocalHeap & lh) const
872
+ {
873
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
874
+ }
875
+
876
+ virtual void
877
+ ApplyFromTraceValues (const FiniteElement & volumefel, int LocalFacetNr,
878
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
879
+ FlatVector<double> trace,
880
+ FlatVector<double> elx, FlatVector<double> ely,
881
+ LocalHeap & lh) const
882
+ {
883
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFromTraceValues not implemented!");
884
+ }
885
+
886
+ virtual void
887
+ ApplyFromTraceValues (const FiniteElement & volumefel, int LocalFacetNr,
888
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
889
+ FlatVector<Complex> trace,
890
+ FlatVector<Complex> elx, FlatVector<Complex> ely,
891
+ LocalHeap & lh) const
892
+ {
893
+ throw Exception ("FacetBilinearFormIntegrator::ApplyFromTraceValues not implemented!");
894
+ }
895
+
896
+
897
+
898
+ };
899
+
900
+
901
+
902
+
903
+
904
+ class NGS_DLL_HEADER BlockBilinearFormIntegrator : public BilinearFormIntegrator
905
+ {
906
+ shared_ptr<BilinearFormIntegrator> bfi;
907
+ int dim;
908
+ int comp;
909
+ public:
910
+ BlockBilinearFormIntegrator (shared_ptr<BilinearFormIntegrator> abfi, int adim, int acomp);
911
+ BlockBilinearFormIntegrator (shared_ptr<BilinearFormIntegrator> abfi, int adim);
912
+ virtual ~BlockBilinearFormIntegrator ();
913
+
914
+ virtual VorB VB () const override
915
+ { return bfi->VB(); }
916
+ virtual xbool IsSymmetric () const override { return bfi->IsSymmetric(); }
917
+ virtual int DimFlux () const override
918
+ { return (comp == -1) ? dim * bfi->DimFlux() : bfi->DimFlux(); }
919
+ int GetDim() const { return dim; }
920
+ int GetComp() const { return comp; }
921
+
922
+ const BilinearFormIntegrator & Block () const { return *bfi; }
923
+ shared_ptr<BilinearFormIntegrator> BlockPtr () const { return bfi; }
924
+
925
+ virtual void
926
+ CalcElementMatrix (const FiniteElement & bfel,
927
+ const ElementTransformation & eltrans,
928
+ FlatMatrix<double> elmat,
929
+ LocalHeap & lh) const override;
930
+
931
+ virtual void
932
+ CalcElementMatrix (const FiniteElement & bfel,
933
+ const ElementTransformation & eltrans,
934
+ FlatMatrix<Complex> elmat,
935
+ LocalHeap & lh) const override;
936
+
937
+ virtual void
938
+ ApplyElementMatrix (const FiniteElement & bfel,
939
+ const ElementTransformation & eltrans,
940
+ const FlatVector<double> elx,
941
+ FlatVector<double> ely,
942
+ void * precomputed,
943
+ LocalHeap & lh) const override;
944
+
945
+ virtual void
946
+ ApplyElementMatrix (const FiniteElement & bfel,
947
+ const ElementTransformation & eltrans,
948
+ const FlatVector<Complex> elx,
949
+ FlatVector<Complex> ely,
950
+ void * precomputed,
951
+ LocalHeap & lh) const override;
952
+
953
+ virtual void
954
+ CalcLinearizedElementMatrix (const FiniteElement & bfel,
955
+ const ElementTransformation & eltrans,
956
+ FlatVector<double> elveclin,
957
+ FlatMatrix<double> elmat,
958
+ LocalHeap & lh) const override;
959
+ virtual void
960
+ CalcLinearizedElementMatrix (const FiniteElement & bfel,
961
+ const ElementTransformation & eltrans,
962
+ FlatVector<Complex> elveclin,
963
+ FlatMatrix<Complex> elmat,
964
+ LocalHeap & lh) const override;
965
+
966
+ /*
967
+ virtual void
968
+ CalcFlux (const FiniteElement & fel,
969
+ const ElementTransformation & eltrans,
970
+ const IntegrationPoint & ip,
971
+ FlatVector<double> elx,
972
+ FlatVector<double> flux,
973
+ bool applyd,
974
+ LocalHeap & lh) const;
975
+
976
+ virtual void
977
+ CalcFlux (const FiniteElement & fel,
978
+ const ElementTransformation & eltrans,
979
+ const IntegrationPoint & ip,
980
+ FlatVector<Complex> elx,
981
+ FlatVector<Complex> flux,
982
+ bool applyd,
983
+ LocalHeap & lh) const;
984
+ */
985
+
986
+
987
+ virtual void
988
+ CalcFlux (const FiniteElement & fel,
989
+ const BaseMappedIntegrationPoint & bmip,
990
+ BareSliceVector<double> elx,
991
+ FlatVector<double> flux,
992
+ bool applyd,
993
+ LocalHeap & lh) const override;
994
+
995
+ virtual void
996
+ CalcFlux (const FiniteElement & fel,
997
+ const BaseMappedIntegrationPoint & bmip,
998
+ BareSliceVector<Complex> elx,
999
+ FlatVector<Complex> flux,
1000
+ bool applyd,
1001
+ LocalHeap & lh) const override;
1002
+
1003
+ virtual void
1004
+ CalcFlux (const FiniteElement & fel,
1005
+ const BaseMappedIntegrationRule & mir,
1006
+ BareSliceVector<double> elx,
1007
+ BareSliceMatrix<double> flux,
1008
+ bool applyd,
1009
+ LocalHeap & lh) const override;
1010
+
1011
+
1012
+
1013
+ virtual void
1014
+ ApplyBTrans (const FiniteElement & bfel,
1015
+ const BaseMappedIntegrationPoint & bmip,
1016
+ FlatVector<double> elx,
1017
+ FlatVector<double> ely,
1018
+ LocalHeap & lh) const override;
1019
+
1020
+ virtual void
1021
+ ApplyBTrans (const FiniteElement & bfel,
1022
+ const BaseMappedIntegrationPoint & bmip,
1023
+ FlatVector<Complex> elx,
1024
+ FlatVector<Complex> ely,
1025
+ LocalHeap & lh) const override;
1026
+
1027
+ virtual void
1028
+ ApplyBTrans (const FiniteElement & fel,
1029
+ const BaseMappedIntegrationRule & mir,
1030
+ FlatMatrix<double> elx,
1031
+ FlatVector<double> ely,
1032
+ LocalHeap & lh) const override;
1033
+
1034
+ virtual double Energy (const FiniteElement & fel,
1035
+ const ElementTransformation & eltrans,
1036
+ FlatVector<double> elx,
1037
+ LocalHeap & lh) const override;
1038
+
1039
+ virtual string Name () const override;
1040
+ };
1041
+
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+ class NGS_DLL_HEADER ComplexBilinearFormIntegrator : public BilinearFormIntegrator
1049
+ {
1050
+ shared_ptr<BilinearFormIntegrator> bfi;
1051
+ Complex factor;
1052
+ public:
1053
+ ComplexBilinearFormIntegrator (shared_ptr<BilinearFormIntegrator> abfi,
1054
+ Complex afactor);
1055
+
1056
+ virtual VorB VB () const override
1057
+ { return bfi->VB(); }
1058
+
1059
+ virtual int DimFlux () const override
1060
+ { return bfi->DimFlux(); }
1061
+ virtual int DimElement () const override
1062
+ { return bfi->DimElement(); }
1063
+ virtual int DimSpace () const override
1064
+ { return bfi->DimSpace(); }
1065
+ virtual xbool IsSymmetric () const override
1066
+ { return bfi->IsSymmetric(); }
1067
+
1068
+
1069
+ virtual void GetFactor(Complex & fac) const {fac = factor;}
1070
+ virtual void GetFactor(double & fac) const {fac = factor.real();}
1071
+
1072
+ virtual shared_ptr<BilinearFormIntegrator> GetBFI(void) const {return bfi;}
1073
+
1074
+ virtual void CheckElement (const FiniteElement & el) const override { bfi->CheckElement(el); }
1075
+
1076
+
1077
+ virtual void
1078
+ CalcElementMatrix (const FiniteElement & fel,
1079
+ const ElementTransformation & eltrans,
1080
+ FlatMatrix<double> elmat,
1081
+ LocalHeap & lh) const override;
1082
+
1083
+ virtual void
1084
+ CalcElementMatrix (const FiniteElement & fel,
1085
+ const ElementTransformation & eltrans,
1086
+ FlatMatrix<Complex> elmat,
1087
+ LocalHeap & lh) const override;
1088
+
1089
+ virtual void
1090
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
1091
+ const FiniteElement & bfel_master_element,
1092
+ const FiniteElement & bfel_other,
1093
+ const ElementTransformation & eltrans_master,
1094
+ const ElementTransformation & eltrans_master_element,
1095
+ const ElementTransformation & eltrans_other,
1096
+ const IntegrationPoint & ip_master,
1097
+ const IntegrationPoint & ip_master_element,
1098
+ const IntegrationPoint & ip_other,
1099
+ FlatMatrix<double> & elmat,
1100
+ LocalHeap & lh) const override;
1101
+
1102
+ virtual void
1103
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
1104
+ const FiniteElement & bfel_master_element,
1105
+ const FiniteElement & bfel_other,
1106
+ const ElementTransformation & eltrans_master,
1107
+ const ElementTransformation & eltrans_master_element,
1108
+ const ElementTransformation & eltrans_other,
1109
+ const IntegrationPoint & ip_master,
1110
+ const IntegrationPoint & ip_master_element,
1111
+ const IntegrationPoint & ip_other,
1112
+ FlatMatrix<Complex> & elmat,
1113
+ LocalHeap & lh) const override;
1114
+
1115
+ virtual void
1116
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
1117
+ const FiniteElement & bfel_other,
1118
+ const ElementTransformation & eltrans_master,
1119
+ const ElementTransformation & eltrans_other,
1120
+ const IntegrationPoint & ip_master,
1121
+ const IntegrationPoint & ip_other,
1122
+ FlatMatrix<double> & elmat,
1123
+ LocalHeap & lh) const override;
1124
+
1125
+ virtual void
1126
+ CalcElementMatrixIndependent (const FiniteElement & bfel_master,
1127
+ const FiniteElement & bfel_other,
1128
+ const ElementTransformation & eltrans_master,
1129
+ const ElementTransformation & eltrans_other,
1130
+ const IntegrationPoint & ip_master,
1131
+ const IntegrationPoint & ip_other,
1132
+ FlatMatrix<Complex> & elmat,
1133
+ LocalHeap & lh) const override;
1134
+
1135
+
1136
+
1137
+ virtual void
1138
+ ApplyElementMatrix (const FiniteElement & fel,
1139
+ const ElementTransformation & eltrans,
1140
+ const FlatVector<Complex> elx,
1141
+ FlatVector<Complex> ely,
1142
+ void * precomputed,
1143
+ LocalHeap & lh) const override;
1144
+ /*
1145
+ virtual void
1146
+ CalcFlux (const FiniteElement & fel,
1147
+ const ElementTransformation & eltrans,
1148
+ const IntegrationPoint & ip,
1149
+ FlatVector<Complex> elx,
1150
+ FlatVector<Complex> flux,
1151
+ bool applyd,
1152
+ LocalHeap & lh) const;
1153
+ */
1154
+
1155
+ virtual void
1156
+ CalcFlux (const FiniteElement & fel,
1157
+ const BaseMappedIntegrationPoint & bmip,
1158
+ BareSliceVector<Complex> elx,
1159
+ FlatVector<Complex> flux,
1160
+ bool applyd,
1161
+ LocalHeap & lh) const override;
1162
+
1163
+ virtual string Name () const override;
1164
+
1165
+ /*
1166
+ virtual const IntegrationRule & GetIntegrationRule (const FiniteElement & fel,
1167
+ const bool use_higher_integration_order = false) const;
1168
+ */
1169
+ };
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+ class NGS_DLL_HEADER TransposeBilinearFormIntegrator : public BilinearFormIntegrator
1176
+ {
1177
+ shared_ptr<BilinearFormIntegrator> bfi;
1178
+ public:
1179
+ TransposeBilinearFormIntegrator (shared_ptr<BilinearFormIntegrator> abfi)
1180
+ : bfi(abfi) { ; }
1181
+ virtual ~TransposeBilinearFormIntegrator () { ; }
1182
+
1183
+ shared_ptr<BilinearFormIntegrator> GetBFI(void) const {return bfi;}
1184
+
1185
+ virtual VorB VB () const
1186
+ { return bfi->VB(); }
1187
+
1188
+ virtual int DimFlux () const
1189
+ { return bfi->DimFlux(); }
1190
+ virtual int DimElement () const
1191
+ { return bfi->DimElement(); }
1192
+ virtual int DimSpace () const
1193
+ { return bfi->DimSpace(); }
1194
+ virtual xbool IsSymmetric () const
1195
+ { return bfi->IsSymmetric(); }
1196
+
1197
+ virtual void CheckElement (const FiniteElement & el) const
1198
+ {
1199
+ return bfi->CheckElement (el);
1200
+ }
1201
+
1202
+ virtual void
1203
+ CalcElementMatrix (const FiniteElement & bfel,
1204
+ const ElementTransformation & eltrans,
1205
+ FlatMatrix<double> elmat,
1206
+ LocalHeap & lh) const;
1207
+ };
1208
+
1209
+
1210
+
1211
+ class NGS_DLL_HEADER BilinearFormIntegratorAnyDim : public BilinearFormIntegrator
1212
+ {
1213
+ shared_ptr<BilinearFormIntegrator> bfi[4]; // dim 0 ... dim 3
1214
+ shared_ptr<BilinearFormIntegrator> any_dim;
1215
+ public:
1216
+ BilinearFormIntegratorAnyDim (shared_ptr<BilinearFormIntegrator> abfi[4])
1217
+ {
1218
+ for (int i = 0; i < 4; i++)
1219
+ {
1220
+ bfi[i] = abfi[i];
1221
+ if (bfi[i]) any_dim = bfi[i];
1222
+ }
1223
+ }
1224
+
1225
+ shared_ptr<BilinearFormIntegrator> GetBFI(int dim) const
1226
+ {
1227
+ if (!bfi[dim])
1228
+ throw Exception (string("BFI for dimension") + ToString(dim)+"not available");
1229
+ bfi[dim]->SetDefinedOn(definedon);
1230
+ return bfi[dim];
1231
+ }
1232
+
1233
+ virtual VorB VB () const
1234
+ { return any_dim->VB(); }
1235
+
1236
+ virtual int DimFlux () const
1237
+ { throw Exception("BFI AnyDim - DimFlux not available"); }
1238
+ virtual int DimElement () const
1239
+ { throw Exception("BFI AnyDim - DimElement not available"); }
1240
+ virtual int DimSpace () const
1241
+ { throw Exception("BFI AnyDim - DimSpace not available"); }
1242
+ virtual xbool IsSymmetric () const
1243
+ { return any_dim->IsSymmetric(); }
1244
+
1245
+ virtual void CheckElement (const FiniteElement & el) const;
1246
+
1247
+ virtual void
1248
+ CalcElementMatrix (const FiniteElement & bfel,
1249
+ const ElementTransformation & eltrans,
1250
+ FlatMatrix<double> elmat,
1251
+ LocalHeap & lh) const;
1252
+ virtual void
1253
+ CalcElementMatrix (const FiniteElement & bfel,
1254
+ const ElementTransformation & eltrans,
1255
+ FlatMatrix<Complex> elmat,
1256
+ LocalHeap & lh) const;
1257
+ };
1258
+
1259
+
1260
+
1261
+
1262
+
1263
+ class NGS_DLL_HEADER CompoundBilinearFormIntegrator : public BilinearFormIntegrator
1264
+ {
1265
+ shared_ptr<BilinearFormIntegrator> bfi;
1266
+ int comp;
1267
+ public:
1268
+ CompoundBilinearFormIntegrator (shared_ptr<BilinearFormIntegrator> abfi, int acomp);
1269
+
1270
+ shared_ptr<BilinearFormIntegrator> GetBFI(void) const {return bfi;}
1271
+ int GetComponent() const {return comp;}
1272
+ virtual VorB VB () const override
1273
+ { return bfi->VB(); }
1274
+
1275
+ virtual int DimFlux () const override
1276
+ { return bfi->DimFlux(); }
1277
+ virtual int DimElement () const override
1278
+ { return bfi->DimElement(); }
1279
+ virtual int DimSpace () const override
1280
+ { return bfi->DimSpace(); }
1281
+ virtual xbool IsSymmetric () const override
1282
+ { return bfi->IsSymmetric(); }
1283
+ virtual bool SkeletonForm () const override
1284
+ { return bfi->SkeletonForm(); }
1285
+ virtual void CheckElement (const FiniteElement & el) const override
1286
+ {
1287
+ return bfi->CheckElement (dynamic_cast<const CompoundFiniteElement&>(el)[comp]);
1288
+ }
1289
+
1290
+ virtual void
1291
+ CalcElementMatrix (const FiniteElement & bfel,
1292
+ const ElementTransformation & eltrans,
1293
+ FlatMatrix<double> elmat,
1294
+ LocalHeap & lh) const override;
1295
+
1296
+ virtual void
1297
+ CalcElementMatrix (const FiniteElement & bfel,
1298
+ const ElementTransformation & eltrans,
1299
+ FlatMatrix<Complex> elmat,
1300
+ LocalHeap & lh) const override;
1301
+
1302
+
1303
+ virtual void
1304
+ CalcLinearizedElementMatrix (const FiniteElement & fel,
1305
+ const ElementTransformation & eltrans,
1306
+ FlatVector<double> elveclin,
1307
+ FlatMatrix<double> elmat,
1308
+ LocalHeap & lh) const override;
1309
+
1310
+ virtual void
1311
+ CalcLinearizedElementMatrix (const FiniteElement & fel,
1312
+ const ElementTransformation & eltrans,
1313
+ FlatVector<Complex> elveclin,
1314
+ FlatMatrix<Complex> elmat,
1315
+ LocalHeap & lh) const override;
1316
+
1317
+ virtual void
1318
+ ApplyElementMatrix (const FiniteElement & bfel,
1319
+ const ElementTransformation & eltrans,
1320
+ FlatVector<double> elx,
1321
+ FlatVector<double> ely,
1322
+ void * precomputed,
1323
+ LocalHeap & lh) const override;
1324
+
1325
+ virtual void
1326
+ ApplyElementMatrix (const FiniteElement & bfel,
1327
+ const ElementTransformation & eltrans,
1328
+ FlatVector<Complex> elx,
1329
+ FlatVector<Complex> ely,
1330
+ void * precomputed,
1331
+ LocalHeap & lh) const override;
1332
+
1333
+ virtual void
1334
+ ApplyLinearizedElementMatrix (const FiniteElement & bfel,
1335
+ const ElementTransformation & eltrans,
1336
+ FlatVector<double> ellin,
1337
+ FlatVector<double> elx,
1338
+ FlatVector<double> ely,
1339
+ LocalHeap & lh) const override;
1340
+
1341
+ virtual void
1342
+ ApplyLinearizedElementMatrix (const FiniteElement & bfel,
1343
+ const ElementTransformation & eltrans,
1344
+ FlatVector<Complex> ellin,
1345
+ FlatVector<Complex> elx,
1346
+ FlatVector<Complex> ely,
1347
+ LocalHeap & lh) const override;
1348
+
1349
+
1350
+ virtual void
1351
+ CalcFlux (const FiniteElement & fel,
1352
+ const BaseMappedIntegrationPoint & bmip,
1353
+ BareSliceVector<double> elx,
1354
+ FlatVector<double> flux,
1355
+ bool applyd,
1356
+ LocalHeap & lh) const override;
1357
+
1358
+
1359
+ virtual void
1360
+ CalcFlux (const FiniteElement & fel,
1361
+ const BaseMappedIntegrationPoint & bmip,
1362
+ BareSliceVector<Complex> elx,
1363
+ FlatVector<Complex> flux,
1364
+ bool applyd,
1365
+ LocalHeap & lh) const override;
1366
+
1367
+
1368
+ virtual void
1369
+ CalcFlux (const FiniteElement & fel,
1370
+ const BaseMappedIntegrationRule & mir,
1371
+ BareSliceVector<double> elx,
1372
+ BareSliceMatrix<double> flux,
1373
+ bool applyd,
1374
+ LocalHeap & lh) const override;
1375
+
1376
+
1377
+ virtual void
1378
+ CalcFlux (const FiniteElement & fel,
1379
+ const BaseMappedIntegrationRule & mir,
1380
+ BareSliceVector<Complex> elx,
1381
+ BareSliceMatrix<Complex> flux,
1382
+ bool applyd,
1383
+ LocalHeap & lh) const override;
1384
+
1385
+
1386
+ virtual void
1387
+ ApplyBTrans (const FiniteElement & fel,
1388
+ const BaseMappedIntegrationPoint & bmip,
1389
+ FlatVector<double> elx,
1390
+ FlatVector<double> ely,
1391
+ LocalHeap & lh) const override;
1392
+
1393
+ virtual void
1394
+ ApplyBTrans (const FiniteElement & fel,
1395
+ const BaseMappedIntegrationPoint & bmip,
1396
+ FlatVector<Complex> elx,
1397
+ FlatVector<Complex> ely,
1398
+ LocalHeap & lh) const override;
1399
+
1400
+ virtual string Name () const override;
1401
+ };
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+ /**
1412
+ Integrator for element vector.
1413
+ */
1414
+ class NGS_DLL_HEADER LinearFormIntegrator : public Integrator
1415
+
1416
+ {
1417
+ public:
1418
+ ///
1419
+ LinearFormIntegrator () { ; }
1420
+ ///
1421
+ virtual ~LinearFormIntegrator () { ; }
1422
+
1423
+
1424
+ /**
1425
+ Computes the element vector.
1426
+ */
1427
+ virtual void
1428
+ CalcElementVector (const FiniteElement & fel,
1429
+ const ElementTransformation & eltrans,
1430
+ FlatVector<double> elvec,
1431
+ LocalHeap & lh) const;
1432
+
1433
+ virtual void
1434
+ CalcElementVector (const FiniteElement & fel,
1435
+ const ElementTransformation & eltrans,
1436
+ FlatVector<Complex> elvec,
1437
+ LocalHeap & lh) const;
1438
+
1439
+
1440
+ virtual void
1441
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1442
+ const BaseMappedIntegrationPoint & s_mip,
1443
+ const BaseMappedIntegrationPoint & g_mip,
1444
+ FlatVector<double> & elvec,
1445
+ LocalHeap & lh,
1446
+ const bool curveint = false) const
1447
+ {
1448
+ cerr << "CalcElementVectorIndependent called for base-class!" << endl;
1449
+ exit(10);
1450
+ }
1451
+
1452
+ virtual void
1453
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1454
+ const BaseMappedIntegrationPoint & s_mip,
1455
+ const BaseMappedIntegrationPoint & g_mip,
1456
+ FlatVector<Complex> & elvec,
1457
+ LocalHeap & lh,
1458
+ const bool curveint = false) const
1459
+ {
1460
+ FlatVector<double> rvec(elvec.Size(), lh);
1461
+ CalcElementVectorIndependent (gfel, s_mip, g_mip, rvec, lh,curveint);
1462
+ elvec = rvec;
1463
+ }
1464
+
1465
+
1466
+ };
1467
+
1468
+
1469
+
1470
+
1471
+
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+
1479
+
1480
+
1481
+
1482
+ class NGS_DLL_HEADER FacetLinearFormIntegrator : public LinearFormIntegrator
1483
+ {
1484
+ public:
1485
+
1486
+ FacetLinearFormIntegrator( /* const Array<shared_ptr<CoefficientFunction>> & coeffs */)
1487
+ : LinearFormIntegrator() { ; }
1488
+
1489
+ ~FacetLinearFormIntegrator() { ; }
1490
+
1491
+ virtual VorB VB () const
1492
+ { return BND; }
1493
+
1494
+ virtual bool SkeletonForm () const
1495
+ { return 1; }
1496
+
1497
+ virtual void
1498
+ CalcElementVector (const FiniteElement & bfel,
1499
+ const ElementTransformation & eltrans,
1500
+ FlatVector<double> elvec,
1501
+ LocalHeap & lh) const{
1502
+ throw Exception ("FacetLinearFormIntegrator can not assemble volumetric element matrices!");
1503
+ }
1504
+
1505
+ virtual void
1506
+ CalcFacetVector (const FiniteElement & volumefel1, int LocalFacetNr1,
1507
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
1508
+ const FiniteElement & volumefel2, int LocalFacetNr2,
1509
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
1510
+ FlatVector<double> elvec,
1511
+ LocalHeap & lh) const{
1512
+ throw Exception ("FacetLinearFormIntegrator::CalcFacetVector for inner facets not implemented!");
1513
+ }
1514
+
1515
+ virtual void
1516
+ CalcFacetVector (const FiniteElement & volumefel1, int LocalFacetNr1,
1517
+ const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
1518
+ const FiniteElement & volumefel2, int LocalFacetNr2,
1519
+ const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
1520
+ FlatVector<Complex> elvec,
1521
+ LocalHeap & lh) const{
1522
+ throw Exception ("FacetLinearFormIntegrator::CalcFacetVector<Complex> for inner facets not implemented!");
1523
+ }
1524
+
1525
+ virtual void
1526
+ CalcFacetVector (const FiniteElement & volumefel, int LocalFacetNr,
1527
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
1528
+ const ElementTransformation & seltrans,
1529
+ FlatVector<double> elvec,
1530
+ LocalHeap & lh) const{
1531
+ throw Exception ("FacetLinearFormIntegrator::CalcFacetVector not implemented!");
1532
+ }
1533
+
1534
+ virtual void
1535
+ CalcFacetVector (const FiniteElement & volumefel, int LocalFacetNr,
1536
+ const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
1537
+ const ElementTransformation & seltrans,
1538
+ FlatVector<Complex> elvec,
1539
+ LocalHeap & lh) const {
1540
+ throw Exception ("FacetLinearFormIntegrator::CalcFacetVector<complex> not implemented!");
1541
+ }
1542
+
1543
+ };
1544
+
1545
+
1546
+
1547
+
1548
+
1549
+ class NGS_DLL_HEADER BlockLinearFormIntegrator : public LinearFormIntegrator
1550
+ {
1551
+ shared_ptr<LinearFormIntegrator> lfi;
1552
+ int dim;
1553
+ int comp;
1554
+ public:
1555
+ BlockLinearFormIntegrator (shared_ptr<LinearFormIntegrator> alfi, int adim, int acomp);
1556
+
1557
+ virtual VorB VB () const
1558
+ { return lfi->VB(); }
1559
+
1560
+
1561
+ virtual void
1562
+ CalcElementVector (const FiniteElement & bfel,
1563
+ const ElementTransformation & eltrans,
1564
+ FlatVector<double> elvec,
1565
+ LocalHeap & lh) const;
1566
+ };
1567
+
1568
+
1569
+
1570
+
1571
+
1572
+ class NGS_DLL_HEADER ComplexLinearFormIntegrator : public LinearFormIntegrator
1573
+ {
1574
+ shared_ptr<LinearFormIntegrator> lfi;
1575
+ Complex factor;
1576
+ public:
1577
+ ComplexLinearFormIntegrator (shared_ptr<LinearFormIntegrator> alfi,
1578
+ Complex afactor);
1579
+ virtual ~ComplexLinearFormIntegrator();
1580
+
1581
+ virtual VorB VB () const override;
1582
+ virtual void CheckElement (const FiniteElement & el) const override;
1583
+
1584
+
1585
+ virtual void
1586
+ CalcElementVector (const FiniteElement & fel,
1587
+ const ElementTransformation & eltrans,
1588
+ FlatVector<double> elvec,
1589
+ LocalHeap & lh) const override;
1590
+
1591
+ virtual void
1592
+ CalcElementVector (const FiniteElement & fel,
1593
+ const ElementTransformation & eltrans,
1594
+ FlatVector<Complex> elvec,
1595
+ LocalHeap & lh) const override;
1596
+
1597
+ virtual void
1598
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1599
+ const BaseMappedIntegrationPoint & s_mip,
1600
+ const BaseMappedIntegrationPoint & g_mip,
1601
+ FlatVector<double> & elvec,
1602
+ LocalHeap & lh,
1603
+ const bool curveint = false) const override;
1604
+
1605
+
1606
+ virtual void
1607
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1608
+ const BaseMappedIntegrationPoint & s_mip,
1609
+ const BaseMappedIntegrationPoint & g_mip,
1610
+ FlatVector<Complex> & elvec,
1611
+ LocalHeap & lh,
1612
+ const bool curveint = false) const override;
1613
+
1614
+ virtual string Name () const override;
1615
+ };
1616
+
1617
+
1618
+
1619
+
1620
+ class NGS_DLL_HEADER CompoundLinearFormIntegrator : public LinearFormIntegrator
1621
+ {
1622
+ shared_ptr<LinearFormIntegrator> lfi;
1623
+ int comp;
1624
+ public:
1625
+ CompoundLinearFormIntegrator (shared_ptr<LinearFormIntegrator> alfi, int acomp)
1626
+ : lfi(alfi), comp(acomp)
1627
+ {
1628
+ is_curve_integrator = lfi->IntegrationAlongCurve();
1629
+ }
1630
+
1631
+ VorB VB () const override
1632
+ { return lfi->VB(); }
1633
+
1634
+ void
1635
+ CalcElementVector (const FiniteElement & bfel,
1636
+ const ElementTransformation & eltrans,
1637
+ FlatVector<double> elvec,
1638
+ LocalHeap & lh) const override;
1639
+
1640
+ void
1641
+ CalcElementVector (const FiniteElement & bfel,
1642
+ const ElementTransformation & eltrans,
1643
+ FlatVector<Complex> elvec,
1644
+ LocalHeap & lh) const override;
1645
+
1646
+ void
1647
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1648
+ const BaseMappedIntegrationPoint & s_mip,
1649
+ const BaseMappedIntegrationPoint & g_mip,
1650
+ FlatVector<double> & elvec,
1651
+ LocalHeap & lh,
1652
+ const bool curveint = false) const override;
1653
+
1654
+ void
1655
+ CalcElementVectorIndependent (const FiniteElement & gfel,
1656
+ const BaseMappedIntegrationPoint & s_mip,
1657
+ const BaseMappedIntegrationPoint & g_mip,
1658
+ FlatVector<Complex> & elvec,
1659
+ LocalHeap & lh,
1660
+ const bool curveint = false) const override;
1661
+
1662
+ string Name () const override
1663
+ {
1664
+ return string ("CompoundIntegrator (") + lfi->Name() + ")";
1665
+ }
1666
+
1667
+ int NumCurvePoints() const override { return lfi->NumCurvePoints(); }
1668
+ FlatVector<double> CurvePoint(int i) override
1669
+ { return lfi->CurvePoint(i); }
1670
+ FlatVector<double> CurvePointTangent(int i) override
1671
+ { return lfi->CurvePointTangent(i); }
1672
+ int GetNumCurveParts() const override
1673
+ { return lfi->GetNumCurveParts(); }
1674
+ int GetStartOfCurve(int i) const override
1675
+ { return lfi->GetStartOfCurve(i); }
1676
+ int GetEndOfCurve(int i) const override
1677
+ { return lfi->GetEndOfCurve(i); }
1678
+
1679
+ void AppendCurvePoint(const FlatVector<double> & point) override
1680
+ { lfi->AppendCurvePoint(point); }
1681
+ void AppendCurvePoint(const FlatVector<double> & point,
1682
+ const FlatVector<double> & tangent) override
1683
+ { lfi->AppendCurvePoint(point, tangent); }
1684
+ void SetCurveClearance() override
1685
+ { lfi->SetCurveClearance(); }
1686
+ void SetCacheComp(const int comp) override
1687
+ { cachecomp = comp; }
1688
+ int CacheComp() const override
1689
+ { return lfi->CacheComp(); }
1690
+
1691
+ };
1692
+
1693
+
1694
+
1695
+
1696
+
1697
+ class NGS_DLL_HEADER LinearFormIntegratorAnyDim : public LinearFormIntegrator
1698
+ {
1699
+ shared_ptr<LinearFormIntegrator> lfi[4]; // dim 0 ... dim 3
1700
+ shared_ptr<LinearFormIntegrator> any_dim;
1701
+ public:
1702
+ LinearFormIntegratorAnyDim (shared_ptr<LinearFormIntegrator> alfi[4])
1703
+ {
1704
+ for (int i = 0; i < 4; i++)
1705
+ {
1706
+ lfi[i] = alfi[i];
1707
+ if (lfi[i]) any_dim = lfi[i];
1708
+ }
1709
+ }
1710
+
1711
+ shared_ptr<LinearFormIntegrator> GetLFI(int dim) const
1712
+ {
1713
+ if (!lfi[dim])
1714
+ throw Exception (string("LFI for dimension") + ToString(dim)+"not available");
1715
+ lfi[dim]->SetDefinedOn(definedon);
1716
+ return lfi[dim];
1717
+ }
1718
+
1719
+ virtual VorB VB () const
1720
+ { return any_dim->VB(); }
1721
+ virtual int DimElement () const
1722
+ { throw Exception("BFI AnyDim - DimElement not available"); }
1723
+ virtual int DimSpace () const
1724
+ { throw Exception("BFI AnyDim - DimSpace not available"); }
1725
+
1726
+ virtual void CheckElement (const FiniteElement & el) const;
1727
+
1728
+ virtual void
1729
+ CalcElementVector (const FiniteElement & bfel,
1730
+ const ElementTransformation & eltrans,
1731
+ FlatVector<double> elvec,
1732
+ LocalHeap & lh) const;
1733
+
1734
+ virtual void
1735
+ CalcElementVector (const FiniteElement & bfel,
1736
+ const ElementTransformation & eltrans,
1737
+ FlatVector<Complex> elvec,
1738
+ LocalHeap & lh) const;
1739
+ };
1740
+
1741
+
1742
+ class CalcFluxDifferentialOperator : public DifferentialOperator
1743
+ {
1744
+ shared_ptr<BilinearFormIntegrator> bfi;
1745
+ bool applyd;
1746
+ public:
1747
+ CalcFluxDifferentialOperator (shared_ptr<BilinearFormIntegrator> _bfi, bool _applyd)
1748
+ : DifferentialOperator(_bfi->DimFlux(), 1, _bfi->VB(), 0), bfi(_bfi)
1749
+ { ; }
1750
+
1751
+ virtual shared_ptr<DifferentialOperator> GetTrace() const override { return nullptr; }
1752
+
1753
+
1754
+ virtual void
1755
+ CalcMatrix (const FiniteElement & fel,
1756
+ const BaseMappedIntegrationPoint & mip,
1757
+ BareSliceMatrix<double,ColMajor> mat,
1758
+ LocalHeap & lh) const override
1759
+ {
1760
+ throw Exception ("CalcFluxDifferentialOperator::CalcMatrix not available");
1761
+ }
1762
+
1763
+ virtual void
1764
+ CalcMatrix (const FiniteElement & fel,
1765
+ const BaseMappedIntegrationPoint & bmip,
1766
+ BareSliceMatrix<Complex,ColMajor> mat,
1767
+ LocalHeap & lh) const override
1768
+ {
1769
+ throw Exception ("CalcFluxDifferentialOperator::CalcMatrix not available");
1770
+ }
1771
+
1772
+ virtual void
1773
+ CalcMatrix (const FiniteElement & fel,
1774
+ const BaseMappedIntegrationRule & mir,
1775
+ BareSliceMatrix<double,ColMajor> mat,
1776
+ LocalHeap & lh) const override
1777
+ {
1778
+ throw Exception ("CalcFluxDifferentialOperator::CalcMatrix not available");
1779
+ }
1780
+
1781
+ NGS_DLL_HEADER virtual void
1782
+ CalcMatrix (const FiniteElement & fel,
1783
+ const BaseMappedIntegrationRule & mir,
1784
+ BareSliceMatrix<Complex,ColMajor> mat,
1785
+ LocalHeap & lh) const override
1786
+ {
1787
+ throw Exception ("CalcFluxDifferentialOperator::CalcMatrix not available");
1788
+ }
1789
+
1790
+
1791
+ NGS_DLL_HEADER virtual void
1792
+ CalcMatrix (const FiniteElement & fel,
1793
+ const SIMD_BaseMappedIntegrationRule & mir,
1794
+ BareSliceMatrix<SIMD<double>> mat) const override
1795
+ {
1796
+ throw Exception ("CalcFluxDifferentialOperator::CalcMatrix not available");
1797
+ }
1798
+
1799
+ using DifferentialOperator::Apply;
1800
+ virtual void
1801
+ Apply (const FiniteElement & fel,
1802
+ const BaseMappedIntegrationPoint & mip,
1803
+ BareSliceVector<double> x,
1804
+ FlatVector<double> flux,
1805
+ LocalHeap & lh) const override
1806
+ {
1807
+ bfi->CalcFlux(fel, mip, x, flux, applyd, lh);
1808
+ }
1809
+
1810
+ NGS_DLL_HEADER virtual void
1811
+ Apply (const FiniteElement & fel,
1812
+ const BaseMappedIntegrationPoint & mip,
1813
+ BareSliceVector<Complex> x,
1814
+ FlatVector<Complex> flux,
1815
+ LocalHeap & lh) const override
1816
+ {
1817
+ bfi->CalcFlux(fel, mip, x, flux, applyd, lh);
1818
+ }
1819
+
1820
+ NGS_DLL_HEADER virtual void
1821
+ Apply (const FiniteElement & fel,
1822
+ const BaseMappedIntegrationRule & mir,
1823
+ BareSliceVector<double> x,
1824
+ BareSliceMatrix<double> flux,
1825
+ LocalHeap & lh) const override
1826
+ {
1827
+ bfi->CalcFlux(fel, mir, x, flux, applyd, lh);
1828
+ }
1829
+
1830
+ NGS_DLL_HEADER virtual void
1831
+ Apply (const FiniteElement & fel,
1832
+ const BaseMappedIntegrationRule & mir,
1833
+ BareSliceVector<Complex> x,
1834
+ BareSliceMatrix<Complex> flux,
1835
+ LocalHeap & lh) const override
1836
+ {
1837
+ bfi->CalcFlux(fel, mir, x, flux, applyd, lh);
1838
+ }
1839
+
1840
+
1841
+ NGS_DLL_HEADER virtual void
1842
+ Apply (const FiniteElement & fel,
1843
+ const SIMD_BaseMappedIntegrationRule & mir,
1844
+ BareSliceVector<double> x,
1845
+ BareSliceMatrix<SIMD<double>> flux) const override
1846
+ {
1847
+ // bfi->CalcFlux(fel, mir, x, flux, applyd);
1848
+ throw ExceptionNOSIMD (string("CalcFluxDiffop: simd is not supported"));
1849
+ }
1850
+
1851
+ NGS_DLL_HEADER virtual void
1852
+ Apply (const FiniteElement & fel,
1853
+ const SIMD_BaseMappedIntegrationRule & mir,
1854
+ BareSliceVector<Complex> x,
1855
+ BareSliceMatrix<SIMD<Complex>> flux) const override
1856
+ {
1857
+ // bfi->CalcFlux(fel, mir, x, flux, applyd);
1858
+ throw ExceptionNOSIMD (string("CalcFluxDiffop: simd is not supported"));
1859
+ }
1860
+
1861
+ };
1862
+
1863
+
1864
+ /// container for all integrators
1865
+ class NGS_DLL_HEADER Integrators
1866
+ {
1867
+ public:
1868
+
1869
+ /// description of integrator
1870
+ template<typename T>
1871
+ class IntegratorInfo
1872
+ {
1873
+ public:
1874
+ string name;
1875
+ int spacedim;
1876
+ int numcoeffs;
1877
+ shared_ptr<T> (*creator)(const Array<shared_ptr<CoefficientFunction>> &);
1878
+
1879
+ IntegratorInfo (const string & aname,
1880
+ int aspacedim,
1881
+ int anumcoffs,
1882
+ shared_ptr<T> (*acreator)(const Array<shared_ptr<CoefficientFunction>> &));
1883
+ };
1884
+
1885
+
1886
+ Array<IntegratorInfo<BilinearFormIntegrator>*> bfis;
1887
+ Array<IntegratorInfo<LinearFormIntegrator>*> lfis;
1888
+
1889
+ public:
1890
+ ///
1891
+ Integrators();
1892
+ ///
1893
+ ~Integrators();
1894
+ ///
1895
+ void AddBFIntegrator (const string & aname, int aspacedim, int anumcoeffs,
1896
+ shared_ptr<BilinearFormIntegrator> (*acreator)(const Array<shared_ptr<CoefficientFunction>> &));
1897
+ ///
1898
+ void AddLFIntegrator (const string & aname, int aspacedim, int anumcoeffs,
1899
+ shared_ptr<LinearFormIntegrator> (*acreator)(const Array<shared_ptr<CoefficientFunction>> &));
1900
+
1901
+ ///
1902
+ const Array<IntegratorInfo<BilinearFormIntegrator>*> & GetBFIs() const { return bfis; }
1903
+ ///
1904
+ const IntegratorInfo<BilinearFormIntegrator> * GetBFI(const string & name, int dim) const;
1905
+ ///
1906
+ shared_ptr<BilinearFormIntegrator> CreateBFI(const string & name, int dim,
1907
+ const Array<shared_ptr<CoefficientFunction>> & coeffs) const;
1908
+ ///
1909
+ shared_ptr<BilinearFormIntegrator> CreateBFI(const string & name, int dim,
1910
+ shared_ptr<CoefficientFunction> coef) const;
1911
+ shared_ptr<BilinearFormIntegrator> CreateBFI(const string & name, int dim,
1912
+ const CoefficientFunction* coef) const;
1913
+
1914
+ ///
1915
+ const Array<IntegratorInfo<LinearFormIntegrator>*> & GetLFIs() const { return lfis; }
1916
+ ///
1917
+ const IntegratorInfo<LinearFormIntegrator> * GetLFI(const string & name, int dim) const;
1918
+ ///
1919
+ shared_ptr<LinearFormIntegrator> CreateLFI(const string & name, int dim,
1920
+ const Array<shared_ptr<CoefficientFunction>> & coeffs) const;
1921
+
1922
+ shared_ptr<LinearFormIntegrator> CreateLFI(const string & name, int dim,
1923
+ shared_ptr<CoefficientFunction> coef) const;
1924
+
1925
+ ///
1926
+ void Print (ostream & ost) const;
1927
+ };
1928
+
1929
+ ///
1930
+ extern NGS_DLL_HEADER Integrators & GetIntegrators ();
1931
+
1932
+ template <typename ... ARGS>
1933
+ inline shared_ptr<BilinearFormIntegrator> CreateBFI (ARGS ... args)
1934
+ {
1935
+ return GetIntegrators().CreateBFI (args...);
1936
+ }
1937
+
1938
+ template <typename ... ARGS>
1939
+ inline shared_ptr<LinearFormIntegrator> CreateLFI (ARGS ... args)
1940
+ {
1941
+ return GetIntegrators().CreateLFI (args...);
1942
+ }
1943
+
1944
+ /*
1945
+ class ConvertCoefs
1946
+ {
1947
+ Array<shared_ptr<CoefficientFunction> > coefs;
1948
+ Array<CoefficientFunction*> pcoefs;
1949
+ public:
1950
+
1951
+ ConvertCoefs (const Array<shared_ptr<CoefficientFunction>> & acoefs)
1952
+ : coefs (acoefs) // explicit copy !
1953
+ {
1954
+ for (int i = 0; i < acoefs.Size(); i++)
1955
+ pcoefs.Append (acoefs[i].get());
1956
+ }
1957
+
1958
+ ConvertCoefs (const Array<CoefficientFunction*> & acoefs)
1959
+ : pcoefs(acoefs)
1960
+ {
1961
+ for (int i = 0; i < acoefs.Size(); i++)
1962
+ coefs.Append (shared_ptr<CoefficientFunction> (acoefs[i], NOOP_Deleter));
1963
+ }
1964
+
1965
+ operator Array<shared_ptr<CoefficientFunction>> () const
1966
+ {
1967
+ return Array<shared_ptr<CoefficientFunction>> (coefs);
1968
+ }
1969
+
1970
+ operator Array<CoefficientFunction*> () const
1971
+ {
1972
+ return Array<CoefficientFunction*> (pcoefs);
1973
+ }
1974
+ };
1975
+ */
1976
+
1977
+ template <typename BFI>
1978
+ class RegisterBilinearFormIntegrator
1979
+ {
1980
+ public:
1981
+ RegisterBilinearFormIntegrator (string label, int dim, int numcoeffs)
1982
+ {
1983
+ GetIntegrators().AddBFIntegrator (label, dim, numcoeffs, Create);
1984
+ // cout << "register bf-integrator '" << label << "'" << endl;
1985
+ }
1986
+
1987
+ static shared_ptr<BilinearFormIntegrator> Create (const Array<shared_ptr<CoefficientFunction>> & coefs)
1988
+ {
1989
+ // return shared_ptr<BilinearFormIntegrator> (new BFI (ConvertCoefs (coefs)));
1990
+ // return make_shared<BFI>(ConvertCoefs (coefs));
1991
+ return make_shared<BFI>(coefs);
1992
+ }
1993
+
1994
+ // static shared_ptr<Integrator> Create (Array<CoefficientFunction*> & coefs)
1995
+ // {
1996
+ // return new BFI (ConvertCoefs (coefs));
1997
+ // }
1998
+ };
1999
+
2000
+
2001
+
2002
+ template <typename LFI>
2003
+ class RegisterLinearFormIntegrator
2004
+ {
2005
+ public:
2006
+ RegisterLinearFormIntegrator (string label, int dim, int numcoeffs)
2007
+ {
2008
+ GetIntegrators().AddLFIntegrator (label, dim, numcoeffs, Create);
2009
+ // cout << "register lf-integrator '" << label << "'" << endl;
2010
+ }
2011
+
2012
+ static shared_ptr<LinearFormIntegrator> Create (const Array<shared_ptr<CoefficientFunction>> & coefs)
2013
+ {
2014
+ // return shared_ptr<LinearFormIntegrator> (new LFI (ConvertCoefs(coefs)));
2015
+ return make_shared<LFI> (coefs);
2016
+ // return new LFI (coefs);
2017
+ }
2018
+ };
2019
+
2020
+
2021
+
2022
+
2023
+ }
2024
+ #endif