ngsolve 6.2.2504.post44.dev0__cp311-cp311-win_amd64.whl → 6.2.2601__cp311-cp311-win_amd64.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 (94) hide show
  1. netgen/include/analytic_integrals.hpp +10 -0
  2. netgen/include/basematrix.hpp +6 -0
  3. netgen/include/bdbequations.hpp +55 -0
  4. netgen/include/bem_diffops.hpp +475 -0
  5. netgen/include/bilinearform.hpp +4 -1
  6. netgen/include/bspline.hpp +2 -0
  7. netgen/include/code_generation.hpp +2 -2
  8. netgen/include/complex_wrapper.hpp +30 -2
  9. netgen/include/contact.hpp +8 -0
  10. netgen/include/diagonalmatrix.hpp +6 -0
  11. netgen/include/diffop_impl.hpp +3 -1
  12. netgen/include/diffopwithfactor.hpp +123 -0
  13. netgen/include/elementbyelement.hpp +9 -3
  14. netgen/include/expr.hpp +45 -7
  15. netgen/include/fespace.hpp +9 -2
  16. netgen/include/gridfunction.hpp +3 -3
  17. netgen/include/h1amg.hpp +24 -1
  18. netgen/include/h1lumping.hpp +6 -0
  19. netgen/include/hcurl_equations.hpp +29 -0
  20. netgen/include/hcurlcurlfe.hpp +20 -0
  21. netgen/include/hdivfe_utils.hpp +1 -0
  22. netgen/include/hdivhofespace.hpp +2 -0
  23. netgen/include/kernels.hpp +724 -0
  24. netgen/include/l2hofe.hpp +1 -0
  25. netgen/include/matrix.hpp +8 -3
  26. netgen/include/meshaccess.hpp +1 -1
  27. netgen/include/mp_coefficient.hpp +24 -19
  28. netgen/include/mptools.hpp +1255 -237
  29. netgen/include/mycomplex.hpp +1 -1
  30. netgen/include/ngblas.hpp +116 -7
  31. netgen/include/potentialtools.hpp +2 -2
  32. netgen/include/preconditioner.hpp +2 -2
  33. netgen/include/prolongation.hpp +6 -3
  34. netgen/include/recursive_pol.hpp +63 -11
  35. netgen/include/simd_complex.hpp +45 -0
  36. netgen/include/sparsecholesky.hpp +6 -2
  37. netgen/include/sparsefactorization_interface.hpp +159 -0
  38. netgen/include/sparsematrix.hpp +21 -7
  39. netgen/include/sparsematrix_dyn.hpp +2 -2
  40. netgen/include/sparsematrix_impl.hpp +100 -33
  41. netgen/include/statushandler.hpp +8 -8
  42. netgen/include/thdivfe_impl.hpp +66 -0
  43. netgen/include/tscalarfe.hpp +1 -1
  44. netgen/include/vector.hpp +272 -47
  45. netgen/lib/libngsolve.lib +0 -0
  46. netgen/libngsolve.dll +0 -0
  47. netgen/ngscxx.bat +1 -1
  48. netgen/ngsld.bat +1 -1
  49. ngsolve/cmake/NGSolveConfig.cmake +8 -8
  50. ngsolve/cmake/ngsolve-targets.cmake +17 -10
  51. ngsolve/config/config.py +8 -8
  52. ngsolve/demos/intro/cmagnet.py +19 -22
  53. ngsolve/directsolvers.py +9 -21
  54. ngsolve/krylovspace.py +172 -3
  55. ngsolve/ngslib.pyd +0 -0
  56. ngsolve/nonlinearsolvers.py +2 -2
  57. ngsolve/solve_implementation.py +14 -1
  58. ngsolve/{solvers.py → solvers/__init__.py} +1 -1
  59. ngsolve/solvers/cudss.py +112 -0
  60. ngsolve/webgui.py +1 -0
  61. {ngsolve-6.2.2504.post44.dev0.dist-info → ngsolve-6.2.2601.dist-info}/METADATA +2 -2
  62. {ngsolve-6.2.2504.post44.dev0.dist-info → ngsolve-6.2.2601.dist-info}/RECORD +94 -88
  63. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/Scripts/ngsolve.tcl +0 -0
  64. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/beam.geo +0 -0
  65. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/beam.vol +0 -0
  66. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/chip.in2d +0 -0
  67. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/chip.vol +0 -0
  68. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coil.geo +0 -0
  69. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coil.vol +0 -0
  70. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coilshield.geo +0 -0
  71. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coilshield.vol +0 -0
  72. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/cube.geo +0 -0
  73. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/cube.vol +0 -0
  74. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
  75. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
  76. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d1_square.pde +0 -0
  77. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d2_chip.pde +0 -0
  78. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
  79. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d4_cube.pde +0 -0
  80. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d5_beam.pde +0 -0
  81. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d6_shaft.pde +0 -0
  82. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d7_coil.pde +0 -0
  83. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
  84. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
  85. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
  86. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/doubleglazing.vol +0 -0
  87. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  88. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/shaft.geo +0 -0
  89. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/shaft.vol +0 -0
  90. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/square.in2d +0 -0
  91. {ngsolve-6.2.2504.post44.dev0.data → ngsolve-6.2.2601.data}/data/share/ngsolve/square.vol +0 -0
  92. {ngsolve-6.2.2504.post44.dev0.dist-info → ngsolve-6.2.2601.dist-info}/LICENSE +0 -0
  93. {ngsolve-6.2.2504.post44.dev0.dist-info → ngsolve-6.2.2601.dist-info}/WHEEL +0 -0
  94. {ngsolve-6.2.2504.post44.dev0.dist-info → ngsolve-6.2.2601.dist-info}/top_level.txt +0 -0
@@ -355,6 +355,23 @@ namespace ngla
355
355
  AddRowTransToVector (i, s*fx(i), fy);
356
356
 
357
357
  timer.AddFlops (this->NZE());
358
+
359
+
360
+ /*
361
+ static Timer t("SparseMatrix::MultTransAdd"); RegionTimer reg(t);
362
+ t.AddFlops (this->NZE()*sizeof(TV_ROW)*sizeof(TV_COL)/sqr(sizeof(double)));
363
+
364
+ ParallelForRange
365
+ (balance, [&] (IntRange myrange)
366
+ {
367
+ FlatVector<TVY> fx = x.FV<TVY>();
368
+ FlatVector<TVX> fy = y.FV<TVX>();
369
+
370
+ for (auto i : myrange)
371
+ AddRowTransToVectorAtomic (i, s*fx(i), fy);
372
+ });
373
+ */
374
+
358
375
  }
359
376
 
360
377
 
@@ -460,21 +477,69 @@ namespace ngla
460
477
  DeleteZeroElements(double tol) const
461
478
  {
462
479
  static Timer t("SparseMatrix::DeleteZeroElements"); RegionTimer reg(t);
463
- Array<int> indi, indj;
464
- Array<TM> val;
465
- for (auto i : Range(this->Height()))
480
+ size_t h = this->Height();
481
+ size_t w = this->Width();
482
+ Array<int> cnt(h);
483
+ Array<bool> keep(data.Size());
484
+ cnt = 0;
485
+ keep = false;
486
+ ParallelForRange( h, [&](IntRange r)
466
487
  {
467
- for (auto j : Range(firsti[i], firsti[i+1]))
468
- {
488
+ for (auto i : r)
489
+ for (auto j : Range(firsti[i], firsti[i+1]))
469
490
  if (ngbla::L2Norm2(data[j]) > tol*tol)
491
+ {
492
+ keep[j] = true;
493
+ cnt[i]++;
494
+ }
495
+ }, 5*TaskManager::GetNumThreads());
496
+
497
+ auto matrix = make_shared<SparseMatrix<TM>> (cnt, w);
498
+ cnt = 0;
499
+
500
+ ParallelForRange( h, [&](IntRange r)
501
+ {
502
+ for (auto i : r)
503
+ {
504
+ auto cols = matrix->GetRowIndices(i);
505
+ auto vals = matrix->GetRowValues(i);
506
+ int icol = 0;
507
+ // size_t firsti_new = matrix->firsti[i];
508
+ for (auto j : Range(firsti[i], firsti[i+1]))
509
+ if (keep[j])
470
510
  {
471
- indi.Append (i);
472
- indj.Append (colnr[j]);
473
- val.Append (data[j]);
511
+ cols[icol] = colnr[j];
512
+ vals[icol] = data[j];
513
+ icol++;
474
514
  }
475
- }
476
- }
477
- return this->CreateFromCOO(indi, indj, val, this->Height(), this->Width());
515
+ }
516
+ }, 5*TaskManager::GetNumThreads());
517
+ return matrix;
518
+
519
+ /*
520
+ // needs parallelization and testing
521
+ Array<int> cnt(this->Height());
522
+ cnt = 0;
523
+ size_t cnt0 = 0;
524
+ for (auto i : Range(this->Height()))
525
+ for (auto j : Range(firsti[i], firsti[i+1]))
526
+ if (ngbla::L2Norm2(data[j]) > tol*tol)
527
+ cnt[i]++;
528
+ else
529
+ cnt0++;
530
+
531
+ cout << "zero-els = " << cnt0 << endl;
532
+
533
+
534
+ auto matrix = make_shared<SparseMatrix<TM>> (cnt, this->Width());
535
+
536
+ for (auto i : Range(this->Height()))
537
+ for (auto j : Range(firsti[i], firsti[i+1]))
538
+ if (ngbla::L2Norm2(data[j]) > tol*tol)
539
+ (*matrix)(i, colnr[i]) = data[j];
540
+
541
+ return matrix;
542
+ */
478
543
  }
479
544
 
480
545
  template <class TM>
@@ -707,36 +772,38 @@ namespace ngla
707
772
 
708
773
  template <class TM>
709
774
  shared_ptr<BaseSparseMatrix> SparseMatrixTM<TM> ::
710
- CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(ngbla::Trans(TM()))>>(const Array<int>&,int)> & creator) const
775
+ CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(ngbla::Trans(TM()))>>(const Array<int>&,int)> & creator,
776
+ bool sorted) const
711
777
  {
712
778
  Array<int> cnt(this->Width());
713
779
  cnt = 0;
714
780
  ParallelFor (this->Height(), [&] (int i)
715
- {
716
- for (int c : this->GetRowIndices(i))
717
- AsAtomic (cnt[c]) ++;
718
- });
719
-
781
+ {
782
+ for (int c : this->GetRowIndices(i))
783
+ AsAtomic (cnt[c]) ++;
784
+ });
785
+
720
786
  auto trans = creator(cnt, this->Height());
721
787
 
722
788
  cnt = 0;
723
789
  ParallelFor (this->Height(), [&] (int i)
724
- {
725
- for (int ci : Range(this->GetRowIndices(i)))
726
- {
727
- int c = this->GetRowIndices(i)[ci];
728
- int pos = AsAtomic(cnt[c])++;
729
- trans -> GetRowIndices(c)[pos] = i;
730
- trans -> GetRowValues(c)[pos] = Trans(this->GetRowValues(i)[ci]);
731
- }
732
- });
733
-
734
- ParallelFor (trans->Height(), [&] (int r)
735
- {
736
- auto rowvals = trans->GetRowValues(r);
737
- BubbleSort (trans->GetRowIndices(r),
738
- FlatArray(rowvals.Size(), rowvals.Data()));
739
- });
790
+ {
791
+ for (int ci : Range(this->GetRowIndices(i)))
792
+ {
793
+ int c = this->GetRowIndices(i)[ci];
794
+ int pos = AsAtomic(cnt[c])++;
795
+ trans -> GetRowIndices(c)[pos] = i;
796
+ trans -> GetRowValues(c)[pos] = Trans(this->GetRowValues(i)[ci]);
797
+ }
798
+ });
799
+
800
+ if (sorted)
801
+ ParallelFor (trans->Height(), [&] (int r)
802
+ {
803
+ auto rowvals = trans->GetRowValues(r);
804
+ BubbleSort (trans->GetRowIndices(r),
805
+ FlatArray(rowvals.Size(), rowvals.Data()));
806
+ });
740
807
 
741
808
  return trans;
742
809
  }
@@ -3,27 +3,27 @@
3
3
 
4
4
  namespace ngstd
5
5
  {
6
-
6
+
7
7
  /** Access to statusbar. (and more)
8
8
  */
9
9
 
10
10
  class NGS_DLL_HEADER BaseStatusHandler
11
- {
12
- public:
13
- static void PushStatus (const char * str);
11
+ {
12
+ public:
13
+ static void PushStatus (const std::string& str);
14
14
  static void PopStatus ();
15
15
  static void SetThreadPercentage (double percent);
16
-
16
+
17
17
  static void GetStatus (string & str, double & percent);
18
-
18
+
19
19
  static void SetTerminate(void);
20
20
  static void UnSetTerminate(void);
21
21
  static bool ShouldTerminate(void);
22
-
22
+
23
23
  class Region
24
24
  {
25
25
  public:
26
- Region(const char * str) { PushStatus(str); }
26
+ Region(const string& str) { PushStatus(str); }
27
27
  ~Region() { PopStatus(); }
28
28
  };
29
29
  };
@@ -235,6 +235,7 @@ namespace ngfem
235
235
  CalcMappedDivShape (const SIMD_BaseMappedIntegrationRule & bmir,
236
236
  BareSliceMatrix<SIMD<double>> divshapes) const
237
237
  {
238
+ /*
238
239
  auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM>&> (bmir);
239
240
  for (size_t i = 0; i < mir.Size(); i++)
240
241
  {
@@ -246,6 +247,29 @@ namespace ngfem
246
247
  divshapesi(j) = val;
247
248
  }));
248
249
  }
250
+ */
251
+ Iterate<4-DIM>
252
+ ([this,&bmir,divshapes](auto CODIM)
253
+ {
254
+ constexpr int DIMSPACE = DIM+CODIM.value;
255
+ if (bmir.DimSpace() == DIMSPACE)
256
+ {
257
+ // cout << "use new div, dim " << DIMSPACE << endl;
258
+ auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIMSPACE>&> (bmir);
259
+ for (size_t i = 0; i < mir.Size(); i++)
260
+ {
261
+ auto divshapesi = divshapes.Col(i);
262
+ auto invJ = 1.0/mir[i].GetJacobiDet();
263
+ static_cast<const FEL*> (this) ->
264
+ T_CalcShape (GetTIPGrad<DIM>(mir[i].IP()),
265
+ SBLambda ([divshapesi,invJ] (size_t j, THDiv2DivShape<DIM,SIMD<double>> val)
266
+ {
267
+ divshapesi(j) = invJ*val.Get();
268
+ }));
269
+ }
270
+ }
271
+ });
272
+
249
273
  }
250
274
 
251
275
  template <class FEL, ELEMENT_TYPE ET>
@@ -384,6 +408,8 @@ namespace ngfem
384
408
  EvaluateDiv (const SIMD_BaseMappedIntegrationRule & bmir, BareSliceVector<> coefs,
385
409
  BareVector<SIMD<double>> values) const
386
410
  {
411
+ /*
412
+ cout << "evaldiv, simd" << endl
387
413
  auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM>&> (bmir);
388
414
  for (size_t i = 0; i < mir.Size(); i++)
389
415
  {
@@ -399,6 +425,46 @@ namespace ngfem
399
425
  }));
400
426
  values(i) = sum;
401
427
  }
428
+ */
429
+
430
+ /*
431
+ Iterate<4-DIM>
432
+ ([this,&bmir,coefs,values](auto CODIM)
433
+ {
434
+ constexpr int DIMSPACE = DIM+CODIM.value;
435
+ if (bmir.DimSpace() == DIMSPACE)
436
+ {
437
+ auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIMSPACE>&> (bmir);
438
+ for (size_t i = 0; i < mir.Size(); i++)
439
+ {
440
+ SIMD<double> sum(0.0);
441
+ static_cast<const FEL*> (this) ->
442
+ T_CalcShape (GetTIPGrad<DIM>(mir[i].IP()),
443
+ SBLambda ([=,&sum] (size_t j, THDiv2DivShape<DIM,SIMD<double>> divshape)
444
+ {
445
+ // auto vshape = HDiv2DivShapeNew (s);
446
+ // shapesi.Range(j*vshape.Size(), (j+1)*vshape.Size()) = vshape;
447
+ // divshapesi(j) = HDiv2DivShapeNew (s);
448
+ sum += coefs(j) * divshape.Get();
449
+ }));
450
+ values(i) = 1/mir[i].GetJacobiDet() * sum;
451
+ }
452
+ }
453
+ });
454
+ */
455
+
456
+ auto & mir = bmir;
457
+ for (size_t i = 0; i < mir.Size(); i++)
458
+ {
459
+ SIMD<double> sum(0.0);
460
+ static_cast<const FEL*> (this) ->
461
+ T_CalcShape (GetTIPGrad<DIM>(mir[i].IP()),
462
+ SBLambda ([=,&sum] (size_t j, THDiv2DivShape<DIM,SIMD<double>> divshape)
463
+ {
464
+ sum += coefs(j) * divshape.Get();
465
+ }));
466
+ values(i) = 1/mir[i].GetJacobiDet() * sum;
467
+ }
402
468
  }
403
469
 
404
470
  template <class FEL, ELEMENT_TYPE ET>
@@ -36,7 +36,7 @@ namespace ngfem
36
36
  INLINE T_ScalarFiniteElement () { ; }
37
37
  // virtual ~T_ScalarFiniteElement() { ; }
38
38
 
39
- HD virtual ELEMENT_TYPE ElementType() const final { return ET; }
39
+ HD virtual ELEMENT_TYPE ElementType() const final override { return ET; }
40
40
  // HD NGS_DLL_HEADER virtual int Dim () const override { return DIM; }
41
41
 
42
42