ngsolve 6.2.2503__cp310-cp310-win_amd64.whl → 6.2.2504.post44.dev0__cp310-cp310-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.

Potentially problematic release.


This version of ngsolve might be problematic. Click here for more details.

Files changed (61) hide show
  1. netgen/include/blockjacobi.hpp +17 -5
  2. netgen/include/cholesky.hpp +2 -2
  3. netgen/include/h1amg.hpp +62 -2
  4. netgen/include/hdiv_equations.hpp +15 -0
  5. netgen/include/integrator.hpp +4 -16
  6. netgen/include/intrule.hpp +2 -1
  7. netgen/include/jacobi.hpp +35 -18
  8. netgen/include/meshaccess.hpp +3 -2
  9. netgen/include/mp_coefficient.hpp +140 -0
  10. netgen/include/mptools.hpp +42 -161
  11. netgen/include/potentialtools.hpp +2 -0
  12. netgen/include/preconditioner.hpp +21 -21
  13. netgen/include/sparsematrix_dyn.hpp +6 -7
  14. netgen/include/sparsematrix_impl.hpp +4 -2
  15. netgen/include/special_matrix.hpp +2 -0
  16. netgen/include/symbolicintegrator.hpp +2 -1
  17. netgen/lib/libngsolve.lib +0 -0
  18. netgen/libngsolve.dll +0 -0
  19. ngsolve/__init__.py +1 -0
  20. ngsolve/cmake/NGSolveConfig.cmake +5 -5
  21. ngsolve/cmake/ngsolve-targets.cmake +1 -9
  22. ngsolve/config/config.py +6 -6
  23. ngsolve/ngslib.lib +0 -0
  24. ngsolve/ngslib.pyd +0 -0
  25. ngsolve/preconditioners.py +1 -0
  26. ngsolve/solve_implementation.py +155 -0
  27. ngsolve/webgui.py +1 -0
  28. {ngsolve-6.2.2503.dist-info → ngsolve-6.2.2504.post44.dev0.dist-info}/METADATA +2 -2
  29. {ngsolve-6.2.2503.dist-info → ngsolve-6.2.2504.post44.dev0.dist-info}/RECORD +61 -59
  30. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/Scripts/ngsolve.tcl +0 -0
  31. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/beam.geo +0 -0
  32. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/beam.vol +0 -0
  33. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/chip.in2d +0 -0
  34. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/chip.vol +0 -0
  35. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/coil.geo +0 -0
  36. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/coil.vol +0 -0
  37. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/coilshield.geo +0 -0
  38. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/coilshield.vol +0 -0
  39. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/cube.geo +0 -0
  40. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/cube.vol +0 -0
  41. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
  42. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
  43. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d1_square.pde +0 -0
  44. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d2_chip.pde +0 -0
  45. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
  46. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d4_cube.pde +0 -0
  47. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d5_beam.pde +0 -0
  48. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d6_shaft.pde +0 -0
  49. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d7_coil.pde +0 -0
  50. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
  51. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
  52. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
  53. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/doubleglazing.vol +0 -0
  54. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  55. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/shaft.geo +0 -0
  56. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/shaft.vol +0 -0
  57. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/square.in2d +0 -0
  58. {ngsolve-6.2.2503.data → ngsolve-6.2.2504.post44.dev0.data}/data/share/ngsolve/square.vol +0 -0
  59. {ngsolve-6.2.2503.dist-info → ngsolve-6.2.2504.post44.dev0.dist-info}/LICENSE +0 -0
  60. {ngsolve-6.2.2503.dist-info → ngsolve-6.2.2504.post44.dev0.dist-info}/WHEEL +0 -0
  61. {ngsolve-6.2.2503.dist-info → ngsolve-6.2.2504.post44.dev0.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,7 @@
9
9
 
10
10
 
11
11
  #include "sparsematrix.hpp"
12
+ #include "jacobi.hpp"
12
13
 
13
14
  namespace ngla
14
15
  {
@@ -16,7 +17,7 @@ namespace ngla
16
17
  /**
17
18
  Base class for Block - Jacobi and Block Gauss Seidel smoother.
18
19
  */
19
- class NGS_DLL_HEADER BaseBlockJacobiPrecond : virtual public BaseMatrix
20
+ class NGS_DLL_HEADER BaseBlockJacobiPrecond : public BaseMSMPrecond
20
21
  {
21
22
  protected:
22
23
  /// the table defining the blocks
@@ -38,6 +39,17 @@ namespace ngla
38
39
  /// deletes the table
39
40
  virtual ~BaseBlockJacobiPrecond ();
40
41
 
42
+ virtual void Smooth (BaseVector & x, const BaseVector & b, int steps = 1) const override
43
+ {
44
+ GSSmooth (x, b, steps);
45
+ }
46
+ virtual void SmoothBack (BaseVector & x, const BaseVector & b, int steps = 1) const override
47
+ {
48
+ GSSmoothBack (x, b, steps);
49
+ }
50
+
51
+
52
+
41
53
  /// performs steps Gauss-Seidel steps for the equation A x = b
42
54
  virtual void GSSmooth (BaseVector & x, const BaseVector & b,
43
55
  int steps = 1) const = 0;
@@ -101,8 +113,8 @@ namespace ngla
101
113
  The blocks are specified by a table container
102
114
  */
103
115
  template <class TM, class TV_ROW, class TV_COL>
104
- class NGS_DLL_HEADER BlockJacobiPrecond : virtual public BaseBlockJacobiPrecond,
105
- virtual public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
116
+ class NGS_DLL_HEADER BlockJacobiPrecond : public BaseBlockJacobiPrecond,
117
+ public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
106
118
  {
107
119
  protected:
108
120
  /// a reference to the matrix
@@ -190,8 +202,8 @@ namespace ngla
190
202
  ///
191
203
  template <class TM, class TV>
192
204
  class BlockJacobiPrecondSymmetric :
193
- virtual public BaseBlockJacobiPrecond,
194
- virtual public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
205
+ public BaseBlockJacobiPrecond,
206
+ public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
195
207
  {
196
208
  protected:
197
209
  shared_ptr<const SparseMatrixSymmetric<TM,TV>> mat;
@@ -503,7 +503,7 @@ namespace ngbla
503
503
 
504
504
  int n = mat.Height();
505
505
  STACK_ARRAY(T, mem, n);
506
- FlatVector<T> dinv(n, &mem);
506
+ FlatVector<T> dinv(n, &mem[0]);
507
507
 
508
508
  for (size_t i = 0; i < n; i++)
509
509
  // CalcInverse (mat(i,i), dinv(i));
@@ -528,7 +528,7 @@ namespace ngbla
528
528
  {
529
529
  size_t n = mat.Height();
530
530
  STACK_ARRAY(T,mem, n);
531
- FlatVector<T> dinv(n, &mem);
531
+ FlatVector<T> dinv(n, &mem[0]);
532
532
 
533
533
  for (size_t i = 0; i < n; i++)
534
534
  {
netgen/include/h1amg.hpp CHANGED
@@ -1,9 +1,10 @@
1
- #ifndef H1AMG_HPP_
2
- #define H1AMG_HPP_
1
+ #ifndef H1AMGxx_HPP_
2
+ #define H1AMGxx_HPP_
3
3
 
4
4
  // #include <la.hpp>
5
5
  #include <basematrix.hpp>
6
6
  #include <sparsematrix.hpp>
7
+ #include <preconditioner.hpp>
7
8
 
8
9
  namespace ngcomp
9
10
  {
@@ -36,6 +37,65 @@ namespace ngcomp
36
37
 
37
38
  virtual void Mult (const ngla::BaseVector & b, ngla::BaseVector & x) const override;
38
39
  };
40
+
41
+
42
+
43
+
44
+
45
+ template <class SCAL>
46
+ class H1AMG_Preconditioner : public Preconditioner
47
+ {
48
+ shared_ptr<BitArray> freedofs;
49
+ shared_ptr<H1AMG_Matrix<SCAL>> mat;
50
+
51
+ ParallelHashTable<IVec<2>,double> edge_weights_ht;
52
+ ParallelHashTable<IVec<1>,double> vertex_weights_ht;
53
+
54
+ public:
55
+
56
+ static shared_ptr<Preconditioner> CreateBF (shared_ptr<BilinearForm> bfa, const Flags & flags, const string & name)
57
+ {
58
+ if (bfa->GetFESpace()->IsComplex())
59
+ return make_shared<H1AMG_Preconditioner<Complex>> (bfa, flags, name);
60
+ else
61
+ return make_shared<H1AMG_Preconditioner<double>> (bfa, flags, name);
62
+ }
63
+
64
+ static DocInfo GetDocu ();
65
+
66
+ H1AMG_Preconditioner (shared_ptr<BilinearForm> abfa, const Flags & aflags,
67
+ const string aname = "H1AMG_cprecond")
68
+ : Preconditioner (abfa, aflags, aname)
69
+ {
70
+ if (is_same<SCAL,double>::value)
71
+ cout << IM(3) << "Create H1AMG" << endl;
72
+ else
73
+ cout << IM(3) << "Create H1AMG, complex" << endl;
74
+ }
75
+
76
+ virtual void InitLevel (shared_ptr<BitArray> _freedofs) override
77
+ {
78
+ freedofs = _freedofs;
79
+ }
80
+
81
+ virtual void FinalizeLevel (const BaseMatrix * matrix) override;
82
+
83
+ virtual void AddElementMatrix (FlatArray<int> dnums,
84
+ FlatMatrix<SCAL> elmat,
85
+ ElementId id,
86
+ LocalHeap & lh) override;
87
+
88
+ virtual void Update () override { ; }
89
+
90
+ virtual const BaseMatrix & GetMatrix() const override
91
+ {
92
+ return *mat;
93
+ }
94
+
95
+ };
96
+
97
+
98
+
39
99
  }
40
100
 
41
101
  #endif // H1AMG_HPP_
@@ -179,6 +179,14 @@ public:
179
179
  {
180
180
  return static_cast<const FEL&> (fel);
181
181
  }
182
+ static int DimRef() { return D-1; }
183
+
184
+ template <typename IP, typename MAT>
185
+ static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
186
+ MAT && mat, LocalHeap & lh)
187
+ {
188
+ Cast(fel).CalcShape (ip, Trans(mat));
189
+ }
182
190
 
183
191
  template <typename AFEL, typename MIP, typename MAT>
184
192
  static void GenerateMatrix (const AFEL & fel, const MIP & mip,
@@ -188,6 +196,13 @@ public:
188
196
  Trans (Cast(fel).GetShape(mip.IP(),lh));
189
197
  }
190
198
 
199
+ template <typename MIP, typename MAT>
200
+ static void CalcTransformationMatrix (const MIP & bmip,
201
+ MAT & mat, LocalHeap & lh)
202
+ {
203
+ auto & mip = static_cast<const MappedIntegrationPoint<D-1,D>&>(bmip);
204
+ mat = 1./mip.GetJacobiDet() * mip.GetJacobian();
205
+ }
191
206
  /*
192
207
  template <typename AFEL, typename MIP, class TVX, class TVY>
193
208
  static void ApplyTrans (const AFEL & fel, const MIP & mip,
@@ -781,20 +781,14 @@ namespace ngfem
781
781
  const FiniteElement & volumefel2, int LocalFacetNr2,
782
782
  const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
783
783
  FlatVector<double> elx, FlatVector<double> ely,
784
- LocalHeap & lh) const
785
- {
786
- throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for inner facets not implemented!");
787
- }
784
+ LocalHeap & lh) const;
788
785
  virtual void
789
786
  ApplyFacetMatrix (const FiniteElement & volumefel1, int LocalFacetNr1,
790
787
  const ElementTransformation & eltrans1, FlatArray<int> & ElVertices1,
791
788
  const FiniteElement & volumefel2, int LocalFacetNr2,
792
789
  const ElementTransformation & eltrans2, FlatArray<int> & ElVertices2,
793
790
  FlatVector<Complex> elx, FlatVector<Complex> ely,
794
- LocalHeap & lh) const
795
- {
796
- throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for inner facets not implemented!");
797
- }
791
+ LocalHeap & lh) const;
798
792
 
799
793
 
800
794
  virtual void
@@ -841,19 +835,13 @@ namespace ngfem
841
835
  const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
842
836
  const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
843
837
  FlatVector<double> elx, FlatVector<double> ely,
844
- LocalHeap & lh) const
845
- {
846
- throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
847
- }
838
+ LocalHeap & lh) const;
848
839
  virtual void
849
840
  ApplyFacetMatrix (const FiniteElement & volumefel, int LocalFacetNr,
850
841
  const ElementTransformation & eltrans, FlatArray<int> & ElVertices,
851
842
  const ElementTransformation & seltrans, FlatArray<int> & SElVertices,
852
843
  FlatVector<Complex> elx, FlatVector<Complex> ely,
853
- LocalHeap & lh) const
854
- {
855
- throw Exception ("FacetBilinearFormIntegrator::ApplyFacetMatrix for boundary facets not implemented!");
856
- }
844
+ LocalHeap & lh) const;
857
845
 
858
846
 
859
847
  // calculate traces in integration points
@@ -1525,7 +1525,8 @@ namespace ngfem
1525
1525
  else
1526
1526
  incr = 0;
1527
1527
  }
1528
-
1528
+
1529
+ virtual ~MappedIntegrationRule() { }
1529
1530
  INLINE MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE> & operator[] (size_t i) const
1530
1531
  {
1531
1532
  // return mips[i];
netgen/include/jacobi.hpp CHANGED
@@ -17,13 +17,30 @@ namespace ngla
17
17
  Jacobi and Gauss Seidel smoother
18
18
  for scalar, block and system matrices
19
19
  */
20
+
21
+ class BaseMSMPrecond : virtual public BaseMatrix
22
+ {
23
+ public:
24
+ virtual void Smooth (BaseVector & x, const BaseVector & b, int steps = 1) const = 0;
25
+ virtual void SmoothBack (BaseVector & x, const BaseVector & b, int steps = 1) const = 0;
26
+ };
20
27
 
21
- class BaseJacobiPrecond : virtual public BaseMatrix
28
+
29
+ class BaseJacobiPrecond : public BaseMSMPrecond
22
30
  {
23
31
  public:
24
- virtual void GSSmooth (BaseVector & x, const BaseVector & b) const = 0;
32
+ virtual void Smooth (BaseVector & x, const BaseVector & b, int steps = 1) const override
33
+ {
34
+ GSSmooth (x, b, steps);
35
+ }
36
+ virtual void SmoothBack (BaseVector & x, const BaseVector & b, int steps = 1) const override
37
+ {
38
+ GSSmoothBack (x, b, steps);
39
+ }
40
+
41
+ virtual void GSSmooth (BaseVector & x, const BaseVector & b, int steps = 1) const = 0;
25
42
  virtual void GSSmooth (BaseVector & x, const BaseVector & b, BaseVector & y) const = 0;
26
- virtual void GSSmoothBack (BaseVector & x, const BaseVector & b) const = 0;
43
+ virtual void GSSmoothBack (BaseVector & x, const BaseVector & b, int steps = 1) const = 0;
27
44
  };
28
45
 
29
46
 
@@ -31,7 +48,7 @@ namespace ngla
31
48
  {
32
49
  shared_ptr<BaseJacobiPrecond> jac;
33
50
  public:
34
- SymmetricGaussSeidelPrecond (const BaseSparseMatrix & mat, shared_ptr<BitArray> freedofs);
51
+ SymmetricGaussSeidelPrecond (shared_ptr<BaseSparseMatrix> mat, shared_ptr<BitArray> freedofs);
35
52
  int VHeight() const override { return jac->VHeight(); }
36
53
  int VWidth() const override { return jac->VHeight(); }
37
54
 
@@ -44,11 +61,11 @@ namespace ngla
44
61
 
45
62
  /// A Jaboci preconditioner for general sparse matrices
46
63
  template <class TM, class TV_ROW, class TV_COL>
47
- class JacobiPrecond : virtual public BaseJacobiPrecond,
48
- virtual public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
64
+ class JacobiPrecond : public BaseJacobiPrecond,
65
+ public S_BaseMatrix<typename mat_traits<TM>::TSCAL>
49
66
  {
50
67
  protected:
51
- const SparseMatrix<TM,TV_ROW,TV_COL> & mat;
68
+ shared_ptr<SparseMatrix<TM,TV_ROW,TV_COL>> mat;
52
69
  ///
53
70
  shared_ptr<BitArray> inner;
54
71
  ///
@@ -60,7 +77,7 @@ namespace ngla
60
77
  typedef typename mat_traits<TM>::TSCAL TSCAL;
61
78
 
62
79
  ///
63
- JacobiPrecond (const SparseMatrix<TM,TV_ROW,TV_COL> & amat,
80
+ JacobiPrecond (shared_ptr<SparseMatrix<TM,TV_ROW,TV_COL>> amat,
64
81
  shared_ptr<BitArray> ainner = nullptr, bool use_par = true);
65
82
 
66
83
  int VHeight() const override { return height; }
@@ -74,20 +91,20 @@ namespace ngla
74
91
  void MultTransAdd (TSCAL s, const BaseVector & x, BaseVector & y) const override
75
92
  { MultAdd (s, x, y); }
76
93
  ///
77
- AutoVector CreateRowVector() const override { return mat.CreateColVector(); }
78
- AutoVector CreateColVector() const override { return mat.CreateRowVector(); }
94
+ AutoVector CreateRowVector() const override { return mat->CreateColVector(); }
95
+ AutoVector CreateColVector() const override { return mat->CreateRowVector(); }
79
96
  ///
80
- void GSSmooth (BaseVector & x, const BaseVector & b) const override;
97
+ void GSSmooth (BaseVector & x, const BaseVector & b, int steps) const override;
81
98
 
82
99
  /// computes partial residual y
83
100
  void GSSmooth (BaseVector & x, const BaseVector & b, BaseVector & y) const override
84
101
  {
85
- GSSmooth (x, b);
102
+ GSSmooth (x, b, 1);
86
103
  }
87
104
 
88
105
 
89
106
  ///
90
- void GSSmoothBack (BaseVector & x, const BaseVector & b) const override;
107
+ void GSSmoothBack (BaseVector & x, const BaseVector & b, int steps) const override;
91
108
 
92
109
  ///
93
110
  virtual void GSSmoothNumbering (BaseVector & x, const BaseVector & b,
@@ -111,23 +128,23 @@ namespace ngla
111
128
  typedef TV TVX;
112
129
 
113
130
  ///
114
- JacobiPrecondSymmetric (const SparseMatrixSymmetric<TM,TV> & amat,
131
+ JacobiPrecondSymmetric (shared_ptr<SparseMatrixSymmetric<TM,TV>> amat,
115
132
  shared_ptr<BitArray> ainner = nullptr, bool use_par = true);
116
133
 
117
134
  ///
118
- virtual void GSSmooth (BaseVector & x, const BaseVector & b) const;
135
+ virtual void GSSmooth (BaseVector & x, const BaseVector & b, int steps) const override;
119
136
 
120
137
  /// computes partial residual y
121
- virtual void GSSmooth (BaseVector & x, const BaseVector & b, BaseVector & y /* , BaseVector & help */) const;
138
+ virtual void GSSmooth (BaseVector & x, const BaseVector & b, BaseVector & y /* , BaseVector & help */) const override;
122
139
 
123
140
  ///
124
- virtual void GSSmoothBack (BaseVector & x, const BaseVector & b) const;
141
+ virtual void GSSmoothBack (BaseVector & x, const BaseVector & b, int steps) const override;
125
142
  virtual void GSSmoothBack (BaseVector & x, const BaseVector & b, BaseVector & y) const;
126
143
 
127
144
  ///
128
145
  virtual void GSSmoothNumbering (BaseVector & x, const BaseVector & b,
129
146
  const Array<int> & numbering,
130
- int forward = 1) const;
147
+ int forward = 1) const override;
131
148
  };
132
149
 
133
150
  }
@@ -1029,11 +1029,12 @@ namespace ngcomp
1029
1029
  ElementId FindElementOfPoint (FlatVector<double> point,
1030
1030
  IntegrationPoint & ip,
1031
1031
  bool build_searchtree,
1032
- const Array<int> * const indices = NULL) const;
1032
+ const Array<int> * const indices = NULL,
1033
+ double tol = 1e-4) const;
1033
1034
  ElementId FindElementOfPoint (FlatVector<double> point,
1034
1035
  IntegrationPoint & ip,
1035
1036
  bool build_searchtree,
1036
- int index) const;
1037
+ int index, double tol = 1e-4) const;
1037
1038
  int FindSurfaceElementOfPoint (FlatVector<double> point,
1038
1039
  IntegrationPoint & ip,
1039
1040
  bool build_searchtree,
@@ -0,0 +1,140 @@
1
+ #ifndef MP_COEFFICIENT
2
+ #define MP_COEFFICIENT
3
+
4
+
5
+ #include "mptools.hpp"
6
+
7
+ namespace ngsbem
8
+ {
9
+
10
+
11
+ // ******************** Coefficient Functions *********************
12
+
13
+
14
+ class SphericalHarmonicsCF : public CoefficientFunction
15
+ {
16
+ SphericalHarmonics<Complex> sh;
17
+ public:
18
+ SphericalHarmonicsCF (int order)
19
+ : CoefficientFunction(1, true), sh(order) { }
20
+ Complex & Coef(int n, int m) { return sh.Coef(n,m); }
21
+
22
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
23
+ { throw Exception("real eval not available"); }
24
+
25
+ virtual void Evaluate (const BaseMappedIntegrationPoint & mip, FlatVector<Complex> values) const override
26
+ {
27
+ values(0) = sh.Eval(mip.GetPoint());
28
+ }
29
+
30
+ virtual void Evaluate (const BaseMappedIntegrationRule & ir, BareSliceMatrix<Complex> values) const override
31
+ {
32
+ for (int i = 0; i < ir.Size(); i++)
33
+ {
34
+ auto & mip = ir[i];
35
+ values(i,0) = sh.Eval(mip.GetPoint());
36
+ }
37
+ }
38
+
39
+ auto & SH() { return sh; }
40
+ };
41
+
42
+
43
+
44
+ template <typename entry_type> class RegularMLMultiPoleCF;
45
+
46
+
47
+ template <typename RADIAL, typename entry_type=Complex>
48
+ class MultiPoleCF : public CoefficientFunction
49
+ {
50
+ MultiPole<RADIAL, entry_type> mp;
51
+ Vec<3> center;
52
+ public:
53
+ MultiPoleCF (int order, double kappa, Vec<3> acenter, double rtyp = 1)
54
+ : CoefficientFunction(sizeof(entry_type)/sizeof(Complex), true), mp(order, kappa, rtyp), center(acenter) { }
55
+
56
+ entry_type & Coef(int n, int m) { return mp.Coef(n,m); }
57
+ auto & SH() { return mp.SH(); }
58
+ auto & MP() { return mp; }
59
+ Vec<3> Center() const { return center; }
60
+
61
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
62
+ { throw Exception("real eval not available"); }
63
+
64
+ virtual void Evaluate (const BaseMappedIntegrationPoint & mip, FlatVector<Complex> values) const override
65
+ {
66
+ if constexpr (std::is_same<entry_type, Complex>())
67
+ values(0) = mp.Eval(mip.GetPoint()-center);
68
+ else
69
+ values = mp.Eval(mip.GetPoint()-center);
70
+ }
71
+
72
+ template <typename TARGET>
73
+ void ShiftZ (double z, MultiPole<TARGET, entry_type> & target) { mp.ShiftZ(z, target); }
74
+
75
+ using CoefficientFunction::Transform;
76
+ template <typename TARGET>
77
+ void Transform (MultiPoleCF<TARGET, entry_type> & target)
78
+ {
79
+ mp.Transform (target.MP(), target.Center()-center);
80
+ }
81
+ };
82
+
83
+ template <typename entry_type>
84
+ class SingularMLMultiPoleCF : public CoefficientFunction
85
+ {
86
+ shared_ptr<SingularMLMultiPole<entry_type>> mlmp;
87
+ public:
88
+ SingularMLMultiPoleCF (Vec<3> center, double r, double kappa)
89
+ : CoefficientFunction(sizeof(entry_type)/sizeof(Complex), true), mlmp{make_shared<SingularMLMultiPole<entry_type>>(center, r, kappa)} { }
90
+
91
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
92
+ { throw Exception("real eval not available"); }
93
+
94
+ virtual void Evaluate (const BaseMappedIntegrationPoint & mip, FlatVector<Complex> values) const override
95
+ {
96
+ // values(0) = mlmp->Evaluate(mip.GetPoint());
97
+
98
+ if constexpr (std::is_same<entry_type, Complex>())
99
+ values(0) = mlmp->Evaluate(mip.GetPoint());
100
+ else
101
+ values = mlmp->Evaluate(mip.GetPoint());
102
+
103
+
104
+ }
105
+
106
+ shared_ptr<SingularMLMultiPole<entry_type>> MLMP() const { return mlmp; }
107
+ shared_ptr<RegularMLMultiPoleCF<entry_type>> CreateRegularExpansion(Vec<3> center, double r) const;
108
+ };
109
+
110
+
111
+ template <typename entry_type>
112
+ class RegularMLMultiPoleCF : public CoefficientFunction
113
+ {
114
+ shared_ptr<RegularMLMultiPole<entry_type>> mlmp;
115
+ public:
116
+ RegularMLMultiPoleCF (shared_ptr<SingularMLMultiPoleCF<entry_type>> asingmp, Vec<3> center, double r)
117
+ : CoefficientFunction(sizeof(entry_type)/sizeof(Complex), true), mlmp{make_shared<RegularMLMultiPole<entry_type>>(asingmp->MLMP(), center, r)} { }
118
+ RegularMLMultiPoleCF (shared_ptr<SingularMLMultiPole<entry_type>> asingmp, Vec<3> center, double r)
119
+ : CoefficientFunction(sizeof(entry_type)/sizeof(Complex), true), mlmp{make_shared<RegularMLMultiPole<entry_type>>(asingmp, center, r)} { }
120
+
121
+ virtual double Evaluate (const BaseMappedIntegrationPoint & ip) const override
122
+ { throw Exception("real eval not available"); }
123
+
124
+ virtual void Evaluate (const BaseMappedIntegrationPoint & mip, FlatVector<Complex> values) const override
125
+ {
126
+ // values(0) = mlmp->Evaluate(mip.GetPoint());
127
+
128
+ if constexpr (std::is_same<entry_type, Complex>())
129
+ values(0) = mlmp->Evaluate(mip.GetPoint());
130
+ else
131
+ values = mlmp->Evaluate(mip.GetPoint());
132
+ }
133
+
134
+ shared_ptr<RegularMLMultiPole<entry_type>> MLMP() { return mlmp; }
135
+ };
136
+
137
+
138
+ }
139
+
140
+ #endif