ngsolve 6.2.2404.post156.dev0__cp39-cp39-win_amd64.whl → 6.2.2406.post112.dev1__cp39-cp39-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 (134) hide show
  1. netgen/include/arnoldi.hpp +3 -0
  2. netgen/include/basematrix.hpp +27 -22
  3. netgen/include/basevector.hpp +43 -71
  4. netgen/include/bdbequations.hpp +14 -3
  5. netgen/include/bilinearform.hpp +8 -59
  6. netgen/include/blockjacobi.hpp +4 -0
  7. netgen/include/cg.hpp +3 -0
  8. netgen/include/chebyshev.hpp +3 -0
  9. netgen/include/coefficient.hpp +6 -2
  10. netgen/include/comp.hpp +0 -4
  11. netgen/include/diagonalmatrix.hpp +154 -0
  12. netgen/include/dump.hpp +5 -5
  13. netgen/include/eigen.hpp +3 -0
  14. netgen/include/elementbyelement.hpp +6 -0
  15. netgen/include/elementtopology.hpp +0 -3
  16. netgen/include/expr.hpp +13 -8
  17. netgen/include/fespace.hpp +12 -14
  18. netgen/include/finiteelement.hpp +7 -7
  19. netgen/include/globalspace.hpp +28 -2
  20. netgen/include/gridfunction.hpp +4 -0
  21. netgen/include/h1amg.hpp +3 -1
  22. netgen/include/h1hofe.hpp +1 -1
  23. netgen/include/hcurlhdivfes.hpp +2 -0
  24. netgen/include/hcurlhofespace.hpp +4 -3
  25. netgen/include/hdivfes.hpp +3 -3
  26. netgen/include/hdivhosurfacefespace.hpp +3 -3
  27. netgen/include/intrule.hpp +15 -1
  28. netgen/include/jacobi.hpp +3 -0
  29. netgen/include/la.hpp +1 -13
  30. netgen/include/matrix.hpp +21 -0
  31. netgen/include/meshaccess.hpp +24 -51
  32. netgen/include/mgpre.hpp +1 -1
  33. netgen/include/mptools.hpp +1 -2
  34. netgen/include/multivector.hpp +2 -0
  35. netgen/include/ngsobject.hpp +1 -1
  36. netgen/include/nodalhofe.hpp +3 -0
  37. netgen/include/normalfacetfespace.hpp +4 -5
  38. netgen/include/normalfacetsurfacefespace.hpp +1 -1
  39. netgen/include/order.hpp +3 -1
  40. netgen/include/parallel_matrices.hpp +5 -0
  41. netgen/include/paralleldofs.hpp +44 -95
  42. netgen/include/parallelngs.hpp +2 -1
  43. netgen/include/parallelvector.hpp +12 -16
  44. netgen/include/pardisoinverse.hpp +1 -0
  45. netgen/include/periodic.hpp +1 -0
  46. netgen/include/pmltrafo.hpp +5 -2
  47. netgen/include/preconditioner.hpp +3 -1
  48. netgen/include/scalarfe.hpp +4 -1
  49. netgen/include/sparsecholesky.hpp +4 -0
  50. netgen/include/sparsematrix.hpp +18 -45
  51. netgen/include/sparsematrix_dyn.hpp +2 -0
  52. netgen/include/sparsematrix_impl.hpp +66 -1
  53. netgen/include/special_matrix.hpp +7 -138
  54. netgen/include/statushandler.hpp +7 -0
  55. netgen/include/symbolicintegrator.hpp +2 -1
  56. netgen/include/tensorcoefficient.hpp +56 -54
  57. netgen/include/tpdiffop.hpp +1 -0
  58. netgen/include/tpintrule.hpp +2 -0
  59. netgen/include/umfpackinverse.hpp +58 -30
  60. netgen/include/vector.hpp +6 -1
  61. netgen/include/voxelcoefficientfunction.hpp +2 -0
  62. netgen/include/vvector.hpp +10 -1
  63. netgen/lib/libngsolve.lib +0 -0
  64. netgen/libngsolve.dll +0 -0
  65. ngsolve/_scikit_build_core_dependencies.py +8 -1
  66. ngsolve/cmake/NGSolveConfig.cmake +1 -1
  67. ngsolve/config/config.py +6 -6
  68. ngsolve/config.py +6 -6
  69. ngsolve/demos/TensorProduct/__init__.py +0 -0
  70. ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
  71. ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
  72. ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
  73. ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
  74. ngsolve/demos/__init__.py +0 -0
  75. ngsolve/demos/howto/__init__.py +0 -0
  76. ngsolve/demos/howto/hhj.py +44 -0
  77. ngsolve/demos/howto/hybrid_dg.py +53 -0
  78. ngsolve/demos/howto/mixed.py +30 -0
  79. ngsolve/demos/howto/nonlin.py +29 -0
  80. ngsolve/demos/howto/pickling.py +26 -0
  81. ngsolve/demos/howto/pml.py +31 -0
  82. ngsolve/demos/howto/taskmanager.py +20 -0
  83. ngsolve/demos/howto/tdnns.py +47 -0
  84. ngsolve/demos/howto/timeDG-skeleton.py +45 -0
  85. ngsolve/demos/howto/timeDG.py +38 -0
  86. ngsolve/demos/howto/timeDGlap.py +42 -0
  87. ngsolve/demos/howto/timeDGwave.py +61 -0
  88. ngsolve/demos/intro/__init__.py +0 -0
  89. ngsolve/demos/intro/adaptive.py +123 -0
  90. ngsolve/demos/intro/cmagnet.py +62 -0
  91. ngsolve/demos/intro/elasticity.py +76 -0
  92. ngsolve/demos/intro/navierstokes.py +74 -0
  93. ngsolve/demos/intro/poisson.ipynb +170 -0
  94. ngsolve/demos/intro/poisson.py +41 -0
  95. ngsolve/demos/mpi/__init__.py +0 -0
  96. ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
  97. ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
  98. ngsolve/demos/mpi/mpi_poisson.py +89 -0
  99. ngsolve/demos/mpi/mpi_timeDG.py +82 -0
  100. ngsolve/ngslib.pyd +0 -0
  101. {ngsolve-6.2.2404.post156.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/METADATA +2 -2
  102. {ngsolve-6.2.2404.post156.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/RECORD +134 -102
  103. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/Scripts/ngsolve.tcl +0 -0
  104. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/beam.geo +0 -0
  105. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/beam.vol +0 -0
  106. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/chip.in2d +0 -0
  107. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/chip.vol +0 -0
  108. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coil.geo +0 -0
  109. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coil.vol +0 -0
  110. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coilshield.geo +0 -0
  111. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coilshield.vol +0 -0
  112. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/cube.geo +0 -0
  113. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/cube.vol +0 -0
  114. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
  115. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
  116. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d1_square.pde +0 -0
  117. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d2_chip.pde +0 -0
  118. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
  119. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d4_cube.pde +0 -0
  120. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d5_beam.pde +0 -0
  121. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d6_shaft.pde +0 -0
  122. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d7_coil.pde +0 -0
  123. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
  124. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
  125. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
  126. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/doubleglazing.vol +0 -0
  127. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  128. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/shaft.geo +0 -0
  129. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/shaft.vol +0 -0
  130. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/square.in2d +0 -0
  131. {ngsolve-6.2.2404.post156.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/square.vol +0 -0
  132. {ngsolve-6.2.2404.post156.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/LICENSE +0 -0
  133. {ngsolve-6.2.2404.post156.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/WHEEL +0 -0
  134. {ngsolve-6.2.2404.post156.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/top_level.txt +0 -0
@@ -7,16 +7,13 @@
7
7
  /* Date: 2007,2011 */
8
8
  /* ************************************************************************/
9
9
 
10
-
11
-
12
- // #ifdef PARALLEL
10
+ #include <vvector.hpp>
11
+ #include <multivector.hpp>
12
+ #include <paralleldofs.hpp>
13
13
 
14
14
  namespace ngla
15
15
  {
16
- // using ngparallel::ParallelDofs;
17
- // using ngla::ParallelDofs;
18
-
19
-
16
+
20
17
  class NGS_DLL_HEADER ParallelBaseVector : virtual public BaseVector
21
18
  {
22
19
  protected:
@@ -24,8 +21,8 @@ namespace ngla
24
21
  shared_ptr<ParallelDofs> paralleldofs;
25
22
  shared_ptr<BaseVector> local_vec;
26
23
 
27
- Array<NG_MPI_Request> sreqs;
28
- Array<NG_MPI_Request> rreqs;
24
+ mutable NgMPI_Requests sreqs;
25
+ mutable NgMPI_Requests rreqs;
29
26
 
30
27
  public:
31
28
  ParallelBaseVector ()
@@ -86,10 +83,10 @@ namespace ngla
86
83
  virtual void Distribute() const override = 0;
87
84
  // { cerr << "ERROR -- Distribute called for BaseVector, is not parallel" << endl; }
88
85
 
89
- virtual void ISend ( int dest, NG_MPI_Request & request ) const;
86
+ virtual NgMPI_Request ISend ( int dest ) const;
90
87
  // virtual void Send ( int dest ) const;
91
88
 
92
- virtual void IRecvVec ( int dest, NG_MPI_Request & request ) = 0;
89
+ virtual NgMPI_Request IRecvVec ( int dest ) = 0;
93
90
  // { cerr << "ERROR -- IRecvVec called for BaseVector, is not parallel" << endl; }
94
91
 
95
92
  // virtual void RecvVec ( int dest )
@@ -105,7 +102,6 @@ namespace ngla
105
102
 
106
103
 
107
104
 
108
-
109
105
  inline ParallelBaseVector * dynamic_cast_ParallelBaseVector (BaseVector * x)
110
106
  {
111
107
  // cout << "my dynamic * cast" << endl;
@@ -126,7 +122,7 @@ namespace ngla
126
122
  }
127
123
  return dynamic_cast<const ParallelBaseVector*> (x);
128
124
  }
129
-
125
+
130
126
  inline ParallelBaseVector & dynamic_cast_ParallelBaseVector (BaseVector & x)
131
127
  {
132
128
  // cout << "my dynamic cast" << endl;
@@ -135,6 +131,7 @@ namespace ngla
135
131
  return dynamic_cast<ParallelBaseVector&> (**ax);
136
132
  return dynamic_cast<ParallelBaseVector&> (x);
137
133
  }
134
+
138
135
  inline const ParallelBaseVector & dynamic_cast_ParallelBaseVector (const BaseVector & x)
139
136
  {
140
137
  // cout << "my dynamic cast" << endl;
@@ -175,7 +172,7 @@ namespace ngla
175
172
  using ParallelBaseVector :: sreqs;
176
173
  using ParallelBaseVector :: rreqs;
177
174
 
178
- Table<SCAL> * recvvalues;
175
+ Table<SCAL> recvvalues;
179
176
 
180
177
  using S_BaseVectorPtr<TSCAL> :: pdata;
181
178
  using ParallelBaseVector :: local_vec;
@@ -192,7 +189,7 @@ namespace ngla
192
189
  virtual AutoVector Range (T_Range<size_t> range) const override;
193
190
  virtual AutoVector Range (DofRange range) const override;
194
191
 
195
- virtual void IRecvVec ( int dest, NG_MPI_Request & request ) override;
192
+ virtual NgMPI_Request IRecvVec ( int dest ) override;
196
193
  // virtual void RecvVec ( int dest );
197
194
  virtual void AddRecvValues( int sender ) override;
198
195
  virtual AutoVector CreateVector () const override;
@@ -269,5 +266,4 @@ namespace ngla
269
266
 
270
267
  }
271
268
 
272
- // #endif
273
269
  #endif
@@ -15,6 +15,7 @@
15
15
 
16
16
  ////////////////////////////////////////////////////////////////////////////////
17
17
 
18
+ #include "sparsecholesky.hpp" // for SparseFactorization
18
19
 
19
20
  namespace ngla
20
21
  {
@@ -80,6 +80,7 @@ namespace ngcomp
80
80
  { space->VTransformVC(ei, vec, tt); }
81
81
 
82
82
  auto & GetVertexMap() const { return vertex_map; }
83
+ auto & GetDofMap() const { return dofmap; }
83
84
  protected:
84
85
  // overload in quasiperiodic space
85
86
  virtual void DofMapped(size_t from, size_t to, size_t idnr) { ; }
@@ -298,13 +298,16 @@ namespace ngcomp
298
298
  Complex alpha;
299
299
  public:
300
300
 
301
- CartesianPML_Transformation(FlatMatrix<double> _bounds, Complex _alpha)
302
- : PML_TransformationDim<DIM>(), alpha(_alpha)
301
+ CartesianPML_Transformation(Mat<DIM,2> _bounds, Complex _alpha)
302
+ : PML_TransformationDim<DIM>(), bounds(_bounds), alpha(_alpha)
303
303
  {
304
+ /*
304
305
  bounds = 0.;
305
306
  for (int i : Range(min(int(_bounds.Height()),DIM)))
306
307
  for (int j : Range(min(int(_bounds.Width()),2)))
307
308
  bounds(i,j)=_bounds(i,j);
309
+ */
310
+ ;
308
311
  }
309
312
 
310
313
  ~CartesianPML_Transformation() {;}
@@ -7,8 +7,10 @@
7
7
  /* Date: 10. Jul. 2000 */
8
8
  /*********************************************************************/
9
9
 
10
- #include <la.hpp>
10
+ // #include <la.hpp>
11
+ #include <basematrix.hpp>
11
12
  #include <mgpre.hpp>
13
+ #include <chebyshev.hpp>
12
14
 
13
15
  namespace ngcomp
14
16
  {
@@ -288,6 +288,9 @@ namespace ngfem
288
288
  {
289
289
  for (int i = 0; i < avnums.Size(); i++) vnums[i] = avnums[i];
290
290
  }
291
+ DGFiniteElement * SetVertexNumbers (FlatArray<int> vnums) override
292
+ { VertexOrientedFE<ET>::SetVertexNumbers(vnums); return this; }
293
+
291
294
 
292
295
  /// assign vertex number
293
296
  void SetVertexNumber (int nr, int vnum) { vnums[nr] = vnum; }
@@ -301,7 +304,7 @@ namespace ngfem
301
304
  NGS_DLL_HEADER void CalcTraceMatrix (int facet, FlatMatrix<> trace) const;
302
305
  NGS_DLL_HEADER void CalcGradientMatrix (FlatMatrix<> gmat) const;
303
306
 
304
- HD NGS_DLL_HEADER virtual void GetDiagMassMatrix (FlatVector<> mass) const;
307
+ HD NGS_DLL_HEADER virtual void GetDiagMassMatrix (FlatVector<> mass) const override;
305
308
 
306
309
  NGS_DLL_HEADER virtual void GetGradient (FlatVector<> coefs, FlatMatrixFixWidth<D> grad) const;
307
310
  NGS_DLL_HEADER virtual void GetGradientTrans (FlatMatrixFixWidth<D> grad, FlatVector<> coefs) const;
@@ -11,6 +11,10 @@
11
11
  sparse cholesky factorization
12
12
  */
13
13
 
14
+ #include "basematrix.hpp"
15
+ #include "sparsematrix.hpp"
16
+ #include "order.hpp"
17
+
14
18
  namespace ngla
15
19
  {
16
20
 
@@ -8,6 +8,9 @@
8
8
  /**************************************************************************/
9
9
 
10
10
 
11
+ #include "vvector.hpp"
12
+ #include "basematrix.hpp"
13
+
11
14
  namespace ngla
12
15
  {
13
16
 
@@ -149,6 +152,9 @@ namespace ngla
149
152
  void CalcBalancing ();
150
153
  const Partitioning & GetBalancing() const { return balance; }
151
154
 
155
+ void EmbedHeight (size_t starti, size_t newheight);
156
+ void EmbedWidth (size_t starti, size_t newwidth);
157
+
152
158
  ostream & Print (ostream & ost) const;
153
159
 
154
160
  virtual Array<MemoryUsage> GetMemoryUsage () const;
@@ -233,9 +239,9 @@ namespace ngla
233
239
  return *this;
234
240
  }
235
241
 
236
- virtual shared_ptr<BaseMatrix> CreateSparseMatrix() const override
242
+ virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override
237
243
  {
238
- return const_cast<BaseSparseMatrix*>(this)->shared_from_this();
244
+ return dynamic_pointer_cast<BaseSparseMatrix>(const_cast<BaseSparseMatrix*>(this)->shared_from_this());
239
245
  }
240
246
 
241
247
  virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner = nullptr) const
@@ -338,6 +344,8 @@ namespace ngla
338
344
  {
339
345
  return asvec;
340
346
  }
347
+
348
+ // tuple<int,int> EntryShape() const { return { entry_height, entry_width }; }
341
349
 
342
350
  FlatVector<TSCAL> GetRowValue (int row, int j)
343
351
  {
@@ -345,9 +353,10 @@ namespace ngla
345
353
  return FlatVector<TSCAL> (entry_size, p);
346
354
  }
347
355
 
348
- FlatMatrix<TSCAL> GetRowValueMat (int row, int j)
356
+ FlatMatrix<TSCAL> GetRowValueMat (int row, int j) const
349
357
  {
350
- TSCAL * p = asvec(entry_size * (firsti[row] + j)).Data(0);
358
+ // TSCAL * p = asvec(entry_size * (firsti[row] + j)).Data(0);
359
+ TSCAL * p = &asvec(entry_size * (firsti[row] + j));
351
360
  return FlatMatrix<TSCAL> (entry_height, entry_width, p);
352
361
  }
353
362
  };
@@ -552,7 +561,7 @@ namespace ngla
552
561
  virtual tuple<int,int> EntrySizes() const override { return { ngbla::Height<TM>(), ngbla::Width<TM>() }; }
553
562
 
554
563
  shared_ptr<BaseSparseMatrix>
555
- CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(Trans(TM()))>>(const Array<int>&, int)> & creator) const;
564
+ CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(ngbla::Trans(TM()))>>(const Array<int>&, int)> & creator) const;
556
565
 
557
566
  public:
558
567
  using BaseMatrix::GetMemoryTracer;
@@ -613,37 +622,13 @@ namespace ngla
613
622
  { return { string("SparseMatrix")+typeid(TM).name(), this->Height(), this->Width() }; }
614
623
 
615
624
  virtual shared_ptr<BaseJacobiPrecond>
616
- CreateJacobiPrecond (shared_ptr<BitArray> inner) const override
617
- {
618
- // if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
619
- if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
620
- else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
621
- throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(mat_traits<TM>::HEIGHT));
622
- return nullptr;
623
- }
624
- else return make_shared<JacobiPrecond<TM,TV_ROW,TV_COL>> (*this, inner);
625
- }
625
+ CreateJacobiPrecond (shared_ptr<BitArray> inner) const override;
626
626
 
627
627
  virtual shared_ptr<BaseBlockJacobiPrecond>
628
628
  CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
629
629
  const BaseVector * constraint = 0,
630
630
  bool parallel = 1,
631
- shared_ptr<BitArray> freedofs = NULL) const override
632
- {
633
- // if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
634
- if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
635
- else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
636
- throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(ngbla::Height<TM>()));
637
- return nullptr;
638
- }
639
- else
640
- // return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>> (*this, blocks, parallel);
641
-
642
- return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>>
643
- ( dynamic_pointer_cast<const SparseMatrix>
644
- (this->shared_from_this()),
645
- blocks, parallel);
646
- }
631
+ shared_ptr<BitArray> freedofs = NULL) const override;
647
632
 
648
633
  virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
649
634
  virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<const Array<int>> clusters) const override;
@@ -790,24 +775,12 @@ namespace ngla
790
775
  this->AddElementMatrixSymmetric (dnums1, elmat, use_atomic);
791
776
  }
792
777
 
793
- virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner) const override
794
- {
795
- return make_shared<JacobiPrecondSymmetric<TM,TV>> (*this, inner);
796
- }
797
-
778
+ virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner) const override;
798
779
  virtual shared_ptr<BaseBlockJacobiPrecond>
799
780
  CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
800
781
  const BaseVector * constraint = 0,
801
782
  bool parallel = 1,
802
- shared_ptr<BitArray> freedofs = NULL) const override
803
- {
804
- // return make_shared<BlockJacobiPrecondSymmetric<TM,TV>> (*this, blocks);
805
- return make_shared<BlockJacobiPrecondSymmetric<TM,TV>>
806
- ( dynamic_pointer_cast<const SparseMatrixSymmetric>
807
- (this->shared_from_this()),
808
- blocks);
809
- }
810
-
783
+ shared_ptr<BitArray> freedofs = NULL) const override;
811
784
 
812
785
  virtual shared_ptr<BaseSparseMatrix> Restrict (const SparseMatrixTM<double> & prol,
813
786
  shared_ptr<BaseSparseMatrix> cmat = nullptr) const override;
@@ -8,6 +8,8 @@
8
8
  /**************************************************************************/
9
9
 
10
10
 
11
+ #include "sparsematrix.hpp"
12
+
11
13
  namespace ngla
12
14
  {
13
15
 
@@ -155,6 +155,44 @@ namespace ngla
155
155
  : SparseMatrixTM<TM> (std::move(agraph))
156
156
  { ; }
157
157
 
158
+
159
+
160
+ template <class TM, class TV_ROW, class TV_COL>
161
+ shared_ptr<BaseJacobiPrecond> SparseMatrix<TM,TV_ROW,TV_COL> ::
162
+ CreateJacobiPrecond (shared_ptr<BitArray> inner) const
163
+ {
164
+ // if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
165
+ if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
166
+ else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
167
+ throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(mat_traits<TM>::HEIGHT));
168
+ return nullptr;
169
+ }
170
+ else return make_shared<JacobiPrecond<TM,TV_ROW,TV_COL>> (*this, inner);
171
+ }
172
+
173
+ template <class TM, class TV_ROW, class TV_COL>
174
+ shared_ptr<BaseBlockJacobiPrecond> SparseMatrix<TM,TV_ROW,TV_COL> ::
175
+ CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
176
+ const BaseVector * constraint,
177
+ bool parallel,
178
+ shared_ptr<BitArray> freedofs) const
179
+ {
180
+ // if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
181
+ if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
182
+ else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
183
+ throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(ngbla::Height<TM>()));
184
+ return nullptr;
185
+ }
186
+ else
187
+ // return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>> (*this, blocks, parallel);
188
+
189
+ return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>>
190
+ ( dynamic_pointer_cast<const SparseMatrix>
191
+ (this->shared_from_this()),
192
+ blocks, parallel);
193
+ }
194
+
195
+
158
196
 
159
197
  template <class TM, class TV_ROW, class TV_COL>
160
198
  void SparseMatrix<TM,TV_ROW,TV_COL> ::
@@ -602,7 +640,7 @@ namespace ngla
602
640
 
603
641
  template <class TM>
604
642
  shared_ptr<BaseSparseMatrix> SparseMatrixTM<TM> ::
605
- CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(Trans(TM()))>>(const Array<int>&,int)> & creator) const
643
+ CreateTransposeTM (const function<shared_ptr<SparseMatrixTM<decltype(ngbla::Trans(TM()))>>(const Array<int>&,int)> & creator) const
606
644
  {
607
645
  Array<int> cnt(this->Width());
608
646
  cnt = 0;
@@ -750,7 +788,34 @@ namespace ngla
750
788
  {
751
789
  ;
752
790
  }
791
+
792
+
793
+ template <class TM, class TV>
794
+ shared_ptr<BaseJacobiPrecond>
795
+ SparseMatrixSymmetric<TM,TV> :: CreateJacobiPrecond (shared_ptr<BitArray> inner) const
796
+ {
797
+ return make_shared<JacobiPrecondSymmetric<TM,TV>> (*this, inner);
798
+ }
799
+
753
800
 
801
+ template <class TM, class TV>
802
+ shared_ptr<BaseBlockJacobiPrecond>
803
+ SparseMatrixSymmetric<TM,TV> :: CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
804
+ const BaseVector * constraint,
805
+ bool parallel,
806
+ shared_ptr<BitArray> freedofs) const
807
+ {
808
+ // return make_shared<BlockJacobiPrecondSymmetric<TM,TV>> (*this, blocks);
809
+ return make_shared<BlockJacobiPrecondSymmetric<TM,TV>>
810
+ ( dynamic_pointer_cast<const SparseMatrixSymmetric>
811
+ (this->shared_from_this()),
812
+ blocks);
813
+ }
814
+
815
+
816
+
817
+
818
+
754
819
  template <class TM, class TV>
755
820
  void SparseMatrixSymmetric<TM,TV> ::
756
821
  MultAdd (double s, const BaseVector & x, BaseVector & y) const
@@ -7,147 +7,12 @@
7
7
  /* Date: 14 Mar. 02 */
8
8
  /* ************************************************************************/
9
9
 
10
+ #include "basematrix.hpp"
11
+ #include "vvector.hpp"
12
+
10
13
  namespace ngla
11
14
  {
12
15
 
13
-
14
- class NGS_DLL_HEADER Projector : public BaseMatrix
15
- {
16
- shared_ptr<BitArray> bits;
17
- bool keep_values;
18
- public:
19
- // projector on true / false bits
20
- Projector (shared_ptr<BitArray> abits, bool akeep_values = true)
21
- : bits(abits), keep_values(akeep_values) { ; }
22
-
23
- virtual bool IsComplex() const override { return false; }
24
-
25
- virtual int VHeight() const override { return bits->Size(); }
26
- virtual int VWidth() const override { return bits->Size(); }
27
-
28
- virtual void Mult (const BaseVector & x, BaseVector & y) const override;
29
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override;
30
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
31
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
32
- virtual void Project (BaseVector & x) const;
33
- virtual void SetValues (BaseVector & x, double val) const;
34
-
35
- bool KeepValues() const { return keep_values; }
36
- shared_ptr<BitArray> Mask() const { return bits; }
37
-
38
- virtual shared_ptr<BaseMatrix> CreateSparseMatrix() const override;
39
-
40
- AutoVector CreateRowVector() const override
41
- { throw Exception("CreateRowVector not implemented for Projector!"); }
42
- AutoVector CreateColVector() const override
43
- { throw Exception("CreateColVector not implemented for Projector!"); }
44
-
45
- AutoVector Evaluate(BaseVector & v) const override
46
- {
47
- auto res = v.CreateVector();
48
- Mult (v, res);
49
- return res;
50
- }
51
-
52
- };
53
-
54
-
55
- template <typename TM=double>
56
- class NGS_DLL_HEADER DiagonalMatrix : public BaseMatrix
57
- {
58
- shared_ptr<VVector<TM>> diag;
59
- public:
60
- // typedef typename mat_traits<TM>::TV_ROW TV_ROW;
61
- // typedef typename mat_traits<TM>::TV_COL TV_COL;
62
- typedef typename mat_traits<TM>::TSCAL TSCAL;
63
-
64
- DiagonalMatrix(size_t h)
65
- : diag(make_shared<VVector<TM>>(h)) { }
66
- DiagonalMatrix(const VVector<TM> & diag_)
67
- : diag(make_shared<VVector<TM>>(diag_)) { }
68
- DiagonalMatrix(shared_ptr<VVector<TM>> diag_)
69
- : diag(diag_) { }
70
-
71
- bool IsComplex() const override { return false; }
72
- TM & operator() (size_t i) { return (*diag)(i); }
73
- const TM & operator() (size_t i) const { return (*diag)(i); }
74
- int VHeight() const override { return diag->Size(); }
75
- int VWidth() const override { return diag->Size(); }
76
-
77
- BaseVector & AsVector() override { return *diag; }
78
- const BaseVector & AsVector() const override { return *diag; }
79
- ostream & Print (ostream & ost) const override;
80
-
81
- virtual shared_ptr<BaseMatrix> CreateSparseMatrix() const override;
82
-
83
- AutoVector CreateRowVector () const override;
84
- AutoVector CreateColVector () const override;
85
-
86
- void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
87
- void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
88
-
89
- shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
90
- };
91
-
92
-
93
- template <typename TM=double>
94
- class BlockDiagonalMatrix : public BaseMatrix
95
- {
96
- Tensor<3,TM> blockdiag;
97
- int blocks, dimy, dimx;
98
- public:
99
- // typedef double TSCAL;
100
-
101
- BlockDiagonalMatrix(Tensor<3,TM> _blockdiag);
102
- bool IsComplex() const override { return ngbla::IsComplex<TM>(); }
103
-
104
- int VHeight() const override { return blocks*dimy; }
105
- int VWidth() const override { return blocks*dimx; }
106
-
107
- ostream & Print (ostream & ost) const override;
108
-
109
- AutoVector CreateRowVector () const override;
110
- AutoVector CreateColVector () const override;
111
-
112
- void Mult (const BaseVector & x, BaseVector & y) const override;
113
- void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
114
- void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
115
-
116
- shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
117
- };
118
-
119
- // blocks is inner-most dimension of tensor and vectors
120
- class BlockDiagonalMatrixSoA : public BaseMatrix
121
- {
122
- Tensor<3> blockdiag;
123
- int blocks, dimy, dimx;
124
- Matrix<double> nonzero;
125
- public:
126
- typedef double TSCAL;
127
-
128
- BlockDiagonalMatrixSoA(Tensor<3> _blockdiag);
129
- bool IsComplex() const override { return false; }
130
-
131
- int VHeight() const override { return blocks*dimy; }
132
- int VWidth() const override { return blocks*dimx; }
133
-
134
- ostream & Print (ostream & ost) const override;
135
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
136
-
137
- AutoVector CreateRowVector () const override;
138
- AutoVector CreateColVector () const override;
139
-
140
- void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
141
- void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
142
- // shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
143
-
144
- FlatTensor<3> GetBlockDiag () const { return blockdiag; }
145
- FlatMatrix<double> GetNonZeroPattern() const { return nonzero; }
146
- };
147
-
148
-
149
-
150
-
151
16
  // Convert RowMajor to ColMajor matrix (stored as vector)
152
17
  class TransposeVector : public BaseMatrix
153
18
  {
@@ -234,6 +99,7 @@ namespace ngla
234
99
 
235
100
  virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
236
101
  virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
102
+ virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
237
103
  };
238
104
 
239
105
 
@@ -273,6 +139,9 @@ namespace ngla
273
139
  shared_ptr<BaseMatrix> GetMatrix() const { return mat; }
274
140
  IntRange GetRange() const { return range; }
275
141
 
142
+ virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
143
+
144
+
276
145
  /*
277
146
  virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
278
147
  {
@@ -19,6 +19,13 @@ namespace ngstd
19
19
  static void SetTerminate(void);
20
20
  static void UnSetTerminate(void);
21
21
  static bool ShouldTerminate(void);
22
+
23
+ class Region
24
+ {
25
+ public:
26
+ Region(const char * str) { PushStatus(str); }
27
+ ~Region() { PopStatus(); }
28
+ };
22
29
  };
23
30
 
24
31
  }
@@ -72,7 +72,8 @@ public:
72
72
 
73
73
  NGS_DLL_HEADER shared_ptr<ProxyFunction> Deriv() const;
74
74
  NGS_DLL_HEADER shared_ptr<ProxyFunction> Trace() const;
75
- NGS_DLL_HEADER shared_ptr<ProxyFunction> Primary() const { return primaryproxy; }
75
+ NGS_DLL_HEADER shared_ptr<CoefficientFunction> Primary() const override
76
+ { return primaryproxy; }
76
77
 
77
78
  NGS_DLL_HEADER shared_ptr<ProxyFunction> Dt() const;
78
79
  NGS_DLL_HEADER shared_ptr<ProxyFunction> AntiDt() const;