ngsolve 6.2.2506.post216.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.
Files changed (306) hide show
  1. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngs_nvcc +22 -0
  2. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngs_nvlink +17 -0
  3. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngscxx +15 -0
  4. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngsld +11 -0
  5. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngsolve.tcl +648 -0
  6. ngsolve-6.2.2506.post216.dev0.data/data/bin/ngspy +2 -0
  7. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/analytic_integrals.hpp +10 -0
  8. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/arnoldi.hpp +55 -0
  9. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bandmatrix.hpp +334 -0
  10. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/basematrix.hpp +963 -0
  11. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/basevector.hpp +1268 -0
  12. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bdbequations.hpp +2807 -0
  13. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bdbintegrator.hpp +1660 -0
  14. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bem_diffops.hpp +475 -0
  15. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bessel.hpp +1064 -0
  16. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bilinearform.hpp +966 -0
  17. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bla.hpp +29 -0
  18. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/blockalloc.hpp +95 -0
  19. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/blockjacobi.hpp +328 -0
  20. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bspline.hpp +116 -0
  21. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/calcinverse.hpp +141 -0
  22. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cg.hpp +368 -0
  23. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/chebyshev.hpp +44 -0
  24. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cholesky.hpp +720 -0
  25. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/clapack.h +7254 -0
  26. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/code_generation.hpp +296 -0
  27. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient.hpp +2033 -0
  28. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient_impl.hpp +19 -0
  29. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient_stdmath.hpp +167 -0
  30. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/commutingAMG.hpp +106 -0
  31. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/comp.hpp +79 -0
  32. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/compatibility.hpp +41 -0
  33. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/complex_wrapper.hpp +101 -0
  34. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/compressedfespace.hpp +110 -0
  35. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/contact.hpp +239 -0
  36. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_core.hpp +216 -0
  37. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_linalg.hpp +185 -0
  38. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_ngbla.hpp +317 -0
  39. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_ngstd.hpp +414 -0
  40. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_profiler.hpp +240 -0
  41. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diagonalmatrix.hpp +160 -0
  42. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/differentialoperator.hpp +276 -0
  43. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffop.hpp +1286 -0
  44. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffop_impl.hpp +328 -0
  45. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffopwithfactor.hpp +123 -0
  46. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/discontinuous.hpp +84 -0
  47. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/dump.hpp +949 -0
  48. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ectypes.hpp +121 -0
  49. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/eigen.hpp +60 -0
  50. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/eigensystem.hpp +18 -0
  51. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elasticity_equations.hpp +595 -0
  52. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementbyelement.hpp +201 -0
  53. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementtopology.hpp +1760 -0
  54. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementtransformation.hpp +339 -0
  55. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/evalfunc.hpp +405 -0
  56. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/expr.hpp +1693 -0
  57. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetfe.hpp +175 -0
  58. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetfespace.hpp +180 -0
  59. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facethofe.hpp +111 -0
  60. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetsurffespace.hpp +112 -0
  61. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fe_interfaces.hpp +32 -0
  62. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fem.hpp +87 -0
  63. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fesconvert.hpp +14 -0
  64. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fespace.hpp +1454 -0
  65. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/finiteelement.hpp +286 -0
  66. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/globalinterfacespace.hpp +77 -0
  67. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/globalspace.hpp +115 -0
  68. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/gridfunction.hpp +525 -0
  69. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1amg.hpp +124 -0
  70. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofe.hpp +188 -0
  71. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofe_impl.hpp +1262 -0
  72. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofefo.hpp +148 -0
  73. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofefo_impl.hpp +185 -0
  74. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofespace.hpp +167 -0
  75. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1lofe.hpp +1240 -0
  76. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1lumping.hpp +41 -0
  77. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurl_equations.hpp +1381 -0
  78. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlcurlfe.hpp +2241 -0
  79. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlcurlfespace.hpp +78 -0
  80. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlfe.hpp +259 -0
  81. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlfe_utils.hpp +107 -0
  82. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhdiv_dshape.hpp +857 -0
  83. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhdivfes.hpp +308 -0
  84. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofe.hpp +175 -0
  85. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofe_impl.hpp +1871 -0
  86. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofespace.hpp +193 -0
  87. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurllofe.hpp +1146 -0
  88. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdiv_equations.hpp +880 -0
  89. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivdivfe.hpp +2923 -0
  90. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivdivsurfacespace.hpp +76 -0
  91. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfe.hpp +206 -0
  92. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfe_utils.hpp +717 -0
  93. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfes.hpp +75 -0
  94. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofe.hpp +447 -0
  95. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofe_impl.hpp +1107 -0
  96. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofefo.hpp +229 -0
  97. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofespace.hpp +177 -0
  98. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhosurfacefespace.hpp +106 -0
  99. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivlofe.hpp +773 -0
  100. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hidden.hpp +74 -0
  101. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/householder.hpp +181 -0
  102. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hypre_ams_precond.hpp +123 -0
  103. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hypre_precond.hpp +73 -0
  104. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/integrator.hpp +2012 -0
  105. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/integratorcf.hpp +253 -0
  106. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/interpolate.hpp +49 -0
  107. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/intrule.hpp +2542 -0
  108. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/intrules_SauterSchwab.hpp +25 -0
  109. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/irspace.hpp +49 -0
  110. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/jacobi.hpp +153 -0
  111. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/kernels.hpp +724 -0
  112. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofe.hpp +194 -0
  113. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofe_impl.hpp +564 -0
  114. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofefo.hpp +542 -0
  115. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofespace.hpp +344 -0
  116. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/la.hpp +38 -0
  117. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/linalg_kernels.hpp +70 -0
  118. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/linearform.hpp +266 -0
  119. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/matrix.hpp +2145 -0
  120. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/memusage.hpp +41 -0
  121. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/meshaccess.hpp +1359 -0
  122. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mgpre.hpp +204 -0
  123. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mp_coefficient.hpp +145 -0
  124. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mptools.hpp +2281 -0
  125. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/multigrid.hpp +42 -0
  126. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/multivector.hpp +447 -0
  127. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mumpsinverse.hpp +187 -0
  128. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mycomplex.hpp +361 -0
  129. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ng_lapack.hpp +1661 -0
  130. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngblas.hpp +1232 -0
  131. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_defines.hpp +30 -0
  132. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_stdcpp_include.hpp +106 -0
  133. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_utils.hpp +121 -0
  134. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngsobject.hpp +1019 -0
  135. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngsstream.hpp +113 -0
  136. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngstd.hpp +72 -0
  137. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/nodalhofe.hpp +96 -0
  138. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/nodalhofe_impl.hpp +141 -0
  139. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetfe.hpp +223 -0
  140. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetfespace.hpp +98 -0
  141. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetsurfacefespace.hpp +84 -0
  142. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/order.hpp +251 -0
  143. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallel_matrices.hpp +222 -0
  144. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/paralleldofs.hpp +340 -0
  145. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallelngs.hpp +23 -0
  146. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallelvector.hpp +269 -0
  147. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pardisoinverse.hpp +200 -0
  148. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/periodic.hpp +129 -0
  149. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/plateaufespace.hpp +25 -0
  150. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pml.hpp +275 -0
  151. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pmltrafo.hpp +631 -0
  152. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/postproc.hpp +142 -0
  153. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/potentialtools.hpp +22 -0
  154. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/precomp.hpp +60 -0
  155. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/preconditioner.hpp +602 -0
  156. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/prolongation.hpp +380 -0
  157. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_comp.hpp +107 -0
  158. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_fem.hpp +89 -0
  159. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_linalg.hpp +58 -0
  160. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_ngstd.hpp +386 -0
  161. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol.hpp +4896 -0
  162. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol_tet.hpp +395 -0
  163. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol_trig.hpp +492 -0
  164. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/reorderedfespace.hpp +81 -0
  165. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sample_sort.hpp +105 -0
  166. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/scalarfe.hpp +335 -0
  167. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/shapefunction_utils.hpp +113 -0
  168. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/simd_complex.hpp +329 -0
  169. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/smoother.hpp +253 -0
  170. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/solve.hpp +89 -0
  171. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsecholesky.hpp +317 -0
  172. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsefactorization_interface.hpp +159 -0
  173. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix.hpp +1052 -0
  174. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix_dyn.hpp +90 -0
  175. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix_impl.hpp +1055 -0
  176. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/special_matrix.hpp +463 -0
  177. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/specialelement.hpp +125 -0
  178. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/statushandler.hpp +33 -0
  179. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/stringops.hpp +12 -0
  180. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/superluinverse.hpp +136 -0
  181. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/symbolicintegrator.hpp +850 -0
  182. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/symmetricmatrix.hpp +144 -0
  183. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tangentialfacetfe.hpp +224 -0
  184. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tangentialfacetfespace.hpp +91 -0
  185. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensor.hpp +522 -0
  186. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensorcoefficient.hpp +446 -0
  187. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensorproductintegrator.hpp +113 -0
  188. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thcurlfe.hpp +128 -0
  189. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thcurlfe_impl.hpp +380 -0
  190. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thdivfe.hpp +80 -0
  191. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thdivfe_impl.hpp +492 -0
  192. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpdiffop.hpp +461 -0
  193. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpfes.hpp +133 -0
  194. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpintrule.hpp +224 -0
  195. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/triangular.hpp +465 -0
  196. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tscalarfe.hpp +245 -0
  197. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tscalarfe_impl.hpp +1029 -0
  198. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/umfpackinverse.hpp +148 -0
  199. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/unifiedvector.hpp +103 -0
  200. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vector.hpp +1452 -0
  201. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/voxelcoefficientfunction.hpp +41 -0
  202. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vtkoutput.hpp +198 -0
  203. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vvector.hpp +208 -0
  204. ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/webgui.hpp +92 -0
  205. ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/NGSolveConfig.cmake +102 -0
  206. ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets-release.cmake +89 -0
  207. ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets.cmake +180 -0
  208. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngbla.so +0 -0
  209. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngcomp.so +0 -0
  210. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngfem.so +0 -0
  211. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngla.so +0 -0
  212. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsbem.so +0 -0
  213. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngscudalib.so +0 -0
  214. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsolve.so +0 -0
  215. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngstd.so +0 -0
  216. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/TensorProductTools.py +210 -0
  217. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__console.py +94 -0
  218. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__expr.py +181 -0
  219. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__init__.py +148 -0
  220. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/_scikit_build_core_dependencies.py +30 -0
  221. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/bvp.py +78 -0
  222. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__init__.py +1 -0
  223. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__main__.py +4 -0
  224. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/config.py +60 -0
  225. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/__init__.py +0 -0
  226. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
  227. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
  228. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
  229. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
  230. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/__init__.py +0 -0
  231. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/__init__.py +0 -0
  232. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hhj.py +44 -0
  233. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hybrid_dg.py +53 -0
  234. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/mixed.py +30 -0
  235. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/nonlin.py +29 -0
  236. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pickling.py +26 -0
  237. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pml.py +31 -0
  238. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/taskmanager.py +20 -0
  239. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/tdnns.py +47 -0
  240. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG-skeleton.py +45 -0
  241. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG.py +38 -0
  242. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGlap.py +42 -0
  243. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGwave.py +61 -0
  244. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/__init__.py +0 -0
  245. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/adaptive.py +123 -0
  246. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/cmagnet.py +59 -0
  247. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/elasticity.py +76 -0
  248. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/navierstokes.py +74 -0
  249. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.ipynb +170 -0
  250. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.py +41 -0
  251. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/__init__.py +0 -0
  252. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
  253. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
  254. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_poisson.py +89 -0
  255. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_timeDG.py +82 -0
  256. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/directsolvers.py +14 -0
  257. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/eigenvalues.py +364 -0
  258. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/internal.py +89 -0
  259. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/krylovspace.py +1182 -0
  260. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/meshes.py +748 -0
  261. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngs2petsc.py +310 -0
  262. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscuda.so +0 -0
  263. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscxx.py +42 -0
  264. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngslib.so +0 -0
  265. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/nonlinearsolvers.py +203 -0
  266. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/preconditioners.py +11 -0
  267. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solve_implementation.py +168 -0
  268. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solvers/__init__.py +7 -0
  269. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solvers/cudss.py +112 -0
  270. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/timestepping.py +185 -0
  271. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/timing.py +108 -0
  272. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/utils.py +167 -0
  273. ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/webgui.py +671 -0
  274. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/beam.geo +17 -0
  275. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/beam.vol +240 -0
  276. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/chip.in2d +41 -0
  277. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/chip.vol +614 -0
  278. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coil.geo +12 -0
  279. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coil.vol +2560 -0
  280. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
  281. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
  282. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/cube.geo +19 -0
  283. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/cube.vol +1832 -0
  284. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
  285. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
  286. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
  287. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
  288. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
  289. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
  290. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
  291. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
  292. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
  293. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
  294. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
  295. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
  296. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
  297. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  298. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/shaft.geo +73 -0
  299. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
  300. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/square.in2d +17 -0
  301. ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/square.vol +149 -0
  302. ngsolve-6.2.2506.post216.dev0.dist-info/METADATA +14 -0
  303. ngsolve-6.2.2506.post216.dev0.dist-info/RECORD +306 -0
  304. ngsolve-6.2.2506.post216.dev0.dist-info/WHEEL +5 -0
  305. ngsolve-6.2.2506.post216.dev0.dist-info/licenses/LICENSE +504 -0
  306. ngsolve-6.2.2506.post216.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1452 @@
1
+ #ifndef FILE_VECTOR_EXPR
2
+ #define FILE_VECTOR_EXPR
3
+
4
+ /**************************************************************************/
5
+ /* File: vector.hpp */
6
+ /* Author: Joachim Schoeberl */
7
+ /* Date: 01. Jan. 02 */
8
+ /**************************************************************************/
9
+
10
+ #include "expr.hpp"
11
+ #include "core/archive.hpp"
12
+ #include <core/hashtable.hpp> // for SparseVector
13
+
14
+ namespace ngbla
15
+ {
16
+
17
+ template <typename T=double, typename TS=size_t, typename TDIST=IC<1>> class VectorView;
18
+
19
+
20
+ template <typename T, typename ...Args>
21
+ INLINE void SetVector (typename mat_traits<T>::TSCAL val, VectorView<T,Args...> vec) NETGEN_NOEXCEPT
22
+ {
23
+ for (size_t i : Range(vec))
24
+ vec[i] = val;
25
+ }
26
+
27
+
28
+
29
+ template <typename T = double>
30
+ using FlatVector = VectorView<T,size_t,IC<1>>;
31
+
32
+ template <typename T, typename TELEM=typename T::TELEM>
33
+ constexpr bool IsConvertibleToFlatVector () {
34
+ return is_constructible_v<FlatVector<TELEM>,T>;
35
+ }
36
+
37
+ template <typename T, typename TELEM=typename T::TELEM>
38
+ auto make_FlatVector (const T & v) {
39
+ return FlatVector<TELEM> (v);
40
+ }
41
+
42
+
43
+
44
+ template <typename T = double>
45
+ using SliceVector = VectorView<T,size_t,size_t>;
46
+
47
+ template <typename T, typename TELEM=typename T::TELEM>
48
+ constexpr bool IsConvertibleToSliceVector () {
49
+ return is_constructible_v<SliceVector<TELEM>,T>;
50
+ }
51
+
52
+ template <typename T, typename TELEM=typename T::TELEM>
53
+ auto make_SliceVector (const T & v) {
54
+ return SliceVector<TELEM> (v);
55
+ }
56
+
57
+
58
+
59
+
60
+ template <typename T = double>
61
+ using BareSliceVector = VectorView<T,undefined_size,size_t>;
62
+
63
+ template <typename T, typename TELEM=typename T::TELEM>
64
+ constexpr bool IsConvertibleToBareSliceVector () {
65
+ return is_constructible_v<BareSliceVector<TELEM>,T>;
66
+ }
67
+
68
+ template <typename T, typename TELEM=typename T::TELEM>
69
+ auto make_BareSliceVector (const T & v) {
70
+ return BareSliceVector<TELEM> (v);
71
+ }
72
+
73
+
74
+
75
+ template <typename T = double>
76
+ using BareVector = VectorView<T,undefined_size,IC<1>>;
77
+
78
+ template <typename T, typename TELEM=typename T::TELEM>
79
+ constexpr bool IsConvertibleToBareVector () {
80
+ return is_constructible_v<BareVector<TELEM>,T>;
81
+ }
82
+
83
+ template <typename T, typename TELEM=typename T::TELEM>
84
+ auto make_BareVector (const T & v) {
85
+ return BareVector<TELEM> (v);
86
+ }
87
+
88
+
89
+ template <typename T, typename TS>
90
+ using LinearVector = VectorView<T,TS,IC<1>>;
91
+
92
+
93
+
94
+
95
+
96
+
97
+ template <int S, class T> class Vec;
98
+
99
+ template <int S, typename T = double>
100
+ using FlatVec = VectorView<T,IC<S>,IC<1>>;
101
+
102
+ template <int S, int D, typename T = double>
103
+ using FlatSliceVec = VectorView<T,IC<S>,IC<D>>;
104
+
105
+ template <int D, typename T = double>
106
+ using FixSliceVec = VectorView<T,size_t,IC<D>>;
107
+
108
+
109
+
110
+ template <class T> class SysVector;
111
+ template <class T = double> class Vector;
112
+ template <int DIST, typename T> class FixSliceVector;
113
+
114
+ #ifdef WIN32
115
+ // #pragma warning( disable : 4848) // support for standard attribute 'no_unique_address' in C++17 and earlier is a vendor extension
116
+ // #define NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
117
+
118
+ // Disable this optimization with MSVC because it creates inconsistent results with different versions.
119
+ // Following code returns 8 for compilers up to MSVC version 19.31, and returns 16 from version 19.32, see https://godbolt.org/z/v6P5vsq1M
120
+ #define NO_UNIQUE_ADDRESS
121
+ /*
122
+ struct Base{};
123
+ struct Empty {};
124
+
125
+ template <typename T, typename TS>
126
+ class Class : public Base{
127
+ T* data;
128
+ [[msvc::no_unique_address]] TS size;
129
+ };
130
+
131
+ int f() {
132
+ return sizeof(Class<void, Empty>);
133
+ }
134
+ */
135
+
136
+ #else
137
+ #define NO_UNIQUE_ADDRESS [[no_unique_address]]
138
+ #endif
139
+
140
+ template <typename T, typename TS, typename TDIST>
141
+ class VectorView : public MatExpr<VectorView<T,TS,TDIST>>
142
+ {
143
+ protected:
144
+ typedef MatExpr<VectorView> BASE;
145
+
146
+ /*
147
+ T * __restrict data;
148
+ NO_UNIQUE_ADDRESS TS size;
149
+ NO_UNIQUE_ADDRESS TDIST dist;
150
+ */
151
+
152
+
153
+ // the data ...
154
+
155
+ template <typename LT>
156
+ class Layout1
157
+ {
158
+ LT * data;
159
+ public:
160
+ Layout1() = default;
161
+ Layout1(const Layout1&) = default;
162
+ Layout1(Layout1&&) = default;
163
+
164
+ Layout1& operator= (const Layout1&) = default;
165
+ Layout1& operator= (Layout1&&) = default;
166
+
167
+ ~Layout1() = default;
168
+
169
+ INLINE Layout1 (LT * adata) : data(adata) { }
170
+ INLINE auto Data() const { return data; }
171
+ };
172
+
173
+
174
+
175
+ // add the size: variable, constant, undefined_size
176
+
177
+ template <typename LT, typename LTS>
178
+ class Layout2 : public Layout1<LT>
179
+ {
180
+ typedef Layout1<LT> BASE;
181
+ LTS size;
182
+ public:
183
+ Layout2() = default;
184
+ Layout2(const Layout2&) = default;
185
+ Layout2(Layout2&&) = default;
186
+
187
+ Layout2& operator= (const Layout2&) = default;
188
+ Layout2& operator= (Layout2&&) = default;
189
+ ~Layout2() = default;
190
+
191
+ INLINE Layout2 (LT * adata, LTS asize)
192
+ : BASE(adata), size(asize) { }
193
+ INLINE Layout2 (LT * adata)
194
+ : BASE(adata) { }
195
+
196
+
197
+ INLINE auto Size() const { return size; }
198
+ using BASE::Data;
199
+ };
200
+
201
+
202
+ template <typename LT, int IDIST>
203
+ class Layout2<LT,IC<IDIST>> : public Layout1<LT>
204
+ {
205
+ typedef Layout1<LT> BASE;
206
+ public:
207
+ Layout2() = default;
208
+ Layout2(const Layout2&) = default;
209
+ Layout2(Layout2&&) = default;
210
+
211
+ Layout2& operator= (const Layout2&) = default;
212
+ Layout2& operator= (Layout2&&) = default;
213
+ ~Layout2() = default;
214
+
215
+ INLINE Layout2 (LT * adata, IC<IDIST> asize)
216
+ : BASE(adata) { }
217
+ INLINE Layout2 (LT * adata)
218
+ : BASE(adata) { }
219
+
220
+ INLINE auto Size() const { return IC<IDIST>(); }
221
+ using BASE::Data;
222
+ };
223
+
224
+
225
+ #if !defined(NETGEN_ENABLE_CHECK_RANGE)
226
+
227
+ template <typename LT>
228
+ class Layout2<LT,undefined_size> : public Layout1<LT>
229
+ {
230
+ typedef Layout1<LT> BASE;
231
+ public:
232
+ Layout2() = default;
233
+ Layout2(const Layout2&) = default;
234
+ Layout2(Layout2&&) = default;
235
+
236
+ Layout2& operator= (const Layout2&) = default;
237
+ Layout2& operator= (Layout2&&) = default;
238
+ ~Layout2() = default;
239
+
240
+ INLINE Layout2 (LT * adata, undefined_size asize)
241
+ : BASE(adata) { }
242
+ INLINE Layout2 (LT * adata)
243
+ : BASE(adata) { }
244
+
245
+ INLINE auto Size() const { return undefined_size(); }
246
+ using BASE::Data;
247
+ };
248
+
249
+ #endif
250
+
251
+
252
+ // add the distance: variable, constant
253
+
254
+ template <typename LT, typename LTS, typename LTDIST>
255
+ class Layout : public Layout2<LT,LTS>
256
+ {
257
+ typedef Layout2<LT,LTS> BASE;
258
+ LTDIST dist;
259
+ public:
260
+ Layout() = default;
261
+ Layout(const Layout&) = default;
262
+ Layout(Layout&&) = default;
263
+
264
+ Layout& operator= (const Layout&) = default;
265
+ Layout& operator= (Layout&&) = default;
266
+ ~Layout() = default;
267
+
268
+ INLINE Layout (LT * adata, LTS asize, LTDIST adist)
269
+ : BASE(adata,asize), dist{adist} { }
270
+ INLINE Layout (LT * adata, LTS asize)
271
+ : BASE(adata,asize) { }
272
+ INLINE Layout (LT * adata)
273
+ : BASE(adata) { }
274
+
275
+ INLINE auto Dist() const { return dist; }
276
+ using BASE::Data;
277
+ using BASE::Size;
278
+ };
279
+
280
+
281
+ template <typename LT, typename LTS, int IDIST>
282
+ class Layout<LT, LTS, IC<IDIST>> : public Layout2<LT,LTS>
283
+ {
284
+ typedef Layout2<LT,LTS> BASE;
285
+ public:
286
+ Layout() = default;
287
+ Layout(const Layout&) = default;
288
+ Layout(Layout&&) = default;
289
+
290
+ Layout& operator= (const Layout&) = default;
291
+ Layout& operator= (Layout&&) = default;
292
+ ~Layout() = default;
293
+
294
+ INLINE Layout (LT * adata, LTS asize, IC<IDIST> adist)
295
+ : BASE(adata,asize) { }
296
+ INLINE Layout (LT * adata, LTS asize)
297
+ : BASE(adata,asize) { }
298
+ INLINE Layout (LT * adata)
299
+ : BASE(adata) { }
300
+
301
+ INLINE auto Dist() const { return IC<IDIST>(); }
302
+ using BASE::Data;
303
+ using BASE::Size;
304
+ };
305
+
306
+ Layout<T,TS,TDIST> layout;
307
+
308
+
309
+ public:
310
+ typedef T TELEM;
311
+ typedef typename mat_traits<T>::TSCAL TSCAL;
312
+ typedef TDIST type_dist;
313
+
314
+ /// linear element access ?
315
+ static constexpr bool IsLinear() { return std::is_same<type_dist,IC<1>>(); }
316
+
317
+ VectorView () = default;
318
+ VectorView (const VectorView&) = default;
319
+ VectorView (VectorView&&) = default;
320
+
321
+ template <typename T2, typename TS2, typename TDIST2,
322
+ enable_if_t<is_convertible<T2*,T*>::value, int> =0,
323
+ enable_if_t<is_constructible<TS,TS2>::value, int> =0,
324
+ enable_if_t<is_constructible<TDIST,TDIST2>::value, int> =0>
325
+ INLINE VectorView (const VectorView<T2,TS2,TDIST2> & v2)
326
+ : layout(v2.Data(), TS(v2.Size()), TDIST(v2.Dist())) { }
327
+ // : data{v2.Data()}, size{TS(v2.Size())}, dist{TDIST(v2.Dist())} { }
328
+
329
+ INLINE explicit VectorView (T * adata)
330
+ // : data(adata)
331
+ : layout(adata)
332
+ {
333
+ ; // static_assert(std::is_same<type_dist,IC<1>>());
334
+ }
335
+ INLINE VectorView (TS asize, T * adata)
336
+ // : data(adata), size(asize)
337
+ : layout(adata, asize)
338
+ {
339
+ static_assert(std::is_same<type_dist,IC<1>>());
340
+ }
341
+ INLINE VectorView (TS asize, TDIST adist, T * adata)
342
+ // : data(adata), size(asize), dist(adist) { }
343
+ : layout(adata, asize, adist) { }
344
+
345
+ /// allocate FlatVector on local heap
346
+ INLINE VectorView (size_t as, LocalHeap & lh)
347
+ // : data(lh.Alloc<T> (as)), size(as), dist(IC<1>()) { }
348
+ : layout(lh.Alloc<T> (as), as, IC<1>()) { }
349
+
350
+ template <typename EXPR>
351
+ INLINE VectorView(LocalHeapExpr<EXPR>&& lhe)
352
+ : VectorView(lhe.Height(), lhe.GetLocalHeap())
353
+ {
354
+ *this = lhe.A();
355
+ }
356
+
357
+ /// put FlatVector over fixed size vector
358
+
359
+ template <int S>
360
+ INLINE VectorView (Vec<S,T> & v)
361
+ // : data(v.Data()), size(v.Size()), dist(IC<1>()) { }
362
+ : layout{v.Data(), TS(v.Size()), (TDIST)IC<1>()} {}
363
+
364
+
365
+ /*
366
+ template <int S>
367
+ INLINE VectorView (Vec<S,T> & v)
368
+ : data(const_cast<T*>(v.Data())), size(v.Size()), dist(IC<1>()) { }
369
+ */
370
+ template <int S>
371
+ INLINE VectorView (const Vec<S,T> & v)
372
+ // : data(const_cast<T*>(v.Data())), size(v.Size()), dist(IC<1>()) { }
373
+ : layout(const_cast<T*>(v.Data()), v.Size(), IC<1>()) { }
374
+ /*
375
+ template <int S>
376
+ INLINE VectorView (Vec<S,const T> & v)
377
+ : data(const_cast<T*>(v.Data())), size(v.Size()), dist(IC<1>()) { }
378
+ template <int S>
379
+ INLINE VectorView (const Vec<S,const T> & v)
380
+ : data(const_cast<T*>(v.Data())), size(v.Size()), dist(IC<1>()) { }
381
+ */
382
+
383
+ INLINE auto Size() const { return layout.Size(); }
384
+ INLINE auto Dist() const { return layout.Dist(); }
385
+ INLINE auto Shape() const { return tuple(layout.Size()); }
386
+
387
+
388
+ INLINE auto Height () const { return layout.Size(); }
389
+ INLINE auto Width () const { return IC<1>(); }
390
+
391
+ INLINE auto Range () const { return IntRange (0, layout.Size()); }
392
+
393
+ INLINE T * Addr(size_t i) const { return layout.Data()+i*layout.Dist(); }
394
+ INLINE T * Data() const { return layout.Data(); }
395
+
396
+ INLINE auto View() const { return VectorView(*this); }
397
+ INLINE auto ViewRW() { return this->View(); }
398
+
399
+ void Dump (ostream & ost) const
400
+ { ost << "VectorView (size=" << Size() << ", dist=" << Dist() << ")"; }
401
+
402
+
403
+ /// assign memory for vector on local heap
404
+ INLINE void AssignMemory (size_t as, LocalHeap & lh)
405
+ {
406
+ /*
407
+ size = as;
408
+ dist = IC<1>();
409
+ data = lh.Alloc<T>(size);
410
+ */
411
+ layout = { lh.Alloc<T>(as), as, IC<1>() };
412
+ }
413
+
414
+ /// assign memory for vector
415
+ void AssignMemory (size_t as, T * mem)
416
+ {
417
+ /*
418
+ size = as;
419
+ dist = IC<1>();
420
+ data = mem;
421
+ */
422
+ layout = { mem, as, IC<1>() };
423
+ }
424
+
425
+ INLINE auto & operator= (const VectorView & v)
426
+ {
427
+ /*
428
+ auto cs = CombinedSize(this->Size(), v.Size());
429
+ for (size_t i = 0; i < cs; i++)
430
+ data[i*dist] = v(i);
431
+ */
432
+ this->template Assign<typename BASE::As> (v);
433
+ return *this;
434
+ }
435
+ INLINE auto & operator= (VectorView && v)
436
+ {
437
+ /*
438
+ auto cs = CombinedSize(this->Size(), v.Size());
439
+ for (size_t i = 0; i < cs; i++)
440
+ data[i*dist] = v(i);
441
+ */
442
+ this->template Assign<typename BASE::As> (v);
443
+ return *this;
444
+ }
445
+
446
+ /// copy vector. sizes must match
447
+ template <typename ...Args>
448
+ INLINE auto & operator= (const VectorView<Args...> & v)
449
+ {
450
+ // BASE::operator= (v);
451
+ this->template Assign<typename BASE::As> (v);
452
+ return *this;
453
+ }
454
+
455
+ template<typename TB>
456
+ INLINE auto & operator= (const Expr<TB> & v)
457
+ {
458
+ // BASE::operator= (v);
459
+ this->template Assign<typename BASE::As> (v);
460
+ return *this;
461
+ }
462
+
463
+ /// assign constant value
464
+ INLINE auto & operator= (TSCAL scal) const
465
+ {
466
+ SetVector (scal, *this);
467
+ return *this;
468
+ }
469
+
470
+ template <int D, typename TSCAL2>
471
+ INLINE auto & operator= (const Vec<D,TSCAL2> & v)
472
+ {
473
+ NETGEN_CHECK_RANGE(D,0,Size()+1);
474
+ for (int i = 0; i < D; i++)
475
+ Data()[i*Dist()] = v(i);
476
+ return *this;
477
+ }
478
+
479
+ /// access element
480
+ INLINE TELEM & operator[] (size_t i)
481
+ {
482
+ NETGEN_CHECK_RANGE(i,0,Size());
483
+ return Data()[i*Dist()];
484
+ }
485
+
486
+ INLINE const TELEM & operator[] (size_t i) const
487
+ {
488
+ NETGEN_CHECK_RANGE(i,0,Size());
489
+ return Data()[i*Dist()];
490
+ }
491
+
492
+
493
+ /// constant element access
494
+ // template<typename I, typename std::enable_if<std::is_integral<I>::value, int>::type = 0>
495
+ template<typename I, typename std::enable_if<std::is_convertible<I,size_t>::value, int>::type = 0>
496
+ INLINE TELEM & operator() (I i) const
497
+ {
498
+ NETGEN_CHECK_RANGE(i,0,Size());
499
+ return Data()[i*Dist()];
500
+ }
501
+
502
+ /// element access. index j is ignored
503
+ INLINE TELEM & operator() (size_t i, size_t j) const
504
+ {
505
+ NETGEN_CHECK_RANGE(i,0,Size());
506
+ return Data()[i*Dist()];
507
+ }
508
+
509
+ RowsArrayExpr<VectorView> operator() (FlatArray<int> rows) const
510
+ {
511
+ return RowsArrayExpr<VectorView> (*this, rows);
512
+ }
513
+
514
+ INLINE auto Range (size_t first, size_t next) const
515
+ {
516
+ NETGEN_CHECK_RANGE(next,first,Size()+1);
517
+ return VectorView<T,size_t,TDIST> (next-first, Dist(), Data()+first*Dist());
518
+ }
519
+
520
+ INLINE auto Range (size_t next) const
521
+ {
522
+ return Range(0, next);
523
+ }
524
+
525
+ INLINE auto Range (IntRange range) const
526
+ {
527
+ return Range (range.First(), range.Next());
528
+ }
529
+
530
+ INLINE auto RangeN (size_t first, size_t n) const
531
+ {
532
+ NETGEN_CHECK_RANGE(first+n,first,Size()+1);
533
+ return VectorView<T,size_t,TDIST> (n, Dist(), Data()+first*Dist());
534
+ }
535
+
536
+
537
+
538
+ /*
539
+ template <int S>
540
+ INLINE auto Range (IC<S> r) const
541
+ {
542
+ return VectorView<T,IC<S>,TDIST> (r, Dist(), Data());
543
+ }
544
+ */
545
+
546
+ INLINE auto Slice(size_t first, size_t dist2) const
547
+ {
548
+ // return VectorView<T,decltype(declval<TS>()/size_t()), decltype(declval<TDIST>()*size_t())> (size/dist2, dist2*dist, Addr(first));
549
+ return VectorView<T,decltype(declval<TS>()/size_t()), decltype(declval<TDIST>()*size_t())> ( (Size()-first+dist2-1)/dist2, dist2*Dist(), Addr(first));
550
+ }
551
+
552
+ INLINE auto Reversed() const
553
+ {
554
+ // return VectorView { Size(), -Dist(), Addr(Size()-1) };
555
+ return VectorView<T,TS,decltype(-declval<TDIST>())> { Size(), -Dist(), Addr(Size()-1) };
556
+ }
557
+
558
+ INLINE auto operator+(int i) const { return VectorView(Size()-i, Dist(), Data()+i*Dist()); }
559
+
560
+ INLINE auto RemoveConst() const { return VectorView<typename remove_const<T>::type,TS,TDIST>(Size(), Dist(), const_cast<typename remove_const<T>::type*> (Data())); }
561
+
562
+ INLINE auto AsMatrix (size_t h, size_t w) const
563
+ {
564
+ // todo: checking
565
+ static_assert(std::is_same<TDIST,IC<1>>());
566
+ return FlatMatrix<T> (h,w, Data());
567
+ }
568
+
569
+ class Iterator
570
+ {
571
+ VectorView vec;
572
+ size_t ind;
573
+ public:
574
+ INLINE Iterator (VectorView avec, size_t ai) : vec(avec), ind(ai) { ; }
575
+ INLINE Iterator operator++ (int) { return Iterator(vec, ind++); }
576
+ INLINE Iterator operator++ () { return Iterator(vec, ++ind); }
577
+ INLINE TELEM operator*() const { return vec[ind]; }
578
+ INLINE TELEM & operator*() { return vec[ind]; }
579
+ INLINE bool operator != (Iterator d2) { return ind != d2.ind; }
580
+ INLINE bool operator == (Iterator d2) { return ind == d2.ind; }
581
+ };
582
+
583
+ INLINE Iterator begin() const { return Iterator (*this, 0); }
584
+ INLINE Iterator end() const { return Iterator (*this, Size()); }
585
+
586
+ };
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+ /**
600
+ A Vector class with memory allocation/deallocation
601
+ */
602
+ template <typename T>
603
+ class Vector : public FlatVector<T>
604
+ {
605
+ // using FlatVector<T>::data;
606
+ // using FlatVector<T>::size;
607
+ public:
608
+ typedef typename mat_traits<T>::TSCAL TSCAL;
609
+
610
+ /// default constructor
611
+ Vector () : FlatVector<T> (0, (T*)nullptr) { ; }
612
+
613
+ /// allocate vector
614
+ explicit Vector (size_t as) : FlatVector<T> (as, new T[as]) { ; }
615
+
616
+
617
+ /// allocate and copy vector
618
+ Vector (const Vector & v2)
619
+ : FlatVector<T> (v2.Size(), new T[v2.Size()])
620
+ {
621
+ FlatVector<T>::operator= (v2);
622
+ }
623
+
624
+ Vector (Vector && v2)
625
+ : FlatVector<T> (v2.Size(), v2.Data())
626
+ {
627
+ v2.layout = { nullptr, 0 };
628
+ // v2.data = nullptr; v2.size = 0;
629
+ }
630
+
631
+ /// allocate and compute
632
+ template<typename TB>
633
+ Vector (const Expr<TB> & v2)
634
+ : FlatVector<T> (v2.Height(), new T[v2.Height()])
635
+ {
636
+ FlatVector<T>::operator= (v2);
637
+ }
638
+
639
+
640
+ Vector (initializer_list<T> list)
641
+ : FlatVector<T> (list.size(), new T[list.size()])
642
+ {
643
+ size_t cnt = 0;
644
+ for (auto val : list)
645
+ (*this)[cnt++] = val;
646
+ }
647
+
648
+
649
+ /// deallocate vector
650
+ ~Vector() { delete [] this->Data(); }
651
+
652
+ /// set vector to constant values
653
+ Vector & operator= (TSCAL scal)
654
+ {
655
+ FlatVector<T>::operator= (scal);
656
+ return *this;
657
+ }
658
+
659
+ /// set vector size
660
+ void SetSize(size_t as)
661
+ {
662
+ /*
663
+ if (this->size == as) return;
664
+ delete [] this->data;
665
+ this->size = as;
666
+ if (as != 0)
667
+ this->data = new T[this->size];
668
+ else
669
+ this->data = nullptr;
670
+ */
671
+ if (this->Size() == as) return;
672
+ delete [] this->Data();
673
+ this->layout = { (as != 0) ? new T[as] : nullptr , as, IC<1>() };
674
+ }
675
+
676
+ /// evaluate matrix expression
677
+ template<typename TB>
678
+ Vector & operator= (const Expr<TB> & v)
679
+ {
680
+ MatExpr<FlatVector<T> >::operator= (v);
681
+ return *this;
682
+ }
683
+
684
+ Vector & operator= (const Vector & v2)
685
+ {
686
+ FlatVector<T>::operator= (static_cast<FlatVector<T> >(v2));
687
+ // MatExpr<FlatVector<T> >::operator= (v2); // does not work, we don't know why
688
+ return *this;
689
+ }
690
+
691
+ Vector & operator= (Vector && v2)
692
+ {
693
+ // this->size = v2.size;
694
+ // Swap (this->data, v2.data);
695
+ Swap (this->layout, v2.layout);
696
+ return *this;
697
+ }
698
+
699
+ Vector & operator= (initializer_list<T> list)
700
+ {
701
+ SetSize (list.size());
702
+ size_t cnt = 0;
703
+ for (auto val : list)
704
+ (*this)[cnt++] = val;
705
+ return *this;
706
+ }
707
+
708
+ };
709
+
710
+
711
+
712
+
713
+ /**
714
+ A Vector class with memory allocation/deallocation. At
715
+ compile-time, a certain amount of vector entries is defined. If the
716
+ dynamic size fits into this memory, the vector is allocated in this memory.
717
+ Otherwise, dynamic memory is allocated.
718
+ */
719
+ template <int S, typename T = double>
720
+ class VectorMem : public FlatVector<T>
721
+ {
722
+ T mem[S];
723
+ public:
724
+ /// the scalar type
725
+ typedef typename mat_traits<T>::TSCAL TSCAL;
726
+
727
+ /** allocate vector.
728
+ If the dynamic size fits into the static size, use static memory. Otherwise use dynamic alloation
729
+ */
730
+ explicit INLINE VectorMem (size_t as) : FlatVector<T> (as, (as <= S) ?
731
+ &mem[0] : new T[as]) { ; }
732
+
733
+ /// deallocates dynamic memory
734
+ INLINE ~VectorMem() { if (this->Size() > S) delete [] this->Data(); }
735
+
736
+ /// assigns constant value
737
+ INLINE VectorMem & operator= (TSCAL scal)
738
+ {
739
+ FlatVector<T>::operator= (scal);
740
+ return *this;
741
+ }
742
+
743
+ /// evaluates matrix expression
744
+ template<typename TB>
745
+ INLINE VectorMem & operator= (const Expr<TB> & v)
746
+ {
747
+ MatExpr<FlatVector<T> >::operator= (v);
748
+ return *this;
749
+ }
750
+ };
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+ // A system vector (not completely functional)
767
+ template <typename T = double>
768
+ class FlatSysVector : public MatExpr<FlatSysVector<T> >
769
+ {
770
+ protected:
771
+ size_t s;
772
+ size_t blocksize;
773
+ T * __restrict data;
774
+ public:
775
+ typedef FlatVector<T> TELEM;
776
+ typedef typename mat_traits<T>::TSCAL TSCAL;
777
+
778
+ INLINE FlatSysVector (size_t as, size_t bs, T * adata)
779
+ : s(as), blocksize(bs), data(adata) { ; }
780
+
781
+ INLINE FlatSysVector (size_t as, size_t bs, LocalHeap & lh)
782
+ : s(as), blocksize(bs), data (new (lh) T[as*bs])
783
+ { ; }
784
+
785
+ /*
786
+ FlatSysVector (const FlatSysVector<TSCAL> & sv)
787
+ : s(sv.Size()),
788
+ blocksize(sv.BlockSize()),
789
+ data (sv(0))
790
+ {
791
+ ;
792
+ }
793
+ */
794
+
795
+ INLINE FlatSysVector & operator= (const FlatSysVector & v)
796
+ {
797
+ for (size_t i = 0; i < this->s * this->blocksize; i++)
798
+ data[i] = v.data[i];
799
+ return *this;
800
+ }
801
+
802
+ template<typename TB>
803
+ INLINE FlatSysVector & operator= (const Expr<TB> & v)
804
+ {
805
+ return MatExpr<FlatSysVector>::operator= (v);
806
+ }
807
+
808
+ INLINE FlatSysVector & operator= (TSCAL s)
809
+ {
810
+ for (size_t i = 0; i < this->s*this->blocksize; i++)
811
+ data[i] = s;
812
+ return *this;
813
+ }
814
+
815
+
816
+
817
+ INLINE auto operator() (size_t i)
818
+ {
819
+ return FlatVector<T> (blocksize, &data[i*blocksize]);
820
+ }
821
+
822
+ INLINE auto operator() (size_t i) const
823
+ {
824
+ return FlatVector<T> (blocksize, &data[i*blocksize]);
825
+ }
826
+
827
+ INLINE const TELEM operator() (size_t i, size_t j) const
828
+ {
829
+ return FlatVector<T> (blocksize, &data[i*blocksize]);
830
+ }
831
+
832
+ INLINE SliceVector<T> Comp (size_t comp) const
833
+ {
834
+ return SliceVector<T> (s, blocksize, data+comp);
835
+ }
836
+
837
+ INLINE FlatSysVector<T> Range(size_t first, size_t last)
838
+ { return FlatSysVector<T> (last-first, blocksize, data+(first*blocksize)); }
839
+ INLINE /* const */ FlatSysVector<T> Range(size_t first, size_t last) const
840
+ { return FlatSysVector<T> (last-first, blocksize, data+(first*blocksize)); }
841
+
842
+ INLINE size_t Size () const { return s; }
843
+ INLINE size_t Height () const { return s; }
844
+ INLINE constexpr size_t Width () const { return 1; }
845
+ };
846
+
847
+
848
+
849
+ /**
850
+ A vector of fixed size.
851
+ Useful as entry type in system vectors.
852
+ */
853
+ template <int S, typename T = double>
854
+ class Vec : public MatExpr<Vec<S,T> > // , protected BaseVec
855
+ {
856
+ /// the values
857
+ // T data[S];
858
+ HTArray<S,T> data;
859
+ public:
860
+ /// type of the elements
861
+ typedef T TELEM;
862
+ /// is the element double or complex ?
863
+ typedef typename mat_traits<T>::TSCAL TSCAL;
864
+ static constexpr bool IsLinear() { return true; }
865
+
866
+
867
+ /// a vec is a S times 1 matrix, the according colume vector
868
+ typedef Vec<S, typename mat_traits<T>::TV_COL> TV_COL;
869
+ /// a vec is a S times 1 matrix, the according row vector
870
+ typedef Vec<1, typename mat_traits<T>::TV_ROW> TV_ROW;
871
+
872
+ enum { SIZE = S };
873
+ /// height of matrix
874
+ enum { HEIGHT = S };
875
+ /// with of matrix
876
+ enum { WIDTH = 1 };
877
+
878
+ /// constructor, no initialization
879
+ INLINE Vec () { ; }
880
+ /// copy vector
881
+ /*
882
+ INLINE Vec (const Vec & v) : MatExpr<Vec> ()
883
+ {
884
+ for (size_t i = 0; i < S; i++)
885
+ data[i] = v.data[i];
886
+ }
887
+ */
888
+
889
+ Vec (const Vec &) = default;
890
+ auto & HTData() { return data; }
891
+ const auto & HTData() const { return data; }
892
+ template <typename T2>
893
+ Vec (const Vec<S,T2> & v2) : data(v2.HTData()) { ; }
894
+
895
+
896
+ /// initialize with values
897
+ INLINE Vec (const TELEM & scal)
898
+ {
899
+ for (size_t i = 0; i < S; i++)
900
+ data[i] = scal;
901
+ }
902
+
903
+ /// initialize with expression
904
+ template<typename TB>
905
+ INLINE Vec (const Expr<TB> & v)
906
+ {
907
+ (*this) = v;
908
+ }
909
+
910
+ /*
911
+ template <int D>
912
+ INLINE Vec(FlatSliceVec<S,D,T> fsv)
913
+ {
914
+ for (int i = 0; i < S; i++)
915
+ data[i] = fsv(i);
916
+ }
917
+ */
918
+ template <typename T2, typename S2, typename D2>
919
+ INLINE Vec(VectorView<T2,S2,D2> fsv)
920
+ {
921
+ for (int i = 0; i < S; i++)
922
+ data[i] = fsv(i);
923
+ }
924
+
925
+
926
+ // Helper function for variadic constructor
927
+ template <int I, class... T2>
928
+ void Set(const TELEM &v, T2... rest)
929
+ {
930
+ data[I] = v;
931
+ Set<I+1>(rest...);
932
+ }
933
+
934
+ template <int I>
935
+ void Set(const TELEM &v)
936
+ {
937
+ data[I] = v;
938
+ }
939
+
940
+ template <class... T2,
941
+ enable_if_t<S==1+sizeof...(T2),bool> = true>
942
+ Vec(const TELEM &v, T2... rest) {
943
+ Set<0>(v, rest...);
944
+ }
945
+
946
+ /// copy vector
947
+ INLINE Vec & operator= (const Vec & v)
948
+ {
949
+ for (size_t i = 0; i < S; i++)
950
+ data[i] = v.data[i];
951
+ return *this;
952
+ }
953
+
954
+
955
+ /// assign scalar value
956
+ INLINE Vec & operator= (const TELEM & scal)
957
+ {
958
+ for (size_t i = 0; i < S; i++)
959
+ data[i] = scal;
960
+ return *this;
961
+ }
962
+
963
+ /// assign expression
964
+ template<typename TB>
965
+ INLINE Vec & operator= (const Expr<TB> & v)
966
+ {
967
+ for (size_t i = 0; i < S; i++)
968
+ data[i] = v.Spec()(i);
969
+ return *this;
970
+ }
971
+
972
+ // auto View() const { return FlatVec(const_cast<Vec&>(*this)); }
973
+ // auto View() const { return Vec(*this); }
974
+ INLINE auto View() const { return Vec<S,const T>{*this}; }
975
+ INLINE auto Shape() const { return tuple { IC<S>() }; }
976
+
977
+ /// access vector
978
+ INLINE TELEM & operator() (size_t i)
979
+ {
980
+ NETGEN_CHECK_RANGE(i,0,Size());
981
+ return data[i];
982
+ }
983
+
984
+ /// access vector
985
+ INLINE const TELEM & operator() (size_t i) const
986
+ {
987
+ NETGEN_CHECK_RANGE(i,0,Size());
988
+ return data[i];
989
+ }
990
+
991
+
992
+ /// access vector
993
+ INLINE TELEM & operator[] (size_t i)
994
+ {
995
+ NETGEN_CHECK_RANGE(i,0,Size());
996
+ return data[i];
997
+ }
998
+
999
+ /// access vector
1000
+ INLINE const TELEM & operator[] (size_t i) const
1001
+ {
1002
+ NETGEN_CHECK_RANGE(i,0,Size());
1003
+ return data[i];
1004
+ }
1005
+
1006
+ /// access vector
1007
+ INLINE TELEM & operator() (size_t i, size_t j)
1008
+ {
1009
+ NETGEN_CHECK_RANGE(i,0,Size());
1010
+ return data[i];
1011
+ }
1012
+
1013
+ /// access vector
1014
+ INLINE const TELEM & operator() (size_t i, size_t j) const
1015
+ {
1016
+ NETGEN_CHECK_RANGE(i,0,Size());
1017
+ return data[i];
1018
+ }
1019
+
1020
+ /// vector size
1021
+ INLINE auto Size () const { return IC<S>(); }
1022
+ /// corresponding matrix height
1023
+ INLINE constexpr size_t Height () const { return S; }
1024
+ /// corresponding matrix with
1025
+ INLINE constexpr size_t Width () const { return 1; }
1026
+ INLINE T* Data() { return data.Ptr(); }
1027
+ INLINE const T* Data() const { return data.Ptr(); }
1028
+
1029
+ INLINE /* const */ FlatVector<const T> Range(size_t first, size_t next) const
1030
+ { return FlatVector<const T> (next-first, data+first); }
1031
+
1032
+ INLINE /* const */ FlatVector<T> Range(size_t first, size_t next)
1033
+ { return FlatVector<T> (next-first, data+first); }
1034
+
1035
+ void DoArchive(Archive & ar)
1036
+ {
1037
+ for (size_t i = 0; i < S; i++)
1038
+ ar & data[i];
1039
+ }
1040
+
1041
+ const T * begin() const { return data.Ptr(); }
1042
+ const T * end() const { return data.Ptr()+S; }
1043
+ T * begin() { return data.Ptr(); }
1044
+ T * end() { return data.Ptr()+S; }
1045
+ };
1046
+
1047
+
1048
+
1049
+ template <typename T>
1050
+ class Vec<0,T> : public MatExpr<Vec<0,T> >
1051
+ {
1052
+ public:
1053
+ static constexpr bool IsLinear() { return true; }
1054
+ INLINE Vec () { }
1055
+ INLINE Vec (const Vec &d) { }
1056
+ INLINE Vec (T d) { }
1057
+ template<typename TB>
1058
+ INLINE Vec (const Expr<TB> & v) {;}
1059
+ INLINE auto View() const { return Vec(*this); }
1060
+ INLINE auto Shape() const { return tuple(IC<0>()); }
1061
+ INLINE constexpr size_t Size() const { return 0; }
1062
+ INLINE constexpr size_t Height() const { return 0; }
1063
+ INLINE constexpr size_t Width() const { return 1; }
1064
+ template<typename TB>
1065
+ INLINE Vec & operator= (const Expr<TB> & v) { return *this;}
1066
+ INLINE Vec & operator= (const T & /* scal */) { return *this; }
1067
+
1068
+ INLINE T & operator[] (int i) const { return *(T*)(void*)(this); }
1069
+ INLINE T & operator() (int i) const { return *(T*)(void*)(this); }
1070
+ INLINE T & operator() (int i, int j) const { return *(T*)(void*)(this); }
1071
+ INLINE T* Data() { return nullptr; }
1072
+ INLINE const T* Data() const { return nullptr; }
1073
+ INLINE FlatVector<const T> Range(size_t first, size_t next) const
1074
+ { return FlatVector<const T> (next-first, (T*)nullptr); }
1075
+ INLINE FlatVector<T> Range(size_t first, size_t next)
1076
+ { return FlatVector<T> (next-first, (T*)nullptr); }
1077
+ };
1078
+
1079
+
1080
+ template <int S, typename T>
1081
+ class mat_traits<Vec<S,T>>
1082
+ {
1083
+ public:
1084
+ /// matrix element
1085
+ typedef T TELEM;
1086
+ /// field of matrix element
1087
+ typedef typename mat_traits<T>::TSCAL TSCAL;
1088
+ /// type of column vector
1089
+ typedef Vec<S, typename mat_traits<T>::TV_COL> TV_COL;
1090
+ /// a vec is a S times 1 matrix, the according row vector
1091
+ typedef Vec<1, typename mat_traits<T>::TV_ROW> TV_ROW;
1092
+ /// matrix height
1093
+ enum { HEIGHT = S };
1094
+ /// matrix with
1095
+ enum { WIDTH = 1 };
1096
+ ///
1097
+ // enum { IS_COMPLEX = mat_traits<TSCAL>::IS_COMPLEX };
1098
+ };
1099
+
1100
+
1101
+
1102
+ template <typename T> struct ConstVecSize { static constexpr int VSIZE = -1; };
1103
+ template <int S, typename T> struct ConstVecSize<Vec<S,T>> { static constexpr int VSIZE = S; };
1104
+ template <int S, typename T> struct ConstVecSize<FlatVec<S,T>> { static constexpr int VSIZE = S; };
1105
+ template <int S, int D, typename T> struct ConstVecSize<FlatSliceVec<S,D,T>> { static constexpr int VSIZE = S; };
1106
+ template <typename T>
1107
+ constexpr auto ConstVectorSize() { return ConstVecSize<T>::VSIZE; }
1108
+
1109
+ /// cross product of 3-vectors
1110
+ template <typename TA, typename TB,
1111
+ std::enable_if_t<ConstVecSize<TA>::VSIZE == 3, bool> = true,
1112
+ std::enable_if_t<ConstVecSize<TB>::VSIZE == 3, bool> = true>
1113
+ INLINE auto Cross (const TA & a, const TB & b)
1114
+ {
1115
+ typedef decltype (a(0)*b(0)) T;
1116
+ return Vec<3,T>{ a(1)*b(2)-a(2)*b(1), a(2)*b(0)-a(0)*b(2), a(0)*b(1)-a(1)*b(0) };
1117
+ }
1118
+
1119
+ template <typename S>
1120
+ INLINE Vec<1,S> Cross (const Vec<2,S> & a, const Vec<2,S> & b)
1121
+ {
1122
+ return Vec<1,S> ( { a(0) * b(1) - a(1) * b(0) } );
1123
+ }
1124
+
1125
+ template <typename S>
1126
+ INLINE Vec<0,S> Cross (const Vec<1,S> & a, const Vec<1,S> & b)
1127
+ {
1128
+ return Vec<0,S>();
1129
+ }
1130
+
1131
+ /// output vector
1132
+ template<int S, typename T>
1133
+ inline ostream & operator<< (ostream & ost, const Vec<S,T> & v)
1134
+ {
1135
+ for (int i = 0; i < S; i++)
1136
+ ost << " " << setw(7) << v(i);
1137
+ return ost;
1138
+ }
1139
+
1140
+
1141
+ template<int S, typename T, typename TB>
1142
+ INLINE Vec<S,T> & operator+= (Vec<S,T> & v, const Expr<TB> & v2)
1143
+ {
1144
+ for (int i = 0; i < S; i++)
1145
+ v(i) += v2.Spec()(i,0);
1146
+ return v;
1147
+ }
1148
+
1149
+ template<int S, typename T, typename TB>
1150
+ INLINE Vec<S,T> & operator-= (Vec<S,T> & v, const Expr<TB> & v2)
1151
+ {
1152
+ for (int i = 0; i < S; i++)
1153
+ v(i) -= v2.Spec()(i,0);
1154
+ return v;
1155
+ }
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+ /// output vector.
1164
+ template<int S, typename T>
1165
+ inline ostream & operator<< (ostream & ost, const FlatVec<S,T> & v)
1166
+ {
1167
+ for (int i = 0; i < S; i++)
1168
+ ost << " " << setw(7) << v(i);
1169
+ return ost;
1170
+ }
1171
+
1172
+
1173
+ template <int S, typename T = double>
1174
+ auto UnitVec(size_t i)
1175
+ {
1176
+ Vec<S,T> ei = T(0.0);
1177
+ ei(i) = T(1.0);
1178
+ return ei;
1179
+ }
1180
+
1181
+ template <class TV, class TSCAL> class Scalar2ElemVector
1182
+ {
1183
+ public:
1184
+ FlatVector<TSCAL> vec;
1185
+ Scalar2ElemVector (FlatVector<TSCAL> avec) : vec(avec) { }
1186
+
1187
+ enum { H = mat_traits<TV>::HEIGHT };
1188
+
1189
+ FlatVec<H,TSCAL> operator() (int i) const
1190
+ {
1191
+ return FlatVec<H,TSCAL> (&vec(i*H));
1192
+ }
1193
+
1194
+ };
1195
+
1196
+
1197
+ template <class TSCAL> class Scalar2ElemVector<TSCAL,TSCAL>
1198
+ {
1199
+ public:
1200
+ FlatVector<TSCAL> vec;
1201
+ Scalar2ElemVector (FlatVector<TSCAL> avec) : vec(avec) { }
1202
+
1203
+
1204
+ const TSCAL & operator() (int i) const
1205
+ {
1206
+ return vec(i);
1207
+ }
1208
+
1209
+ TSCAL & operator() (int i)
1210
+ {
1211
+ return vec(i);
1212
+ }
1213
+
1214
+ };
1215
+
1216
+
1217
+ template <typename T=double>
1218
+ class SparseVector
1219
+ {
1220
+ size_t size;
1221
+ ClosedHashTable<size_t, T> data;
1222
+ public:
1223
+ SparseVector (size_t asize) : size(asize), data(10) { }
1224
+ size_t Size() const { return size; }
1225
+ T operator[] (size_t i) const { return data[i]; }
1226
+ T & operator[] (size_t i) { return data[i]; }
1227
+ T InnerProduct (FlatVector<T> v2) const
1228
+ {
1229
+ T sum = 0;
1230
+ for (auto [i,v] : data)
1231
+ sum += v * v2(i);
1232
+ return sum;
1233
+ }
1234
+ auto & Data() const { return data; }
1235
+ };
1236
+
1237
+ template <typename T>
1238
+ inline ostream & operator<< (ostream & ost, const SparseVector<T> & sv) {
1239
+ for (auto [i,v] : sv.Data())
1240
+ ost << i << ": " << v << ", ";
1241
+ return ost;
1242
+ }
1243
+
1244
+
1245
+ template <class T>
1246
+ class mat_traits<FlatVector<T> >
1247
+ {
1248
+ public:
1249
+ typedef T TELEM;
1250
+ typedef T TSCAL;
1251
+ };
1252
+
1253
+
1254
+ template <int S, typename T>
1255
+ INLINE auto operator* (double a, const Vec<S,T> & vec)
1256
+ {
1257
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1258
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1259
+ Vec<S, TRES> res;
1260
+ for (int i = 0; i < S; i++)
1261
+ res(i) = a * vec(i);
1262
+ return res;
1263
+ }
1264
+
1265
+ template <int S, typename T>
1266
+ INLINE auto operator* (int a, const Vec<S,T> & vec) { return double(a)*vec; }
1267
+
1268
+ template <int S, typename T>
1269
+ INLINE auto operator* (Complex a, const Vec<S,T> & vec)
1270
+ {
1271
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1272
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1273
+ Vec<S, TRES> res;
1274
+ for (int i = 0; i < S; i++)
1275
+ res(i) = a * vec(i);
1276
+ return res;
1277
+ }
1278
+
1279
+ // all other cases ...
1280
+ template <int S, typename T,
1281
+ typename enable_if<!is_convertible_v<T,Complex>,int>::type=0>
1282
+ INLINE auto operator* (T a, const Vec<S,T> & vec)
1283
+ {
1284
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1285
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1286
+ Vec<S, TRES> res;
1287
+ for (int i = 0; i < S; i++)
1288
+ res(i) = a * vec(i);
1289
+ return res;
1290
+ }
1291
+
1292
+ template <int S, typename T>
1293
+ INLINE auto operator+ (const Vec<S,T> & a, const Vec<S,T> & b)
1294
+ {
1295
+ // typedef decltype(RemoveConst(a(0))) TRES;
1296
+ typedef typename std::remove_const<T>::type TRES;
1297
+ Vec<S,TRES> res;
1298
+ for (int i = 0; i < S; i++)
1299
+ res(i) = a(i)+b(i);
1300
+ return res;
1301
+ }
1302
+
1303
+ template <int S, typename T>
1304
+ INLINE auto operator- (const Vec<S,T> & a, const Vec<S,T> & b)
1305
+ {
1306
+ // typedef decltype(RemoveConst(a(0))) TRES;
1307
+ typedef typename std::remove_const<T>::type TRES;
1308
+ Vec<S,TRES> res;
1309
+ for (int i = 0; i < S; i++)
1310
+ res(i) = a(i)-b(i);
1311
+ return res;
1312
+ }
1313
+
1314
+
1315
+ template <int S, typename T>
1316
+ INLINE auto operator* (double a, FlatVec<S,T> vec)
1317
+ // -> Vec<S, decltype(RemoveConst(a*vec(0)))>
1318
+ {
1319
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1320
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1321
+ Vec<S, TRES> res;
1322
+ for (int i = 0; i < S; i++)
1323
+ res(i) = a * vec(i);
1324
+ return res;
1325
+ }
1326
+
1327
+
1328
+ template <int S, typename T>
1329
+ INLINE auto operator* (Complex a, FlatVec<S,T> vec)
1330
+ // -> Vec<S, decltype(RemoveConst(a*vec(0)))>
1331
+ {
1332
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1333
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1334
+ Vec<S, TRES> res;
1335
+ for (int i = 0; i < S; i++)
1336
+ res(i) = a * vec(i);
1337
+ return res;
1338
+ }
1339
+
1340
+ template <int S, int D, typename T>
1341
+ INLINE auto operator* (double a, FlatSliceVec<S,D,T> vec)
1342
+ // -> Vec<S, decltype(RemoveConst(a*vec(0)))>
1343
+ {
1344
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1345
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1346
+ Vec<S, TRES> res;
1347
+ for (int i = 0; i < S; i++)
1348
+ res(i) = a * vec(i);
1349
+ return res;
1350
+ }
1351
+
1352
+
1353
+ template <int S, int D, typename T>
1354
+ INLINE auto operator* (Complex a, FlatSliceVec<S,D,T> vec)
1355
+ // -> Vec<S, decltype(RemoveConst(a*vec(0)))>
1356
+ {
1357
+ // typedef decltype(RemoveConst(a*vec(0))) TRES;
1358
+ typedef typename std::remove_const<decltype(a*std::declval<T>())>::type TRES;
1359
+ Vec<S, TRES> res;
1360
+ for (int i = 0; i < S; i++)
1361
+ res(i) = a * vec(i);
1362
+ return res;
1363
+ }
1364
+
1365
+
1366
+ template <int S, typename T>
1367
+ INLINE auto operator+ (FlatVec<S,T> x, FlatVec<S,T> y) -> Vec<S,T>
1368
+ {
1369
+ Vec<S,T> tmp = x;
1370
+ tmp += y;
1371
+ return tmp;
1372
+ }
1373
+
1374
+ template <int S, typename T>
1375
+ INLINE auto operator- (FlatVec<S,T> x, FlatVec<S,T> y) -> Vec<S,T>
1376
+ {
1377
+ Vec<S,T> tmp = x;
1378
+ tmp -= y;
1379
+ return tmp;
1380
+ }
1381
+
1382
+
1383
+
1384
+ template <int DIM, typename SCAL, typename TANY>
1385
+ inline void AtomicAdd (Vec<DIM,SCAL> & x, TANY y)
1386
+ {
1387
+ for (int i = 0; i < DIM; i++)
1388
+ AtomicAdd (x(i), y(i));
1389
+ }
1390
+
1391
+ template <int DIM, typename SCAL, typename TANY>
1392
+ inline void AtomicAdd (FlatVec<DIM,SCAL> x, TANY y)
1393
+ {
1394
+ for (int i = 0; i < DIM; i++)
1395
+ AtomicAdd (x(i), y(i));
1396
+ }
1397
+
1398
+
1399
+ template <typename T, typename TS, typename TDIST, typename TB>
1400
+ inline void AtomicAdd (VectorView<T,TS,TDIST> v, const Expr<TB> & v2)
1401
+ {
1402
+ auto viewv2 = v2.View();
1403
+ auto combsize = CombinedSize(v.Size(), v2.Height());
1404
+ for (size_t i = 0; i < combsize; i++)
1405
+ AtomicAdd (v(i), viewv2(i));
1406
+ }
1407
+
1408
+
1409
+ }
1410
+
1411
+
1412
+ namespace ngcore
1413
+ {
1414
+
1415
+ template <typename T, size_t S> class MakeSimdCl;
1416
+
1417
+ template <typename T, size_t S, int VS>
1418
+ class MakeSimdCl<ngbla::Vec<VS,T>,S>
1419
+ {
1420
+ std::array<ngbla::Vec<VS,T>,S> a;
1421
+ public:
1422
+ MakeSimdCl (std::array<ngbla::Vec<VS,T>,S> aa) : a(aa) { ; }
1423
+
1424
+ auto Get() const
1425
+ {
1426
+ std::array<T,S> ai;
1427
+ ngbla::Vec<VS, decltype(MakeSimd(ai))> res;
1428
+ for (int i = 0; i < VS; i++)
1429
+ {
1430
+ for (int j = 0; j < S; j++)
1431
+ ai[j] = a[j](i);
1432
+ res(i) = MakeSimd(ai);
1433
+ }
1434
+ return res;
1435
+ }
1436
+ };
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+ template<typename T> struct MPI_typetrait;
1443
+
1444
+ template<int S, typename T>
1445
+ struct MPI_typetrait<ngbla::Vec<S, T> > {
1446
+ static auto MPIType () {
1447
+ return MPI_typetrait<std::array<T,S>>::MPIType();
1448
+ }
1449
+ };
1450
+ }
1451
+
1452
+ #endif