ngsolve 6.2.2506.post75.dev0__cp314-cp314-manylinux_2_28_x86_64.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 (303) hide show
  1. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngs_nvcc +14 -0
  2. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngs_nvlink +14 -0
  3. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngscxx +15 -0
  4. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngsld +11 -0
  5. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngsolve.tcl +648 -0
  6. ngsolve-6.2.2506.post75.dev0.data/data/bin/ngspy +2 -0
  7. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/analytic_integrals.hpp +10 -0
  8. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/arnoldi.hpp +55 -0
  9. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bandmatrix.hpp +334 -0
  10. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/basematrix.hpp +957 -0
  11. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/basevector.hpp +1268 -0
  12. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bdbequations.hpp +2805 -0
  13. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bdbintegrator.hpp +1660 -0
  14. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bem_diffops.hpp +475 -0
  15. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bessel.hpp +1064 -0
  16. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bilinearform.hpp +963 -0
  17. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bla.hpp +29 -0
  18. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/blockalloc.hpp +95 -0
  19. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/blockjacobi.hpp +328 -0
  20. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/bspline.hpp +116 -0
  21. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/calcinverse.hpp +141 -0
  22. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cg.hpp +368 -0
  23. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/chebyshev.hpp +44 -0
  24. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cholesky.hpp +720 -0
  25. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/clapack.h +7254 -0
  26. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/code_generation.hpp +296 -0
  27. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/coefficient.hpp +2033 -0
  28. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/coefficient_impl.hpp +19 -0
  29. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/coefficient_stdmath.hpp +167 -0
  30. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/commutingAMG.hpp +106 -0
  31. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/comp.hpp +79 -0
  32. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/compatibility.hpp +41 -0
  33. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/complex_wrapper.hpp +73 -0
  34. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/compressedfespace.hpp +110 -0
  35. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/contact.hpp +235 -0
  36. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cuda_linalg.hpp +175 -0
  37. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cuda_ngbla.hpp +226 -0
  38. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cuda_ngstd.hpp +527 -0
  39. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/cuda_profiler.hpp +240 -0
  40. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/diagonalmatrix.hpp +154 -0
  41. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/differentialoperator.hpp +276 -0
  42. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/diffop.hpp +1286 -0
  43. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/diffop_impl.hpp +328 -0
  44. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/diffopwithfactor.hpp +123 -0
  45. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/discontinuous.hpp +84 -0
  46. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/dump.hpp +949 -0
  47. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ectypes.hpp +121 -0
  48. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/eigen.hpp +60 -0
  49. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/eigensystem.hpp +18 -0
  50. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/elasticity_equations.hpp +595 -0
  51. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/elementbyelement.hpp +195 -0
  52. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/elementtopology.hpp +1760 -0
  53. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/elementtransformation.hpp +339 -0
  54. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/evalfunc.hpp +405 -0
  55. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/expr.hpp +1686 -0
  56. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/facetfe.hpp +175 -0
  57. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/facetfespace.hpp +180 -0
  58. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/facethofe.hpp +111 -0
  59. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/facetsurffespace.hpp +112 -0
  60. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/fe_interfaces.hpp +32 -0
  61. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/fem.hpp +87 -0
  62. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/fesconvert.hpp +14 -0
  63. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/fespace.hpp +1449 -0
  64. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/finiteelement.hpp +286 -0
  65. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/globalinterfacespace.hpp +77 -0
  66. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/globalspace.hpp +115 -0
  67. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/gridfunction.hpp +525 -0
  68. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1amg.hpp +124 -0
  69. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1hofe.hpp +188 -0
  70. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1hofe_impl.hpp +1262 -0
  71. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1hofefo.hpp +148 -0
  72. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1hofefo_impl.hpp +185 -0
  73. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1hofespace.hpp +167 -0
  74. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1lofe.hpp +1240 -0
  75. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/h1lumping.hpp +41 -0
  76. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurl_equations.hpp +1381 -0
  77. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlcurlfe.hpp +2241 -0
  78. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlcurlfespace.hpp +78 -0
  79. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlfe.hpp +259 -0
  80. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlfe_utils.hpp +107 -0
  81. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlhdiv_dshape.hpp +857 -0
  82. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlhdivfes.hpp +308 -0
  83. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlhofe.hpp +175 -0
  84. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlhofe_impl.hpp +1871 -0
  85. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurlhofespace.hpp +193 -0
  86. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hcurllofe.hpp +1146 -0
  87. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdiv_equations.hpp +880 -0
  88. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivdivfe.hpp +2923 -0
  89. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivdivsurfacespace.hpp +76 -0
  90. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivfe.hpp +206 -0
  91. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivfe_utils.hpp +717 -0
  92. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivfes.hpp +75 -0
  93. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivhofe.hpp +447 -0
  94. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivhofe_impl.hpp +1107 -0
  95. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivhofefo.hpp +229 -0
  96. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivhofespace.hpp +177 -0
  97. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivhosurfacefespace.hpp +106 -0
  98. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hdivlofe.hpp +773 -0
  99. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hidden.hpp +74 -0
  100. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/householder.hpp +181 -0
  101. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hypre_ams_precond.hpp +123 -0
  102. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/hypre_precond.hpp +73 -0
  103. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/integrator.hpp +2012 -0
  104. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/integratorcf.hpp +253 -0
  105. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/interpolate.hpp +49 -0
  106. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/intrule.hpp +2542 -0
  107. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/intrules_SauterSchwab.hpp +25 -0
  108. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/irspace.hpp +49 -0
  109. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/jacobi.hpp +153 -0
  110. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/kernels.hpp +762 -0
  111. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/l2hofe.hpp +194 -0
  112. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/l2hofe_impl.hpp +564 -0
  113. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/l2hofefo.hpp +542 -0
  114. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/l2hofespace.hpp +344 -0
  115. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/la.hpp +38 -0
  116. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/linalg_kernels.hpp +102 -0
  117. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/linearform.hpp +266 -0
  118. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/matrix.hpp +2140 -0
  119. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/memusage.hpp +41 -0
  120. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/meshaccess.hpp +1359 -0
  121. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/mgpre.hpp +204 -0
  122. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/mp_coefficient.hpp +145 -0
  123. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/mptools.hpp +2281 -0
  124. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/multigrid.hpp +42 -0
  125. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/multivector.hpp +447 -0
  126. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/mumpsinverse.hpp +187 -0
  127. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/mycomplex.hpp +361 -0
  128. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ng_lapack.hpp +1661 -0
  129. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngblas.hpp +1232 -0
  130. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngs_defines.hpp +30 -0
  131. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngs_stdcpp_include.hpp +106 -0
  132. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngs_utils.hpp +121 -0
  133. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngsobject.hpp +1019 -0
  134. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngsstream.hpp +113 -0
  135. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/ngstd.hpp +72 -0
  136. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/nodalhofe.hpp +96 -0
  137. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/nodalhofe_impl.hpp +141 -0
  138. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/normalfacetfe.hpp +223 -0
  139. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/normalfacetfespace.hpp +98 -0
  140. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/normalfacetsurfacefespace.hpp +84 -0
  141. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/order.hpp +251 -0
  142. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/parallel_matrices.hpp +222 -0
  143. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/paralleldofs.hpp +340 -0
  144. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/parallelngs.hpp +23 -0
  145. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/parallelvector.hpp +269 -0
  146. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/pardisoinverse.hpp +200 -0
  147. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/periodic.hpp +129 -0
  148. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/plateaufespace.hpp +25 -0
  149. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/pml.hpp +275 -0
  150. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/pmltrafo.hpp +631 -0
  151. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/postproc.hpp +142 -0
  152. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/potentialtools.hpp +22 -0
  153. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/precomp.hpp +60 -0
  154. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/preconditioner.hpp +602 -0
  155. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/prolongation.hpp +377 -0
  156. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/python_comp.hpp +107 -0
  157. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/python_fem.hpp +89 -0
  158. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/python_linalg.hpp +58 -0
  159. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/python_ngstd.hpp +386 -0
  160. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/recursive_pol.hpp +4896 -0
  161. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/recursive_pol_tet.hpp +395 -0
  162. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/recursive_pol_trig.hpp +492 -0
  163. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/reorderedfespace.hpp +81 -0
  164. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/sample_sort.hpp +105 -0
  165. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/scalarfe.hpp +335 -0
  166. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/shapefunction_utils.hpp +113 -0
  167. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/simd_complex.hpp +329 -0
  168. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/smoother.hpp +253 -0
  169. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/solve.hpp +89 -0
  170. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/sparsecholesky.hpp +313 -0
  171. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/sparsematrix.hpp +1038 -0
  172. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/sparsematrix_dyn.hpp +90 -0
  173. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/sparsematrix_impl.hpp +1013 -0
  174. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/special_matrix.hpp +463 -0
  175. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/specialelement.hpp +125 -0
  176. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/statushandler.hpp +33 -0
  177. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/stringops.hpp +12 -0
  178. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/superluinverse.hpp +136 -0
  179. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/symbolicintegrator.hpp +850 -0
  180. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/symmetricmatrix.hpp +144 -0
  181. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tangentialfacetfe.hpp +224 -0
  182. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tangentialfacetfespace.hpp +91 -0
  183. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tensor.hpp +522 -0
  184. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tensorcoefficient.hpp +446 -0
  185. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tensorproductintegrator.hpp +113 -0
  186. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/thcurlfe.hpp +128 -0
  187. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/thcurlfe_impl.hpp +380 -0
  188. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/thdivfe.hpp +80 -0
  189. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/thdivfe_impl.hpp +492 -0
  190. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tpdiffop.hpp +461 -0
  191. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tpfes.hpp +133 -0
  192. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tpintrule.hpp +224 -0
  193. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/triangular.hpp +465 -0
  194. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tscalarfe.hpp +245 -0
  195. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/tscalarfe_impl.hpp +1029 -0
  196. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/umfpackinverse.hpp +148 -0
  197. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/unifiedvector.hpp +103 -0
  198. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/vector.hpp +1273 -0
  199. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/voxelcoefficientfunction.hpp +41 -0
  200. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/vtkoutput.hpp +198 -0
  201. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/vvector.hpp +208 -0
  202. ngsolve-6.2.2506.post75.dev0.data/data/include/netgen/webgui.hpp +92 -0
  203. ngsolve-6.2.2506.post75.dev0.data/data/lib/cmake/ngsolve/NGSolveConfig.cmake +102 -0
  204. ngsolve-6.2.2506.post75.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets-release.cmake +89 -0
  205. ngsolve-6.2.2506.post75.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets.cmake +173 -0
  206. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngbla.so +0 -0
  207. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngcomp.so +0 -0
  208. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngfem.so +0 -0
  209. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngla.so +0 -0
  210. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsbem.so +0 -0
  211. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngscudalib.so +0 -0
  212. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsolve.so +0 -0
  213. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngstd.so +0 -0
  214. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/TensorProductTools.py +210 -0
  215. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/__console.py +94 -0
  216. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/__expr.py +181 -0
  217. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/__init__.py +148 -0
  218. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/_scikit_build_core_dependencies.py +30 -0
  219. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/bvp.py +78 -0
  220. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__init__.py +1 -0
  221. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__main__.py +4 -0
  222. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/config.py +60 -0
  223. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/__init__.py +0 -0
  224. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
  225. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
  226. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
  227. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
  228. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/__init__.py +0 -0
  229. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/__init__.py +0 -0
  230. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hhj.py +44 -0
  231. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hybrid_dg.py +53 -0
  232. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/mixed.py +30 -0
  233. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/nonlin.py +29 -0
  234. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pickling.py +26 -0
  235. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pml.py +31 -0
  236. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/taskmanager.py +20 -0
  237. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/tdnns.py +47 -0
  238. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG-skeleton.py +45 -0
  239. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG.py +38 -0
  240. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGlap.py +42 -0
  241. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGwave.py +61 -0
  242. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/__init__.py +0 -0
  243. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/adaptive.py +123 -0
  244. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/cmagnet.py +59 -0
  245. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/elasticity.py +76 -0
  246. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/navierstokes.py +74 -0
  247. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.ipynb +170 -0
  248. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.py +41 -0
  249. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/__init__.py +0 -0
  250. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
  251. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
  252. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_poisson.py +89 -0
  253. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_timeDG.py +82 -0
  254. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/directsolvers.py +26 -0
  255. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/eigenvalues.py +364 -0
  256. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/internal.py +89 -0
  257. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/krylovspace.py +1013 -0
  258. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/meshes.py +748 -0
  259. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngs2petsc.py +310 -0
  260. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscuda.so +0 -0
  261. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscxx.py +42 -0
  262. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngslib.so +0 -0
  263. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/nonlinearsolvers.py +203 -0
  264. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/preconditioners.py +11 -0
  265. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/solve_implementation.py +168 -0
  266. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/solvers.py +7 -0
  267. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/timestepping.py +185 -0
  268. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/timing.py +108 -0
  269. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/utils.py +167 -0
  270. ngsolve-6.2.2506.post75.dev0.data/data/lib/python3.14/site-packages/ngsolve/webgui.py +670 -0
  271. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/beam.geo +17 -0
  272. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/beam.vol +240 -0
  273. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/chip.in2d +41 -0
  274. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/chip.vol +614 -0
  275. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/coil.geo +12 -0
  276. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/coil.vol +2560 -0
  277. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
  278. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
  279. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/cube.geo +19 -0
  280. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/cube.vol +1832 -0
  281. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
  282. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
  283. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
  284. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
  285. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
  286. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
  287. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
  288. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
  289. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
  290. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
  291. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
  292. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
  293. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
  294. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  295. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/shaft.geo +73 -0
  296. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
  297. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/square.in2d +17 -0
  298. ngsolve-6.2.2506.post75.dev0.data/data/share/ngsolve/square.vol +149 -0
  299. ngsolve-6.2.2506.post75.dev0.dist-info/METADATA +14 -0
  300. ngsolve-6.2.2506.post75.dev0.dist-info/RECORD +303 -0
  301. ngsolve-6.2.2506.post75.dev0.dist-info/WHEEL +5 -0
  302. ngsolve-6.2.2506.post75.dev0.dist-info/licenses/LICENSE +504 -0
  303. ngsolve-6.2.2506.post75.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2033 @@
1
+ #ifndef FILE_COEFFICIENT
2
+ #define FILE_COEFFICIENT
3
+
4
+ /*********************************************************************/
5
+ /* File: coefficient.hh */
6
+ /* Author: Joachim Schoeberl */
7
+ /* Date: 25. Mar. 2000 */
8
+ /*********************************************************************/
9
+
10
+ #include <bla.hpp>
11
+ #include "code_generation.hpp"
12
+
13
+ #include "intrule.hpp"
14
+ #include "elementtransformation.hpp"
15
+
16
+ namespace ngfem
17
+ {
18
+
19
+ /*
20
+ type to determine (non)zero propagation of arithmetic expressions,
21
+ formerly bool was used instead
22
+ */
23
+ class NonZero
24
+ {
25
+ bool nz;
26
+ public:
27
+ constexpr NonZero () : nz(false) { }
28
+ constexpr NonZero (bool _nz) : nz(_nz) { };
29
+ NonZero & operator= (const NonZero &) = default;
30
+ NonZero & operator= (bool _nz) { nz = _nz; return *this; }
31
+ constexpr operator bool() const { return nz; }
32
+
33
+ constexpr NonZero operator+ (const NonZero & nz2) const { return nz || nz2.nz; }
34
+ constexpr NonZero operator- (const NonZero & nz2) const { return nz || nz2.nz; }
35
+ constexpr NonZero operator* (const NonZero & nz2) const { return nz && nz2.nz; }
36
+ NonZero & operator+= (const NonZero & nz2) { nz = nz || nz2.nz; return *this; }
37
+ NonZero & operator*= (const NonZero & nz2) { nz = nz && nz2.nz; return *this; }
38
+ };
39
+
40
+ /**
41
+ coefficient functions
42
+ */
43
+ class NGS_DLL_HEADER CoefficientFunction : public enable_shared_from_this<CoefficientFunction>
44
+ {
45
+ private:
46
+ size_t dimension = 1;
47
+ Array<int> dims;
48
+ protected:
49
+ bool elementwise_constant = false;
50
+ bool is_complex = false;
51
+ int spacedim = -1; // needed for grad(x), grad(1), ...
52
+ string description;
53
+ bool is_variable = false; // variables cannot be optimized away (e.g. for differentiation)
54
+ public:
55
+ static std::true_type shallow_archive;
56
+ typedef std::map<shared_ptr<CoefficientFunction>, shared_ptr<CoefficientFunction>> T_DJC; // DiffJacobi Cache type
57
+ // default constructor for archive
58
+ CoefficientFunction() = default;
59
+ CoefficientFunction (int adimension, bool ais_complex = false)
60
+ : is_complex(ais_complex)
61
+ {
62
+ SetDimension(adimension);
63
+ }
64
+
65
+ void SetDimension(int adimension)
66
+ {
67
+ dimension = adimension;
68
+ if (dimension <= 1)
69
+ dims = Array<int> (0);
70
+ else
71
+ dims = Array<int> ( { int(dimension) } );
72
+ }
73
+
74
+ ///
75
+ virtual ~CoefficientFunction ();
76
+
77
+ virtual void DoArchive(Archive& ar) { ar & dimension & dims & is_complex; }
78
+ virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const;
79
+ ///
80
+ virtual int NumRegions () { return INT_MAX; }
81
+ virtual bool DefinedOn (const ElementTransformation & trafo) { return true; }
82
+ ///
83
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const = 0;
84
+
85
+ ///
86
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double> values) const;
87
+ void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double,ColMajor> values) const
88
+ { Evaluate (ir, Trans(values)); }
89
+
90
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<double>> values) const;
91
+ void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex,ColMajor> values) const
92
+ { Evaluate (ir, Trans(values)); }
93
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<Complex>> values) const;
94
+
95
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex> values) const;
96
+
97
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, FlatArray<BareSliceMatrix<double,ColMajor>> input,
98
+ BareSliceMatrix<double,ColMajor> values) const
99
+ {
100
+ Evaluate (ir, Trans(values));
101
+ }
102
+
103
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
104
+ FlatArray<BareSliceMatrix<SIMD<double>>> input,
105
+ BareSliceMatrix<SIMD<double>> values) const
106
+ {
107
+ Evaluate (ir, values);
108
+ }
109
+
110
+
111
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
112
+ BareSliceMatrix<AutoDiff<1,double>> values) const
113
+ {
114
+ throw Exception (string("Evaluate AutoDiff<double> not overloaded, type = ")+typeid(*this).name());
115
+ }
116
+
117
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
118
+ FlatArray<BareSliceMatrix<AutoDiff<1,double>,ColMajor>> input,
119
+ BareSliceMatrix<AutoDiff<1,double>,ColMajor> values) const
120
+ {
121
+ Evaluate (ir, Trans(values));
122
+ }
123
+
124
+ void Evaluate (const BaseMappedIntegrationRule & ir,
125
+ BareSliceMatrix<AutoDiff<1,double>, ColMajor> values) const
126
+ {
127
+ Evaluate (ir, Trans(values));
128
+ }
129
+
130
+
131
+
132
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
133
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const
134
+ {
135
+ throw ExceptionNOSIMD (string("cf::Evaluate(AutoDiff<simd>) not overloaded for ")+typeid(*this).name());
136
+ }
137
+
138
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
139
+ FlatArray<BareSliceMatrix<AutoDiff<1,SIMD<double>>>> input,
140
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const
141
+ {
142
+ Evaluate (ir, values);
143
+ }
144
+
145
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
146
+ BareSliceMatrix<AutoDiffDiff<1,double>> values) const
147
+ {
148
+ throw Exception (string("Evaluate AutoDiffDiff<double> not overloaded, type = ")+typeid(*this).name());
149
+ }
150
+
151
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
152
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,double>,ColMajor>> input,
153
+ BareSliceMatrix<AutoDiffDiff<1,double>,ColMajor> values) const
154
+ {
155
+ Evaluate (ir, Trans(values));
156
+ }
157
+
158
+ void Evaluate (const BaseMappedIntegrationRule & ir,
159
+ BareSliceMatrix<AutoDiffDiff<1,double>, ColMajor> values) const
160
+ {
161
+ Evaluate (ir, Trans(values));
162
+ }
163
+
164
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
165
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const
166
+ {
167
+ throw ExceptionNOSIMD (string("cf::Evaluate(AutoDiffDiff<simd>) not overloaded for ")+typeid(*this).name());
168
+ }
169
+
170
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
171
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>>> input,
172
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const
173
+ {
174
+ Evaluate (ir, values);
175
+ }
176
+
177
+ ///
178
+ virtual Complex EvaluateComplex (const BaseMappedIntegrationPoint & ip) const
179
+ {
180
+ return Evaluate (ip);
181
+ }
182
+
183
+ template <typename SCAL>
184
+ inline SCAL T_Evaluate (const BaseMappedIntegrationPoint & ip) const
185
+ {
186
+ return SCAL (Evaluate (ip)); // used by PML : AutoDiff<complex>
187
+ }
188
+
189
+ virtual double EvaluateConst () const
190
+ {
191
+ throw Exception (string ("EvaluateConst called for non-const coefficient function ")+
192
+ typeid(*this).name());
193
+ }
194
+
195
+ bool IsComplex() const { return is_complex; }
196
+ size_t Dimension() const { return dimension; }
197
+ FlatArray<int> Dimensions() const { return dims; }
198
+
199
+ void SetDimensions (FlatArray<int> adims)
200
+ {
201
+ dims = adims;
202
+ dimension = 1;
203
+ for (int d : dims) dimension *= d;
204
+ }
205
+
206
+ // creates a wrapper with new shape
207
+ shared_ptr<CoefficientFunction> Reshape (FlatArray<int> adims) const;
208
+ shared_ptr<CoefficientFunction> Reshape (int s) const
209
+ { return Reshape( Array<int>( { s } )); }
210
+ shared_ptr<CoefficientFunction> Reshape (int h, int w) const
211
+ { return Reshape( Array<int>( { h, w } )); }
212
+
213
+ shared_ptr<CoefficientFunction> Transpose () const;
214
+ shared_ptr<CoefficientFunction> TensorTranspose (int i, int j) const;
215
+
216
+ int SpaceDim () const { return spacedim; }
217
+ void SetSpaceDim (int adim);
218
+
219
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
220
+ FlatVector<> result) const
221
+ {
222
+ double f = Evaluate (ip);
223
+ result(0) = f;
224
+ }
225
+
226
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
227
+ FlatVector<Complex> result) const
228
+ {
229
+ VectorMem<10,double> dres(result.Size());
230
+ Evaluate(ip, dres);
231
+ result = dres;
232
+ }
233
+
234
+ virtual void EvaluateDeriv (const BaseMappedIntegrationRule & ir,
235
+ FlatMatrix<Complex> result,
236
+ FlatMatrix<Complex> deriv) const
237
+ {
238
+ Evaluate (ir, result);
239
+ deriv = 0;
240
+ }
241
+
242
+ bool ElementwiseConstant () const { return elementwise_constant; }
243
+ virtual bool IsZeroCF() const;
244
+ // virtual void NonZeroPattern (const class ProxyUserData & ud, FlatVector<bool> nonzero) const;
245
+
246
+ /*
247
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
248
+ FlatVector<bool> nonzero,
249
+ FlatVector<bool> nonzero_deriv,
250
+ FlatVector<bool> nonzero_dderiv) const;
251
+ */
252
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
253
+ FlatVector<AutoDiffDiff<1,NonZero>> nonzero) const;
254
+
255
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
256
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
257
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const
258
+ {
259
+ cout << string("nonzero in-out not overloaded for type")+typeid(*this).name() << endl;
260
+ /*
261
+ Vector<bool> nz(values.Size()), nzd(values.Size()), nzdd(values.Size());
262
+ NonZeroPattern (ud, nz, nzd, nzdd);
263
+ for (size_t i = 0; i < values.Size(); i++)
264
+ {
265
+ values(i).Value() = nz(i);
266
+ values(i).DValue(0) = nzd(i);
267
+ values(i).DDValue(0) = nzdd(i);
268
+ }
269
+ */
270
+ NonZeroPattern (ud, values);
271
+ }
272
+
273
+ virtual void PrintReport (ostream & ost) const;
274
+ virtual void PrintReportRec (ostream & ost, int level) const;
275
+ virtual string GetDescription () const;
276
+ void SetDescription (string desc) { description = desc; }
277
+
278
+
279
+ bool IsVariable() const { return is_variable; }
280
+ void SetVariable (bool var = true) { is_variable = var; }
281
+
282
+ struct T_Transform {
283
+ std::map<shared_ptr<CoefficientFunction>, shared_ptr<CoefficientFunction>> replace;
284
+ std::map<shared_ptr<CoefficientFunction>, shared_ptr<CoefficientFunction>> cache;
285
+ };
286
+ virtual shared_ptr<CoefficientFunction> Transform (T_Transform & transformation) const;
287
+
288
+ virtual shared_ptr<CoefficientFunction>
289
+ Diff (const CoefficientFunction * var, shared_ptr<CoefficientFunction> dir) const;
290
+ // returns Jacobi-matrix (possible as higher order tensor)
291
+ virtual shared_ptr<CoefficientFunction>
292
+ DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const;
293
+
294
+
295
+ // returns primary operator
296
+ virtual shared_ptr<CoefficientFunction> Primary () const;
297
+ virtual shared_ptr<CoefficientFunction> Operator (const string & name) const;
298
+ virtual shared_ptr<CoefficientFunction> Operator (shared_ptr<class DifferentialOperator> diffop) const;
299
+
300
+ virtual void TraverseTree (const function<void(CoefficientFunction&)> & func);
301
+ virtual Array<shared_ptr<CoefficientFunction>> InputCoefficientFunctions() const
302
+ { return Array<shared_ptr<CoefficientFunction>>(); }
303
+ virtual bool StoreUserData() const { return false; }
304
+
305
+ };
306
+
307
+
308
+ inline ostream & operator<< (ostream & ost, const CoefficientFunction & cf)
309
+ {
310
+ cf.PrintReport (ost);
311
+ return ost;
312
+ }
313
+
314
+
315
+ template <>
316
+ inline double CoefficientFunction ::
317
+ T_Evaluate<double> (const BaseMappedIntegrationPoint & ip) const
318
+ {
319
+ return Evaluate (ip);
320
+ }
321
+
322
+ template <>
323
+ inline Complex CoefficientFunction ::
324
+ T_Evaluate<Complex> (const BaseMappedIntegrationPoint & ip) const
325
+ {
326
+ return EvaluateComplex (ip);
327
+ }
328
+
329
+
330
+
331
+ /*
332
+ template <int S, int R>
333
+ inline double Evaluate (const CoefficientFunction & fun,
334
+ const MappedIntegrationPoint<S,R> & ip)
335
+ {
336
+ return fun.Evaluate(ip);
337
+ }
338
+ */
339
+
340
+ inline double Evaluate (const CoefficientFunction & fun,
341
+ const BaseMappedIntegrationPoint & ip)
342
+ {
343
+ return fun.Evaluate(ip);
344
+ }
345
+
346
+
347
+ class NGS_DLL_HEADER CoefficientFunctionNoDerivative : public CoefficientFunction
348
+ {
349
+ public:
350
+ using CoefficientFunction::CoefficientFunction;
351
+ using CoefficientFunction::Evaluate;
352
+
353
+ /*
354
+ virtual void EvaluateDeriv (const SIMD_BaseMappedIntegrationRule & ir,
355
+ AFlatMatrix<double> values, AFlatMatrix<double> deriv) const override
356
+ {
357
+ Evaluate(ir, values);
358
+ deriv = 0.0;
359
+ }
360
+
361
+ virtual void EvaluateDDeriv (const SIMD_BaseMappedIntegrationRule & ir,
362
+ AFlatMatrix<double> values, AFlatMatrix<double> deriv,
363
+ AFlatMatrix<double> dderiv) const override
364
+ {
365
+ Evaluate (ir, values);
366
+ deriv = 0.0;
367
+ dderiv = 0.0;
368
+ }
369
+ */
370
+
371
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
372
+ FlatArray<BareSliceMatrix<SIMD<double>>> input,
373
+ BareSliceMatrix<SIMD<double>> values) const override
374
+ { Evaluate (ir, values); }
375
+
376
+
377
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
378
+ BareSliceMatrix<AutoDiff<1,double>> values) const override
379
+ {
380
+ SliceMatrix<double> hvalues(ir.Size(), Dimension(), 2*values.Dist(), &values(0).Value());
381
+ Evaluate (ir, hvalues);
382
+ for (size_t i = 0; i < ir.Size(); i++)
383
+ for (size_t j = Dimension(); j-- > 0; )
384
+ values(i,j) = hvalues(i,j);
385
+ }
386
+
387
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
388
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
389
+ {
390
+ // BareSliceMatrix<SIMD<double>> hvalues(2*values.Dist(), &values(0).Value(), DummySize(Dimension(), ir.Size()));
391
+ BareSliceMatrix<SIMD<double>> hvalues(Dimension(), ir.Size(), 2*values.Dist(), &values(0).Value());
392
+ Evaluate (ir, hvalues);
393
+ for (size_t i = 0; i < Dimension(); i++)
394
+ for (size_t j = ir.Size(); j-- > 0; )
395
+ values(i,j) = hvalues(i,j);
396
+ }
397
+
398
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
399
+ FlatArray<BareSliceMatrix<AutoDiff<1,SIMD<double>>>> input,
400
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
401
+ { Evaluate (ir, values); }
402
+
403
+
404
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
405
+ BareSliceMatrix<AutoDiffDiff<1,double>> values) const override
406
+ {
407
+ SliceMatrix<double> hvalues(ir.Size(), Dimension(), 3*values.Dist(), &values(0).Value());
408
+ Evaluate (ir, hvalues);
409
+ for (size_t i = 0; i < ir.Size(); i++)
410
+ for (size_t j = Dimension(); j-- > 0; )
411
+ values(i,j) = hvalues(i,j);
412
+ }
413
+
414
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
415
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
416
+ {
417
+ // BareSliceMatrix<SIMD<double>> hvalues(3*values.Dist(), &values(0).Value(), DummySize(Dimension(), ir.Size()));
418
+ BareSliceMatrix<SIMD<double>> hvalues(Dimension(), ir.Size(), 3*values.Dist(), &values(0).Value());
419
+ Evaluate (ir, hvalues);
420
+ for (size_t i = 0; i < Dimension(); i++)
421
+ for (size_t j = ir.Size(); j-- > 0; )
422
+ values(i,j) = hvalues(i,j);
423
+ }
424
+
425
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
426
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>>> input,
427
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
428
+ { Evaluate (ir, values); }
429
+
430
+ /*
431
+ virtual void EvaluateDeriv (const SIMD_BaseMappedIntegrationRule & ir,
432
+ FlatArray<AFlatMatrix<>*> input,
433
+ FlatArray<AFlatMatrix<>*> dinput,
434
+ AFlatMatrix<> result,
435
+ AFlatMatrix<> deriv) const
436
+ {
437
+ Evaluate (ir, input, result);
438
+ deriv = 0.0;
439
+ }
440
+
441
+ virtual void EvaluateDDeriv (const SIMD_BaseMappedIntegrationRule & ir,
442
+ FlatArray<AFlatMatrix<>*> input,
443
+ FlatArray<AFlatMatrix<>*> dinput,
444
+ FlatArray<AFlatMatrix<>*> ddinput,
445
+ AFlatMatrix<> result,
446
+ AFlatMatrix<> deriv,
447
+ AFlatMatrix<> dderiv) const
448
+ {
449
+ Evaluate (ir, input, result);
450
+ deriv = 0.0;
451
+ dderiv = 0.0;
452
+ }
453
+ */
454
+
455
+ /*
456
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
457
+ FlatVector<bool> nonzero,
458
+ FlatVector<bool> nonzero_deriv,
459
+ FlatVector<bool> nonzero_dderiv) const override
460
+ {
461
+ nonzero = true;
462
+ nonzero_deriv = false;
463
+ nonzero_dderiv = false;
464
+ }
465
+ */
466
+
467
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
468
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
469
+ {
470
+ values = AutoDiffDiff<1,NonZero> (true);
471
+ }
472
+
473
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
474
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
475
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
476
+ {
477
+ values = AutoDiffDiff<1,NonZero> (true);
478
+ }
479
+
480
+ virtual shared_ptr<CoefficientFunction>
481
+ Diff (const CoefficientFunction * var, shared_ptr<CoefficientFunction> dir) const override;
482
+
483
+ virtual shared_ptr<CoefficientFunction>
484
+ DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override;
485
+
486
+ };
487
+
488
+
489
+
490
+
491
+ template <typename TCF, typename BASE = CoefficientFunction>
492
+ class T_CoefficientFunction : public BASE
493
+ {
494
+ public:
495
+ using BASE::IsComplex;
496
+ using BASE::Dimension;
497
+ using BASE::BASE;
498
+
499
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<double>> values) const override
500
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <SIMD<double>> */ (ir, values); }
501
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<Complex>> values) const override
502
+ {
503
+ if (IsComplex())
504
+ static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <SIMD<Complex>> */ (ir, values);
505
+ else
506
+ {
507
+ size_t nv = ir.Size();
508
+ SliceMatrix<SIMD<double>> overlay(Dimension(), nv, 2*values.Dist(), &values(0,0).real());
509
+ Evaluate (ir, overlay);
510
+ for (size_t i = 0; i < Dimension(); i++)
511
+ for (size_t j = nv; j-- > 0; )
512
+ values(i,j) = overlay(i,j);
513
+ }
514
+ }
515
+
516
+ double Evaluate (const BaseMappedIntegrationPoint & ip) const override
517
+ {
518
+ STACK_ARRAY(double, hmem, Dimension());
519
+ FlatMatrix<double,ColMajor> mat(Dimension(), 1, hmem);
520
+ ip.IntegrationRuleFromPoint([this,mat] (const BaseMappedIntegrationRule & ir)
521
+ { static_cast<const TCF*>(this)->T_Evaluate (ir, BareSliceMatrix<double,ColMajor>(mat)); });
522
+ return mat(0);
523
+ }
524
+
525
+
526
+ void Evaluate(const BaseMappedIntegrationPoint & ip,
527
+ FlatVector<> result) const override
528
+ {
529
+ FlatMatrix<double,ColMajor> mat(Dimension(), 1, &result(0));
530
+ ip.IntegrationRuleFromPoint([this,mat] (const BaseMappedIntegrationRule & ir)
531
+ { static_cast<const TCF*>(this)->T_Evaluate (ir, BareSliceMatrix<double,ColMajor>(mat)); });
532
+ }
533
+
534
+ void Evaluate(const BaseMappedIntegrationPoint & ip,
535
+ FlatVector<Complex> result) const override
536
+ {
537
+ FlatMatrix<Complex,ColMajor> mat(Dimension(), 1, &result(0));
538
+ ip.IntegrationRuleFromPoint([this,mat] (const BaseMappedIntegrationRule & ir)
539
+ { static_cast<const TCF*>(this)->T_Evaluate (ir, BareSliceMatrix<Complex,ColMajor>(mat)); });
540
+ }
541
+
542
+
543
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
544
+ FlatArray<BareSliceMatrix<SIMD<double>>> input,
545
+ BareSliceMatrix<SIMD<double>> values) const override
546
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <SIMD<double>> */ (ir, input, values); }
547
+
548
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double> values) const override
549
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate (ir, Trans(values)); }
550
+
551
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
552
+ FlatArray<BareSliceMatrix<double,ColMajor>> input,
553
+ BareSliceMatrix<double,ColMajor> values) const override
554
+ { static_cast<const TCF*>(this) -> T_Evaluate (ir, input, values); }
555
+
556
+
557
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex> values) const override
558
+ {
559
+ if (!IsComplex())
560
+ {
561
+ /*
562
+ BareSliceMatrix<double> realvalues(2*values.Dist(), (double*)values.Data(),
563
+ DummySize(values.Height(), values.Width()));
564
+ */
565
+ BareSliceMatrix<double> realvalues(values.Height(), values.Width(), 2*values.Dist(), (double*)values.Data());
566
+ Evaluate (ir, realvalues);
567
+ for (size_t i = 0; i < ir.Size(); i++)
568
+ for (size_t j = Dimension(); j-- > 0; )
569
+ values(i,j) = realvalues(i,j);
570
+ return;
571
+ }
572
+ static_cast<const TCF*>(this) -> /* template */ T_Evaluate (ir, Trans(values));
573
+ }
574
+
575
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
576
+ BareSliceMatrix<AutoDiff<1,double>> values) const override
577
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate (ir, Trans(values)); }
578
+
579
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
580
+ FlatArray<BareSliceMatrix<AutoDiff<1,double>,ColMajor>> input,
581
+ BareSliceMatrix<AutoDiff<1,double>,ColMajor> values) const override
582
+ { static_cast<const TCF*>(this) -> T_Evaluate (ir, input, values); }
583
+
584
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
585
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
586
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <AutoDiff<1,SIMD<double>>> */ (ir, values); }
587
+
588
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
589
+ FlatArray<BareSliceMatrix<AutoDiff<1,SIMD<double>>>> input,
590
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
591
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <AutoDiff<1,SIMD<double>>> */ (ir, input, values); }
592
+
593
+
594
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
595
+ BareSliceMatrix<AutoDiffDiff<1,double>> values) const override
596
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate (ir, Trans(values)); }
597
+
598
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
599
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,double>,ColMajor>> input,
600
+ BareSliceMatrix<AutoDiffDiff<1,double>,ColMajor> values) const override
601
+ { static_cast<const TCF*>(this) -> T_Evaluate (ir, input, values); }
602
+
603
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
604
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
605
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <AutoDiffDiff<1,SIMD<double>>> */ (ir, values); }
606
+
607
+ virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
608
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>>> input,
609
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
610
+ { static_cast<const TCF*>(this) -> /* template */ T_Evaluate /* <AutoDiffDiff<1,SIMD<double>>> */ (ir, input, values); }
611
+ };
612
+
613
+
614
+ /// The coefficient is constant everywhere
615
+ class NGS_DLL_HEADER ConstantCoefficientFunction
616
+ : public T_CoefficientFunction<ConstantCoefficientFunction, CoefficientFunctionNoDerivative>
617
+ {
618
+ ///
619
+ double val;
620
+ typedef T_CoefficientFunction<ConstantCoefficientFunction, CoefficientFunctionNoDerivative> BASE;
621
+ using BASE::T_DJC;
622
+ public:
623
+ ///
624
+ // ConstantCoefficientFunction() = default;
625
+ ConstantCoefficientFunction (double aval);
626
+ ///
627
+ virtual ~ConstantCoefficientFunction ();
628
+ ///
629
+
630
+ void DoArchive (Archive & archive) override
631
+ {
632
+ /*
633
+ BASE::DoArchive(archive);
634
+ archive & val;
635
+ */
636
+ }
637
+
638
+ auto GetCArgs() const { return tuple { val }; }
639
+
640
+ using BASE::Evaluate;
641
+ // virtual bool ElementwiseConstant () const override { return true; }
642
+
643
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
644
+ {
645
+ return val;
646
+ }
647
+
648
+ virtual double EvaluateConst () const override
649
+ {
650
+ return val;
651
+ }
652
+
653
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double> values) const override;
654
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex> values) const override;
655
+
656
+ template <typename MIR, typename T, ORDERING ORD>
657
+ void T_Evaluate (const MIR & ir, BareSliceMatrix<T,ORD> values) const
658
+ {
659
+ size_t np = ir.Size();
660
+ __assume (np > 0);
661
+ for (size_t i = 0; i < np; i++)
662
+ values(0,i) = val;
663
+ }
664
+
665
+ template <typename MIR, typename T, ORDERING ORD>
666
+ void T_Evaluate (const MIR & ir,
667
+ FlatArray<BareSliceMatrix<T,ORD>> input,
668
+ BareSliceMatrix<T,ORD> values) const
669
+ { T_Evaluate (ir, values); }
670
+
671
+ virtual void PrintReport (ostream & ost) const override;
672
+ virtual string GetDescription () const override;
673
+
674
+ virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const override;
675
+
676
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
677
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
678
+ {
679
+ values = AutoDiffDiff<1,NonZero> (val != 0.0);
680
+ }
681
+
682
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
683
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
684
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
685
+ {
686
+ values = AutoDiffDiff<1,NonZero> (val != 0.0);
687
+ }
688
+
689
+ virtual shared_ptr<CoefficientFunction>
690
+ DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override;
691
+ };
692
+
693
+
694
+
695
+ /// The coefficient is constant everywhere
696
+ template<typename SCAL>
697
+ class NGS_DLL_HEADER ParameterCoefficientFunction : public CoefficientFunctionNoDerivative
698
+ {
699
+ ///
700
+ SCAL val;
701
+ public:
702
+ ///
703
+ // ParameterCoefficientFunction() = default;
704
+ ParameterCoefficientFunction (SCAL aval);
705
+ ///
706
+ virtual ~ParameterCoefficientFunction ();
707
+ ///
708
+ void DoArchive (Archive& ar) override;
709
+ auto GetCArgs() const { return tuple { val }; }
710
+
711
+ using CoefficientFunction::Evaluate;
712
+ double Evaluate (const BaseMappedIntegrationPoint & ip) const override;
713
+ void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double> values) const override;
714
+ void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<double>> values) const override;
715
+ void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex> values) const override;
716
+ void Evaluate (const SIMD_BaseMappedIntegrationRule & ir, BareSliceMatrix<SIMD<Complex>> values) const override;
717
+
718
+ virtual void SetValue (SCAL in) { val = in; }
719
+ virtual SCAL GetValue () { return val; }
720
+ void PrintReport (ostream & ost) const override;
721
+ void GenerateCode (Code &code, FlatArray<int> inputs, int index) const override;
722
+ };
723
+
724
+ class NGS_DLL_HEADER PlaceholderCoefficientFunction : public CoefficientFunction
725
+ {
726
+ shared_ptr<CoefficientFunction> cf;
727
+ public:
728
+ PlaceholderCoefficientFunction() = default;
729
+ PlaceholderCoefficientFunction(shared_ptr<CoefficientFunction> _cf)
730
+ : CoefficientFunction(_cf->Dimension(), _cf->IsComplex()), cf(_cf)
731
+ { SetDimensions(cf->Dimensions()); }
732
+
733
+ void DoArchive(Archive& ar) override;
734
+
735
+ void Set(shared_ptr<CoefficientFunction> _cf);
736
+
737
+ double Evaluate(const BaseMappedIntegrationPoint& ip) const override
738
+ { return cf->Evaluate(ip); }
739
+ void Evaluate(const BaseMappedIntegrationRule & ir,
740
+ BareSliceMatrix<double> values) const override
741
+ { cf->Evaluate(ir, values); }
742
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
743
+ BareSliceMatrix<SIMD<double>> values) const override
744
+ { cf->Evaluate(ir, values); }
745
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
746
+ BareSliceMatrix<SIMD<Complex>> values) const override
747
+ { cf->Evaluate(ir, values); }
748
+ void Evaluate(const BaseMappedIntegrationRule & ir,
749
+ BareSliceMatrix<Complex> values) const override
750
+ { cf->Evaluate(ir, values); }
751
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
752
+ FlatArray<BareSliceMatrix<SIMD<double>>> input,
753
+ BareSliceMatrix<SIMD<double>> values) const override
754
+ { cf->Evaluate (ir, values); }
755
+ void Evaluate(const BaseMappedIntegrationRule & ir,
756
+ BareSliceMatrix<AutoDiff<1,double>> values) const override
757
+ { cf->Evaluate(ir, values); }
758
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
759
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
760
+ { cf->Evaluate(ir, values); }
761
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
762
+ FlatArray<BareSliceMatrix<AutoDiff<1,SIMD<double>>>> input,
763
+ BareSliceMatrix<AutoDiff<1,SIMD<double>>> values) const override
764
+ { cf->Evaluate (ir, values); }
765
+ void Evaluate(const BaseMappedIntegrationRule & ir,
766
+ BareSliceMatrix<AutoDiffDiff<1,double>> values) const override
767
+ { cf->Evaluate(ir, values); }
768
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
769
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
770
+ { cf->Evaluate(ir, values); }
771
+ void Evaluate(const SIMD_BaseMappedIntegrationRule & ir,
772
+ FlatArray<BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>>> input,
773
+ BareSliceMatrix<AutoDiffDiff<1,SIMD<double>>> values) const override
774
+ { cf->Evaluate(ir, input, values); }
775
+
776
+ Complex EvaluateComplex (const BaseMappedIntegrationPoint & ip) const override
777
+ { return cf->EvaluateComplex(ip); }
778
+
779
+ double EvaluateConst () const override
780
+ { return cf->EvaluateConst(); }
781
+
782
+ void Evaluate(const BaseMappedIntegrationPoint & ip,
783
+ FlatVector<> result) const override
784
+ { cf->Evaluate(ip, result); }
785
+ void Evaluate(const BaseMappedIntegrationPoint & ip,
786
+ FlatVector<Complex> result) const override
787
+ { cf->Evaluate(ip, result); }
788
+ void EvaluateDeriv(const BaseMappedIntegrationRule & ir,
789
+ FlatMatrix<Complex> result,
790
+ FlatMatrix<Complex> deriv) const override
791
+ { cf->EvaluateDeriv(ir, result, deriv); }
792
+
793
+ void NonZeroPattern (const class ProxyUserData & ud,
794
+ FlatVector<AutoDiffDiff<1,NonZero>> nonzero) const override
795
+ { cf->NonZeroPattern(ud, nonzero); }
796
+
797
+ void NonZeroPattern (const class ProxyUserData & ud,
798
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
799
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
800
+ { cf->NonZeroPattern(ud, input, values); }
801
+
802
+ void TraverseTree (const function<void(CoefficientFunction&)> & func) override
803
+ {
804
+ cf->TraverseTree(func);
805
+ func(*this);
806
+ }
807
+ Array<shared_ptr<CoefficientFunction>> InputCoefficientFunctions() const override
808
+ { return { cf }; }
809
+ };
810
+
811
+
812
+
813
+ #ifdef OLD
814
+ ///
815
+ // template <int DIM>
816
+ class NGS_DLL_HEADER DomainVariableCoefficientFunction : public CoefficientFunction
817
+ {
818
+ Array<shared_ptr<EvalFunction>> fun;
819
+ Array<shared_ptr<CoefficientFunction>> depends_on;
820
+ int numarg;
821
+ public:
822
+ ///
823
+ DomainVariableCoefficientFunction (const EvalFunction & afun);
824
+ DomainVariableCoefficientFunction (const EvalFunction & afun,
825
+ const Array<shared_ptr<CoefficientFunction>> & adepends_on);
826
+ DomainVariableCoefficientFunction (const Array<shared_ptr<EvalFunction>> & afun);
827
+ DomainVariableCoefficientFunction (const Array<shared_ptr<EvalFunction>> & afun,
828
+ const Array<shared_ptr<CoefficientFunction>> & adepends_on);
829
+
830
+ ///
831
+ virtual ~DomainVariableCoefficientFunction ();
832
+ ///
833
+ virtual int NumRegions () { return (fun.Size() == 1) ? INT_MAX : fun.Size(); }
834
+ ///
835
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const;
836
+
837
+ virtual Complex EvaluateComplex (const BaseMappedIntegrationPoint & ip) const;
838
+
839
+ EvalFunction & GetEvalFunction(const int index)
840
+ {
841
+ return *(fun[index]);
842
+ }
843
+
844
+ virtual bool IsComplex() const;
845
+ /*
846
+ {
847
+ for (int i = 0; i < fun.Size(); i++)
848
+ if (fun[i]->IsResultComplex()) return true;
849
+ return false;
850
+ }
851
+ */
852
+ virtual int Dimension() const;
853
+ // { return fun[0]->Dimension(); }
854
+
855
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
856
+ FlatVector<> result) const;
857
+
858
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
859
+ FlatVector<Complex> result) const;
860
+
861
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir,
862
+ BareSliceMatrix<double> values) const;
863
+
864
+ virtual void PrintReport (ostream & ost) const;
865
+
866
+ virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const;
867
+ };
868
+ #endif
869
+
870
+
871
+ #ifdef OLD
872
+ ///
873
+ template <int DIM>
874
+ class NGS_DLL_HEADER DomainInternalCoefficientFunction : public CoefficientFunction
875
+ {
876
+ ///
877
+ int matnr;
878
+ ///
879
+ double (*f)(const double*);
880
+ public:
881
+ ///
882
+ DomainInternalCoefficientFunction (int amatnr, double (*af)(const double*))
883
+ : matnr(amatnr), f(af) { ; }
884
+ ///
885
+ virtual ~DomainInternalCoefficientFunction () { ; }
886
+ ///
887
+ /*
888
+ template <int S, int R>
889
+ double Evaluate (const MappedIntegrationPoint<S,R> & ip)
890
+ {
891
+ int elind = ip.GetTransformation().GetElementIndex();
892
+ if (elind != matnr && matnr > 0) return 0;
893
+
894
+ return f(&ip.GetPoint()(0));
895
+ }
896
+ */
897
+
898
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const
899
+ {
900
+ int elind = ip.GetTransformation().GetElementIndex();
901
+ if (elind != matnr && matnr > 0) return 0;
902
+
903
+ return f(&static_cast<const DimMappedIntegrationPoint<DIM>&>(ip).GetPoint()(0));
904
+ // return f(&ip.GetPoint().REval(0));
905
+ }
906
+
907
+ };
908
+ #endif
909
+
910
+
911
+ #ifdef OLD
912
+
913
+ /**
914
+ coefficient function that is defined in every integration point.
915
+ NOTE: for the constructor, the maximal number of integration
916
+ points per element is required!
917
+ **/
918
+ class IntegrationPointCoefficientFunction : public CoefficientFunction
919
+ {
920
+ int elems, ips_per_elem;
921
+ ///
922
+ Array<double> values;
923
+ public:
924
+ IntegrationPointCoefficientFunction() = default;
925
+ ///
926
+ IntegrationPointCoefficientFunction (int aelems, int size)
927
+ : CoefficientFunction(1, false), elems(aelems), ips_per_elem(size), values(aelems*size) { ; }
928
+ ///
929
+ IntegrationPointCoefficientFunction (int aelems, int size, double val)
930
+ : CoefficientFunction(1, false), elems(aelems), ips_per_elem(size), values(aelems*size)
931
+ {
932
+ values = val;
933
+ }
934
+ ///
935
+ IntegrationPointCoefficientFunction (int aelems, int size, Array<double> & avalues)
936
+ : CoefficientFunction(1, false), elems(aelems), ips_per_elem(size), values(avalues)
937
+ {
938
+ if ( avalues.Size() < aelems * size )
939
+ {
940
+ cout << "Warning: IntegrationPointCoefficientFunction, constructor: sizes don't match!" << endl;
941
+ values.SetSize(aelems*size);
942
+ }
943
+ }
944
+
945
+ ///
946
+ virtual ~IntegrationPointCoefficientFunction () { ; }
947
+
948
+ void DoArchive(Archive& ar) override
949
+ {
950
+ ar & elems & ips_per_elem & values;
951
+ }
952
+ ///
953
+ /*
954
+ template <int S, int R>
955
+ double Evaluate (const MappedIntegrationPoint<S,R> & ip)
956
+ {
957
+ int ipnr = ip.GetIPNr();
958
+ int elnr = ip.GetTransformation().GetElementNr();
959
+
960
+ if ( ipnr < 0 || ipnr >= ips_per_elem || elnr < 0 || elnr >= elems )
961
+ {
962
+ ostringstream ost;
963
+ ost << "IntegrationPointCoefficientFunction: ip = "
964
+ << ipnr << " / elem = " << elnr << ". Ranges: 0 - "
965
+ << ips_per_elem << "/ 0 - " << elems << "!" << endl;
966
+ throw Exception (ost.str());
967
+ }
968
+
969
+ return values[elnr*ips_per_elem+ipnr];
970
+ }
971
+ */
972
+ double Evaluate (const BaseMappedIntegrationPoint & ip) const override
973
+ {
974
+ int ipnr = ip.GetIPNr();
975
+ int elnr = ip.GetTransformation().GetElementNr();
976
+
977
+ if ( ipnr < 0 || ipnr >= ips_per_elem || elnr < 0 || elnr >= elems )
978
+ {
979
+ ostringstream ost;
980
+ ost << "IntegrationPointCoefficientFunction: ip = "
981
+ << ipnr << " / elem = " << elnr << ". Ranges: 0 - "
982
+ << ips_per_elem << "/ 0 - " << elems << "!" << endl;
983
+ throw Exception (ost.str());
984
+ }
985
+
986
+ return values[elnr*ips_per_elem+ipnr];
987
+ }
988
+
989
+
990
+ // direct access to the values at the integration points
991
+ double & operator() (int elnr, int ipnr)
992
+ {
993
+ if ( ipnr < 0 || ipnr >= ips_per_elem || elnr < 0 || elnr >= elems )
994
+ {
995
+ ostringstream ost;
996
+ ost << "IntegrationPointCoefficientFunction: ip = "
997
+ << ipnr << " / elem = " << elnr << ". Ranges: 0 - "
998
+ << ips_per_elem-1 << " / 0 - " << elems-1 << "!" << endl;
999
+ throw Exception (ost.str());
1000
+ }
1001
+
1002
+ return values[elnr*ips_per_elem+ipnr];
1003
+ }
1004
+
1005
+ double operator() (int elnr, int ipnr) const
1006
+ {
1007
+ if ( ipnr < 0 || ipnr >= ips_per_elem || elnr < 0 || elnr >= elems )
1008
+ {
1009
+ ostringstream ost;
1010
+ ost << "IntegrationPointCoefficientFunction: ip = "
1011
+ << ipnr << " / elem = " << elnr << ". Ranges: 0 - "
1012
+ << ips_per_elem-1 << " / 0 - " << elems-1 << "!" << endl;
1013
+ throw Exception (ost.str());
1014
+ }
1015
+
1016
+ return values[elnr*ips_per_elem+ipnr];
1017
+ }
1018
+
1019
+
1020
+
1021
+ int GetNumIPs() const { return ips_per_elem; }
1022
+ int GetNumElems() const { return elems; }
1023
+
1024
+
1025
+
1026
+ void ReSetValues( Array<double> & avalues )
1027
+ {
1028
+ if ( avalues.Size() < values.Size() )
1029
+ {
1030
+ throw Exception("IntegrationPointCoefficientFunction::ReSetValues - sizes don't match!");
1031
+ }
1032
+ values = avalues;
1033
+ }
1034
+
1035
+ };
1036
+ #endif
1037
+
1038
+
1039
+ #ifdef OLD
1040
+ /// Coefficient function that depends (piecewise polynomially) on a parameter
1041
+ class PolynomialCoefficientFunction : public CoefficientFunction
1042
+ {
1043
+ private:
1044
+ Array < Array< Array<double>* >* > polycoeffs;
1045
+ Array < Array<double>* > polybounds;
1046
+
1047
+ private:
1048
+ double EvalPoly(const double t, const Array<double> & coeffs) const;
1049
+ double EvalPolyDeri(const double t, const Array<double> & coeffs) const;
1050
+
1051
+ public:
1052
+ PolynomialCoefficientFunction(const Array < Array<double>* > & polycoeffs_in);
1053
+ PolynomialCoefficientFunction(const Array < Array< Array<double>* >* > & polycoeffs_in, const Array < Array<double>* > & polybounds_in);
1054
+
1055
+ virtual ~PolynomialCoefficientFunction();
1056
+ using CoefficientFunction::Evaluate;
1057
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const;
1058
+
1059
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip, const double & t) const;
1060
+
1061
+ virtual double EvaluateDeri (const BaseMappedIntegrationPoint & ip, const double & t) const;
1062
+
1063
+ virtual double EvaluateConst () const;
1064
+ };
1065
+ #endif
1066
+
1067
+
1068
+ //////////////////
1069
+ #ifdef OLD
1070
+ class FileCoefficientFunction : public CoefficientFunction
1071
+ {
1072
+ private:
1073
+ Array < Array < double > * > ValuesAtIps;
1074
+
1075
+ ofstream outfile;
1076
+
1077
+ string valuesfilename;
1078
+ string infofilename;
1079
+ string ipfilename;
1080
+
1081
+ int maxelnum, maxipnum, totalipnum;
1082
+
1083
+ bool writeips;
1084
+
1085
+ private:
1086
+ void EmptyValues(void);
1087
+
1088
+ public:
1089
+ FileCoefficientFunction();
1090
+
1091
+ FileCoefficientFunction(const string & filename);
1092
+
1093
+ FileCoefficientFunction(const string & aipfilename,
1094
+ const string & ainfofilename,
1095
+ const string & avaluesfilename,
1096
+ const bool loadvalues = false);
1097
+
1098
+ virtual ~FileCoefficientFunction();
1099
+
1100
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const;
1101
+
1102
+ void LoadValues(const string & filename);
1103
+ inline void LoadValues(void){ LoadValues(valuesfilename); }
1104
+
1105
+ void StartWriteIps(const string & filename);
1106
+ inline void StartWriteIps(void){ StartWriteIps(ipfilename); }
1107
+
1108
+ void StopWriteIps(const string & infofilename);
1109
+ inline void StopWriteIps(void){ StopWriteIps(infofilename); }
1110
+
1111
+ void Reset(void);
1112
+
1113
+ };
1114
+ #endif
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+ // *************************** CoefficientFunction Algebra ********************************
1129
+ template <typename OP>
1130
+ class cl_UnaryOpCF : public T_CoefficientFunction<cl_UnaryOpCF<OP>>
1131
+ {
1132
+ shared_ptr<CoefficientFunction> c1;
1133
+ OP lam;
1134
+ string name;
1135
+ typedef T_CoefficientFunction<cl_UnaryOpCF<OP>> BASE;
1136
+ using typename BASE::T_DJC;
1137
+ public:
1138
+ // cl_UnaryOpCF() = default;
1139
+ cl_UnaryOpCF (shared_ptr<CoefficientFunction> ac1,
1140
+ OP alam, string aname="undefined")
1141
+ : BASE(ac1->Dimension(),
1142
+ ac1->IsComplex() && typeid (lam(Complex(0.0))) == typeid(Complex)),
1143
+ c1(ac1), lam(alam), name(aname)
1144
+ {
1145
+ this->SetDimensions (c1->Dimensions());
1146
+ this->elementwise_constant = c1->ElementwiseConstant();
1147
+ this->SetDescription(string("unary operation '")+name+"'");
1148
+ }
1149
+
1150
+ virtual void DoArchive (Archive & archive) override
1151
+ {
1152
+ BASE::DoArchive(archive); // for reshape
1153
+ // archive.Shallow(c1) & name & lam;
1154
+ }
1155
+ auto GetCArgs() const { return tuple { c1, lam, name }; }
1156
+ /*
1157
+ virtual string GetDescription () const override
1158
+ {
1159
+ return string("unary operation '")+name+"'";
1160
+ }
1161
+ */
1162
+ virtual bool DefinedOn (const ElementTransformation & trafo) override
1163
+ { return c1->DefinedOn(trafo); }
1164
+
1165
+ // virtual bool ElementwiseConstant () const override { return c1->ElementwiseConstant(); }
1166
+
1167
+ virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const override
1168
+ {
1169
+ //code.Declare (code.res_type, index, this->Dimensions());
1170
+ code.Declare (index, this->Dimensions(), this->IsComplex());
1171
+ if (code_uses_tensors)
1172
+ {
1173
+ code.body += "for (size_t i = 0; i < "+ToString(this->Dimension())+"; i++)\n";
1174
+ code.body += "var_"+ToString(index)+"[i] = "+name+"( var_"+ToString(inputs[0])+"[i]);\n";
1175
+ }
1176
+ else
1177
+ for (int i = 0; i < this->Dimension(); i++)
1178
+ code.body += Var(index, i, this->Dimensions())
1179
+ .Assign( Var(inputs[0], i, c1->Dimensions()).Func(name), false);
1180
+ }
1181
+
1182
+ shared_ptr<CoefficientFunction>
1183
+ Transform(CoefficientFunction::T_Transform& transformation) const override
1184
+ {
1185
+ auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this());
1186
+ if(transformation.cache.count(thisptr))
1187
+ return transformation.cache[thisptr];
1188
+ if(transformation.replace.count(thisptr))
1189
+ return transformation.replace[thisptr];
1190
+ auto newcf = make_shared<cl_UnaryOpCF>(c1->Transform(transformation), lam, name);
1191
+ newcf->SetDimensions(BASE::Dimensions());
1192
+ transformation.cache[thisptr] = newcf;
1193
+ return newcf;
1194
+ }
1195
+
1196
+ virtual void TraverseTree (const function<void(CoefficientFunction&)> & func) override
1197
+ {
1198
+ c1->TraverseTree (func);
1199
+ func(*this);
1200
+ }
1201
+
1202
+ virtual Array<shared_ptr<CoefficientFunction>> InputCoefficientFunctions() const override
1203
+ { return Array<shared_ptr<CoefficientFunction>>({ c1 }); }
1204
+
1205
+ using BASE::Evaluate;
1206
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
1207
+ {
1208
+ return lam (c1->Evaluate(ip));
1209
+ }
1210
+
1211
+ virtual Complex EvaluateComplex (const BaseMappedIntegrationPoint & ip) const override
1212
+ {
1213
+ return lam (c1->EvaluateComplex(ip));
1214
+ }
1215
+
1216
+ virtual double EvaluateConst () const override
1217
+ {
1218
+ return lam (c1->EvaluateConst());
1219
+ }
1220
+
1221
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
1222
+ FlatVector<> result) const override
1223
+ {
1224
+ c1->Evaluate (ip, result);
1225
+ for (int j = 0; j < result.Size(); j++)
1226
+ result(j) = lam(result(j));
1227
+ }
1228
+
1229
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<double> result) const override
1230
+ {
1231
+ c1->Evaluate (ir, result);
1232
+ /*
1233
+ for (int i = 0; i < result.Height()*result.Width(); i++)
1234
+ result(i) = lam (result(i));
1235
+ */
1236
+ size_t np = ir.Size();
1237
+ size_t dim = this->Dimension();
1238
+ for (size_t i = 0; i < np; i++)
1239
+ for (size_t j = 0; j < dim; j++)
1240
+ result(i,j) = lam (result(i,j));
1241
+ }
1242
+
1243
+ virtual void Evaluate(const BaseMappedIntegrationPoint & ip,
1244
+ FlatVector<Complex> result) const override
1245
+ {
1246
+ c1->Evaluate (ip, result);
1247
+ for (int j = 0; j < result.Size(); j++)
1248
+ result(j) = lam(result(j));
1249
+ }
1250
+
1251
+ virtual void Evaluate(const BaseMappedIntegrationRule & ir,
1252
+ BareSliceMatrix<Complex> result) const override
1253
+ {
1254
+ c1->Evaluate (ir, result);
1255
+ // for (int i = 0; i < result.Height()*result.Width(); i++)
1256
+ // result(i) = lam(result(i));
1257
+ size_t np = ir.Size();
1258
+ size_t dim = this->Dimension();
1259
+ for (size_t i = 0; i < np; i++)
1260
+ for (size_t j = 0; j < dim; j++)
1261
+ result(i,j) = lam (result(i,j));
1262
+ }
1263
+
1264
+ template <typename MIR, typename T, ORDERING ORD>
1265
+ void T_Evaluate (const MIR & ir, BareSliceMatrix<T,ORD> values) const
1266
+ {
1267
+ c1->Evaluate (ir, values);
1268
+ size_t dim = this->Dimension();
1269
+ size_t np = ir.Size();
1270
+ for (size_t i = 0; i < dim; i++)
1271
+ for (size_t j = 0; j < np; j++)
1272
+ values(i,j) = lam (values(i,j));
1273
+ }
1274
+
1275
+ template <typename MIR, typename T, ORDERING ORD>
1276
+ void T_Evaluate (const MIR & ir,
1277
+ FlatArray<BareSliceMatrix<T,ORD>> input,
1278
+ BareSliceMatrix<T,ORD> values) const
1279
+ {
1280
+ auto in0 = input[0];
1281
+ size_t dim = this->Dimension();
1282
+ size_t np = ir.Size();
1283
+ for (size_t i = 0; i < dim; i++)
1284
+ for (size_t j = 0; j < np; j++)
1285
+ values(i,j) = lam (in0(i,j));
1286
+ }
1287
+
1288
+
1289
+ virtual shared_ptr<CoefficientFunction>
1290
+ Operator (const string & name) const override
1291
+ { throw Exception ("unarycf "+name+" does not provide Operator"); }
1292
+
1293
+
1294
+ virtual shared_ptr<CoefficientFunction>
1295
+ Diff (const CoefficientFunction * var, shared_ptr<CoefficientFunction> dir) const override
1296
+ {
1297
+ if (this == var) return dir;
1298
+ return CWMult (lam.Diff(c1), c1->Diff(var, dir));
1299
+
1300
+ // throw Exception ("unarycf "+name+" does not provide a derivative");
1301
+ }
1302
+
1303
+ virtual shared_ptr<CoefficientFunction>
1304
+ DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override
1305
+ {
1306
+ if (this == var) return make_shared<ConstantCoefficientFunction> (1);
1307
+ if (this->Dimensions().Size() == 0)
1308
+ return lam.Diff(c1) * c1->DiffJacobi(var, cache);
1309
+ else
1310
+ return MakeMultDiagMatCoefficientFunction (lam.Diff(c1),
1311
+ c1->DiffJacobi(var, cache));
1312
+ // return BASE::DiffJacobi(var, cache);
1313
+ }
1314
+
1315
+
1316
+ /*
1317
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1318
+ FlatVector<bool> nonzero,
1319
+ FlatVector<bool> nonzero_deriv,
1320
+ FlatVector<bool> nonzero_dderiv) const override
1321
+ {
1322
+ size_t dim = this->Dimension();
1323
+ Vector<bool> v1(dim), d1(dim), dd1(dim);
1324
+ c1->NonZeroPattern(ud, v1, d1, dd1);
1325
+ for (int i = 0; i < nonzero.Size(); i++)
1326
+ {
1327
+ if (name == "-" || name == " ") // "-" actually not used that way
1328
+ {
1329
+ nonzero(i) = v1(i);
1330
+ nonzero_deriv(i) = d1(i);
1331
+ nonzero_dderiv(i) = dd1(i);
1332
+ }
1333
+ else
1334
+ {
1335
+ nonzero(i) = v1(i);
1336
+ nonzero_deriv(i) = d1(i);
1337
+ nonzero_dderiv(i) = d1(i) || dd1(i);
1338
+ }
1339
+ }
1340
+ }
1341
+ */
1342
+
1343
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1344
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
1345
+ {
1346
+ size_t dim = this->Dimension();
1347
+ Vector<AutoDiffDiff<1,NonZero>> v1(dim);
1348
+ c1->NonZeroPattern(ud, v1);
1349
+ for (int i = 0; i < values.Size(); i++)
1350
+ {
1351
+ if (name == "-" || name == " ") // "-" actually not used that way
1352
+ {
1353
+ values = v1;
1354
+ }
1355
+ else
1356
+ {
1357
+ for (size_t i = 0; i < values.Size(); i++)
1358
+ {
1359
+ values[i].Value() = v1[i].Value();
1360
+ values[i].DValue(0) = v1[i].DValue(0);
1361
+ values[i].DDValue(0) = v1[i].DValue(0) || v1[i].DDValue(0);
1362
+ }
1363
+ }
1364
+ }
1365
+ }
1366
+
1367
+
1368
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1369
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
1370
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
1371
+ {
1372
+ auto v1 = input[0];
1373
+ if (name == "-" || name == " ") // "-" actually not used that way
1374
+ {
1375
+ values = v1;
1376
+ }
1377
+ else
1378
+ {
1379
+ for (size_t i = 0; i < values.Size(); i++)
1380
+ {
1381
+ values[i].Value() = v1[i].Value();
1382
+ values[i].DValue(0) = v1[i].DValue(0);
1383
+ values[i].DDValue(0) = v1[i].DValue(0) || v1[i].DDValue(0);
1384
+ }
1385
+ }
1386
+ }
1387
+ };
1388
+
1389
+
1390
+
1391
+
1392
+ template <typename OP>
1393
+ class cl_BinaryOpCF : public T_CoefficientFunction<cl_BinaryOpCF<OP>>
1394
+ {
1395
+ typedef T_CoefficientFunction<cl_BinaryOpCF<OP>> BASE;
1396
+ shared_ptr<CoefficientFunction> c1, c2;
1397
+ OP lam;
1398
+ string opname;
1399
+ using BASE::is_complex;
1400
+ using BASE::Dimension;
1401
+ using BASE::SetDimension;
1402
+ using BASE::SetDimensions;
1403
+ using BASE::Evaluate;
1404
+ using typename BASE::T_DJC;
1405
+ public:
1406
+ // cl_BinaryOpCF() = default;
1407
+ cl_BinaryOpCF (shared_ptr<CoefficientFunction> ac1,
1408
+ shared_ptr<CoefficientFunction> ac2,
1409
+ OP alam, string aopname)
1410
+ : BASE(ac1->Dimension(), ac1->IsComplex() || ac2->IsComplex()),
1411
+ c1(ac1), c2(ac2), lam(alam),
1412
+ opname(aopname)
1413
+ {
1414
+ int dim1 = c1->Dimension();
1415
+ int dim2 = c2->Dimension();
1416
+ // if (!(c1->Dimensions() == c2->Dimensions())) // too critical ???
1417
+ if (dim1 != dim2)
1418
+ throw Exception ("Dimensions don't match, op = "+opname + " dims1 = " + ToString(c1->Dimensions()) + ", dims2 = " + ToString(c2->Dimensions()));
1419
+ is_complex = c1->IsComplex() || c2->IsComplex();
1420
+ this->elementwise_constant = c1->ElementwiseConstant() && c2->ElementwiseConstant();
1421
+ SetDimensions (c1->Dimensions());
1422
+ }
1423
+
1424
+ auto GetCArgs() const { return tuple { c1, c2, lam, opname }; }
1425
+ virtual void DoArchive (Archive & archive) override { }
1426
+ /*
1427
+ virtual void DoArchive (Archive & archive) override
1428
+ {
1429
+ BASE::DoArchive(archive);
1430
+ archive.Shallow(c1).Shallow(c2) & opname;
1431
+ }
1432
+ */
1433
+ shared_ptr<CoefficientFunction>
1434
+ Transform(CoefficientFunction::T_Transform& transformation) const override
1435
+ {
1436
+ auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this());
1437
+ if(transformation.cache.count(thisptr))
1438
+ return transformation.cache[thisptr];
1439
+ if(transformation.replace.count(thisptr))
1440
+ return transformation.replace[thisptr];
1441
+ auto newcf = make_shared<cl_BinaryOpCF<OP>>(c1->Transform(transformation), c2->Transform(transformation), lam, opname);
1442
+ transformation.cache[thisptr] = newcf;
1443
+ return newcf;
1444
+ }
1445
+
1446
+ virtual string GetDescription () const override
1447
+ {
1448
+ return string("binary operation '")+opname+"'";
1449
+ }
1450
+ virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const override
1451
+ {
1452
+ // code.Declare (code.res_type, index, this->Dimensions());
1453
+ code.Declare (index, this->Dimensions(), this->IsComplex());
1454
+
1455
+ if (code_uses_tensors)
1456
+ {
1457
+ code.body += "for (int i = 0; i < "+ToString(this->Dimension())+"; i++)\n";
1458
+ code.body += "var_" + ToString(index) + "[i] = ";
1459
+ if(opname.size()>2) // atan2, pow, etc.
1460
+ {
1461
+ code.body += opname + '(' + "var_" + ToString(inputs[0]) + "[i],";
1462
+ code.body += "var_" + ToString(inputs[1]) + "[i]); \n";
1463
+ }
1464
+ else
1465
+ {
1466
+ code.body += "var_" + ToString(inputs[0]) + "[i]" + opname;
1467
+ code.body += "var_" + ToString(inputs[1]) + "[i]; \n";
1468
+ }
1469
+ }
1470
+
1471
+ else
1472
+ {
1473
+ for (int i = 0; i < this->Dimension(); i++)
1474
+ {
1475
+ auto op1 = Var(inputs[0], i, c1->Dimensions()).S();
1476
+ auto op2 = Var(inputs[1], i, c2->Dimensions()).S();
1477
+ string expr;
1478
+ if(opname.size()>2) // atan2, pow, etc.
1479
+ expr = opname + '(' + op1 + ',' + op2 + ')';
1480
+ else // +,-,*,/, etc.
1481
+ expr = op1 + ' ' + opname + ' ' + op2;
1482
+ code.body += Var(index,i,this->Dimensions()).Assign( expr, false );
1483
+ }
1484
+ }
1485
+ }
1486
+
1487
+ virtual void TraverseTree (const function<void(CoefficientFunction&)> & func) override
1488
+ {
1489
+ c1->TraverseTree (func);
1490
+ c2->TraverseTree (func);
1491
+ func(*this);
1492
+ }
1493
+
1494
+ virtual bool DefinedOn (const ElementTransformation & trafo) override
1495
+ { return c1->DefinedOn(trafo) && c2->DefinedOn(trafo); }
1496
+
1497
+ virtual Array<shared_ptr<CoefficientFunction>> InputCoefficientFunctions() const override
1498
+ { return Array<shared_ptr<CoefficientFunction>>({ c1, c2 }); }
1499
+
1500
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
1501
+ {
1502
+ return lam (c1->Evaluate(ip), c2->Evaluate(ip));
1503
+ }
1504
+
1505
+ virtual Complex EvaluateComplex (const BaseMappedIntegrationPoint & ip) const override
1506
+ {
1507
+ return lam (c1->EvaluateComplex(ip), c2->EvaluateComplex(ip));
1508
+ }
1509
+
1510
+ virtual double EvaluateConst () const override
1511
+ {
1512
+ return lam (c1->EvaluateConst(), c2->EvaluateConst());
1513
+ }
1514
+
1515
+
1516
+ virtual void Evaluate(const BaseMappedIntegrationPoint & mip,
1517
+ FlatVector<> result) const override
1518
+ {
1519
+ size_t dim = Dimension();
1520
+ STACK_ARRAY(double, hmem, dim);
1521
+ FlatVector<> temp(dim, hmem);
1522
+
1523
+ c1->Evaluate (mip, result);
1524
+ c2->Evaluate (mip, temp);
1525
+ for (int i = 0; i < result.Size(); i++)
1526
+ result(i) = lam (result(i), temp(i));
1527
+ }
1528
+
1529
+
1530
+ virtual void Evaluate(const BaseMappedIntegrationPoint & mip,
1531
+ FlatVector<Complex> result) const override
1532
+ {
1533
+ size_t dim = Dimension();
1534
+ if (!is_complex)
1535
+ {
1536
+ STACK_ARRAY(double, hmem, dim);
1537
+ FlatVector<> temp(dim, &hmem[0]);
1538
+ Evaluate (mip, temp);
1539
+ result = temp;
1540
+ return;
1541
+ }
1542
+
1543
+ STACK_ARRAY(Complex, hmem, dim);
1544
+ FlatVector<Complex> temp(dim, hmem);
1545
+
1546
+ c1->Evaluate (mip, result);
1547
+ c2->Evaluate (mip, temp);
1548
+ for (int i = 0; i < result.Size(); i++)
1549
+ result(i) = lam (result(i), temp(i));
1550
+ }
1551
+
1552
+
1553
+
1554
+ virtual void Evaluate(const BaseMappedIntegrationRule & ir,
1555
+ BareSliceMatrix<> result) const override
1556
+ {
1557
+ size_t dim = Dimension();
1558
+ size_t np = ir.Size();
1559
+ STACK_ARRAY(double, hmem, np*dim);
1560
+ FlatMatrix<> temp(np, dim, hmem);
1561
+
1562
+ c1->Evaluate (ir, result);
1563
+ c2->Evaluate (ir, temp);
1564
+ /*
1565
+ for (int i = 0; i < result.Height()*result.Width(); i++)
1566
+ result(i) = lam (result(i), temp(i));
1567
+ */
1568
+ for (size_t i = 0; i < np; i++)
1569
+ for (size_t j = 0; j < dim; j++)
1570
+ result(i,j) = lam(result(i,j), temp(i,j));
1571
+ }
1572
+
1573
+ virtual void Evaluate(const BaseMappedIntegrationRule & ir,
1574
+ BareSliceMatrix<Complex> result) const override
1575
+ {
1576
+ size_t dim = Dimension();
1577
+ if (!is_complex)
1578
+ {
1579
+ STACK_ARRAY(double, hmem, ir.Size()*dim);
1580
+ FlatMatrix<> temp(ir.Size(), dim, &hmem[0]);
1581
+ Evaluate (ir, temp);
1582
+ result.AddSize(ir.Size(), dim) = temp;
1583
+ return;
1584
+ }
1585
+
1586
+
1587
+ STACK_ARRAY(double, hmem, 2*ir.Size()*dim);
1588
+ FlatMatrix<Complex> temp(ir.Size(), dim, reinterpret_cast<Complex*> (&hmem[0]));
1589
+
1590
+ c1->Evaluate (ir, result);
1591
+ c2->Evaluate (ir, temp);
1592
+ /*
1593
+ for (int i = 0; i < result.Height()*result.Width(); i++)
1594
+ result(i) = lam(result(i), temp(i));
1595
+ */
1596
+ size_t np = ir.Size();
1597
+ for (size_t i = 0; i < np; i++)
1598
+ for (size_t j = 0; j < dim; j++)
1599
+ result(i,j) = lam (result(i,j), temp(i,j));
1600
+
1601
+ }
1602
+
1603
+
1604
+ template <typename MIR, typename T, ORDERING ORD>
1605
+ void T_Evaluate (const MIR & ir, BareSliceMatrix<T,ORD> values) const
1606
+ {
1607
+ size_t np = ir.Size();
1608
+ size_t mydim = Dimension();
1609
+ STACK_ARRAY(T, hmem, np*mydim);
1610
+ FlatMatrix<T,ORD> temp(mydim, np, &hmem[0]);
1611
+ c1->Evaluate (ir, values);
1612
+ c2->Evaluate (ir, temp);
1613
+ for (size_t i = 0; i < mydim; i++)
1614
+ for (size_t j = 0; j < np; j++)
1615
+ values(i,j) = lam (values(i,j), temp(i,j));
1616
+ }
1617
+
1618
+ template <typename MIR, typename T, ORDERING ORD>
1619
+ void T_Evaluate (const MIR & ir,
1620
+ FlatArray<BareSliceMatrix<T,ORD>> input,
1621
+ BareSliceMatrix<T,ORD> values) const
1622
+ {
1623
+ size_t np = ir.Size();
1624
+ size_t dim = Dimension();
1625
+
1626
+ auto in0 = input[0];
1627
+ auto in1 = input[1];
1628
+ for (size_t i = 0; i < dim; i++)
1629
+ for (size_t j = 0; j < np; j++)
1630
+ values(i,j) = lam (in0(i,j), in1(i,j));
1631
+ }
1632
+
1633
+ using CoefficientFunction::Operator;
1634
+ virtual shared_ptr<CoefficientFunction>
1635
+ Operator (const string & name) const override
1636
+ { throw Exception ("binarycf "+opname+" does not provide Operator"); }
1637
+
1638
+ virtual shared_ptr<CoefficientFunction>
1639
+ Diff (const CoefficientFunction * var, shared_ptr<CoefficientFunction> dir) const override
1640
+ { throw Exception ("binarycf "+opname+" does not provide a derivative"); }
1641
+
1642
+ virtual shared_ptr<CoefficientFunction>
1643
+ DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override
1644
+ { return BASE::DiffJacobi(var, cache); }
1645
+
1646
+ /*
1647
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1648
+ FlatVector<bool> nonzero,
1649
+ FlatVector<bool> nonzero_deriv,
1650
+ FlatVector<bool> nonzero_dderiv) const override
1651
+ {
1652
+ size_t dim = Dimension();
1653
+ Vector<bool> v1(dim), v2(dim), d1(dim), d2(dim), dd1(dim), dd2(dim);
1654
+ c1->NonZeroPattern(ud, v1, d1, dd1);
1655
+ c2->NonZeroPattern(ud, v2, d2, dd2);
1656
+ for (int i = 0; i < nonzero.Size(); i++)
1657
+ {
1658
+ if (opname == "+" || opname == "-")
1659
+ {
1660
+ nonzero(i) = v1(i) || v2(i);
1661
+ nonzero_deriv(i) = d1(i) || d2(i);
1662
+ nonzero_dderiv(i) = dd1(i) || dd2(i);
1663
+ }
1664
+ else if (opname == "*")
1665
+ {
1666
+ nonzero(i) = v1(i) && v2(i);
1667
+ nonzero_deriv(i) = (v1(i) && d2(i)) || (d1(i) && v2(i));
1668
+ nonzero_dderiv(i) = (v1(i) && dd2(i)) || (d1(i) && d2(i)) || (dd1(i) && v2(i));
1669
+ }
1670
+ else
1671
+ {
1672
+ nonzero(i) = v1(i) || v2(i);
1673
+ nonzero_deriv(i) = d1(i) || d2(i);
1674
+ nonzero_dderiv(i) = d1(i) || dd1(i) || d2(i) || dd2(i);
1675
+ }
1676
+ }
1677
+ }
1678
+ */
1679
+
1680
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1681
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
1682
+ {
1683
+ size_t dim = Dimension();
1684
+ Vector<AutoDiffDiff<1,NonZero>> v1(dim), v2(dim);
1685
+ c1->NonZeroPattern(ud, v1);
1686
+ c2->NonZeroPattern(ud, v2);
1687
+ for (int i = 0; i < values.Size(); i++)
1688
+ {
1689
+ if (opname == "+" || opname == "-")
1690
+ values(i) = v1(i) + v2(i);
1691
+ else if (opname == "*")
1692
+ values(i) = v1(i) * v2(i);
1693
+ else
1694
+ {
1695
+ values(i).Value() = v1(i).Value() || v2(i).Value();
1696
+ values(i).DValue(0) = v1(i).DValue(0) || v2(i).DValue(0);
1697
+ values(i).DDValue(0) = v1(i).DValue(0) || v2(i).DValue(0) || v1(i).DDValue(0) || v2(i).DDValue(0);
1698
+ }
1699
+ }
1700
+ }
1701
+
1702
+ virtual void NonZeroPattern (const class ProxyUserData & ud,
1703
+ FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
1704
+ FlatVector<AutoDiffDiff<1,NonZero>> values) const override
1705
+ {
1706
+ auto v1 = input[0];
1707
+ auto v2 = input[1];
1708
+ for (int i = 0; i < values.Size(); i++)
1709
+ {
1710
+ if (opname == "+" || opname == "-")
1711
+ values(i) = v1(i) + v2(i);
1712
+ else if (opname == "*")
1713
+ values(i) = v1(i) * v2(i);
1714
+ else
1715
+ {
1716
+ values(i).Value() = v1(i).Value() || v2(i).Value();
1717
+ values(i).DValue(0) = v1(i).DValue(0) || v2(i).DValue(0);
1718
+ values(i).DDValue(0) = v1(i).DValue(0) || v2(i).DValue(0) || v1(i).DDValue(0) || v2(i).DDValue(0);
1719
+ }
1720
+ }
1721
+ }
1722
+ };
1723
+
1724
+
1725
+
1726
+ // extern shared_ptr<CoefficientFunction> shape; // for shape derivative
1727
+ // information howto treat GridFunctions (and maybe other stuff) for shape-derivatives
1728
+ class DiffShapeCF : public ConstantCoefficientFunction
1729
+ {
1730
+ public:
1731
+ DiffShapeCF() : ConstantCoefficientFunction(1) {
1732
+ SetVariable();
1733
+ }
1734
+ ~DiffShapeCF() override;
1735
+ Array<shared_ptr<CoefficientFunction>> Eulerian_gridfunctions;
1736
+ };
1737
+
1738
+
1739
+
1740
+
1741
+
1742
+
1743
+ template <typename OP>
1744
+ INLINE shared_ptr<CoefficientFunction> BinaryOpCF(shared_ptr<CoefficientFunction> c1,
1745
+ shared_ptr<CoefficientFunction> c2,
1746
+ OP lam,
1747
+ string opname)
1748
+ {
1749
+ return make_shared<cl_BinaryOpCF<OP>>(c1, c2, lam, opname);
1750
+ }
1751
+
1752
+
1753
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1754
+ MakeConstantCoefficientFunction (Complex c);
1755
+
1756
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1757
+ MakeComponentCoefficientFunction (shared_ptr<CoefficientFunction> c1, int comp);
1758
+
1759
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1760
+ MakeVectorialCoefficientFunction (Array<shared_ptr<CoefficientFunction>> aci);
1761
+
1762
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1763
+ MakeSubTensorCoefficientFunction (shared_ptr<CoefficientFunction> c1,
1764
+ int first, Array<int> num, Array<int> dist);
1765
+
1766
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1767
+ MakeExtendDimensionCoefficientFunction (shared_ptr<CoefficientFunction> c1,
1768
+ Array<int> dims, Array<int> pos, Array<int> stride);
1769
+
1770
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1771
+ MakeTensorTransposeCoefficientFunction (shared_ptr<CoefficientFunction> c1, Array<int> ordering);
1772
+
1773
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1774
+ MakeTensorTransposeCoefficientFunction (shared_ptr<CoefficientFunction> c1, int i1, int i2);
1775
+
1776
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1777
+ MakeTensorTraceCoefficientFunction (shared_ptr<CoefficientFunction> c1, int i1, int i2);
1778
+
1779
+ // cf_ijk v0_i v1_j v2_k
1780
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1781
+ MakeVectorContractionCoefficientFunction (shared_ptr<CoefficientFunction> c1,
1782
+ Array<shared_ptr<CoefficientFunction>> vectors);
1783
+
1784
+ // contract index'th index with vector
1785
+ // cf_i_0, .., i_ind-1, k, i_ind+1, i_dim v_k
1786
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1787
+ MakeSingleContractionCoefficientFunction (shared_ptr<CoefficientFunction> c1,
1788
+ shared_ptr<CoefficientFunction> vec,
1789
+ int index);
1790
+
1791
+ // diag(c1) * c2
1792
+ // general tensor (TODO)
1793
+ // C = A*B in sense of
1794
+ // C_ijk = A_ij B_ik
1795
+ // with i.. single index, and j,k multi-index
1796
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1797
+ MakeMultDiagMatCoefficientFunction (shared_ptr<CoefficientFunction> c1,
1798
+ shared_ptr<CoefficientFunction> c2);
1799
+
1800
+
1801
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1802
+ MakeCoordinateCoefficientFunction (int comp);
1803
+
1804
+ // for DG jump terms
1805
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1806
+ MakeOtherCoefficientFunction (shared_ptr<CoefficientFunction> me);
1807
+ NGS_DLL_HEADER bool IsOtherCoefficientFunction (CoefficientFunction & coef);
1808
+
1809
+
1810
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1811
+ MakeDomainWiseCoefficientFunction (Array<shared_ptr<CoefficientFunction>> aci,
1812
+ optional<VorB> vb=nullopt);
1813
+
1814
+
1815
+
1816
+
1817
+ /* ******************** matrix operations ********************** */
1818
+
1819
+
1820
+
1821
+ NGS_DLL_HEADER
1822
+ shared_ptr<CoefficientFunction> operator+ (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1823
+
1824
+ NGS_DLL_HEADER
1825
+ shared_ptr<CoefficientFunction> operator- (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1826
+
1827
+ NGS_DLL_HEADER
1828
+ shared_ptr<CoefficientFunction> operator* (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1829
+ // coponent-wise multiplication
1830
+ NGS_DLL_HEADER
1831
+ shared_ptr<CoefficientFunction> CWMult (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1832
+
1833
+ NGS_DLL_HEADER
1834
+ shared_ptr<CoefficientFunction> operator* (double v1, shared_ptr<CoefficientFunction> c2);
1835
+ NGS_DLL_HEADER
1836
+ shared_ptr<CoefficientFunction> operator* (Complex v1, shared_ptr<CoefficientFunction> c2);
1837
+
1838
+ NGS_DLL_HEADER
1839
+ shared_ptr<CoefficientFunction> operator- (shared_ptr<CoefficientFunction> c1);
1840
+
1841
+ NGS_DLL_HEADER
1842
+ shared_ptr<CoefficientFunction> CreateWrapperCF (shared_ptr<CoefficientFunction> cf);
1843
+
1844
+ NGS_DLL_HEADER
1845
+ shared_ptr<CoefficientFunction> ConjCF (shared_ptr<CoefficientFunction> c1);
1846
+
1847
+ NGS_DLL_HEADER
1848
+ shared_ptr<CoefficientFunction> InnerProduct (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1849
+
1850
+ NGS_DLL_HEADER
1851
+ shared_ptr<CoefficientFunction> CrossProduct (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1852
+
1853
+ NGS_DLL_HEADER
1854
+ shared_ptr<CoefficientFunction> operator/ (shared_ptr<CoefficientFunction> c1, shared_ptr<CoefficientFunction> c2);
1855
+
1856
+ NGS_DLL_HEADER
1857
+ shared_ptr<CoefficientFunction> operator/ (double val, shared_ptr<CoefficientFunction> c2);
1858
+
1859
+ NGS_DLL_HEADER
1860
+ shared_ptr<CoefficientFunction> IdentityCF (int dim);
1861
+
1862
+ NGS_DLL_HEADER
1863
+ shared_ptr<CoefficientFunction> IdentityCF (FlatArray<int> dims);
1864
+
1865
+ NGS_DLL_HEADER
1866
+ shared_ptr<CoefficientFunction> ZeroCF (FlatArray<int> dims);
1867
+
1868
+ NGS_DLL_HEADER
1869
+ shared_ptr<CoefficientFunction> ConstantCF (double val);
1870
+
1871
+ NGS_DLL_HEADER
1872
+ shared_ptr<CoefficientFunction> UnitVectorCF (int dim, int coord);
1873
+
1874
+ NGS_DLL_HEADER
1875
+ shared_ptr<CoefficientFunction> OneVectorCF (FlatArray<int> dims);
1876
+
1877
+
1878
+ NGS_DLL_HEADER
1879
+ shared_ptr<CoefficientFunction> LeviCivitaCF(int dimension);
1880
+
1881
+ NGS_DLL_HEADER
1882
+ shared_ptr <CoefficientFunction> EinsumCF(const string &index_signature,
1883
+ const Array <shared_ptr<CoefficientFunction>>& cfs,
1884
+ const map<string, bool> &options = {});
1885
+
1886
+ NGS_DLL_HEADER
1887
+ shared_ptr<CoefficientFunction> TransposeCF (shared_ptr<CoefficientFunction> coef);
1888
+
1889
+ NGS_DLL_HEADER
1890
+ shared_ptr<CoefficientFunction> ReshapeCF (shared_ptr<CoefficientFunction> coef,
1891
+ FlatArray<int> adims);
1892
+
1893
+ INLINE
1894
+ shared_ptr<CoefficientFunction> ReshapeCF (shared_ptr<CoefficientFunction> coef, int s)
1895
+ { return ReshapeCF (std::move(coef), Array<int>{s}); }
1896
+
1897
+ INLINE
1898
+ shared_ptr<CoefficientFunction> ReshapeCF (shared_ptr<CoefficientFunction> coef, int h, int w)
1899
+ { return ReshapeCF (std::move(coef), Array<int>{h,w}); }
1900
+
1901
+ NGS_DLL_HEADER
1902
+ shared_ptr<CoefficientFunction> InverseCF (shared_ptr<CoefficientFunction> coef);
1903
+
1904
+ NGS_DLL_HEADER
1905
+ shared_ptr<CoefficientFunction> DeterminantCF (shared_ptr<CoefficientFunction> coef);
1906
+
1907
+ NGS_DLL_HEADER
1908
+ shared_ptr<CoefficientFunction> CofactorCF (shared_ptr<CoefficientFunction> coef);
1909
+
1910
+ NGS_DLL_HEADER
1911
+ shared_ptr<CoefficientFunction> SymmetricCF (shared_ptr<CoefficientFunction> coef);
1912
+
1913
+ NGS_DLL_HEADER
1914
+ shared_ptr<CoefficientFunction> SkewCF (shared_ptr<CoefficientFunction> coef);
1915
+
1916
+ NGS_DLL_HEADER
1917
+ shared_ptr<CoefficientFunction> TraceCF (shared_ptr<CoefficientFunction> coef);
1918
+
1919
+ NGS_DLL_HEADER
1920
+ shared_ptr<CoefficientFunction> NormCF (shared_ptr<CoefficientFunction> coef);
1921
+
1922
+ NGS_DLL_HEADER
1923
+ shared_ptr<CoefficientFunction> EigCF (shared_ptr<CoefficientFunction> coef);
1924
+
1925
+ NGS_DLL_HEADER
1926
+ shared_ptr<CoefficientFunction> IfPos (shared_ptr<CoefficientFunction> cf_if,
1927
+ shared_ptr<CoefficientFunction> cf_then,
1928
+ shared_ptr<CoefficientFunction> cf_else);
1929
+
1930
+ NGS_DLL_HEADER
1931
+ shared_ptr<CoefficientFunction> Real(shared_ptr<CoefficientFunction> cf);
1932
+ NGS_DLL_HEADER
1933
+ shared_ptr<CoefficientFunction> Imag(shared_ptr<CoefficientFunction> cf);
1934
+
1935
+ NGS_DLL_HEADER
1936
+ shared_ptr<CoefficientFunction> Freeze (shared_ptr<CoefficientFunction> cf);
1937
+
1938
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1939
+ CreateMinimizationCF(shared_ptr<CoefficientFunction> expression,
1940
+ shared_ptr<CoefficientFunction> startingpoint,
1941
+ std::optional<double> atol, std::optional<double> rtol,
1942
+ std::optional<int> maxiter, std::optional<bool> allow_fail);
1943
+
1944
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1945
+ CreateMinimizationCF(shared_ptr<CoefficientFunction> expression,
1946
+ const Array<shared_ptr<CoefficientFunction>> &startingpoints,
1947
+ std::optional<double> tol, std::optional<double> rtol,
1948
+ std::optional<int> maxiter, std::optional<bool> allow_fail);
1949
+
1950
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1951
+ CreateNewtonCF (shared_ptr<CoefficientFunction> expression,
1952
+ shared_ptr<CoefficientFunction> startingpoint,
1953
+ std::optional<double> atol,
1954
+ std::optional<double> rtol,
1955
+ std::optional<int> maxiter,
1956
+ std::optional<bool> allow_fail);
1957
+
1958
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction>
1959
+ CreateNewtonCF (shared_ptr<CoefficientFunction> expression,
1960
+ const Array<shared_ptr<CoefficientFunction>> &startingpoints,
1961
+ std::optional<double> tol,
1962
+ std::optional<double> rtol,
1963
+ std::optional<int> maxiter,
1964
+ std::optional<bool> allow_fail);
1965
+
1966
+
1967
+ class CompiledCoefficientFunctionInterface : public CoefficientFunction
1968
+ {
1969
+ protected:
1970
+ Array<CoefficientFunction*> steps;
1971
+ public:
1972
+ using CoefficientFunction::CoefficientFunction;
1973
+ virtual Code GenerateProgram (int deriv, bool simd) const = 0;
1974
+ const Array<CoefficientFunction*> & Steps() const { return steps; }
1975
+ };
1976
+
1977
+ NGS_DLL_HEADER
1978
+ shared_ptr<CompiledCoefficientFunctionInterface> Compile (shared_ptr<CoefficientFunction> c, bool realcompile=false, int maxderiv=2, bool wait=false, bool keep_files=false);
1979
+
1980
+ NGS_DLL_HEADER
1981
+ shared_ptr<CoefficientFunction> LoggingCF (shared_ptr<CoefficientFunction> func, string logfile="stdout");
1982
+
1983
+ NGS_DLL_HEADER
1984
+ shared_ptr<CoefficientFunction> CacheCF (shared_ptr<CoefficientFunction> func);
1985
+
1986
+ NGS_DLL_HEADER
1987
+ void PrecomputeCacheCF (CoefficientFunction & func, SIMD_BaseMappedIntegrationRule & mir,
1988
+ LocalHeap & lh);
1989
+
1990
+ NGS_DLL_HEADER Array<CoefficientFunction*> FindCacheCF (CoefficientFunction & func);
1991
+ NGS_DLL_HEADER
1992
+ void PrecomputeCacheCF (const Array<CoefficientFunction*> & cachecfs, BaseMappedIntegrationRule & mir,
1993
+ LocalHeap & lh);
1994
+ NGS_DLL_HEADER
1995
+ void PrecomputeCacheCF (const Array<CoefficientFunction*> & cachecfs, SIMD_BaseMappedIntegrationRule & mir,
1996
+ LocalHeap & lh);
1997
+
1998
+
1999
+ NGS_DLL_HEADER
2000
+ shared_ptr<CoefficientFunction> NormalVectorCF
2001
+ (int dim, optional<BitArray> inverted_faces=nullopt);
2002
+ NGS_DLL_HEADER
2003
+ shared_ptr<CoefficientFunction> TangentialVectorCF (int dim, bool consistent);
2004
+ NGS_DLL_HEADER
2005
+ shared_ptr<CoefficientFunction> JacobianMatrixCF (int dims, int dimr);
2006
+ NGS_DLL_HEADER
2007
+ shared_ptr<CoefficientFunction> WeingartenCF (int dim);
2008
+ NGS_DLL_HEADER
2009
+ shared_ptr<CoefficientFunction> VertexTangentialVectorsCF (int dim);
2010
+ NGS_DLL_HEADER
2011
+ shared_ptr<CoefficientFunction> EdgeFaceTangentialVectorsCF (int dim);
2012
+ NGS_DLL_HEADER
2013
+ shared_ptr<CoefficientFunction> EdgeCurvatureCF (int dim);
2014
+
2015
+ template <typename OP /* , typename OPC */>
2016
+ shared_ptr<CoefficientFunction> UnaryOpCF(shared_ptr<CoefficientFunction> c1,
2017
+ OP lam, /* OPC lamc, */ string name="undefined")
2018
+ {
2019
+ if (c1->GetDescription() == "ZeroCF" && lam(0.)==0.)
2020
+ {
2021
+ return ZeroCF(c1->Dimensions());
2022
+ }
2023
+ return shared_ptr<CoefficientFunction> (new cl_UnaryOpCF<OP /* ,OPC */> (c1, lam/* , lamc */, name));
2024
+ }
2025
+
2026
+
2027
+ }
2028
+
2029
+
2030
+
2031
+
2032
+
2033
+ #endif