ngsolve 6.2.2506.post38.dev0__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2506.post60.dev0__cp313-cp313-macosx_10_15_universal2.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/bdbequations.hpp +33 -0
- netgen/include/diffopwithfactor.hpp +123 -0
- netgen/include/expr.hpp +32 -1
- netgen/include/kernels.hpp +183 -74
- netgen/include/l2hofe.hpp +1 -0
- netgen/include/mptools.hpp +49 -39
- netgen/include/thdivfe_impl.hpp +1 -1
- netgen/include/vector.hpp +7 -2
- netgen/libngbla.dylib +0 -0
- netgen/libngcomp.dylib +0 -0
- netgen/libngfem.dylib +0 -0
- netgen/libngla.dylib +0 -0
- netgen/libngsbem.dylib +0 -0
- netgen/libngstd.dylib +0 -0
- ngsolve/__init__.pyi +3 -3
- ngsolve/cmake/NGSolveConfig.cmake +1 -1
- ngsolve/config/__init__.pyi +6 -6
- ngsolve/config/config.py +5 -5
- ngsolve/config/config.pyi +6 -6
- ngsolve/directsolvers.pyi +1 -1
- ngsolve/krylovspace.pyi +3 -3
- ngsolve/nonlinearsolvers.pyi +1 -1
- ngsolve/solve_implementation.py +10 -1
- ngsolve/solve_implementation.pyi +4 -4
- ngsolve/timestepping.pyi +3 -3
- ngsolve/timing.pyi +1 -1
- ngsolve/utils.pyi +1 -1
- {ngsolve-6.2.2506.post38.dev0.dist-info → ngsolve-6.2.2506.post60.dev0.dist-info}/METADATA +1 -1
- {ngsolve-6.2.2506.post38.dev0.dist-info → ngsolve-6.2.2506.post60.dev0.dist-info}/RECORD +65 -64
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/Netgen.icns +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/bin/ngscxx +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/bin/ngsld +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/bin/ngsolve.tcl +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/bin/ngspy +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/beam.geo +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/beam.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/chip.in2d +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/chip.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/coil.geo +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/coil.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/coilshield.geo +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/coilshield.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/cube.geo +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/cube.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d1_square.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d2_chip.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d4_cube.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d5_beam.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d6_shaft.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d7_coil.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/doubleglazing.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/shaft.geo +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/shaft.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/square.in2d +0 -0
- {ngsolve-6.2.2506.post38.dev0.data → ngsolve-6.2.2506.post60.dev0.data}/data/share/ngsolve/square.vol +0 -0
- {ngsolve-6.2.2506.post38.dev0.dist-info → ngsolve-6.2.2506.post60.dev0.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2506.post38.dev0.dist-info → ngsolve-6.2.2506.post60.dev0.dist-info}/WHEEL +0 -0
- {ngsolve-6.2.2506.post38.dev0.dist-info → ngsolve-6.2.2506.post60.dev0.dist-info}/top_level.txt +0 -0
netgen/include/bdbequations.hpp
CHANGED
|
@@ -2344,6 +2344,39 @@ namespace ngfem
|
|
|
2344
2344
|
mat.Rows(DIM_SPC*i, DIM_SPC*(i+1)).Cols(fel.GetRange(i)) = Trans(hmat);
|
|
2345
2345
|
}
|
|
2346
2346
|
|
|
2347
|
+
static int DimRef() { return DIM_SPC*DIM_ELEMENT; }
|
|
2348
|
+
|
|
2349
|
+
template <typename IP, typename MAT>
|
|
2350
|
+
static void GenerateMatrixRef (const FiniteElement & bfel, const IP & ip,
|
|
2351
|
+
MAT && mat, LocalHeap & lh)
|
|
2352
|
+
{
|
|
2353
|
+
HeapReset hr(lh);
|
|
2354
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2355
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_ELEMENT>&> (fel[0]);
|
|
2356
|
+
FlatMatrix<> hmat(feli.GetNDof(), DIM_ELEMENT, lh);
|
|
2357
|
+
feli.CalcDShape(ip, hmat);
|
|
2358
|
+
int ndof = feli.GetNDof();
|
|
2359
|
+
mat.Rows(DIM_SPACE*DIM_ELEMENT).Cols(DIM_SPC*ndof) = 0.0;
|
|
2360
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2361
|
+
mat.Rows(i*DIM_ELEMENT, (i+1)*DIM_ELEMENT).Cols(i*ndof,(i+1)*ndof)
|
|
2362
|
+
= Trans(hmat);
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
template <typename MIP, typename MAT>
|
|
2366
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
2367
|
+
MAT & mat, LocalHeap & lh)
|
|
2368
|
+
{
|
|
2369
|
+
FlatMatrix<> hmat(DIM_SPC, DIM_ELEMENT, lh);
|
|
2370
|
+
hmat = Trans(static_cast<const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPC>&>(mip).GetJacobianInverse());
|
|
2371
|
+
mat.Rows(DIM_DMAT).Cols(DIM_ELEMENT*DIM_SPC) = 0.0;
|
|
2372
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2373
|
+
mat.Rows(i*DIM_SPC, (i+1)*DIM_SPC).Cols(i*DIM_ELEMENT, (i+1)*DIM_ELEMENT) = hmat;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2347
2380
|
|
|
2348
2381
|
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
2349
2382
|
const SIMD_BaseMappedIntegrationRule & mir,
|
|
@@ -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
|
netgen/include/expr.hpp
CHANGED
|
@@ -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
|
{
|
|
@@ -1492,8 +1492,39 @@ namespace ngbla
|
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
1494
|
|
|
1495
|
+
/* ************************* OuterProduct ********************** */
|
|
1496
|
+
|
|
1497
|
+
template <class TA, class TB>
|
|
1498
|
+
class OuterProductExpr : public Expr<OuterProductExpr<TA,TB>>
|
|
1499
|
+
{
|
|
1500
|
+
TA a;
|
|
1501
|
+
TB b;
|
|
1502
|
+
public:
|
|
1503
|
+
OuterProductExpr (TA aa, TB ab) : a(aa), b(ab) { ; }
|
|
1495
1504
|
|
|
1505
|
+
// INLINE auto operator() (size_t i) const { return a[i] * b(i); }
|
|
1506
|
+
INLINE auto operator() (size_t i, size_t j) const { return a[i] * b[j]; }
|
|
1496
1507
|
|
|
1508
|
+
INLINE auto View() const { return *this; }
|
|
1509
|
+
INLINE auto Shape() const
|
|
1510
|
+
{
|
|
1511
|
+
return tuple<size_t,size_t> (a.Size(), b.Width());
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
INLINE const auto A() const { return a; }
|
|
1515
|
+
INLINE const auto B() const { return b; }
|
|
1516
|
+
INLINE auto Height() const { return a.Size(); }
|
|
1517
|
+
INLINE auto Width() const { return b.Size(); }
|
|
1518
|
+
|
|
1519
|
+
static constexpr bool IsLinear() { return false; }
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
template <typename TA, typename TB>
|
|
1524
|
+
INLINE auto OuterProduct (const Expr<TA> & a, const Expr<TB> & b)
|
|
1525
|
+
{
|
|
1526
|
+
return OuterProductExpr (a.View(), b.View());
|
|
1527
|
+
}
|
|
1497
1528
|
|
|
1498
1529
|
|
|
1499
1530
|
|
netgen/include/kernels.hpp
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#define KERNELS_hpp
|
|
3
3
|
|
|
4
4
|
#include "mptools.hpp"
|
|
5
|
+
#include <type_traits>
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
// **************************** The kernels **********************************
|
|
@@ -62,18 +63,26 @@ namespace ngsbem
|
|
|
62
63
|
|
|
63
64
|
/** LaplaceSLkernel is the kernel for the single layer potential of
|
|
64
65
|
the Laplace equation $ \Delta u = 0 \,.$ */
|
|
65
|
-
template <int DIM> class LaplaceSLKernel;
|
|
66
|
+
template <int DIM, int COMPS=1> class LaplaceSLKernel;
|
|
66
67
|
|
|
67
68
|
/** LaplaceSLkernel in 3D reads
|
|
68
69
|
$$ G(x-y) = \frac{1}{4\,\pi \, | x-y| }, \quad x, y \in \mathbb R^3, \; x\not=y\,. $$ */
|
|
69
|
-
template
|
|
70
|
-
class LaplaceSLKernel<3> : public BaseKernel
|
|
70
|
+
template<int COMPS>
|
|
71
|
+
class LaplaceSLKernel<3, COMPS> : public BaseKernel
|
|
71
72
|
{
|
|
72
73
|
public:
|
|
73
|
-
LaplaceSLKernel<3>
|
|
74
|
+
LaplaceSLKernel<3,COMPS>()
|
|
75
|
+
{
|
|
76
|
+
for (size_t i = 0; i < COMPS; i++)
|
|
77
|
+
terms += {1.0, 0, i, i};
|
|
78
|
+
};
|
|
74
79
|
typedef double value_type;
|
|
80
|
+
using mp_type = typename std::conditional<COMPS == 1,
|
|
81
|
+
Complex,
|
|
82
|
+
Vec<COMPS, Complex>>::type;
|
|
83
|
+
|
|
75
84
|
static string Name() { return "LaplaceSL"; }
|
|
76
|
-
static auto Shape() { return IVec<2>(
|
|
85
|
+
static auto Shape() { return IVec<2>(COMPS,COMPS); }
|
|
77
86
|
|
|
78
87
|
template <typename T>
|
|
79
88
|
auto Evaluate (Vec<3,T> x, Vec<3,T> y, Vec<3,T> nx, Vec<3,T> ny) const
|
|
@@ -83,45 +92,59 @@ namespace ngsbem
|
|
|
83
92
|
return Vec<1,T> (1.0 / (4 * M_PI * norm));
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
Array<KernelTerm> terms
|
|
95
|
+
Array<KernelTerm> terms;
|
|
87
96
|
|
|
88
97
|
auto CreateMultipoleExpansion (Vec<3> c, double r) const
|
|
89
98
|
{
|
|
90
|
-
return make_shared<SingularMLExpansion<
|
|
99
|
+
return make_shared<SingularMLExpansion<mp_type>> (c, r, 1e-16);
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
auto CreateLocalExpansion (Vec<3> c, double r) const
|
|
94
103
|
{
|
|
95
|
-
return make_shared<RegularMLExpansion<
|
|
104
|
+
return make_shared<RegularMLExpansion<mp_type>> (c, r, 1e-16);
|
|
96
105
|
}
|
|
97
106
|
|
|
98
|
-
void AddSource (SingularMLExpansion<
|
|
107
|
+
void AddSource (SingularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
99
108
|
{
|
|
100
|
-
|
|
109
|
+
if constexpr (COMPS == 1)
|
|
110
|
+
mp.AddCharge (pnt, val(0));
|
|
111
|
+
else
|
|
112
|
+
mp.AddCharge (pnt, val);
|
|
101
113
|
}
|
|
102
114
|
|
|
103
|
-
void EvaluateMP (RegularMLExpansion<
|
|
115
|
+
void EvaluateMP (RegularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
104
116
|
{
|
|
105
|
-
|
|
117
|
+
if constexpr (COMPS == 1)
|
|
118
|
+
val(0) = Real(mp.Evaluate (pnt));
|
|
119
|
+
else
|
|
120
|
+
val = Real(mp.Evaluate (pnt));
|
|
106
121
|
}
|
|
107
122
|
};
|
|
108
123
|
|
|
109
124
|
|
|
110
125
|
/** LaplaceDLkernel is the kernel for the double layer potential of
|
|
111
126
|
the Laplace equation $ \Delta u = 0 \,.$ */
|
|
112
|
-
template <int DIM> class LaplaceDLKernel;
|
|
127
|
+
template <int DIM, int COMPS=1> class LaplaceDLKernel;
|
|
113
128
|
|
|
114
129
|
/** LaplaceDLkernel in 3D reads
|
|
115
130
|
$$ \frac{\partial }{ \partial n_y} G(x-y) = \frac{1}{4\,\pi} \,
|
|
116
131
|
\frac{ \langle n(y), x-y\rangle }{ | x-y|^3 },
|
|
117
132
|
\quad x, y \in \mathbb R^3, \; x\not=y\,. $$ */
|
|
118
|
-
template
|
|
119
|
-
class LaplaceDLKernel<3> : public BaseKernel
|
|
133
|
+
template<int COMPS>
|
|
134
|
+
class LaplaceDLKernel<3, COMPS> : public BaseKernel
|
|
120
135
|
{
|
|
121
136
|
public:
|
|
137
|
+
LaplaceDLKernel<3,COMPS>()
|
|
138
|
+
{
|
|
139
|
+
for (size_t i = 0; i < COMPS; i++)
|
|
140
|
+
terms += {1.0, 0, i, i};
|
|
141
|
+
};
|
|
122
142
|
typedef double value_type;
|
|
143
|
+
using mp_type = typename std::conditional<COMPS == 1,
|
|
144
|
+
Complex,
|
|
145
|
+
Vec<COMPS, Complex>>::type;
|
|
123
146
|
static string Name() { return "LaplaceDL"; }
|
|
124
|
-
static auto Shape() { return IVec<2>(
|
|
147
|
+
static auto Shape() { return IVec<2>(COMPS,COMPS); }
|
|
125
148
|
|
|
126
149
|
template <typename T>
|
|
127
150
|
auto Evaluate (Vec<3,T> x, Vec<3,T> y, Vec<3,T> nx, Vec<3,T> ny) const
|
|
@@ -132,83 +155,48 @@ namespace ngsbem
|
|
|
132
155
|
return Vec<1,T> (nxy / (4 * M_PI * norm*norm*norm));
|
|
133
156
|
}
|
|
134
157
|
|
|
135
|
-
Array<KernelTerm> terms
|
|
158
|
+
Array<KernelTerm> terms;
|
|
136
159
|
|
|
137
160
|
auto CreateMultipoleExpansion (Vec<3> c, double r) const
|
|
138
161
|
{
|
|
139
|
-
return make_shared<SingularMLExpansion<
|
|
162
|
+
return make_shared<SingularMLExpansion<mp_type>> (c, r, 1e-16);
|
|
140
163
|
}
|
|
141
164
|
|
|
142
165
|
auto CreateLocalExpansion (Vec<3> c, double r) const
|
|
143
166
|
{
|
|
144
|
-
return make_shared<RegularMLExpansion<
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
void AddSource (SingularMLExpansion<Complex> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
148
|
-
{
|
|
149
|
-
mp.AddDipole(pnt, -nv, val(0));
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
void AddSourceTrans(SingularMLExpansion<Complex> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
153
|
-
{
|
|
154
|
-
mp.AddCharge(pnt, val(0));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
void EvaluateMP (RegularMLExpansion<Complex> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
158
|
-
{
|
|
159
|
-
val(0) = Real(mp.Evaluate (pnt));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
void EvaluateMPTrans(RegularMLExpansion<Complex> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
163
|
-
{
|
|
164
|
-
val(0) = Real(mp.EvaluateDirectionalDerivative(pnt, nv));
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
template <int DIM> class LaplaceHSKernel;
|
|
170
|
-
|
|
171
|
-
template<>
|
|
172
|
-
class LaplaceHSKernel<3> : public BaseKernel
|
|
173
|
-
{
|
|
174
|
-
public:
|
|
175
|
-
typedef double value_type;
|
|
176
|
-
static string Name() { return "LaplaceHL"; }
|
|
177
|
-
static auto Shape() { return IVec<2>(3,3); }
|
|
178
|
-
|
|
179
|
-
template <typename T>
|
|
180
|
-
auto Evaluate (Vec<3,T> x, Vec<3,T> y, Vec<3,T> nx, Vec<3,T> ny) const
|
|
181
|
-
{
|
|
182
|
-
T norm = L2Norm(x-y);
|
|
183
|
-
// return 1.0 / (4 * M_PI * norm);
|
|
184
|
-
return Vec<1,T> (1.0 / (4 * M_PI * norm));
|
|
167
|
+
return make_shared<RegularMLExpansion<mp_type>> (c, r, 1e-16);
|
|
185
168
|
}
|
|
186
|
-
|
|
187
|
-
Array<KernelTerm> terms =
|
|
188
|
-
{
|
|
189
|
-
KernelTerm{1.0, 0, 0, 0},
|
|
190
|
-
KernelTerm{1.0, 0, 1, 1},
|
|
191
|
-
KernelTerm{1.0, 0, 2, 2},
|
|
192
|
-
};
|
|
193
169
|
|
|
194
|
-
|
|
170
|
+
void AddSource (SingularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
195
171
|
{
|
|
196
|
-
|
|
172
|
+
if constexpr (COMPS == 1)
|
|
173
|
+
mp.AddDipole(pnt, -nv, val(0));
|
|
174
|
+
else
|
|
175
|
+
mp.AddDipole(pnt, -nv, val);
|
|
197
176
|
}
|
|
198
177
|
|
|
199
|
-
|
|
178
|
+
void AddSourceTrans(SingularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
200
179
|
{
|
|
201
|
-
|
|
180
|
+
if constexpr (COMPS == 1)
|
|
181
|
+
mp.AddCharge (pnt, val(0));
|
|
182
|
+
else
|
|
183
|
+
mp.AddCharge (pnt, val);
|
|
202
184
|
}
|
|
203
185
|
|
|
204
|
-
void
|
|
186
|
+
void EvaluateMP (RegularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
205
187
|
{
|
|
206
|
-
|
|
188
|
+
if constexpr (COMPS == 1)
|
|
189
|
+
val(0) = Real(mp.Evaluate (pnt));
|
|
190
|
+
else
|
|
191
|
+
val = Real(mp.Evaluate (pnt));
|
|
207
192
|
}
|
|
208
193
|
|
|
209
|
-
void
|
|
194
|
+
void EvaluateMPTrans(RegularMLExpansion<mp_type> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
210
195
|
{
|
|
211
|
-
|
|
196
|
+
if constexpr (COMPS == 1)
|
|
197
|
+
val(0) = Real(mp.EvaluateDirectionalDerivative(pnt, nv));
|
|
198
|
+
else
|
|
199
|
+
val = Real(mp.EvaluateDirectionalDerivative(pnt, nv));
|
|
212
200
|
}
|
|
213
201
|
};
|
|
214
202
|
|
|
@@ -646,6 +634,127 @@ namespace ngsbem
|
|
|
646
634
|
};
|
|
647
635
|
|
|
648
636
|
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
/*
|
|
641
|
+
Dissertation Guenther Of
|
|
642
|
+
"BETI–Gebietszerlegungsmethoden
|
|
643
|
+
mit schnellen Randelementverfahren
|
|
644
|
+
und Anwendungen"
|
|
645
|
+
page 85
|
|
646
|
+
*/
|
|
647
|
+
|
|
648
|
+
template <int D> class LameSLKernel;
|
|
649
|
+
|
|
650
|
+
template<>
|
|
651
|
+
class LameSLKernel<3> : public BaseKernel
|
|
652
|
+
{
|
|
653
|
+
double E, nu;
|
|
654
|
+
double alpha;
|
|
655
|
+
public:
|
|
656
|
+
typedef double value_type;
|
|
657
|
+
|
|
658
|
+
static string Name() { return "LameSL"; }
|
|
659
|
+
static auto Shape() { return IVec<2>(3,3); }
|
|
660
|
+
|
|
661
|
+
LameSLKernel (const LameSLKernel&) = default;
|
|
662
|
+
LameSLKernel (LameSLKernel&&) = default;
|
|
663
|
+
LameSLKernel (double _E, double _nu) : E(_E), nu(_nu)
|
|
664
|
+
{
|
|
665
|
+
alpha = (1+nu)/((1-nu)*2*E);
|
|
666
|
+
|
|
667
|
+
terms += { 3-4*nu, 0, 0, 0 };
|
|
668
|
+
terms += { 3-4*nu, 0, 1, 1 };
|
|
669
|
+
terms += { 3-4*nu, 0, 2, 2 };
|
|
670
|
+
|
|
671
|
+
terms += { 1, 1, 0, 0 };
|
|
672
|
+
terms += { 1, 2, 0, 1 };
|
|
673
|
+
terms += { 1, 2, 1, 0 };
|
|
674
|
+
|
|
675
|
+
terms += { 1, 3, 0, 2 };
|
|
676
|
+
terms += { 1, 3, 2, 0 };
|
|
677
|
+
terms += { 1, 4, 1, 1 };
|
|
678
|
+
|
|
679
|
+
terms += { 1, 5, 1, 2 };
|
|
680
|
+
terms += { 1, 5, 2, 1 };
|
|
681
|
+
terms += { 1, 6, 2, 2 };
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
Array<KernelTerm> terms;
|
|
685
|
+
|
|
686
|
+
template <typename T>
|
|
687
|
+
auto Evaluate (Vec<3,T> x, Vec<3,T> y, Vec<3,T> nx, Vec<3,T> ny) const
|
|
688
|
+
{
|
|
689
|
+
T norm = L2Norm(x-y);
|
|
690
|
+
auto lapkern = alpha / (4 * M_PI * norm); // lapkern times factor
|
|
691
|
+
|
|
692
|
+
return Vec<7,T> { lapkern,
|
|
693
|
+
(x(0)-y(0))*(x(0)-y(0))/sqr(norm) * lapkern,
|
|
694
|
+
(x(0)-y(0))*(x(1)-y(1))/sqr(norm) * lapkern,
|
|
695
|
+
(x(0)-y(0))*(x(2)-y(2))/sqr(norm) * lapkern,
|
|
696
|
+
(x(1)-y(1))*(x(1)-y(1))/sqr(norm) * lapkern,
|
|
697
|
+
(x(1)-y(1))*(x(2)-y(2))/sqr(norm) * lapkern,
|
|
698
|
+
(x(2)-y(2))*(x(2)-y(2))/sqr(norm) * lapkern
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
auto CreateMultipoleExpansion (Vec<3> c, double r) const
|
|
704
|
+
{
|
|
705
|
+
return make_shared<SingularMLExpansion<Vec<6,Complex>>> (c, r, 1e-16);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
auto CreateLocalExpansion (Vec<3> c, double r) const
|
|
709
|
+
{
|
|
710
|
+
return make_shared<RegularMLExpansion<Vec<6,Complex>>> (c, r, 1e-16);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
void AddSource (SingularMLExpansion<Vec<6,Complex>> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
715
|
+
{
|
|
716
|
+
Vec<6> charge = 0.0;
|
|
717
|
+
charge.Range(0,3) = val;
|
|
718
|
+
mp.AddCharge(pnt, charge); // Row 1+2
|
|
719
|
+
|
|
720
|
+
Mat<3,3> jacobi = OuterProduct(pnt, val) + InnerProduct(pnt, val) * Id<3>();
|
|
721
|
+
|
|
722
|
+
for (int k = 0; k < 3; k++)
|
|
723
|
+
{
|
|
724
|
+
Vec<6> dipole_charge = 0.0;
|
|
725
|
+
dipole_charge.Range(3,6) = jacobi.Col(k);
|
|
726
|
+
|
|
727
|
+
auto ek = UnitVec<3>(k);
|
|
728
|
+
mp.AddDipole(pnt, -ek, dipole_charge);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
void EvaluateMP (RegularMLExpansion<Vec<6,Complex>> & mp, Vec<3> pnt, Vec<3> nv, BareSliceVector<double> val) const
|
|
733
|
+
{
|
|
734
|
+
Vec<6> mpval = Real(mp.Evaluate (pnt));
|
|
735
|
+
val.Range(0,3) = 0;
|
|
736
|
+
val += (3-4*nu)*alpha * mpval.Range(0,3); // Row 1
|
|
737
|
+
|
|
738
|
+
val -= alpha/2 * mpval.Range(3,6); // Row 3
|
|
739
|
+
|
|
740
|
+
// Row 2
|
|
741
|
+
Mat<3,3> jacobi = 0.0;
|
|
742
|
+
for (int k = 0; k < 3; k++)
|
|
743
|
+
{
|
|
744
|
+
auto ek = UnitVec<3>(k);
|
|
745
|
+
jacobi.Col(k) = Real(mp.EvaluateDirectionalDerivative(pnt, ek).Range(0,3));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
val -= alpha/2 * ( Trans(jacobi) * pnt + Trace(jacobi) * pnt);
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
649
758
|
}
|
|
650
759
|
|
|
651
760
|
|