ngsolve 6.2.2404.post109.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.
- netgen/include/arnoldi.hpp +3 -0
- netgen/include/basematrix.hpp +30 -19
- netgen/include/basevector.hpp +43 -71
- netgen/include/bdbequations.hpp +14 -3
- netgen/include/bilinearform.hpp +8 -59
- netgen/include/blockjacobi.hpp +4 -0
- netgen/include/cg.hpp +3 -0
- netgen/include/chebyshev.hpp +3 -0
- netgen/include/coefficient.hpp +6 -2
- netgen/include/comp.hpp +0 -4
- netgen/include/diagonalmatrix.hpp +154 -0
- netgen/include/dump.hpp +5 -5
- netgen/include/eigen.hpp +3 -0
- netgen/include/elementbyelement.hpp +6 -0
- netgen/include/elementtopology.hpp +0 -3
- netgen/include/expr.hpp +13 -8
- netgen/include/fespace.hpp +12 -14
- netgen/include/finiteelement.hpp +7 -7
- netgen/include/globalspace.hpp +28 -2
- netgen/include/gridfunction.hpp +4 -0
- netgen/include/h1amg.hpp +3 -1
- netgen/include/h1hofe.hpp +1 -1
- netgen/include/hcurlhdivfes.hpp +2 -0
- netgen/include/hcurlhofespace.hpp +4 -3
- netgen/include/hdivfes.hpp +3 -3
- netgen/include/hdivhosurfacefespace.hpp +3 -3
- netgen/include/integratorcf.hpp +14 -9
- netgen/include/intrule.hpp +15 -1
- netgen/include/jacobi.hpp +3 -0
- netgen/include/la.hpp +1 -13
- netgen/include/matrix.hpp +21 -0
- netgen/include/meshaccess.hpp +30 -51
- netgen/include/mgpre.hpp +1 -1
- netgen/include/mptools.hpp +2145 -0
- netgen/include/multivector.hpp +2 -0
- netgen/include/ngsobject.hpp +1 -1
- netgen/include/nodalhofe.hpp +3 -0
- netgen/include/normalfacetfespace.hpp +4 -5
- netgen/include/normalfacetsurfacefespace.hpp +1 -1
- netgen/include/order.hpp +3 -1
- netgen/include/parallel_matrices.hpp +5 -0
- netgen/include/paralleldofs.hpp +44 -95
- netgen/include/parallelngs.hpp +2 -1
- netgen/include/parallelvector.hpp +12 -16
- netgen/include/pardisoinverse.hpp +1 -0
- netgen/include/periodic.hpp +1 -0
- netgen/include/pmltrafo.hpp +5 -2
- netgen/include/preconditioner.hpp +3 -1
- netgen/include/scalarfe.hpp +4 -1
- netgen/include/shapefunction_utils.hpp +40 -1
- netgen/include/sparsecholesky.hpp +4 -0
- netgen/include/sparsematrix.hpp +25 -43
- netgen/include/sparsematrix_dyn.hpp +2 -0
- netgen/include/sparsematrix_impl.hpp +66 -1
- netgen/include/special_matrix.hpp +7 -134
- netgen/include/statushandler.hpp +7 -0
- netgen/include/symbolicintegrator.hpp +2 -1
- netgen/include/tensorcoefficient.hpp +56 -54
- netgen/include/tpdiffop.hpp +1 -0
- netgen/include/tpintrule.hpp +2 -0
- netgen/include/umfpackinverse.hpp +58 -30
- netgen/include/vector.hpp +8 -2
- netgen/include/voxelcoefficientfunction.hpp +2 -0
- netgen/include/vvector.hpp +10 -1
- netgen/lib/libngsolve.lib +0 -0
- netgen/libngsolve.dll +0 -0
- ngsolve/_scikit_build_core_dependencies.py +8 -1
- ngsolve/cmake/NGSolveConfig.cmake +5 -5
- ngsolve/config/config.py +6 -6
- ngsolve/config.py +6 -6
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +44 -0
- ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve/demos/howto/mixed.py +30 -0
- ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve/demos/howto/pickling.py +26 -0
- ngsolve/demos/howto/pml.py +31 -0
- ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve/demos/intro/cmagnet.py +62 -0
- ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve/demos/intro/poisson.py +41 -0
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
- ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve/demos/mpi/mpi_timeDG.py +82 -0
- ngsolve/internal.py +5 -0
- ngsolve/ngslib.pyd +0 -0
- {ngsolve-6.2.2404.post109.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/METADATA +2 -2
- {ngsolve-6.2.2404.post109.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/RECORD +137 -104
- {ngsolve-6.2.2404.post109.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/WHEEL +1 -1
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/Scripts/ngsolve.tcl +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/beam.geo +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/beam.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/chip.in2d +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/chip.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coil.geo +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coil.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coilshield.geo +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/coilshield.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/cube.geo +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/cube.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d1_square.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d2_chip.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d4_cube.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d5_beam.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d6_shaft.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d7_coil.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/doubleglazing.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/shaft.geo +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/shaft.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/square.in2d +0 -0
- {ngsolve-6.2.2404.post109.dev0.data → ngsolve-6.2.2406.post112.dev1.data}/data/share/ngsolve/square.vol +0 -0
- {ngsolve-6.2.2404.post109.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2404.post109.dev0.dist-info → ngsolve-6.2.2406.post112.dev1.dist-info}/top_level.txt +0 -0
netgen/include/sparsematrix.hpp
CHANGED
|
@@ -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,6 +239,11 @@ namespace ngla
|
|
|
233
239
|
return *this;
|
|
234
240
|
}
|
|
235
241
|
|
|
242
|
+
virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override
|
|
243
|
+
{
|
|
244
|
+
return dynamic_pointer_cast<BaseSparseMatrix>(const_cast<BaseSparseMatrix*>(this)->shared_from_this());
|
|
245
|
+
}
|
|
246
|
+
|
|
236
247
|
virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner = nullptr) const
|
|
237
248
|
{
|
|
238
249
|
throw Exception ("BaseSparseMatrix::CreateJacobiPrecond");
|
|
@@ -333,6 +344,8 @@ namespace ngla
|
|
|
333
344
|
{
|
|
334
345
|
return asvec;
|
|
335
346
|
}
|
|
347
|
+
|
|
348
|
+
// tuple<int,int> EntryShape() const { return { entry_height, entry_width }; }
|
|
336
349
|
|
|
337
350
|
FlatVector<TSCAL> GetRowValue (int row, int j)
|
|
338
351
|
{
|
|
@@ -340,9 +353,10 @@ namespace ngla
|
|
|
340
353
|
return FlatVector<TSCAL> (entry_size, p);
|
|
341
354
|
}
|
|
342
355
|
|
|
343
|
-
FlatMatrix<TSCAL> GetRowValueMat (int row, int j)
|
|
356
|
+
FlatMatrix<TSCAL> GetRowValueMat (int row, int j) const
|
|
344
357
|
{
|
|
345
|
-
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));
|
|
346
360
|
return FlatMatrix<TSCAL> (entry_height, entry_width, p);
|
|
347
361
|
}
|
|
348
362
|
};
|
|
@@ -547,7 +561,7 @@ namespace ngla
|
|
|
547
561
|
virtual tuple<int,int> EntrySizes() const override { return { ngbla::Height<TM>(), ngbla::Width<TM>() }; }
|
|
548
562
|
|
|
549
563
|
shared_ptr<BaseSparseMatrix>
|
|
550
|
-
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;
|
|
551
565
|
|
|
552
566
|
public:
|
|
553
567
|
using BaseMatrix::GetMemoryTracer;
|
|
@@ -608,37 +622,13 @@ namespace ngla
|
|
|
608
622
|
{ return { string("SparseMatrix")+typeid(TM).name(), this->Height(), this->Width() }; }
|
|
609
623
|
|
|
610
624
|
virtual shared_ptr<BaseJacobiPrecond>
|
|
611
|
-
CreateJacobiPrecond (shared_ptr<BitArray> inner) const override
|
|
612
|
-
{
|
|
613
|
-
// if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
|
|
614
|
-
if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
|
|
615
|
-
else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
|
|
616
|
-
throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(mat_traits<TM>::HEIGHT));
|
|
617
|
-
return nullptr;
|
|
618
|
-
}
|
|
619
|
-
else return make_shared<JacobiPrecond<TM,TV_ROW,TV_COL>> (*this, inner);
|
|
620
|
-
}
|
|
625
|
+
CreateJacobiPrecond (shared_ptr<BitArray> inner) const override;
|
|
621
626
|
|
|
622
627
|
virtual shared_ptr<BaseBlockJacobiPrecond>
|
|
623
628
|
CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
|
|
624
629
|
const BaseVector * constraint = 0,
|
|
625
630
|
bool parallel = 1,
|
|
626
|
-
shared_ptr<BitArray> freedofs = NULL) const override
|
|
627
|
-
{
|
|
628
|
-
// if constexpr(mat_traits<TM>::HEIGHT != mat_traits<TM>::WIDTH) return nullptr;
|
|
629
|
-
if constexpr(ngbla::Height<TM>() != ngbla::Width<TM>()) return nullptr;
|
|
630
|
-
else if constexpr(ngbla::Height<TM>() > MAX_SYS_DIM) {
|
|
631
|
-
throw Exception(string("MAX_SYS_DIM = ")+to_string(MAX_SYS_DIM)+string(", need ")+to_string(ngbla::Height<TM>()));
|
|
632
|
-
return nullptr;
|
|
633
|
-
}
|
|
634
|
-
else
|
|
635
|
-
// return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>> (*this, blocks, parallel);
|
|
636
|
-
|
|
637
|
-
return make_shared<BlockJacobiPrecond<TM,TV_ROW,TV_COL>>
|
|
638
|
-
( dynamic_pointer_cast<const SparseMatrix>
|
|
639
|
-
(this->shared_from_this()),
|
|
640
|
-
blocks, parallel);
|
|
641
|
-
}
|
|
631
|
+
shared_ptr<BitArray> freedofs = NULL) const override;
|
|
642
632
|
|
|
643
633
|
virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
|
|
644
634
|
virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<const Array<int>> clusters) const override;
|
|
@@ -785,24 +775,12 @@ namespace ngla
|
|
|
785
775
|
this->AddElementMatrixSymmetric (dnums1, elmat, use_atomic);
|
|
786
776
|
}
|
|
787
777
|
|
|
788
|
-
virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner) const override
|
|
789
|
-
{
|
|
790
|
-
return make_shared<JacobiPrecondSymmetric<TM,TV>> (*this, inner);
|
|
791
|
-
}
|
|
792
|
-
|
|
778
|
+
virtual shared_ptr<BaseJacobiPrecond> CreateJacobiPrecond (shared_ptr<BitArray> inner) const override;
|
|
793
779
|
virtual shared_ptr<BaseBlockJacobiPrecond>
|
|
794
780
|
CreateBlockJacobiPrecond (shared_ptr<Table<int>> blocks,
|
|
795
781
|
const BaseVector * constraint = 0,
|
|
796
782
|
bool parallel = 1,
|
|
797
|
-
shared_ptr<BitArray> freedofs = NULL) const override
|
|
798
|
-
{
|
|
799
|
-
// return make_shared<BlockJacobiPrecondSymmetric<TM,TV>> (*this, blocks);
|
|
800
|
-
return make_shared<BlockJacobiPrecondSymmetric<TM,TV>>
|
|
801
|
-
( dynamic_pointer_cast<const SparseMatrixSymmetric>
|
|
802
|
-
(this->shared_from_this()),
|
|
803
|
-
blocks);
|
|
804
|
-
}
|
|
805
|
-
|
|
783
|
+
shared_ptr<BitArray> freedofs = NULL) const override;
|
|
806
784
|
|
|
807
785
|
virtual shared_ptr<BaseSparseMatrix> Restrict (const SparseMatrixTM<double> & prol,
|
|
808
786
|
shared_ptr<BaseSparseMatrix> cmat = nullptr) const override;
|
|
@@ -875,6 +853,10 @@ namespace ngla
|
|
|
875
853
|
[[deprecated("Use sparsematrix->CreateTranspose() instead!")]]
|
|
876
854
|
NGS_DLL_HEADER shared_ptr<SparseMatrixTM<double>> TransposeMatrix (const SparseMatrixTM<double> & mat);
|
|
877
855
|
|
|
856
|
+
NGS_DLL_HEADER shared_ptr<SparseMatrixTM<double>>
|
|
857
|
+
MatAdd (double sa, const SparseMatrixTM<double> & mata,
|
|
858
|
+
double sb, const SparseMatrixTM<double> & matb);
|
|
859
|
+
|
|
878
860
|
NGS_DLL_HEADER shared_ptr<SparseMatrixTM<double>>
|
|
879
861
|
MatMult (const SparseMatrixTM<double> & mata, const SparseMatrixTM<double> & matb);
|
|
880
862
|
NGS_DLL_HEADER shared_ptr<SparseMatrixTM<Complex>>
|
|
@@ -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,143 +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
|
-
AutoVector CreateRowVector() const override
|
|
39
|
-
{ throw Exception("CreateRowVector not implemented for Projector!"); }
|
|
40
|
-
AutoVector CreateColVector() const override
|
|
41
|
-
{ throw Exception("CreateColVector not implemented for Projector!"); }
|
|
42
|
-
|
|
43
|
-
AutoVector Evaluate(BaseVector & v) const override
|
|
44
|
-
{
|
|
45
|
-
auto res = v.CreateVector();
|
|
46
|
-
Mult (v, res);
|
|
47
|
-
return res;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
template <typename TM=double>
|
|
54
|
-
class NGS_DLL_HEADER DiagonalMatrix : public BaseMatrix
|
|
55
|
-
{
|
|
56
|
-
shared_ptr<VVector<TM>> diag;
|
|
57
|
-
public:
|
|
58
|
-
// typedef typename mat_traits<TM>::TV_ROW TV_ROW;
|
|
59
|
-
// typedef typename mat_traits<TM>::TV_COL TV_COL;
|
|
60
|
-
typedef typename mat_traits<TM>::TSCAL TSCAL;
|
|
61
|
-
|
|
62
|
-
DiagonalMatrix(size_t h)
|
|
63
|
-
: diag(make_shared<VVector<TM>>(h)) { }
|
|
64
|
-
DiagonalMatrix(const VVector<TM> & diag_)
|
|
65
|
-
: diag(make_shared<VVector<TM>>(diag_)) { }
|
|
66
|
-
DiagonalMatrix(shared_ptr<VVector<TM>> diag_)
|
|
67
|
-
: diag(diag_) { }
|
|
68
|
-
|
|
69
|
-
bool IsComplex() const override { return false; }
|
|
70
|
-
TM & operator() (size_t i) { return (*diag)(i); }
|
|
71
|
-
const TM & operator() (size_t i) const { return (*diag)(i); }
|
|
72
|
-
int VHeight() const override { return diag->Size(); }
|
|
73
|
-
int VWidth() const override { return diag->Size(); }
|
|
74
|
-
|
|
75
|
-
BaseVector & AsVector() override { return *diag; }
|
|
76
|
-
const BaseVector & AsVector() const override { return *diag; }
|
|
77
|
-
ostream & Print (ostream & ost) const override;
|
|
78
|
-
|
|
79
|
-
AutoVector CreateRowVector () const override;
|
|
80
|
-
AutoVector CreateColVector () const override;
|
|
81
|
-
|
|
82
|
-
void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
83
|
-
void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
84
|
-
|
|
85
|
-
shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
template <typename TM=double>
|
|
90
|
-
class BlockDiagonalMatrix : public BaseMatrix
|
|
91
|
-
{
|
|
92
|
-
Tensor<3,TM> blockdiag;
|
|
93
|
-
int blocks, dimy, dimx;
|
|
94
|
-
public:
|
|
95
|
-
// typedef double TSCAL;
|
|
96
|
-
|
|
97
|
-
BlockDiagonalMatrix(Tensor<3,TM> _blockdiag);
|
|
98
|
-
bool IsComplex() const override { return ngbla::IsComplex<TM>(); }
|
|
99
|
-
|
|
100
|
-
int VHeight() const override { return blocks*dimy; }
|
|
101
|
-
int VWidth() const override { return blocks*dimx; }
|
|
102
|
-
|
|
103
|
-
ostream & Print (ostream & ost) const override;
|
|
104
|
-
|
|
105
|
-
AutoVector CreateRowVector () const override;
|
|
106
|
-
AutoVector CreateColVector () const override;
|
|
107
|
-
|
|
108
|
-
void Mult (const BaseVector & x, BaseVector & y) const override;
|
|
109
|
-
void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
110
|
-
void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
111
|
-
|
|
112
|
-
shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// blocks is inner-most dimension of tensor and vectors
|
|
116
|
-
class BlockDiagonalMatrixSoA : public BaseMatrix
|
|
117
|
-
{
|
|
118
|
-
Tensor<3> blockdiag;
|
|
119
|
-
int blocks, dimy, dimx;
|
|
120
|
-
Matrix<double> nonzero;
|
|
121
|
-
public:
|
|
122
|
-
typedef double TSCAL;
|
|
123
|
-
|
|
124
|
-
BlockDiagonalMatrixSoA(Tensor<3> _blockdiag);
|
|
125
|
-
bool IsComplex() const override { return false; }
|
|
126
|
-
|
|
127
|
-
int VHeight() const override { return blocks*dimy; }
|
|
128
|
-
int VWidth() const override { return blocks*dimx; }
|
|
129
|
-
|
|
130
|
-
ostream & Print (ostream & ost) const override;
|
|
131
|
-
virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
|
|
132
|
-
|
|
133
|
-
AutoVector CreateRowVector () const override;
|
|
134
|
-
AutoVector CreateColVector () const override;
|
|
135
|
-
|
|
136
|
-
void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
137
|
-
void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
138
|
-
// shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const override;
|
|
139
|
-
|
|
140
|
-
FlatTensor<3> GetBlockDiag () const { return blockdiag; }
|
|
141
|
-
FlatMatrix<double> GetNonZeroPattern() const { return nonzero; }
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
16
|
// Convert RowMajor to ColMajor matrix (stored as vector)
|
|
148
17
|
class TransposeVector : public BaseMatrix
|
|
149
18
|
{
|
|
@@ -230,6 +99,7 @@ namespace ngla
|
|
|
230
99
|
|
|
231
100
|
virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
232
101
|
virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override;
|
|
102
|
+
virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
|
|
233
103
|
};
|
|
234
104
|
|
|
235
105
|
|
|
@@ -269,6 +139,9 @@ namespace ngla
|
|
|
269
139
|
shared_ptr<BaseMatrix> GetMatrix() const { return mat; }
|
|
270
140
|
IntRange GetRange() const { return range; }
|
|
271
141
|
|
|
142
|
+
virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
|
|
143
|
+
|
|
144
|
+
|
|
272
145
|
/*
|
|
273
146
|
virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
|
|
274
147
|
{
|
netgen/include/statushandler.hpp
CHANGED
|
@@ -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<
|
|
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;
|
|
@@ -191,77 +191,79 @@ namespace ngfem {
|
|
|
191
191
|
optimize_identities(string, const Array<shared_ptr<CoefficientFunction>>& cfs,
|
|
192
192
|
const map<string, bool> &options);
|
|
193
193
|
|
|
194
|
-
class LeviCivitaCoefficientFunction
|
|
195
|
-
: public T_CoefficientFunction<LeviCivitaCoefficientFunction> {
|
|
196
|
-
using BASE = T_CoefficientFunction<LeviCivitaCoefficientFunction>;
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
|
|
195
|
+
// class LeviCivitaCoefficientFunction
|
|
196
|
+
// : public T_CoefficientFunction<LeviCivitaCoefficientFunction> {
|
|
197
|
+
// using BASE = T_CoefficientFunction<LeviCivitaCoefficientFunction>;
|
|
200
198
|
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
// int dim = 0;
|
|
200
|
+
// MultiIndex mi{};
|
|
203
201
|
|
|
204
|
-
|
|
202
|
+
// public:
|
|
203
|
+
// LeviCivitaCoefficientFunction() = default;
|
|
205
204
|
|
|
206
|
-
|
|
207
|
-
func(*this);
|
|
208
|
-
}
|
|
205
|
+
// LeviCivitaCoefficientFunction(int adim);
|
|
209
206
|
|
|
210
|
-
|
|
207
|
+
// virtual void TraverseTree(const function<void(CoefficientFunction &)> &func) override {
|
|
208
|
+
// func(*this);
|
|
209
|
+
// }
|
|
211
210
|
|
|
212
|
-
|
|
211
|
+
// virtual string GetDescription() const override { return string("Levi-Civita Symbol"); }
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
GenerateCode(code, inputs, index, false);
|
|
216
|
-
}
|
|
213
|
+
// virtual void DoArchive(Archive &ar) override;
|
|
217
214
|
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
// virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index) const override {
|
|
216
|
+
// GenerateCode(code, inputs, index, false);
|
|
217
|
+
// }
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
// virtual void GenerateCode(Code &code, FlatArray<int> inputs, int index,
|
|
220
|
+
// bool skip_zeroes = true) const;
|
|
223
221
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
FlatVector<AutoDiffDiff<1,NonZero>> values) const override;
|
|
222
|
+
// virtual void NonZeroPattern(const class ProxyUserData &ud,
|
|
223
|
+
// FlatVector<AutoDiffDiff<1,NonZero>> values) const override;
|
|
227
224
|
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
// virtual void NonZeroPattern(const class ProxyUserData &ud,
|
|
226
|
+
// FlatArray<FlatVector<AutoDiffDiff<1,NonZero>>> input,
|
|
227
|
+
// FlatVector<AutoDiffDiff<1,NonZero>> values) const override;
|
|
230
228
|
|
|
231
|
-
|
|
229
|
+
// using BASE::Evaluate;
|
|
230
|
+
// using typename BASE::T_DJC;
|
|
232
231
|
|
|
233
|
-
|
|
234
|
-
void T_Evaluate(const MIR &ir, BareSliceMatrix<T, ORD> values) const
|
|
235
|
-
{
|
|
236
|
-
auto val = T(0.0);
|
|
237
|
-
values.AddSize(Dimension(), ir.Size()) = val;
|
|
238
|
-
auto ir_size = ir.Size();
|
|
239
|
-
for (size_t I: Range(Dimension())) {
|
|
240
|
-
const auto I_array = split(I, mi);
|
|
241
|
-
if (is_even_iota_permutation(I_array.begin(), I_array.end()))
|
|
242
|
-
val = 1.0;
|
|
243
|
-
else if (is_odd_iota_permutation(I_array.begin(), I_array.end()))
|
|
244
|
-
val = -1.0;
|
|
245
|
-
else
|
|
246
|
-
continue;
|
|
247
|
-
for (auto q: Range(ir_size))
|
|
248
|
-
values(I, q) = val;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
232
|
+
// virtual double Evaluate(const BaseMappedIntegrationPoint &ip) const override;
|
|
251
233
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
234
|
+
// template<typename MIR, typename T, ORDERING ORD>
|
|
235
|
+
// void T_Evaluate(const MIR &ir, BareSliceMatrix<T, ORD> values) const
|
|
236
|
+
// {
|
|
237
|
+
// auto val = T(0.0);
|
|
238
|
+
// values.AddSize(Dimension(), ir.Size()) = val;
|
|
239
|
+
// auto ir_size = ir.Size();
|
|
240
|
+
// for (size_t I: Range(Dimension())) {
|
|
241
|
+
// const auto I_array = split(I, mi);
|
|
242
|
+
// cout << "check I: " << I_array << endl;
|
|
243
|
+
// if (is_even_iota_permutation(I_array.begin(), I_array.end()))
|
|
244
|
+
// val = 1.0;
|
|
245
|
+
// else if (is_odd_iota_permutation(I_array.begin(), I_array.end()))
|
|
246
|
+
// val = -1.0;
|
|
247
|
+
// else
|
|
248
|
+
// continue;
|
|
249
|
+
// for (auto q: Range(ir_size))
|
|
250
|
+
// values(I, q) = val;
|
|
251
|
+
// }
|
|
252
|
+
// }
|
|
258
253
|
|
|
254
|
+
// template<typename MIR, typename T, ORDERING ORD>
|
|
255
|
+
// void T_Evaluate(const MIR &ir, FlatArray<BareSliceMatrix<T, ORD>> input,
|
|
256
|
+
// BareSliceMatrix<T, ORD> values) const
|
|
257
|
+
// {
|
|
258
|
+
// T_Evaluate(ir, values);
|
|
259
|
+
// }
|
|
259
260
|
|
|
260
|
-
shared_ptr<CoefficientFunction> Diff(const CoefficientFunction *var,
|
|
261
|
-
shared_ptr<CoefficientFunction> dir) const override;
|
|
262
261
|
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
// shared_ptr<CoefficientFunction> Diff(const CoefficientFunction *var,
|
|
263
|
+
// shared_ptr<CoefficientFunction> dir) const override;
|
|
264
|
+
|
|
265
|
+
// shared_ptr<CoefficientFunction> DiffJacobi(const CoefficientFunction *var, T_DJC & cache) const override;
|
|
266
|
+
// };
|
|
265
267
|
|
|
266
268
|
class EinsumCoefficientFunction
|
|
267
269
|
: public T_CoefficientFunction<EinsumCoefficientFunction>
|
netgen/include/tpdiffop.hpp
CHANGED
|
@@ -25,6 +25,7 @@ namespace ngfem
|
|
|
25
25
|
virtual IntRange UsedDofs(const FiniteElement & fel) const override { return IntRange(0, fel.GetNDof()); }
|
|
26
26
|
|
|
27
27
|
virtual bool operator== (const TPDifferentialOperator & diffop2) const { return false; }
|
|
28
|
+
virtual bool operator== (const DifferentialOperator & diffop2) const override { return false; }
|
|
28
29
|
|
|
29
30
|
shared_ptr<DifferentialOperator> & GetEvaluators( int num)
|
|
30
31
|
{
|
netgen/include/tpintrule.hpp
CHANGED
|
@@ -46,6 +46,8 @@ namespace ngfem
|
|
|
46
46
|
{ throw Exception("TPMappedIntegrationRule::Range not implemented"); }
|
|
47
47
|
virtual SliceMatrix<> GetPoints() const
|
|
48
48
|
{ throw Exception("TPMappedIntegrationRule::GetPoints not implemented"); }
|
|
49
|
+
virtual SliceMatrix<> GetNormals() const
|
|
50
|
+
{ throw Exception("TPMappedIntegrationRule::GetNormals not implemented"); }
|
|
49
51
|
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr)
|
|
50
52
|
{ throw Exception("TPMappedIntegrationRule::ComputeNormalsAndMeasure not implemented"); }
|
|
51
53
|
virtual bool IsComplex() const
|