ngsolve 6.2.2502__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.
- netgen/include/analytic_integrals.hpp +10 -0
- netgen/include/basematrix.hpp +6 -0
- netgen/include/bdbequations.hpp +55 -0
- netgen/include/bem_diffops.hpp +475 -0
- netgen/include/bilinearform.hpp +4 -1
- netgen/include/blockjacobi.hpp +17 -5
- netgen/include/bspline.hpp +2 -0
- netgen/include/cholesky.hpp +2 -2
- netgen/include/code_generation.hpp +2 -2
- netgen/include/complex_wrapper.hpp +30 -2
- netgen/include/contact.hpp +8 -0
- netgen/include/diagonalmatrix.hpp +6 -0
- netgen/include/diffop_impl.hpp +3 -1
- netgen/include/diffopwithfactor.hpp +123 -0
- netgen/include/elementbyelement.hpp +9 -3
- netgen/include/expr.hpp +45 -7
- netgen/include/fespace.hpp +12 -4
- netgen/include/gridfunction.hpp +3 -3
- netgen/include/h1amg.hpp +85 -2
- netgen/include/h1lumping.hpp +6 -0
- netgen/include/hcurl_equations.hpp +29 -0
- netgen/include/hcurlcurlfe.hpp +20 -0
- netgen/include/hdiv_equations.hpp +15 -0
- netgen/include/hdivfe_utils.hpp +1 -0
- netgen/include/hdivhofespace.hpp +2 -0
- netgen/include/integrator.hpp +4 -16
- netgen/include/intrule.hpp +2 -1
- netgen/include/intrules_SauterSchwab.hpp +25 -0
- netgen/include/jacobi.hpp +35 -18
- netgen/include/kernels.hpp +724 -0
- netgen/include/l2hofe.hpp +1 -0
- netgen/include/matrix.hpp +8 -3
- netgen/include/meshaccess.hpp +4 -3
- netgen/include/mp_coefficient.hpp +145 -0
- netgen/include/mptools.hpp +1331 -368
- netgen/include/mycomplex.hpp +1 -1
- netgen/include/ngblas.hpp +116 -7
- netgen/include/potentialtools.hpp +22 -0
- netgen/include/preconditioner.hpp +23 -23
- netgen/include/prolongation.hpp +132 -6
- netgen/include/recursive_pol.hpp +63 -11
- netgen/include/simd_complex.hpp +45 -0
- netgen/include/sparsecholesky.hpp +6 -2
- netgen/include/sparsefactorization_interface.hpp +159 -0
- netgen/include/sparsematrix.hpp +21 -7
- netgen/include/sparsematrix_dyn.hpp +6 -7
- netgen/include/sparsematrix_impl.hpp +175 -40
- netgen/include/special_matrix.hpp +2 -0
- netgen/include/statushandler.hpp +8 -8
- netgen/include/symbolicintegrator.hpp +2 -1
- netgen/include/tangentialfacetfespace.hpp +7 -22
- netgen/include/thdivfe_impl.hpp +66 -0
- netgen/include/tscalarfe.hpp +1 -1
- netgen/include/vector.hpp +272 -47
- netgen/lib/libngsolve.lib +0 -0
- netgen/libngsolve.dll +0 -0
- netgen/ngscxx.bat +1 -1
- netgen/ngsld.bat +1 -1
- ngsolve/__init__.py +1 -0
- ngsolve/cmake/NGSolveConfig.cmake +8 -8
- ngsolve/cmake/ngsolve-targets.cmake +24 -18
- ngsolve/config/config.py +7 -7
- ngsolve/demos/intro/cmagnet.py +19 -22
- ngsolve/directsolvers.py +9 -21
- ngsolve/krylovspace.py +172 -3
- ngsolve/ngslib.lib +0 -0
- ngsolve/ngslib.pyd +0 -0
- ngsolve/nonlinearsolvers.py +2 -2
- ngsolve/preconditioners.py +1 -0
- ngsolve/solve_implementation.py +168 -0
- ngsolve/{solvers.py → solvers/__init__.py} +1 -1
- ngsolve/solvers/cudss.py +112 -0
- ngsolve/webgui.py +2 -0
- {ngsolve-6.2.2502.dist-info → ngsolve-6.2.2601.dist-info}/METADATA +2 -2
- {ngsolve-6.2.2502.dist-info → ngsolve-6.2.2601.dist-info}/RECORD +107 -97
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/Scripts/ngsolve.tcl +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/beam.geo +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/beam.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/chip.in2d +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/chip.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coil.geo +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coil.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coilshield.geo +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/coilshield.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/cube.geo +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/cube.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d1_square.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d2_chip.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d4_cube.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d5_beam.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d6_shaft.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d7_coil.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/doubleglazing.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/shaft.geo +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/shaft.vol +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/square.in2d +0 -0
- {ngsolve-6.2.2502.data → ngsolve-6.2.2601.data}/data/share/ngsolve/square.vol +0 -0
- {ngsolve-6.2.2502.dist-info → ngsolve-6.2.2601.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2502.dist-info → ngsolve-6.2.2601.dist-info}/WHEEL +0 -0
- {ngsolve-6.2.2502.dist-info → ngsolve-6.2.2601.dist-info}/top_level.txt +0 -0
|
@@ -57,7 +57,7 @@ namespace ngfem
|
|
|
57
57
|
|
|
58
58
|
string pointer;
|
|
59
59
|
|
|
60
|
-
NGS_DLL_HEADER string AddPointer(const void *p );
|
|
60
|
+
NGS_DLL_HEADER string AddPointer(const void *p, string name = "", string type = "void *", string qualifiers = "");
|
|
61
61
|
|
|
62
62
|
void AddLinkFlag(string flag);
|
|
63
63
|
|
|
@@ -287,7 +287,7 @@ namespace ngfem
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
std::filesystem::path CreateTempDir();
|
|
290
|
-
unique_ptr<SharedLibrary> CompileCode(const std::vector<std::variant<filesystem::path, string>> &codes, const std::vector<string> &link_flags, bool keep_files = false );
|
|
290
|
+
unique_ptr<SharedLibrary> CompileCode(const std::vector<std::variant<filesystem::path, string>> &codes, const std::vector<string> &link_flags, bool keep_files = false, optional<string> compiler = nullopt, optional<string> linker = nullopt);
|
|
291
291
|
namespace detail {
|
|
292
292
|
string GenerateL2ElementCode(int order);
|
|
293
293
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#ifndef COMPLEX_WRAPPER
|
|
2
2
|
#define COMPLEX_WRAPPER
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
#include <complex>
|
|
5
7
|
|
|
8
|
+
|
|
6
9
|
#ifdef USE_MYCOMPLEX
|
|
7
10
|
#include <mycomplex.hpp>
|
|
8
11
|
#endif
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
|
|
13
15
|
// #ifdef __clang__
|
|
14
16
|
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
|
15
17
|
namespace std
|
|
@@ -25,18 +27,44 @@ namespace std
|
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
|
|
30
|
+
|
|
28
31
|
namespace ngcore
|
|
29
32
|
{
|
|
33
|
+
|
|
30
34
|
#ifdef USE_MYCOMPLEX
|
|
31
35
|
typedef ngstd::MyComplex<double> Complex;
|
|
32
36
|
using std::fabs;
|
|
33
|
-
|
|
37
|
+
INLINE double fabs (Complex v) { return ngstd::abs (v); }
|
|
34
38
|
#else
|
|
35
39
|
typedef std::complex<double> Complex;
|
|
36
40
|
using std::fabs;
|
|
37
41
|
inline double fabs (Complex v) { return std::abs (v); }
|
|
38
42
|
#endif
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#if defined(__CUDA_ARCH__)
|
|
48
|
+
namespace ngcore
|
|
49
|
+
{
|
|
50
|
+
__device__ inline Complex conj(Complex a)
|
|
51
|
+
{
|
|
52
|
+
return Complex (a.real(), -a.imag());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
__device__ inline Complex operator+ (Complex a, Complex b) {
|
|
56
|
+
return Complex(a.real()+b.real(), a.imag()+b.imag());
|
|
57
|
+
}
|
|
58
|
+
__device__ inline Complex& operator+= (Complex& a, Complex b) {
|
|
59
|
+
a = a+b;
|
|
60
|
+
return a;
|
|
61
|
+
}
|
|
39
62
|
}
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
40
68
|
|
|
41
69
|
|
|
42
70
|
|
netgen/include/contact.hpp
CHANGED
|
@@ -89,6 +89,7 @@ namespace ngcomp
|
|
|
89
89
|
shared_ptr<CoefficientFunction> cf;
|
|
90
90
|
shared_ptr<FESpace> fes;
|
|
91
91
|
Array<ProxyFunction*> trial_proxies;
|
|
92
|
+
Array<CoefficientFunction*> cf_gridfunctions;
|
|
92
93
|
bool deformed;
|
|
93
94
|
|
|
94
95
|
public:
|
|
@@ -123,6 +124,9 @@ namespace ngcomp
|
|
|
123
124
|
shared_ptr<CoefficientFunction> cf;
|
|
124
125
|
shared_ptr<FESpace> fes;
|
|
125
126
|
Array<ProxyFunction*> trial_proxies, test_proxies;
|
|
127
|
+
Array<CoefficientFunction*> cf_gridfunctions;
|
|
128
|
+
Array<shared_ptr<CoefficientFunction>> dcf_dtest; // derivatives by test-functions
|
|
129
|
+
Matrix<shared_ptr<CoefficientFunction>> ddcf_dtest_dtrial; // derivatives by test- and trial-functions
|
|
126
130
|
bool deformed;
|
|
127
131
|
public:
|
|
128
132
|
ContactIntegrator(shared_ptr<CoefficientFunction> _cf,
|
|
@@ -187,6 +191,10 @@ namespace ngcomp
|
|
|
187
191
|
const auto& GetIntegrators(bool def) const { return def ? deformed_integrators : undeformed_integrators; }
|
|
188
192
|
shared_ptr<FESpace> GetFESpace() const { return fes; }
|
|
189
193
|
tuple<FlatArray<Vec<3>>, FlatArray<Vec<3>>> GetDrawingPairs() { return {primary_points, secondary_points}; }
|
|
194
|
+
auto GetCArgs() {
|
|
195
|
+
return std::make_tuple(master, other, draw_pairs, volume, element_boundary);
|
|
196
|
+
}
|
|
197
|
+
void DoArchive(Archive& ar);
|
|
190
198
|
};
|
|
191
199
|
|
|
192
200
|
template<int DIM>
|
|
@@ -47,6 +47,10 @@ namespace ngla
|
|
|
47
47
|
Mult (v, res);
|
|
48
48
|
return res;
|
|
49
49
|
}
|
|
50
|
+
AutoVector EvaluateTrans(BaseVector & v) const override
|
|
51
|
+
{
|
|
52
|
+
return this->Evaluate(v);
|
|
53
|
+
}
|
|
50
54
|
|
|
51
55
|
};
|
|
52
56
|
|
|
@@ -144,6 +148,8 @@ namespace ngla
|
|
|
144
148
|
|
|
145
149
|
FlatTensor<3> GetBlockDiag () const { return blockdiag; }
|
|
146
150
|
FlatMatrix<bool> GetNonZeroPattern() const { return nonzero; }
|
|
151
|
+
FlatTable<int> GetSparseMatrix() const { return sparse; }
|
|
152
|
+
FlatTable<int> GetSparseMatrixTrans() const { return sparseT; }
|
|
147
153
|
};
|
|
148
154
|
|
|
149
155
|
}
|
netgen/include/diffop_impl.hpp
CHANGED
|
@@ -312,10 +312,12 @@ namespace ngfem
|
|
|
312
312
|
|
|
313
313
|
template <typename DIFFOP>
|
|
314
314
|
void T_DifferentialOperator<DIFFOP> ::
|
|
315
|
-
CalcTransformationMatrix (const BaseMappedIntegrationPoint &
|
|
315
|
+
CalcTransformationMatrix (const BaseMappedIntegrationPoint & bmip,
|
|
316
316
|
SliceMatrix<double> trans,
|
|
317
317
|
LocalHeap & lh) const
|
|
318
318
|
{
|
|
319
|
+
const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE> & mip =
|
|
320
|
+
static_cast<const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPACE>&> (bmip);
|
|
319
321
|
DIFFOP::CalcTransformationMatrix(mip, trans, lh);
|
|
320
322
|
}
|
|
321
323
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#ifndef DIFFOPWITHFACTOR_HPP
|
|
2
|
+
#define DIFFOPWITHFACTOR_HPP
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
namespace ngsbem
|
|
7
|
+
{
|
|
8
|
+
using namespace ngfem;
|
|
9
|
+
|
|
10
|
+
class DifferentialOperatorWithFactor : public DifferentialOperator
|
|
11
|
+
{
|
|
12
|
+
shared_ptr<DifferentialOperator> diffop;
|
|
13
|
+
shared_ptr<CoefficientFunction> factor;
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
DifferentialOperatorWithFactor (shared_ptr<DifferentialOperator> adiffop,
|
|
17
|
+
shared_ptr<CoefficientFunction> afactor)
|
|
18
|
+
: DifferentialOperator(afactor->Dimensions()[0], 1, adiffop->VB(), adiffop->DiffOrder()),
|
|
19
|
+
diffop(adiffop), factor(afactor)
|
|
20
|
+
{
|
|
21
|
+
;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
int DimRef() const override { return diffop->DimRef(); }
|
|
25
|
+
|
|
26
|
+
virtual IntRange UsedDofs(const FiniteElement & fel) const override { return diffop->UsedDofs(fel); }
|
|
27
|
+
|
|
28
|
+
auto BaseDiffOp() const { return diffop; }
|
|
29
|
+
|
|
30
|
+
void CalcMatrix (const FiniteElement & fel,
|
|
31
|
+
const BaseMappedIntegrationPoint & mip,
|
|
32
|
+
BareSliceMatrix<double,ColMajor> mat,
|
|
33
|
+
LocalHeap & lh) const override
|
|
34
|
+
{
|
|
35
|
+
FlatMatrix<double,ColMajor> hmat(diffop->Dim(), fel.GetNDof(), lh);
|
|
36
|
+
diffop -> CalcMatrix (fel, mip, hmat, lh);
|
|
37
|
+
|
|
38
|
+
auto dims = factor->Dimensions();
|
|
39
|
+
FlatMatrix<double> factorx(dims[0], dims[1], lh);
|
|
40
|
+
factor->Evaluate (mip, factorx.AsVector());
|
|
41
|
+
|
|
42
|
+
IntRange used = diffop->UsedDofs(fel);
|
|
43
|
+
mat.Cols(used) = factorx * hmat.Cols(used);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
void CalcMatrix (const FiniteElement & fel,
|
|
47
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
48
|
+
BareSliceMatrix<SIMD<double>> mat) const override
|
|
49
|
+
{
|
|
50
|
+
// *testout << "CalcMatrix SIMD" << endl;
|
|
51
|
+
Matrix<SIMD<double>> hmat (fel.GetNDof()*diffop->Dim(), mir.Size());
|
|
52
|
+
// hmat = SIMD<double>(0.0);
|
|
53
|
+
diffop -> CalcMatrix (fel, mir, hmat);
|
|
54
|
+
|
|
55
|
+
Matrix<SIMD<double>> fac(factor->Dimension(), mir.Size());
|
|
56
|
+
factor -> Evaluate (mir, fac);
|
|
57
|
+
|
|
58
|
+
auto dims = factor -> Dimensions();
|
|
59
|
+
|
|
60
|
+
mat.Rows(fel.GetNDof()*dims[1]).Cols(mir.Size()) = SIMD<double>(0.0);
|
|
61
|
+
|
|
62
|
+
for (size_t i = 0; i < mir.Size(); i++)
|
|
63
|
+
for (size_t j = 0; j < dims[0]; j++)
|
|
64
|
+
for (size_t k = 0; k < dims[1]; k++)
|
|
65
|
+
mat.Col(i).Slice(j,dims[0]) += fac(j*dims[1]+k, i) * hmat.Col(i).Slice(k, dims[1]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
void CalcMatrix (const FiniteElement & fel,
|
|
70
|
+
const IntegrationPoint & ip,
|
|
71
|
+
BareSliceMatrix<double,ColMajor> mat,
|
|
72
|
+
LocalHeap & lh) const override
|
|
73
|
+
{
|
|
74
|
+
diffop -> CalcMatrix(fel, ip, mat, lh);
|
|
75
|
+
/*
|
|
76
|
+
*testout << "calcmatrix mip" << endl
|
|
77
|
+
<< mat.Rows(Dim()).Cols(fel.GetNDof()) << endl;
|
|
78
|
+
*/
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void CalcTransformationMatrix (const BaseMappedIntegrationPoint & mip,
|
|
82
|
+
SliceMatrix<double> trans,
|
|
83
|
+
LocalHeap & lh) const override
|
|
84
|
+
{
|
|
85
|
+
HeapReset hr(lh);
|
|
86
|
+
auto dims = factor->Dimensions();
|
|
87
|
+
|
|
88
|
+
FlatMatrix<double> factorx(dims[0], dims[1], lh);
|
|
89
|
+
factor->Evaluate (mip, factorx.AsVector());
|
|
90
|
+
|
|
91
|
+
FlatMatrix<double> basetrans(diffop->Dim(), diffop->DimRef(), lh);
|
|
92
|
+
diffop -> CalcTransformationMatrix(mip, basetrans, lh);
|
|
93
|
+
|
|
94
|
+
trans = factorx * basetrans;
|
|
95
|
+
// *testout << "trans = " << trans << endl;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
void Apply (const FiniteElement & fel,
|
|
100
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
101
|
+
BareSliceVector<double> x,
|
|
102
|
+
BareSliceMatrix<SIMD<double>> flux) const override
|
|
103
|
+
{
|
|
104
|
+
auto dims = factor->Dimensions();
|
|
105
|
+
|
|
106
|
+
Matrix<SIMD<double>> tmpflux(dims[1], mir.Size());
|
|
107
|
+
Matrix<SIMD<double>> factorx(dims[0]*dims[1], mir.Size());
|
|
108
|
+
|
|
109
|
+
diffop -> Apply (fel, mir, x, tmpflux);
|
|
110
|
+
factor -> Evaluate (mir, factorx);
|
|
111
|
+
flux.Rows(0, dims[0]).Cols(0, mir.Size()) = SIMD<double>(0.0);
|
|
112
|
+
for (int i = 0; i < dims[0]; i++)
|
|
113
|
+
for (int j = 0; j < dims[1]; j++)
|
|
114
|
+
flux.Row(i).Range(mir.Size()) += pw_mult(factorx.Row(i*dims[1]+j), tmpflux.Row(j));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#endif
|
|
@@ -131,10 +131,13 @@ namespace ngla
|
|
|
131
131
|
{
|
|
132
132
|
size_t h, w;
|
|
133
133
|
Matrix<SCAL> matrix;
|
|
134
|
-
Table<int> col_dnums;
|
|
135
|
-
Table<int> row_dnums;
|
|
134
|
+
Table<int> col_dnums; // output
|
|
135
|
+
Table<int> row_dnums; // input
|
|
136
136
|
bool disjoint_rows, disjoint_cols;
|
|
137
137
|
Table<int> row_coloring, col_coloring;
|
|
138
|
+
bool output_onto = false;
|
|
139
|
+
bool output_matrix = false;
|
|
140
|
+
bool output_matrix_trans = false;
|
|
138
141
|
public:
|
|
139
142
|
ConstantElementByElementMatrix (size_t ah, size_t aw, Matrix<SCAL> amatrix,
|
|
140
143
|
Table<int> acol_dnums, Table<int> arow_dnums);
|
|
@@ -157,7 +160,10 @@ namespace ngla
|
|
|
157
160
|
FlatTable<int> GetColDNums() const { return col_dnums; }
|
|
158
161
|
|
|
159
162
|
FlatTable<int> GetRowColoring() const { return row_coloring; }
|
|
160
|
-
FlatTable<int> GetColColoring() const { return col_coloring; }
|
|
163
|
+
FlatTable<int> GetColColoring() const { return col_coloring; }
|
|
164
|
+
|
|
165
|
+
bool OutputMatrix() const { return output_matrix; }
|
|
166
|
+
bool OutputMatrixTrans() const { return output_matrix_trans; }
|
|
161
167
|
};
|
|
162
168
|
|
|
163
169
|
class NGS_DLL_HEADER StructuredElementByElementMatrix : public BaseMatrix
|
netgen/include/expr.hpp
CHANGED
|
@@ -291,9 +291,9 @@ namespace ngbla
|
|
|
291
291
|
struct undefined_size
|
|
292
292
|
{
|
|
293
293
|
undefined_size() = default;
|
|
294
|
-
undefined_size(size_t s) { }
|
|
294
|
+
INLINE undefined_size(size_t s) { }
|
|
295
295
|
template <int S>
|
|
296
|
-
explicit constexpr undefined_size(IC<S> s) { }
|
|
296
|
+
INLINE explicit constexpr undefined_size(IC<S> s) { }
|
|
297
297
|
};
|
|
298
298
|
|
|
299
299
|
inline ostream & operator<< (ostream & ost, undefined_size s) { ost << "undefined"; return ost; }
|
|
@@ -515,7 +515,7 @@ namespace ngbla
|
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
|
|
518
|
-
if (TB::IsLinear())
|
|
518
|
+
if constexpr (TB::IsLinear())
|
|
519
519
|
{
|
|
520
520
|
if (T::IsLinear())
|
|
521
521
|
{
|
|
@@ -573,9 +573,6 @@ namespace ngbla
|
|
|
573
573
|
|
|
574
574
|
enum { COL_MAJOR = 0 }; // matrix is stored col-major
|
|
575
575
|
|
|
576
|
-
void Dump (ostream & ost) const { ost << "Matrix"; }
|
|
577
|
-
|
|
578
|
-
|
|
579
576
|
|
|
580
577
|
template<typename TOP, typename TB>
|
|
581
578
|
INLINE auto & Assign (const Expr<TB> & v)
|
|
@@ -735,6 +732,11 @@ namespace ngbla
|
|
|
735
732
|
{
|
|
736
733
|
return (*this) *= (1./s);
|
|
737
734
|
}
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
void Dump (ostream & ost) const
|
|
738
|
+
{ ost << "Matexpr (h=" << Height() << ", w=" << Width() << ")"; }
|
|
739
|
+
|
|
738
740
|
};
|
|
739
741
|
|
|
740
742
|
|
|
@@ -838,6 +840,7 @@ namespace ngbla
|
|
|
838
840
|
{
|
|
839
841
|
TA a;
|
|
840
842
|
public:
|
|
843
|
+
MinusExpr (const MinusExpr&) = default;
|
|
841
844
|
MinusExpr (TA aa) : a(aa) { ; }
|
|
842
845
|
|
|
843
846
|
template <typename ...I>
|
|
@@ -850,7 +853,10 @@ namespace ngbla
|
|
|
850
853
|
INLINE auto Width() const { return a.Width(); }
|
|
851
854
|
INLINE TA A() const { return a; }
|
|
852
855
|
|
|
853
|
-
static constexpr bool IsLinear() { return TA::IsLinear(); }
|
|
856
|
+
static constexpr bool IsLinear() { return TA::IsLinear(); }
|
|
857
|
+
void Dump (ostream & ost) const
|
|
858
|
+
{ ost << "-("; a.Dump(ost); ost << ")"; }
|
|
859
|
+
|
|
854
860
|
};
|
|
855
861
|
|
|
856
862
|
template <typename TA>
|
|
@@ -934,6 +940,7 @@ namespace ngbla
|
|
|
934
940
|
public:
|
|
935
941
|
static constexpr bool IsLinear() { return TA::IsLinear(); }
|
|
936
942
|
|
|
943
|
+
ScaleExpr (const ScaleExpr&) = default;
|
|
937
944
|
INLINE ScaleExpr (TA aa, TS as) : a(aa), s(as) { ; }
|
|
938
945
|
|
|
939
946
|
// INLINE auto operator() (size_t i) const { return s * a(i); }
|
|
@@ -1492,8 +1499,39 @@ namespace ngbla
|
|
|
1492
1499
|
}
|
|
1493
1500
|
|
|
1494
1501
|
|
|
1502
|
+
/* ************************* OuterProduct ********************** */
|
|
1503
|
+
|
|
1504
|
+
template <class TA, class TB>
|
|
1505
|
+
class OuterProductExpr : public Expr<OuterProductExpr<TA,TB>>
|
|
1506
|
+
{
|
|
1507
|
+
TA a;
|
|
1508
|
+
TB b;
|
|
1509
|
+
public:
|
|
1510
|
+
OuterProductExpr (TA aa, TB ab) : a(aa), b(ab) { ; }
|
|
1495
1511
|
|
|
1512
|
+
// INLINE auto operator() (size_t i) const { return a[i] * b(i); }
|
|
1513
|
+
INLINE auto operator() (size_t i, size_t j) const { return a[i] * b[j]; }
|
|
1496
1514
|
|
|
1515
|
+
INLINE auto View() const { return *this; }
|
|
1516
|
+
INLINE auto Shape() const
|
|
1517
|
+
{
|
|
1518
|
+
return tuple<size_t,size_t> (a.Size(), b.Width());
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
INLINE const auto A() const { return a; }
|
|
1522
|
+
INLINE const auto B() const { return b; }
|
|
1523
|
+
INLINE auto Height() const { return a.Size(); }
|
|
1524
|
+
INLINE auto Width() const { return b.Size(); }
|
|
1525
|
+
|
|
1526
|
+
static constexpr bool IsLinear() { return false; }
|
|
1527
|
+
};
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
template <typename TA, typename TB>
|
|
1531
|
+
INLINE auto OuterProduct (const Expr<TA> & a, const Expr<TB> & b)
|
|
1532
|
+
{
|
|
1533
|
+
return OuterProductExpr (a.View(), b.View());
|
|
1534
|
+
}
|
|
1497
1535
|
|
|
1498
1536
|
|
|
1499
1537
|
|
netgen/include/fespace.hpp
CHANGED
|
@@ -256,7 +256,7 @@ ANY 1 1 1 1 | 15
|
|
|
256
256
|
|
|
257
257
|
virtual void UpdateDofTables() { ; }
|
|
258
258
|
virtual void UpdateCouplingDofArray() { ; }
|
|
259
|
-
|
|
259
|
+
virtual void UpdateFreeDofs();
|
|
260
260
|
/// update element coloring
|
|
261
261
|
virtual void FinalizeUpdate();
|
|
262
262
|
|
|
@@ -448,7 +448,8 @@ ANY 1 1 1 1 | 15
|
|
|
448
448
|
virtual void GetDofNrs (NodeId ni, Array<DofId> & dnums) const;
|
|
449
449
|
BitArray GetDofs (const Region & reg) const;
|
|
450
450
|
Table<int> CreateDofTable (VorB vorb) const;
|
|
451
|
-
|
|
451
|
+
virtual void SelectDofs (const string & name, BitArray & dofs) const;
|
|
452
|
+
|
|
452
453
|
/// get coupling types of dofs
|
|
453
454
|
virtual void GetDofCouplingTypes (int elnr, Array<COUPLING_TYPE> & dnums) const;
|
|
454
455
|
|
|
@@ -531,8 +532,13 @@ ANY 1 1 1 1 | 15
|
|
|
531
532
|
void SetDefinedOnBoundary (const BitArray & defon)
|
|
532
533
|
{ SetDefinedOn(BND,defon); }
|
|
533
534
|
|
|
535
|
+
const Array<bool> & GetDefinedOn (VorB vb) const { return definedon[vb]; }
|
|
536
|
+
|
|
534
537
|
///
|
|
535
538
|
void SetDirichletBoundaries (const BitArray & dirbnds);
|
|
539
|
+
const BitArray & GetDirichletBoundaries (VorB vb) const { return dirichlet_constraints[vb]; }
|
|
540
|
+
|
|
541
|
+
|
|
536
542
|
/// Get reference element for tet, prism, trig, etc ..
|
|
537
543
|
// const FiniteElement & GetFE (ELEMENT_TYPE type) const;
|
|
538
544
|
|
|
@@ -640,7 +646,7 @@ ANY 1 1 1 1 | 15
|
|
|
640
646
|
/// Set multigrid prolongation
|
|
641
647
|
// void SetProlongation (ngmg::Prolongation * aprol)
|
|
642
648
|
// { prol = aprol; }
|
|
643
|
-
virtual void SetHarmonicProlongation (shared_ptr<BilinearForm> bfa);
|
|
649
|
+
virtual void SetHarmonicProlongation (shared_ptr<BilinearForm> bfa, string inverse);
|
|
644
650
|
|
|
645
651
|
/// returns function-evaluator
|
|
646
652
|
shared_ptr<DifferentialOperator> GetEvaluator (VorB vb = VOL) const
|
|
@@ -1109,6 +1115,7 @@ ANY 1 1 1 1 | 15
|
|
|
1109
1115
|
|
|
1110
1116
|
/// copies dofcoupling from components
|
|
1111
1117
|
void UpdateCouplingDofArray() override;
|
|
1118
|
+
virtual void UpdateFreeDofs() override;
|
|
1112
1119
|
|
|
1113
1120
|
void SetDefinedOn (VorB vb, const BitArray& defon) override;
|
|
1114
1121
|
|
|
@@ -1140,7 +1147,8 @@ ANY 1 1 1 1 | 15
|
|
|
1140
1147
|
void GetEdgeDofNrs (int ednr, Array<DofId> & dnums) const override;
|
|
1141
1148
|
void GetFaceDofNrs (int fanr, Array<DofId> & dnums) const override;
|
|
1142
1149
|
void GetInnerDofNrs (int elnr, Array<DofId> & dnums) const override;
|
|
1143
|
-
|
|
1150
|
+
void SelectDofs (const string & name, BitArray & dofs) const override;
|
|
1151
|
+
|
|
1144
1152
|
void SolveM(CoefficientFunction * rho, BaseVector & vec, Region * definedon,
|
|
1145
1153
|
LocalHeap & lh) const override;
|
|
1146
1154
|
void ApplyM(CoefficientFunction * rho, BaseVector & vec, Region * definedon,
|
netgen/include/gridfunction.hpp
CHANGED
|
@@ -157,16 +157,16 @@ namespace ngcomp
|
|
|
157
157
|
int GetMultiDim () const { return multidim; }
|
|
158
158
|
|
|
159
159
|
/// increase multidim and copy vec to new component
|
|
160
|
-
void AddMultiDimComponent (BaseVector & vec);
|
|
160
|
+
void AddMultiDimComponent (BaseVector & vec, bool copy = true);
|
|
161
161
|
|
|
162
162
|
int GetLevelUpdated() const { return level_updated; }
|
|
163
163
|
///
|
|
164
164
|
|
|
165
165
|
// const FESpace & GetFESpace() const { return *fespace; }
|
|
166
166
|
///
|
|
167
|
-
shared_ptr<FESpace> GetFESpace() const { return fespace; }
|
|
167
|
+
const shared_ptr<FESpace> & GetFESpace() const { return fespace; }
|
|
168
168
|
///
|
|
169
|
-
shared_ptr<MeshAccess> GetMeshAccess() const { return fespace->GetMeshAccess(); }
|
|
169
|
+
const shared_ptr<MeshAccess> & GetMeshAccess() const { return fespace->GetMeshAccess(); }
|
|
170
170
|
///
|
|
171
171
|
virtual string GetClassName () const
|
|
172
172
|
{
|
netgen/include/h1amg.hpp
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
#ifndef
|
|
2
|
-
#define
|
|
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
|
{
|
|
10
11
|
using namespace ngla;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
struct H1AMG_Parameters
|
|
16
|
+
{
|
|
17
|
+
int verbose = 0;
|
|
18
|
+
int smoothing_steps = 3;
|
|
19
|
+
int coarsenings_per_level = 3; // number of binary coarsenings per level
|
|
20
|
+
bool block_smoother = true; // block or point smoother ?
|
|
21
|
+
bool use_smoothed_prolongation = true;
|
|
22
|
+
int max_coarse = 10;
|
|
23
|
+
int max_level = 20;
|
|
24
|
+
};
|
|
25
|
+
|
|
11
26
|
|
|
12
27
|
template <class SCAL>
|
|
13
28
|
class NGS_DLL_HEADER H1AMG_Matrix : public ngla::BaseMatrix
|
|
@@ -25,6 +40,7 @@ namespace ngcomp
|
|
|
25
40
|
ngcore::FlatArray<ngcore::IVec<2>> e2v,
|
|
26
41
|
ngcore::FlatArray<double> edge_weights,
|
|
27
42
|
ngcore::FlatArray<double> vertex_weights,
|
|
43
|
+
const H1AMG_Parameters & param,
|
|
28
44
|
size_t level);
|
|
29
45
|
|
|
30
46
|
virtual int VHeight() const override { return size; }
|
|
@@ -36,6 +52,73 @@ namespace ngcomp
|
|
|
36
52
|
|
|
37
53
|
virtual void Mult (const ngla::BaseVector & b, ngla::BaseVector & x) const override;
|
|
38
54
|
};
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
template <class SCAL>
|
|
61
|
+
class H1AMG_Preconditioner : public Preconditioner
|
|
62
|
+
{
|
|
63
|
+
shared_ptr<BitArray> freedofs;
|
|
64
|
+
shared_ptr<H1AMG_Matrix<SCAL>> mat;
|
|
65
|
+
|
|
66
|
+
ParallelHashTable<IVec<2>,double> edge_weights_ht;
|
|
67
|
+
ParallelHashTable<IVec<1>,double> vertex_weights_ht;
|
|
68
|
+
|
|
69
|
+
H1AMG_Parameters param;
|
|
70
|
+
|
|
71
|
+
public:
|
|
72
|
+
|
|
73
|
+
static shared_ptr<Preconditioner> CreateBF (shared_ptr<BilinearForm> bfa, const Flags & flags, const string & name)
|
|
74
|
+
{
|
|
75
|
+
if (bfa->GetFESpace()->IsComplex())
|
|
76
|
+
return make_shared<H1AMG_Preconditioner<Complex>> (bfa, flags, name);
|
|
77
|
+
else
|
|
78
|
+
return make_shared<H1AMG_Preconditioner<double>> (bfa, flags, name);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static DocInfo GetDocu ();
|
|
82
|
+
|
|
83
|
+
H1AMG_Preconditioner (shared_ptr<BilinearForm> abfa, const Flags & aflags,
|
|
84
|
+
const string aname = "H1AMG_cprecond")
|
|
85
|
+
: Preconditioner (abfa, aflags, aname)
|
|
86
|
+
{
|
|
87
|
+
if (is_same<SCAL,double>::value)
|
|
88
|
+
cout << IM(3) << "Create H1AMG" << endl;
|
|
89
|
+
else
|
|
90
|
+
cout << IM(3) << "Create H1AMG, complex" << endl;
|
|
91
|
+
|
|
92
|
+
param.verbose = int(flags.GetNumFlag("verbose", 0));
|
|
93
|
+
param.smoothing_steps = int(flags.GetNumFlag("smoothingsteps", 1));
|
|
94
|
+
param.use_smoothed_prolongation = flags.GetDefineFlagX("smoothedprolongation").IsMaybeTrue();
|
|
95
|
+
param.max_coarse = int(flags.GetNumFlag("maxcoarse", 10));
|
|
96
|
+
param.max_level = int(flags.GetNumFlag("maxlevel", 20));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
virtual void InitLevel (shared_ptr<BitArray> _freedofs) override
|
|
100
|
+
{
|
|
101
|
+
freedofs = _freedofs;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
virtual void FinalizeLevel (const BaseMatrix * matrix) override;
|
|
105
|
+
|
|
106
|
+
virtual void AddElementMatrix (FlatArray<int> dnums,
|
|
107
|
+
FlatMatrix<SCAL> elmat,
|
|
108
|
+
ElementId id,
|
|
109
|
+
LocalHeap & lh) override;
|
|
110
|
+
|
|
111
|
+
virtual void Update () override { ; }
|
|
112
|
+
|
|
113
|
+
virtual const BaseMatrix & GetMatrix() const override
|
|
114
|
+
{
|
|
115
|
+
return *mat;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
39
122
|
}
|
|
40
123
|
|
|
41
124
|
#endif // H1AMG_HPP_
|
netgen/include/h1lumping.hpp
CHANGED
|
@@ -25,6 +25,12 @@ namespace ngcomp
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
void GetDofNrs (ElementId ei, Array<DofId> & dnums) const override;
|
|
28
|
+
void GetVertexDofNrs (int vnr, Array<int> & dnums) const override;
|
|
29
|
+
void GetEdgeDofNrs (int ednr, Array<int> & dnums) const override;
|
|
30
|
+
void GetFaceDofNrs (int fanr, Array<int> & dnums) const override;
|
|
31
|
+
void GetInnerDofNrs (int elnr, Array<int> & dnums) const override;
|
|
32
|
+
|
|
33
|
+
|
|
28
34
|
|
|
29
35
|
FiniteElement & GetFE (ElementId ei, Allocator & alloc) const override;
|
|
30
36
|
|
|
@@ -643,6 +643,17 @@ namespace ngfem
|
|
|
643
643
|
enum { DIM_DMAT = 1 };
|
|
644
644
|
enum { DIFFORDER = 1 };
|
|
645
645
|
|
|
646
|
+
static string Name() { return "curl"; }
|
|
647
|
+
|
|
648
|
+
static const FEL & Cast(const FiniteElement & fel)
|
|
649
|
+
{
|
|
650
|
+
return static_cast<const FEL&> (fel);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
static int DimRef() { return 1; }
|
|
655
|
+
|
|
656
|
+
|
|
646
657
|
static constexpr bool SUPPORT_PML = true;
|
|
647
658
|
template <typename AFEL, typename MIP, typename MAT>
|
|
648
659
|
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
@@ -651,6 +662,22 @@ namespace ngfem
|
|
|
651
662
|
mat = 1.0/mip.GetJacobiDet() *
|
|
652
663
|
Trans (static_cast<const FEL&>(fel).GetCurlShape(mip.IP(),lh));
|
|
653
664
|
}
|
|
665
|
+
|
|
666
|
+
template<typename IP, typename MAT>
|
|
667
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
668
|
+
MAT && mat, LocalHeap & lh)
|
|
669
|
+
{
|
|
670
|
+
Cast(fel).CalcCurlShape (ip, Trans(mat));
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
template <typename MIP, typename MAT>
|
|
674
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
675
|
+
MAT & mat, LocalHeap & lh)
|
|
676
|
+
{
|
|
677
|
+
// auto & mip = static_cast<const MappedIntegrationPoint<D-1,D>&>(bmip);
|
|
678
|
+
mat = 1./mip.GetJacobiDet();
|
|
679
|
+
}
|
|
680
|
+
|
|
654
681
|
|
|
655
682
|
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
656
683
|
const SIMD_BaseMappedIntegrationRule & mir,
|
|
@@ -701,6 +728,8 @@ public:
|
|
|
701
728
|
enum { DIM_DMAT = 3 };
|
|
702
729
|
enum { DIFFORDER = 1 };
|
|
703
730
|
|
|
731
|
+
static string Name() { return "curl"; }
|
|
732
|
+
|
|
704
733
|
static constexpr bool SUPPORT_PML = true;
|
|
705
734
|
static const FEL & Cast (const FiniteElement & fel)
|
|
706
735
|
{ return static_cast<const FEL&> (fel); }
|