ngsolve 6.2.2506__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2506.post33.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/bem_diffops.hpp +475 -0
- netgen/include/bspline.hpp +2 -0
- netgen/include/contact.hpp +4 -0
- netgen/include/h1lumping.hpp +6 -0
- netgen/include/kernels.hpp +654 -0
- netgen/include/mp_coefficient.hpp +20 -20
- netgen/include/mptools.hpp +244 -118
- netgen/include/potentialtools.hpp +2 -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/libngsolve.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/demos/intro/cmagnet.py +19 -22
- ngsolve/directsolvers.pyi +1 -1
- ngsolve/krylovspace.pyi +2 -2
- ngsolve/nonlinearsolvers.pyi +1 -1
- ngsolve/solve.pyi +1 -1
- ngsolve/solve_implementation.pyi +3 -3
- ngsolve/timestepping.pyi +3 -3
- ngsolve/timing.pyi +1 -1
- ngsolve/utils.pyi +1 -1
- {ngsolve-6.2.2506.dist-info → ngsolve-6.2.2506.post33.dev0.dist-info}/METADATA +2 -2
- {ngsolve-6.2.2506.dist-info → ngsolve-6.2.2506.post33.dev0.dist-info}/RECORD +67 -65
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/Netgen.icns +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/bin/ngscxx +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/bin/ngsld +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/bin/ngsolve.tcl +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/bin/ngspy +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/beam.geo +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/beam.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/chip.in2d +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/chip.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/coil.geo +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/coil.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/coilshield.geo +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/coilshield.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/cube.geo +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/cube.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d11_chip_nitsche.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d1_square.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d2_chip.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d3_helmholtz.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d4_cube.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d5_beam.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d6_shaft.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d7_coil.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d8_coilshield.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/d9_hybridDG.pde +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/doubleglazing.in2d +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/doubleglazing.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/shaft.geo +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/shaft.vol +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/square.in2d +0 -0
- {ngsolve-6.2.2506.data → ngsolve-6.2.2506.post33.dev0.data}/data/share/ngsolve/square.vol +0 -0
- {ngsolve-6.2.2506.dist-info → ngsolve-6.2.2506.post33.dev0.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2506.dist-info → ngsolve-6.2.2506.post33.dev0.dist-info}/WHEEL +0 -0
- {ngsolve-6.2.2506.dist-info → ngsolve-6.2.2506.post33.dev0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
#ifndef DIFFOPS_HPP
|
|
2
|
+
#define DIFFOPS_HPP
|
|
3
|
+
|
|
4
|
+
#include <bla.hpp>
|
|
5
|
+
#include <scalarfe.hpp>
|
|
6
|
+
#include <hcurlfe.hpp>
|
|
7
|
+
#include <hdivfe.hpp>
|
|
8
|
+
#include <diffop_impl.hpp>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
namespace ngsbem
|
|
12
|
+
{
|
|
13
|
+
using namespace ngbla;
|
|
14
|
+
using namespace ngfem;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DiffOpBoundaryRot : public DiffOp<DiffOpBoundaryRot>
|
|
18
|
+
{
|
|
19
|
+
public:
|
|
20
|
+
enum { DIM = 1 };
|
|
21
|
+
enum { DIM_SPACE = 3 };
|
|
22
|
+
enum { DIM_ELEMENT = 2 };
|
|
23
|
+
enum { DIM_DMAT = 3 };
|
|
24
|
+
enum { DIFFORDER = 1 };
|
|
25
|
+
|
|
26
|
+
static bool SupportsVB (VorB checkvb) { return checkvb==BND; }
|
|
27
|
+
|
|
28
|
+
static string Name() { return "boundaryrot"; }
|
|
29
|
+
|
|
30
|
+
static const ScalarFiniteElement<2> & Cast (const FiniteElement & fel)
|
|
31
|
+
{ return static_cast<const ScalarFiniteElement<2>&> (fel); }
|
|
32
|
+
|
|
33
|
+
///
|
|
34
|
+
// mat is 3 x ndof
|
|
35
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
36
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
37
|
+
MAT & mat, LocalHeap & lh)
|
|
38
|
+
{
|
|
39
|
+
Cast(fel).CalcMappedDShape (mip, Trans(mat));
|
|
40
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
41
|
+
{
|
|
42
|
+
Vec<3> grad = mat.Col(i);
|
|
43
|
+
mat.Col(i) = Cross(mip.GetNV(), grad);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static int DimRef() { return 2; }
|
|
48
|
+
|
|
49
|
+
template <typename IP, typename MAT>
|
|
50
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
51
|
+
MAT && mat, LocalHeap & lh)
|
|
52
|
+
{
|
|
53
|
+
Cast(fel).CalcDShape (ip, Trans(mat));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
template <typename MIP, typename MAT>
|
|
57
|
+
static void CalcTransformationMatrix (const MIP & bmip,
|
|
58
|
+
MAT & mat, LocalHeap & lh)
|
|
59
|
+
{
|
|
60
|
+
auto & mip = static_cast<const MappedIntegrationPoint<2,3>&>(bmip);
|
|
61
|
+
Vec<3> nv = mip.GetNV();
|
|
62
|
+
mat = Trans(mip.GetJacobianInverse());
|
|
63
|
+
|
|
64
|
+
for (int j = 0; j < 2; j++)
|
|
65
|
+
mat.Col(j) = Cross(nv, Vec<3> (mat.Col(j)));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/// mat is (ndof*3) x mip.Size()
|
|
70
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
71
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
72
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
73
|
+
{
|
|
74
|
+
Cast(fel).CalcMappedDShape (mir, mat);
|
|
75
|
+
|
|
76
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
77
|
+
{
|
|
78
|
+
Vec<3,SIMD<double>> nv = static_cast<const SIMD<ngfem::MappedIntegrationPoint<3,3>>&>(mir[j]).GetNV();
|
|
79
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
80
|
+
{
|
|
81
|
+
Vec<3,SIMD<double>> grad = mat.Col(j).Range(3*i, 3*i+3);
|
|
82
|
+
mat.Col(j).Range(3*i,3*i+3) = Cross(nv, grad);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class DiffOpRotatedTrace : public DiffOp<DiffOpRotatedTrace>
|
|
92
|
+
{
|
|
93
|
+
public:
|
|
94
|
+
enum { DIM = 1 };
|
|
95
|
+
enum { DIM_SPACE = 3 };
|
|
96
|
+
enum { DIM_ELEMENT = 2 };
|
|
97
|
+
enum { DIM_DMAT = 3 };
|
|
98
|
+
enum { DIFFORDER = 1 };
|
|
99
|
+
|
|
100
|
+
static string Name() { return "rotatedtrace"; }
|
|
101
|
+
static int DimRef() { return 2; }
|
|
102
|
+
|
|
103
|
+
static const HCurlFiniteElement<2> & Cast (const FiniteElement & fel)
|
|
104
|
+
{ return static_cast<const HCurlFiniteElement<2>&> (fel); }
|
|
105
|
+
|
|
106
|
+
// mat is 2 x ndof
|
|
107
|
+
template <typename IP, typename MAT>
|
|
108
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
109
|
+
MAT && mat, LocalHeap & lh)
|
|
110
|
+
{
|
|
111
|
+
Cast(fel).CalcShape (ip, Trans(mat));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
///
|
|
115
|
+
// mat is 3 x ndof
|
|
116
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
117
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
118
|
+
MAT & mat, LocalHeap & lh)
|
|
119
|
+
{
|
|
120
|
+
Cast(fel).CalcMappedShape (mip, Trans(mat));
|
|
121
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
122
|
+
{
|
|
123
|
+
Vec<3> shape = mat.Col(i);
|
|
124
|
+
mat.Col(i) = Cross(mip.GetNV(), shape);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// mat is 3 x 2
|
|
129
|
+
template <typename MIP, typename MAT>
|
|
130
|
+
static void CalcTransformationMatrix (const MIP & bmip,
|
|
131
|
+
MAT & mat, LocalHeap & lh)
|
|
132
|
+
{
|
|
133
|
+
auto & mip = static_cast<const MappedIntegrationPoint<2,3>&>(bmip);
|
|
134
|
+
Vec<3> nv = mip.GetNV();
|
|
135
|
+
mat = Trans(mip.GetJacobianInverse());
|
|
136
|
+
|
|
137
|
+
for (int j = 0; j < 2; j++)
|
|
138
|
+
mat.Col(j) = Cross(nv, Vec<3> (mat.Col(j)));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/// mat is (ndof*3) x mip.Size()
|
|
142
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
143
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
144
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
145
|
+
{
|
|
146
|
+
Cast(fel).CalcMappedShape (mir, mat);
|
|
147
|
+
|
|
148
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
149
|
+
{
|
|
150
|
+
Vec<3,SIMD<double>> nv = static_cast<const SIMD<ngfem::MappedIntegrationPoint<2,3>>&>(mir[j]).GetNV();
|
|
151
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
152
|
+
{
|
|
153
|
+
Vec<3,SIMD<double>> shape = mat.Col(j).Range(3*i, 3*i+3);
|
|
154
|
+
mat.Col(j).Range(3*i,3*i+3) = Cross(nv, shape);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// rotated + scalar
|
|
161
|
+
class DiffOpHelmholtz : public DiffOp<DiffOpHelmholtz>
|
|
162
|
+
{
|
|
163
|
+
public:
|
|
164
|
+
enum { DIM = 1 };
|
|
165
|
+
enum { DIM_SPACE = 3 };
|
|
166
|
+
enum { DIM_ELEMENT = 2 };
|
|
167
|
+
enum { DIM_DMAT = 4 };
|
|
168
|
+
enum { DIFFORDER = 1 };
|
|
169
|
+
|
|
170
|
+
static string Name() { return "Helmholtz"; }
|
|
171
|
+
static int DimRef() { return 3; }
|
|
172
|
+
|
|
173
|
+
static const ScalarFiniteElement<2> & Cast (const FiniteElement & fel)
|
|
174
|
+
{ return static_cast<const ScalarFiniteElement<2>&> (fel); }
|
|
175
|
+
|
|
176
|
+
// mat is 3xndof
|
|
177
|
+
template <typename IP, typename MAT>
|
|
178
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
179
|
+
MAT && mat, LocalHeap & lh)
|
|
180
|
+
{
|
|
181
|
+
auto matvec = mat.Rows(0,2);
|
|
182
|
+
Cast(fel).CalcDShape (ip, Trans(matvec));
|
|
183
|
+
Cast(fel).CalcShape(ip, mat.Row(2));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
///
|
|
187
|
+
// mat is 4 x ndof
|
|
188
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
189
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
190
|
+
MAT & mat, LocalHeap & lh)
|
|
191
|
+
{
|
|
192
|
+
// mat.AddSize(4, fel.GetNDof()) = 0.0;
|
|
193
|
+
auto matvec = mat.Rows(0,3);
|
|
194
|
+
Cast(fel).CalcMappedDShape (mip, Trans(matvec));
|
|
195
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
196
|
+
{
|
|
197
|
+
Vec<3> grad = matvec.Col(i);
|
|
198
|
+
matvec.Col(i) = Cross(mip.GetNV(), grad);
|
|
199
|
+
}
|
|
200
|
+
// *testout << "mat1 = " << mat << endl;
|
|
201
|
+
// mat.AddSize(4, fel.GetNDof()) = 0.0;
|
|
202
|
+
Cast(fel).CalcShape(mip.IP(), mat.Row(3));
|
|
203
|
+
// *testout << "scalar mat = " << endl << mat << mat;
|
|
204
|
+
// *testout << "mat2 = " << mat << endl;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// mat is 4x3
|
|
208
|
+
template <typename MIP, typename MAT>
|
|
209
|
+
static void CalcTransformationMatrix (const MIP & bmip,
|
|
210
|
+
MAT & mat, LocalHeap & lh)
|
|
211
|
+
{
|
|
212
|
+
auto & mip = static_cast<const MappedIntegrationPoint<2,3>&>(bmip);
|
|
213
|
+
Vec<3> nv = mip.GetNV();
|
|
214
|
+
mat = 0.0;
|
|
215
|
+
mat.Rows(0,3).Cols(0,2) = Trans(mip.GetJacobianInverse());
|
|
216
|
+
auto gradmat = mat.Rows(0,3).Cols(0,2);
|
|
217
|
+
for (int j = 0; j < 2; j++)
|
|
218
|
+
gradmat.Col(j) = Cross(nv, Vec<3> (gradmat.Col(j)));
|
|
219
|
+
|
|
220
|
+
mat(3,2) = 1.0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// mat is (ndof*4) x mip.Size()
|
|
224
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
225
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
226
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
227
|
+
{
|
|
228
|
+
Cast(fel).CalcMappedDShape (mir, mat.Rows(0, 3*fel.GetNDof()));
|
|
229
|
+
|
|
230
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
231
|
+
{
|
|
232
|
+
Vec<3,SIMD<double>> nv = static_cast<const SIMD<ngfem::MappedIntegrationPoint<3,3>>&>(mir[j]).GetNV();
|
|
233
|
+
for (int i = fel.GetNDof()-1; i >= 0; i--)
|
|
234
|
+
{
|
|
235
|
+
Vec<3,SIMD<double>> grad = mat.Col(j).Range(3*i, 3*i+3);
|
|
236
|
+
mat.Col(j).Range(4*i,4*i+3) = Cross(nv, grad);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// *testout << "simd mat1 = " << endl << mat.AddSize(4*fel.GetNDof(), mir.Size()) << endl;
|
|
240
|
+
// mat.AddSize(4*fel.GetNDof(), mir.Size()) = SIMD<double>(0.0);
|
|
241
|
+
Cast(fel).CalcShape (mir.IR(), mat.RowSlice(3,4));
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
// rotated
|
|
248
|
+
class DiffOpMaxwell : public DiffOp<DiffOpMaxwell>
|
|
249
|
+
{
|
|
250
|
+
public:
|
|
251
|
+
enum { DIM = 1 };
|
|
252
|
+
enum { DIM_SPACE = 3 };
|
|
253
|
+
enum { DIM_ELEMENT = 2 };
|
|
254
|
+
enum { DIM_DMAT = 4 };
|
|
255
|
+
enum { DIFFORDER = 1 };
|
|
256
|
+
|
|
257
|
+
static string Name() { return "Maxwell"; }
|
|
258
|
+
static int DimRef() { return 3; }
|
|
259
|
+
|
|
260
|
+
static const HCurlFiniteElement<2> & Cast (const FiniteElement & fel)
|
|
261
|
+
{ return static_cast<const HCurlFiniteElement<2>&> (fel); }
|
|
262
|
+
|
|
263
|
+
// mat is 3 x ndof
|
|
264
|
+
template <typename IP, typename MAT>
|
|
265
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
266
|
+
MAT && mat, LocalHeap & lh)
|
|
267
|
+
{
|
|
268
|
+
// auto matvec = mat.Rows(0,2);
|
|
269
|
+
Cast(fel).CalcShape (ip, Trans(mat));
|
|
270
|
+
Cast(fel).CalcCurlShape(ip, Trans(mat.Rows(2,3)));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
///
|
|
274
|
+
// mat is 4 x ndof
|
|
275
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
276
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
277
|
+
MAT & mat, LocalHeap & lh)
|
|
278
|
+
{
|
|
279
|
+
// mat.AddSize(4, fel.GetNDof()) = 0.0;
|
|
280
|
+
auto matvec = mat.Rows(0,3);
|
|
281
|
+
Cast(fel).CalcMappedShape (mip, Trans(matvec));
|
|
282
|
+
for (int i = 0; i < fel.GetNDof(); i++)
|
|
283
|
+
{
|
|
284
|
+
Vec<3> shape = matvec.Col(i);
|
|
285
|
+
matvec.Col(i) = Cross(mip.GetNV(), shape);
|
|
286
|
+
}
|
|
287
|
+
// *testout << "mat1 = " << mat << endl;
|
|
288
|
+
// mat.AddSize(4, fel.GetNDof()) = 0.0;
|
|
289
|
+
mat.Row(3) =
|
|
290
|
+
1.0/mip.GetJacobiDet() *
|
|
291
|
+
Cast(fel).GetCurlShape(mip.IP(),lh).Col(0);
|
|
292
|
+
// *testout << "scalar mat = " << endl << mat << mat;
|
|
293
|
+
// *testout << "mat2 = " << mat << endl;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// mat is 4x3
|
|
297
|
+
template <typename MIP, typename MAT>
|
|
298
|
+
static void CalcTransformationMatrix (const MIP & bmip,
|
|
299
|
+
MAT & mat, LocalHeap & lh)
|
|
300
|
+
{
|
|
301
|
+
auto & mip = static_cast<const MappedIntegrationPoint<2,3>&>(bmip);
|
|
302
|
+
Vec<3> nv = mip.GetNV();
|
|
303
|
+
mat = 0.0;
|
|
304
|
+
mat.Rows(0,3).Cols(0,2) = Trans(mip.GetJacobianInverse());
|
|
305
|
+
auto matvec = mat.Rows(0,3).Cols(0,2);
|
|
306
|
+
for (int j = 0; j < 2; j++)
|
|
307
|
+
matvec.Col(j) = Cross(nv, Vec<3> (matvec.Col(j)));
|
|
308
|
+
|
|
309
|
+
mat(3,2) = 1.0 / mip.GetJacobiDet();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/// mat is (ndof*4) x mip.Size()
|
|
313
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
314
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
315
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
316
|
+
{
|
|
317
|
+
Cast(fel).CalcMappedShape (mir, mat.Rows(0, 3*fel.GetNDof()));
|
|
318
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
319
|
+
{
|
|
320
|
+
Vec<3,SIMD<double>> nv = static_cast<const SIMD<ngfem::MappedIntegrationPoint<2,3>>&>(mir[j]).GetNV();
|
|
321
|
+
for (int i = fel.GetNDof()-1; i >= 0; i--)
|
|
322
|
+
{
|
|
323
|
+
Vec<3,SIMD<double>> shape = mat.Col(j).Range(3*i, 3*i+3);
|
|
324
|
+
mat.Col(j).Range(4*i,4*i+3) = Cross(nv, shape);
|
|
325
|
+
// mat.Col(j).Range(4*i+3,4*i+4) = SIMD<double>(0.0);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// *testout << "simd mat1 = " << endl << mat.AddSize(4*fel.GetNDof(), mir.Size()) << endl;
|
|
329
|
+
// mat.AddSize(4*fel.GetNDof(), mir.Size()) = SIMD<double>(0.0);
|
|
330
|
+
|
|
331
|
+
constexpr size_t BS=16;
|
|
332
|
+
LocalHeapMem<BS*SIMD<double>::Size()*sizeof(SIMD<MappedIntegrationPoint<2,2>>)+64> lh("genmatlh");
|
|
333
|
+
FE_ElementTransformation<2,2> trafo2d(fel.ElementType());
|
|
334
|
+
for (size_t first = 0; first < mir.Size(); first += BS)
|
|
335
|
+
{
|
|
336
|
+
HeapReset hr(lh);
|
|
337
|
+
size_t next = std::min(first+BS, mir.Size());
|
|
338
|
+
SIMD_MappedIntegrationRule<2,2> mir2d(mir.IR().Range(first, next), trafo2d, lh);
|
|
339
|
+
Cast(fel).CalcMappedCurlShape (mir2d, mat.RowSlice(3,4).Cols(first, next));
|
|
340
|
+
}
|
|
341
|
+
for (size_t i = 0; i < mir.Size(); i++)
|
|
342
|
+
mat.Col(i).Slice(3,4).Range(fel.GetNDof()) *= 1.0 / mir[i].GetJacobiDet();
|
|
343
|
+
// *testout << "simd mat2 = " << endl << mat.AddSize(4*fel.GetNDof(), mir.Size()) << endl;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
using DiffOp<DiffOpMaxwell>::ApplySIMDIR;
|
|
347
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
348
|
+
BareSliceVector<Complex> x, BareSliceMatrix<SIMD<Complex>> y)
|
|
349
|
+
{
|
|
350
|
+
Cast(fel).Evaluate (mir, x, y.Rows(3));
|
|
351
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
352
|
+
{
|
|
353
|
+
Vec<3,SIMD<double>> nv = static_cast<const SIMD<ngfem::MappedIntegrationPoint<2,3>>&>(mir[j]).GetNV();
|
|
354
|
+
Vec<3,SIMD<Complex>> shape = y.Col(j).Range(0,3);
|
|
355
|
+
y.Col(j).Range(0,3) = Cross(nv, shape);
|
|
356
|
+
}
|
|
357
|
+
y.Row(3).Range(mir.Size()) = SIMD<Complex>(0.0);
|
|
358
|
+
// TODO: curl part
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
// copied from ngsolve/fem/hdiv_equations.hpp, DiffOpIdHDivSurface
|
|
368
|
+
class DiffOpMaxwellNew : public DiffOp<DiffOpMaxwellNew>
|
|
369
|
+
{
|
|
370
|
+
public:
|
|
371
|
+
enum { DIM = 1 };
|
|
372
|
+
enum { DIM_SPACE = 3 };
|
|
373
|
+
enum { DIM_ELEMENT = 2 };
|
|
374
|
+
enum { DIM_DMAT = 4 };
|
|
375
|
+
enum { DIFFORDER = 1 };
|
|
376
|
+
|
|
377
|
+
static string Name() { return "Maxwell"; }
|
|
378
|
+
static int DimRef() { return 3; }
|
|
379
|
+
|
|
380
|
+
static const HDivFiniteElement<2> & Cast (const FiniteElement & fel)
|
|
381
|
+
{ return static_cast<const HDivFiniteElement<2>&> (fel); }
|
|
382
|
+
|
|
383
|
+
// mat is 3xndof
|
|
384
|
+
template<typename IP, typename MAT>
|
|
385
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
386
|
+
MAT && mat, LocalHeap & lh)
|
|
387
|
+
{
|
|
388
|
+
auto matvec = mat.Rows(0,2); // 2D vector field
|
|
389
|
+
Cast(fel).CalcShape (ip, Trans(matvec));
|
|
390
|
+
Cast(fel).CalcDivShape (ip, mat.Row(2)); //divergence
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
///
|
|
394
|
+
// mat is 4 x ndof
|
|
395
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
396
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
397
|
+
MAT & mat, LocalHeap & lh)
|
|
398
|
+
{
|
|
399
|
+
auto matvec = mat.Rows(0,3);
|
|
400
|
+
matvec = (1.0 / mip.GetJacobiDet()) *mip.GetJacobian () *
|
|
401
|
+
Trans (Cast(fel).GetShape(mip.IP(),lh));
|
|
402
|
+
|
|
403
|
+
mat.Row(3) =
|
|
404
|
+
1.0/mip.GetJacobiDet() *
|
|
405
|
+
Cast(fel).GetDivShape(mip.IP(),lh).Col(0);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// mat is 4x3
|
|
409
|
+
template <typename MIP, typename MAT>
|
|
410
|
+
static void CalcTransformationMatrix (const MIP & bmip,
|
|
411
|
+
MAT & mat, LocalHeap & lh)
|
|
412
|
+
{
|
|
413
|
+
auto & mip = static_cast<const MappedIntegrationPoint<2,3>&>(bmip);
|
|
414
|
+
mat = 0.0;
|
|
415
|
+
mat.Rows(0,3).Cols(0,2) = (1.0 / mip.GetJacobiDet()) * mip.GetJacobian();
|
|
416
|
+
mat(3,2) = 1.0 / mip.GetJacobiDet();
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/// mat is (ndof*4) x mip.Size()
|
|
420
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
421
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
422
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
423
|
+
{
|
|
424
|
+
Cast(fel).CalcMappedShape (mir, mat.Rows(0, 3*fel.GetNDof()));
|
|
425
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
426
|
+
{
|
|
427
|
+
for (int i = fel.GetNDof()-1; i >= 0; i--)
|
|
428
|
+
{
|
|
429
|
+
Vec<3,SIMD<double>> shape = mat.Col(j).Range(3*i, 3*i+3);
|
|
430
|
+
mat.Col(j).Range(4*i,4*i+3) = shape;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
Cast(fel).CalcMappedDivShape (mir, mat.RowSlice(3, 4));
|
|
435
|
+
/*
|
|
436
|
+
constexpr size_t BS=16;
|
|
437
|
+
LocalHeapMem<BS*SIMD<double>::Size()*sizeof(SIMD<MappedIntegrationPoint<2,2>>)+64> lh("genmatlh");
|
|
438
|
+
FE_ElementTransformation<2,2> trafo2d(fel.ElementType());
|
|
439
|
+
for (size_t first = 0; first < mir.Size(); first += BS)
|
|
440
|
+
{
|
|
441
|
+
HeapReset hr(lh);
|
|
442
|
+
size_t next = std::min(first+BS, mir.Size());
|
|
443
|
+
SIMD_MappedIntegrationRule<2,2> mir2d(mir.IR().Range(first, next), trafo2d, lh);
|
|
444
|
+
Cast(fel).CalcMappedDivShape (mir2d, mat.RowSlice(3,4).Cols(first, next));
|
|
445
|
+
}
|
|
446
|
+
for (size_t i = 0; i < mir.Size(); i++)
|
|
447
|
+
mat.Col(i).Slice(3,4).Range(fel.GetNDof()) *= 1.0 / mir[i].GetJacobiDet();
|
|
448
|
+
*/
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
using DiffOp<DiffOpMaxwellNew>::ApplySIMDIR;
|
|
452
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
453
|
+
BareSliceVector<Complex> x, BareSliceMatrix<SIMD<Complex>> y)
|
|
454
|
+
{
|
|
455
|
+
Vector<> xr(fel.GetNDof()), xi(fel.GetNDof());
|
|
456
|
+
Matrix<SIMD<double>> valr(3,mir.Size()), vali(3, mir.Size());
|
|
457
|
+
|
|
458
|
+
xr = Real(x);
|
|
459
|
+
xi = Imag(x);
|
|
460
|
+
Cast(fel).Evaluate (mir, xr, valr);
|
|
461
|
+
Cast(fel).Evaluate (mir, xi, vali);
|
|
462
|
+
|
|
463
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
464
|
+
for (int k = 0; k < 3; k ++)
|
|
465
|
+
y(k,j) = SIMD<Complex> (valr(k,j), vali(k,j));
|
|
466
|
+
y.Row(3).Range(mir.Size()) = SIMD<Complex>(0.0);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
#endif
|
netgen/include/bspline.hpp
CHANGED
|
@@ -13,6 +13,7 @@ namespace ngstd
|
|
|
13
13
|
|
|
14
14
|
class BSpline
|
|
15
15
|
{
|
|
16
|
+
shared_ptr<BSpline> diff = nullptr;
|
|
16
17
|
int order;
|
|
17
18
|
Array<double> t;
|
|
18
19
|
Array<double> c;
|
|
@@ -48,6 +49,7 @@ namespace ngstd
|
|
|
48
49
|
NGS_DLL_HEADER SIMD<double> operator() (SIMD<double> x) const;
|
|
49
50
|
// NGS_DLL_HEADER SIMD<Complex> operator() (SIMD<Complex> x) const;
|
|
50
51
|
|
|
52
|
+
int GetOrder() const { return order; }
|
|
51
53
|
friend ostream & operator<< (ostream & ost, const BSpline & sp);
|
|
52
54
|
};
|
|
53
55
|
|
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,
|
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
|
|