ngsolve 6.2.2501.post21.dev1__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2501.post34.dev1__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.
- ngsolve/webgui.py +1 -1
- {ngsolve-6.2.2501.post21.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/METADATA +2 -2
- ngsolve-6.2.2501.post34.dev1.dist-info/RECORD +25 -0
- netgen/include/arnoldi.hpp +0 -55
- netgen/include/bandmatrix.hpp +0 -334
- netgen/include/basematrix.hpp +0 -957
- netgen/include/basevector.hpp +0 -1268
- netgen/include/bdbequations.hpp +0 -2752
- netgen/include/bdbintegrator.hpp +0 -1659
- netgen/include/bessel.hpp +0 -1064
- netgen/include/bilinearform.hpp +0 -963
- netgen/include/bla.hpp +0 -29
- netgen/include/blockalloc.hpp +0 -95
- netgen/include/blockjacobi.hpp +0 -316
- netgen/include/bspline.hpp +0 -114
- netgen/include/calcinverse.hpp +0 -141
- netgen/include/cg.hpp +0 -368
- netgen/include/chebyshev.hpp +0 -44
- netgen/include/cholesky.hpp +0 -720
- netgen/include/clapack.h +0 -7254
- netgen/include/code_generation.hpp +0 -296
- netgen/include/coefficient.hpp +0 -2006
- netgen/include/coefficient_impl.hpp +0 -18
- netgen/include/coefficient_stdmath.hpp +0 -157
- netgen/include/commutingAMG.hpp +0 -106
- netgen/include/comp.hpp +0 -79
- netgen/include/compatibility.hpp +0 -41
- netgen/include/complex_wrapper.hpp +0 -73
- netgen/include/compressedfespace.hpp +0 -110
- netgen/include/contact.hpp +0 -231
- netgen/include/diagonalmatrix.hpp +0 -154
- netgen/include/differentialoperator.hpp +0 -276
- netgen/include/diffop.hpp +0 -1286
- netgen/include/diffop_impl.hpp +0 -326
- netgen/include/discontinuous.hpp +0 -84
- netgen/include/dump.hpp +0 -949
- netgen/include/eigen.hpp +0 -60
- netgen/include/eigensystem.hpp +0 -18
- netgen/include/elasticity_equations.hpp +0 -595
- netgen/include/elementbyelement.hpp +0 -195
- netgen/include/elementtopology.hpp +0 -1760
- netgen/include/elementtransformation.hpp +0 -339
- netgen/include/evalfunc.hpp +0 -405
- netgen/include/expr.hpp +0 -1655
- netgen/include/facetfe.hpp +0 -175
- netgen/include/facetfespace.hpp +0 -178
- netgen/include/facethofe.hpp +0 -111
- netgen/include/facetsurffespace.hpp +0 -112
- netgen/include/fe_interfaces.hpp +0 -32
- netgen/include/fem.hpp +0 -87
- netgen/include/fesconvert.hpp +0 -14
- netgen/include/fespace.hpp +0 -1445
- netgen/include/finiteelement.hpp +0 -286
- netgen/include/globalinterfacespace.hpp +0 -77
- netgen/include/globalspace.hpp +0 -115
- netgen/include/gridfunction.hpp +0 -525
- netgen/include/h1amg.hpp +0 -41
- netgen/include/h1hofe.hpp +0 -188
- netgen/include/h1hofe_impl.hpp +0 -1262
- netgen/include/h1hofefo.hpp +0 -148
- netgen/include/h1hofefo_impl.hpp +0 -185
- netgen/include/h1hofespace.hpp +0 -167
- netgen/include/h1lofe.hpp +0 -1237
- netgen/include/h1lumping.hpp +0 -35
- netgen/include/hcurl_equations.hpp +0 -1352
- netgen/include/hcurlcurlfe.hpp +0 -2221
- netgen/include/hcurlcurlfespace.hpp +0 -78
- netgen/include/hcurlfe.hpp +0 -259
- netgen/include/hcurlfe_utils.hpp +0 -107
- netgen/include/hcurlhdiv_dshape.hpp +0 -857
- netgen/include/hcurlhdivfes.hpp +0 -308
- netgen/include/hcurlhofe.hpp +0 -175
- netgen/include/hcurlhofe_impl.hpp +0 -1871
- netgen/include/hcurlhofespace.hpp +0 -193
- netgen/include/hcurllofe.hpp +0 -1146
- netgen/include/hdiv_equations.hpp +0 -865
- netgen/include/hdivdivfe.hpp +0 -2923
- netgen/include/hdivdivsurfacespace.hpp +0 -76
- netgen/include/hdivfe.hpp +0 -206
- netgen/include/hdivfe_utils.hpp +0 -716
- netgen/include/hdivfes.hpp +0 -75
- netgen/include/hdivhofe.hpp +0 -447
- netgen/include/hdivhofe_impl.hpp +0 -1107
- netgen/include/hdivhofefo.hpp +0 -229
- netgen/include/hdivhofespace.hpp +0 -175
- netgen/include/hdivhosurfacefespace.hpp +0 -106
- netgen/include/hdivlofe.hpp +0 -773
- netgen/include/hidden.hpp +0 -74
- netgen/include/householder.hpp +0 -181
- netgen/include/hypre_ams_precond.hpp +0 -123
- netgen/include/hypre_precond.hpp +0 -73
- netgen/include/integrator.hpp +0 -2024
- netgen/include/integratorcf.hpp +0 -253
- netgen/include/interpolate.hpp +0 -49
- netgen/include/intrule.hpp +0 -2541
- netgen/include/irspace.hpp +0 -49
- netgen/include/jacobi.hpp +0 -136
- netgen/include/l2hofe.hpp +0 -193
- netgen/include/l2hofe_impl.hpp +0 -564
- netgen/include/l2hofefo.hpp +0 -542
- netgen/include/l2hofespace.hpp +0 -344
- netgen/include/la.hpp +0 -38
- netgen/include/linearform.hpp +0 -266
- netgen/include/matrix.hpp +0 -2140
- netgen/include/memusage.hpp +0 -41
- netgen/include/meshaccess.hpp +0 -1358
- netgen/include/mgpre.hpp +0 -204
- netgen/include/mptools.hpp +0 -2145
- netgen/include/multigrid.hpp +0 -42
- netgen/include/multivector.hpp +0 -447
- netgen/include/mumpsinverse.hpp +0 -187
- netgen/include/mycomplex.hpp +0 -361
- netgen/include/ng_lapack.hpp +0 -1661
- netgen/include/ngblas.hpp +0 -1099
- netgen/include/ngs_defines.hpp +0 -30
- netgen/include/ngs_stdcpp_include.hpp +0 -106
- netgen/include/ngs_utils.hpp +0 -121
- netgen/include/ngsobject.hpp +0 -1019
- netgen/include/ngsstream.hpp +0 -113
- netgen/include/ngstd.hpp +0 -72
- netgen/include/nodalhofe.hpp +0 -96
- netgen/include/nodalhofe_impl.hpp +0 -141
- netgen/include/normalfacetfe.hpp +0 -223
- netgen/include/normalfacetfespace.hpp +0 -98
- netgen/include/normalfacetsurfacefespace.hpp +0 -84
- netgen/include/order.hpp +0 -251
- netgen/include/parallel_matrices.hpp +0 -222
- netgen/include/paralleldofs.hpp +0 -340
- netgen/include/parallelngs.hpp +0 -23
- netgen/include/parallelvector.hpp +0 -269
- netgen/include/pardisoinverse.hpp +0 -200
- netgen/include/periodic.hpp +0 -125
- netgen/include/plateaufespace.hpp +0 -25
- netgen/include/pml.hpp +0 -275
- netgen/include/pmltrafo.hpp +0 -631
- netgen/include/postproc.hpp +0 -142
- netgen/include/precomp.hpp +0 -60
- netgen/include/preconditioner.hpp +0 -602
- netgen/include/prolongation.hpp +0 -235
- netgen/include/python_comp.hpp +0 -107
- netgen/include/python_fem.hpp +0 -89
- netgen/include/python_linalg.hpp +0 -58
- netgen/include/python_ngstd.hpp +0 -385
- netgen/include/recursive_pol.hpp +0 -4844
- netgen/include/recursive_pol_tet.hpp +0 -395
- netgen/include/recursive_pol_trig.hpp +0 -492
- netgen/include/reorderedfespace.hpp +0 -81
- netgen/include/sample_sort.hpp +0 -105
- netgen/include/scalarfe.hpp +0 -335
- netgen/include/shapefunction_utils.hpp +0 -113
- netgen/include/simd_complex.hpp +0 -284
- netgen/include/smoother.hpp +0 -253
- netgen/include/solve.hpp +0 -89
- netgen/include/sparsecholesky.hpp +0 -313
- netgen/include/sparsematrix.hpp +0 -1038
- netgen/include/sparsematrix_dyn.hpp +0 -91
- netgen/include/sparsematrix_impl.hpp +0 -920
- netgen/include/special_matrix.hpp +0 -461
- netgen/include/specialelement.hpp +0 -125
- netgen/include/statushandler.hpp +0 -33
- netgen/include/stringops.hpp +0 -12
- netgen/include/superluinverse.hpp +0 -136
- netgen/include/symbolicintegrator.hpp +0 -849
- netgen/include/symmetricmatrix.hpp +0 -144
- netgen/include/tangentialfacetfe.hpp +0 -224
- netgen/include/tangentialfacetfespace.hpp +0 -106
- netgen/include/tensor.hpp +0 -522
- netgen/include/tensorcoefficient.hpp +0 -446
- netgen/include/tensorproductintegrator.hpp +0 -113
- netgen/include/thcurlfe.hpp +0 -128
- netgen/include/thcurlfe_impl.hpp +0 -380
- netgen/include/thdivfe.hpp +0 -80
- netgen/include/thdivfe_impl.hpp +0 -426
- netgen/include/tpdiffop.hpp +0 -461
- netgen/include/tpfes.hpp +0 -133
- netgen/include/tpintrule.hpp +0 -224
- netgen/include/triangular.hpp +0 -465
- netgen/include/tscalarfe.hpp +0 -245
- netgen/include/tscalarfe_impl.hpp +0 -1029
- netgen/include/umfpackinverse.hpp +0 -148
- netgen/include/vector.hpp +0 -1219
- netgen/include/voxelcoefficientfunction.hpp +0 -41
- netgen/include/vtkoutput.hpp +0 -198
- netgen/include/vvector.hpp +0 -208
- netgen/include/webgui.hpp +0 -92
- netgen/libngbla.dylib +0 -0
- netgen/libngcomp.dylib +0 -0
- netgen/libngfem.dylib +0 -0
- netgen/libngla.dylib +0 -0
- netgen/libngsolve.dylib +0 -0
- netgen/libngstd.dylib +0 -0
- ngsolve/__init__.pyi +0 -231
- ngsolve/bla.pyi +0 -1139
- ngsolve/bvp.pyi +0 -32
- ngsolve/cmake/NGSolveConfig.cmake +0 -102
- ngsolve/cmake/ngsolve-targets-release.cmake +0 -69
- ngsolve/cmake/ngsolve-targets.cmake +0 -163
- ngsolve/comp/__init__.pyi +0 -5382
- ngsolve/comp/pml.pyi +0 -89
- ngsolve/config/__init__.py +0 -1
- ngsolve/config/__init__.pyi +0 -43
- ngsolve/config/__main__.py +0 -4
- ngsolve/config/config.py +0 -60
- ngsolve/config/config.pyi +0 -45
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +0 -80
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +0 -73
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +0 -72
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +0 -66
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +0 -44
- ngsolve/demos/howto/hybrid_dg.py +0 -53
- ngsolve/demos/howto/mixed.py +0 -30
- ngsolve/demos/howto/nonlin.py +0 -29
- ngsolve/demos/howto/pickling.py +0 -26
- ngsolve/demos/howto/pml.py +0 -31
- ngsolve/demos/howto/taskmanager.py +0 -20
- ngsolve/demos/howto/tdnns.py +0 -47
- ngsolve/demos/howto/timeDG-skeleton.py +0 -45
- ngsolve/demos/howto/timeDG.py +0 -38
- ngsolve/demos/howto/timeDGlap.py +0 -42
- ngsolve/demos/howto/timeDGwave.py +0 -61
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +0 -123
- ngsolve/demos/intro/cmagnet.py +0 -62
- ngsolve/demos/intro/elasticity.py +0 -76
- ngsolve/demos/intro/navierstokes.py +0 -74
- ngsolve/demos/intro/poisson.ipynb +0 -170
- ngsolve/demos/intro/poisson.py +0 -41
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +0 -87
- ngsolve/demos/mpi/mpi_navierstokes.py +0 -117
- ngsolve/demos/mpi/mpi_poisson.py +0 -89
- ngsolve/demos/mpi/mpi_timeDG.py +0 -82
- ngsolve/directsolvers.pyi +0 -18
- ngsolve/eigenvalues.pyi +0 -30
- ngsolve/fem.pyi +0 -1707
- ngsolve/krylovspace.pyi +0 -309
- ngsolve/la.pyi +0 -1218
- ngsolve/ngslib.so +0 -0
- ngsolve/ngstd.pyi +0 -58
- ngsolve/nonlinearsolvers.pyi +0 -98
- ngsolve/preconditioners.pyi +0 -6
- ngsolve/solve.pyi +0 -108
- ngsolve/solvers.pyi +0 -14
- ngsolve/timestepping.pyi +0 -34
- ngsolve/timing.pyi +0 -57
- ngsolve/utils.pyi +0 -279
- ngsolve-6.2.2501.post21.dev1.data/data/Netgen.icns +0 -0
- ngsolve-6.2.2501.post21.dev1.data/data/bin/ngscxx +0 -17
- ngsolve-6.2.2501.post21.dev1.data/data/bin/ngsld +0 -13
- ngsolve-6.2.2501.post21.dev1.data/data/bin/ngsolve.tcl +0 -648
- ngsolve-6.2.2501.post21.dev1.data/data/bin/ngspy +0 -2
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/beam.geo +0 -17
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/beam.vol +0 -240
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/chip.in2d +0 -41
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/chip.vol +0 -614
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/coil.geo +0 -12
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/coil.vol +0 -2560
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/coilshield.geo +0 -24
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/coilshield.vol +0 -3179
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/cube.geo +0 -19
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/cube.vol +0 -1832
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -50
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d11_chip_nitsche.pde +0 -40
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d1_square.pde +0 -43
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d2_chip.pde +0 -35
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d3_helmholtz.pde +0 -22
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d4_cube.pde +0 -46
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d5_beam.pde +0 -74
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d6_shaft.pde +0 -73
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d7_coil.pde +0 -50
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d8_coilshield.pde +0 -49
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/d9_hybridDG.pde +0 -72
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/doubleglazing.in2d +0 -27
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/doubleglazing.vol +0 -737
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/shaft.geo +0 -73
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/shaft.vol +0 -4291
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/square.in2d +0 -17
- ngsolve-6.2.2501.post21.dev1.data/data/share/ngsolve/square.vol +0 -149
- ngsolve-6.2.2501.post21.dev1.dist-info/RECORD +0 -304
- {ngsolve-6.2.2501.post21.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/LICENSE +0 -0
- {ngsolve-6.2.2501.post21.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/WHEEL +0 -0
- {ngsolve-6.2.2501.post21.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/top_level.txt +0 -0
netgen/include/hcurlcurlfe.hpp
DELETED
|
@@ -1,2221 +0,0 @@
|
|
|
1
|
-
#ifndef FILE_HCURLCURLFE
|
|
2
|
-
#define FILE_HCURLCURLFE
|
|
3
|
-
|
|
4
|
-
/*********************************************************************/
|
|
5
|
-
/* File: hcurlcurlfe.hpp */
|
|
6
|
-
/* Author: Michael Neunteufel */
|
|
7
|
-
/* Date: June 2018 */
|
|
8
|
-
/*********************************************************************/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#include "finiteelement.hpp"
|
|
12
|
-
#include "fe_interfaces.hpp"
|
|
13
|
-
#include "hcurlfe.hpp"
|
|
14
|
-
#include "hcurlfe_utils.hpp"
|
|
15
|
-
#include "recursive_pol.hpp"
|
|
16
|
-
#include "recursive_pol_trig.hpp"
|
|
17
|
-
#include "recursive_pol_tet.hpp"
|
|
18
|
-
|
|
19
|
-
namespace ngfem
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
template <typename T>
|
|
23
|
-
Mat<3,3,T> TensorCrossProduct(Mat<3,3,T> A, Mat<3,3,T> B)
|
|
24
|
-
{
|
|
25
|
-
// return 0.5 * ( Cof(A+B) - Cof(A-B) ); // more cancelation
|
|
26
|
-
|
|
27
|
-
Mat<3,3,T> prod;
|
|
28
|
-
prod.Col(0) = Cross(A.Col(1), B.Col(2)) - Cross(A.Col(2), B.Col(1));
|
|
29
|
-
prod.Col(1) = Cross(A.Col(2), B.Col(0)) - Cross(A.Col(0), B.Col(2));
|
|
30
|
-
prod.Col(2) = Cross(A.Col(0), B.Col(1)) - Cross(A.Col(1), B.Col(0));
|
|
31
|
-
return prod;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
template <typename T>
|
|
35
|
-
Mat<3,3,T> TensorCrossProduct(Vec<3,T> v, Mat<3,3,T> A)
|
|
36
|
-
{
|
|
37
|
-
Mat<3,3,T> result;
|
|
38
|
-
for (int j = 0; j < 3; j++)
|
|
39
|
-
result.Col(j) = Cross(v, A.Col(j));
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
template <typename T>
|
|
44
|
-
Mat<3,3,T> TensorCrossProduct(Mat<3,3,T> A, Vec<3,T> v)
|
|
45
|
-
{
|
|
46
|
-
Mat<3,3,T> result;
|
|
47
|
-
for (int j = 0; j < 3; j++)
|
|
48
|
-
result.Row(j) = Cross(A.Row(j), v);
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
template <int DIM>
|
|
55
|
-
class HCurlCurlFiniteElement : public FiniteElement
|
|
56
|
-
{
|
|
57
|
-
public:
|
|
58
|
-
using FiniteElement::FiniteElement;
|
|
59
|
-
using FiniteElement::ndof;
|
|
60
|
-
using FiniteElement::order;
|
|
61
|
-
|
|
62
|
-
virtual void CalcMappedShape (const BaseMappedIntegrationPoint & bmip,
|
|
63
|
-
BareSliceMatrix<double> shape) const = 0;
|
|
64
|
-
|
|
65
|
-
virtual void EvaluateMappedShape (const BaseMappedIntegrationPoint & bmip,
|
|
66
|
-
BareSliceVector<double> coefs,
|
|
67
|
-
BareSliceMatrix<double> shape) const = 0;
|
|
68
|
-
|
|
69
|
-
virtual void CalcMappedCurlShape (const BaseMappedIntegrationPoint & bmip,
|
|
70
|
-
BareSliceMatrix<double> shape) const = 0;
|
|
71
|
-
|
|
72
|
-
virtual void CalcMappedIncShape (const BaseMappedIntegrationPoint & bmip,
|
|
73
|
-
BareSliceMatrix<double> shape) const = 0;
|
|
74
|
-
|
|
75
|
-
virtual void EvaluateMappedIncShape (const BaseMappedIntegrationPoint & bmip,
|
|
76
|
-
BareSliceVector<double> coefs,
|
|
77
|
-
BareSliceVector<double> inc) const = 0;
|
|
78
|
-
|
|
79
|
-
virtual void CalcMappedIncShape (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
80
|
-
BareSliceMatrix<SIMD<double>> shape) const = 0;
|
|
81
|
-
|
|
82
|
-
virtual void EvaluateIncShape (const SIMD_BaseMappedIntegrationRule & ir,
|
|
83
|
-
BareSliceVector<> coefs,
|
|
84
|
-
BareSliceMatrix<SIMD<double>> values) const = 0;
|
|
85
|
-
|
|
86
|
-
virtual void AddTransIncShape (const SIMD_BaseMappedIntegrationRule & ir,
|
|
87
|
-
BareSliceMatrix<SIMD<double>> values,
|
|
88
|
-
BareSliceVector<> coefs) const = 0;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
virtual void CalcMappedShape (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
92
|
-
BareSliceMatrix<SIMD<double>> shapes) const = 0;
|
|
93
|
-
|
|
94
|
-
virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & ir,
|
|
95
|
-
BareSliceVector<> coefs,
|
|
96
|
-
BareSliceMatrix<SIMD<double>> values) const = 0;
|
|
97
|
-
|
|
98
|
-
virtual void AddTrans (const SIMD_BaseMappedIntegrationRule & ir,
|
|
99
|
-
BareSliceMatrix<SIMD<double>> values,
|
|
100
|
-
BareSliceVector<> coefs) const = 0;
|
|
101
|
-
|
|
102
|
-
virtual void CalcDualShape (const BaseMappedIntegrationPoint & bmip, BareSliceMatrix<> shape) const = 0;
|
|
103
|
-
virtual void CalcDualShape (const SIMD_BaseMappedIntegrationRule & bmir, BareSliceMatrix<SIMD<double>> shape) const = 0;
|
|
104
|
-
virtual void EvaluateDual (const SIMD_BaseMappedIntegrationRule & bmir, BareSliceVector<> coefs, BareSliceMatrix<SIMD<double>> values) const = 0;
|
|
105
|
-
virtual void AddDualTrans (const SIMD_BaseMappedIntegrationRule& bmir, BareSliceMatrix<SIMD<double>> values, BareSliceVector<double> coefs) const = 0;
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
template <int D,typename VEC,typename MAT>
|
|
110
|
-
void VecToSymMat(const VEC & vec, MAT & mat)
|
|
111
|
-
{
|
|
112
|
-
switch(D)
|
|
113
|
-
{
|
|
114
|
-
case 1:
|
|
115
|
-
mat(0) = vec(0);
|
|
116
|
-
break;
|
|
117
|
-
case 2:
|
|
118
|
-
mat(0) = vec(0);
|
|
119
|
-
mat(3) = vec(1);
|
|
120
|
-
mat(1) = mat(2) = vec(2);
|
|
121
|
-
break;
|
|
122
|
-
case 3:
|
|
123
|
-
mat(0) = vec(0);
|
|
124
|
-
mat(4) = vec(1);
|
|
125
|
-
mat(8) = vec(2);
|
|
126
|
-
mat(1) = mat(3) = vec(5);
|
|
127
|
-
mat(2) = mat(6) = vec(4);
|
|
128
|
-
mat(5) = mat(7) = vec(3);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
template <int H, int W, typename T>
|
|
134
|
-
Mat<H,W,T> DyadProd(Vec<H,T> a, Vec<W,T> b)
|
|
135
|
-
{
|
|
136
|
-
Mat<H,W,T> m;
|
|
137
|
-
for (int i = 0; i < H; i++)
|
|
138
|
-
for (int j = 0; j < W; j++)
|
|
139
|
-
m(i,j) = a(i)*b(j);
|
|
140
|
-
return m;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
template <int S, typename T>
|
|
144
|
-
Mat<S,S,T> SymDyadProd(Vec<S,T> a, Vec<S,T> b)
|
|
145
|
-
{
|
|
146
|
-
Mat<S,S,T> m;
|
|
147
|
-
for (int i = 0; i < S; i++)
|
|
148
|
-
for (int j = 0; j < S; j++)
|
|
149
|
-
m(i,j) = a(i)*b(j)+a(j)*b(i);
|
|
150
|
-
return m;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
template <typename T>
|
|
155
|
-
Vec<6, AutoDiff<3,T>> SymDyadProd(AutoDiff<3,T> a, AutoDiff<3,T> b)
|
|
156
|
-
{
|
|
157
|
-
return Vec<6, AutoDiff<3,T>>(2*a.DValue(0)*b.DValue(0),2*a.DValue(1)*b.DValue(1),2*a.DValue(2)*b.DValue(2), a.DValue(1)*b.DValue(2)+a.DValue(2)*b.DValue(1), a.DValue(0)*b.DValue(2)+a.DValue(2)*b.DValue(0),a.DValue(1)*b.DValue(0)+a.DValue(0)*b.DValue(1));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
template <typename T>
|
|
161
|
-
Vec<6, AutoDiff<3,T>> SymDyadProdAD(Vec<3,T> a, Vec<3,T> b)
|
|
162
|
-
{
|
|
163
|
-
return Vec<6, AutoDiff<3,T>>(2*a(0)*b(0),2*a(1)*b(1),2*a(2)*b(2), a(1)*b(2)+a(2)*b(1), a(0)*b(2)+a(2)*b(0),a(1)*b(0)+a(0)*b(1));
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
template <typename T>
|
|
167
|
-
Vec<3,AutoDiff<2,T>> SymDyadProd(AutoDiff<2,T> a, AutoDiff<2,T> b)
|
|
168
|
-
{
|
|
169
|
-
return Vec<3,AutoDiff<2,T>>(2*a.DValue(0)*b.DValue(0),2*a.DValue(1)*b.DValue(1),a.DValue(1)*b.DValue(0)+a.DValue(0)*b.DValue(1));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
template <typename T>
|
|
173
|
-
Vec<3,AutoDiff<2,T>> SymDyadProdAD(Vec<2,T> a, Vec<2,T> b)
|
|
174
|
-
{
|
|
175
|
-
return Vec<3,AutoDiff<2,T>>(2*a(0)*b(0),2*a(1)*b(1),a(1)*b(0)+a(0)*b(1));
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
template <typename T>
|
|
179
|
-
AutoDiff<1,T> SymDyadProd(AutoDiff<1,T> a, AutoDiff<1,T> b)
|
|
180
|
-
{
|
|
181
|
-
return a.DValue(0)*b.DValue(0);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
//------------------REGGE_SHAPE---------------------
|
|
186
|
-
template <int D, typename T> class T_REGGE_Shape;
|
|
187
|
-
template <typename T> class T_REGGE_Shape<1,T>
|
|
188
|
-
{
|
|
189
|
-
AutoDiff<1,T> u;
|
|
190
|
-
public:
|
|
191
|
-
T_REGGE_Shape (AutoDiff<1,T> au) : u(au) { ; }
|
|
192
|
-
Vec<1,T> Shape() { return u.Value(); }
|
|
193
|
-
/*0 2
|
|
194
|
-
2 1*/
|
|
195
|
-
Vec<1,T> CurlShape() { return 0.0; }
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
template <typename T> class T_REGGE_Shape<2,T>
|
|
199
|
-
{
|
|
200
|
-
Vec<3,AutoDiff<2,T>> u;
|
|
201
|
-
public:
|
|
202
|
-
T_REGGE_Shape (Vec<3,AutoDiff<2,T>> au) : u(au) { ; }
|
|
203
|
-
Vec<3,T> Shape() { return Vec<3,T> (u(0).Value(), u(1).Value(), u(2).Value()); }
|
|
204
|
-
/*0 2
|
|
205
|
-
2 1*/
|
|
206
|
-
Vec<2,T> CurlShape() { return Vec<2,T> (u(2).DValue(0)-u(0).DValue(1), u(1).DValue(0)-u(2).DValue(1)); }
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
template <typename T> class T_REGGE_Shape<3,T>
|
|
210
|
-
{
|
|
211
|
-
Vec<6,AutoDiff<3,T>> u;
|
|
212
|
-
public:
|
|
213
|
-
T_REGGE_Shape (Vec<6,AutoDiff<3,T>> au) : u(au) { ; }
|
|
214
|
-
Vec<6,T> Shape() { return Vec<6,T> (u(0).Value(), u(1).Value(), u(2).Value(), u(3).Value(), u(4).Value(), u(5).Value()); }
|
|
215
|
-
/*0 5 4
|
|
216
|
-
5 1 3
|
|
217
|
-
4 3 2*/
|
|
218
|
-
Vec<9,T> CurlShape() { return Vec<9,T> (u(4).DValue(1)-u(5).DValue(2), -u(4).DValue(0)+u(0).DValue(2), u(5).DValue(0)-u(0).DValue(1),
|
|
219
|
-
u(3).DValue(1)-u(1).DValue(2), -u(3).DValue(0)+u(5).DValue(2), u(1).DValue(0)-u(5).DValue(1),
|
|
220
|
-
u(2).DValue(1)-u(3).DValue(2), -u(2).DValue(0)+u(4).DValue(2), u(3).DValue(0)-u(4).DValue(1)); }
|
|
221
|
-
};
|
|
222
|
-
//---------------------------------------------------
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// ***************** EpsGrad ****************************** */
|
|
226
|
-
// eps (nabla u)
|
|
227
|
-
|
|
228
|
-
template <int D, typename T> class T_EpsGrad;
|
|
229
|
-
template <typename T> class T_EpsGrad<2,T>
|
|
230
|
-
{
|
|
231
|
-
AutoDiffDiff<2,T> u;
|
|
232
|
-
public:
|
|
233
|
-
T_EpsGrad (AutoDiffDiff<2,T> au) : u(au) { ; }
|
|
234
|
-
Vec<3,T> Shape()
|
|
235
|
-
{
|
|
236
|
-
return Vec<3,T> (u.DDValue(0,0), u.DDValue(1,1), u.DDValue(0,1));
|
|
237
|
-
}
|
|
238
|
-
Vec<2,T> CurlShape() { return Vec<2,T> (0.0, 0.0); }
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
template <int D, typename T>
|
|
242
|
-
auto EpsGrad (AutoDiffDiff<D,T> au) { return T_EpsGrad<D,T>(au); }
|
|
243
|
-
|
|
244
|
-
// ***************** wEpsGrad ****************************** */
|
|
245
|
-
// w*eps (nabla u)
|
|
246
|
-
|
|
247
|
-
template <int D, typename T> class T_wEpsGrad;
|
|
248
|
-
template <typename T> class T_wEpsGrad<2,T>
|
|
249
|
-
{
|
|
250
|
-
AutoDiffDiff<2,T> u;
|
|
251
|
-
AutoDiff<1,T> w;
|
|
252
|
-
public:
|
|
253
|
-
T_wEpsGrad (AutoDiffDiff<2,T> au, AutoDiff<1,T> aw) : u(au), w(aw) { ; }
|
|
254
|
-
Vec<6,T> Shape()
|
|
255
|
-
{
|
|
256
|
-
return w.Value()*Vec<6,T> (u.DDValue(0,0), u.DDValue(1,1), u.DDValue(2,2), u.DDValue(1,2), u.DDValue(0,2), u.DDValue(0,1));
|
|
257
|
-
}
|
|
258
|
-
Vec<9,T> CurlShape() { return Vec<9,T> (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); }
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
template <int D, typename T>
|
|
262
|
-
auto wEpsGrad (AutoDiffDiff<D,T> au, AutoDiff<1,T> aw) { return T_wEpsGrad<D,T>(au, aw); }
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
// ***************** Eps_u_Gradv ****************************** */
|
|
266
|
-
// eps (u nabla v)
|
|
267
|
-
|
|
268
|
-
template <int D, typename T> class T_Eps_u_Gradv;
|
|
269
|
-
template <typename T> class T_Eps_u_Gradv<2,T>
|
|
270
|
-
{
|
|
271
|
-
AutoDiffDiff<2,T> u, v;
|
|
272
|
-
public:
|
|
273
|
-
T_Eps_u_Gradv (AutoDiffDiff<2,T> au, AutoDiffDiff<2,T> av) : u(au), v(av) { ; }
|
|
274
|
-
Vec<3,T> Shape() { return Vec<3,T> ((u.Value()*v.DDValue(0,0) + u.DValue(0)*v.DValue(0)),
|
|
275
|
-
(u.Value()*v.DDValue(1,1) + u.DValue(1)*v.DValue(1)),
|
|
276
|
-
u.Value()*v.DDValue(0,1) + 0.5 * (u.DValue(0)*v.DValue(1)+u.DValue(1)*v.DValue(0))); }
|
|
277
|
-
Vec<2,T> CurlShape()
|
|
278
|
-
{
|
|
279
|
-
T uxx = u.DDValue(0,0), uyy = u.DDValue(1,1), uxy = u.DDValue(0,1);
|
|
280
|
-
T ux = u.DValue(0), uy = u.DValue(1);
|
|
281
|
-
T vxx = v.DDValue(0,0), vyy = v.DDValue(1,1), vxy = v.DDValue(0,1);
|
|
282
|
-
T vx = v.DValue(0), vy = v.DValue(1);
|
|
283
|
-
|
|
284
|
-
/*return -0.5 * Vec<2,T> (uyy*vx - uxy*vy + uy*vxy - ux*vyy,
|
|
285
|
-
-uxy*vx + uxx*vy - uy*vxx + ux*vxy);*/
|
|
286
|
-
return 0.5 * Vec<2,T>(ux*vxy - uy*vxx - uxy*vx + uxx*vy,
|
|
287
|
-
ux*vyy + uxy*vy - uyy*vx - uy*vxy);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
template <int D, typename T>
|
|
292
|
-
auto Eps_u_Gradv (AutoDiffDiff<D,T> au, AutoDiffDiff<D,T> av) { return T_Eps_u_Gradv<D,T>(au, av); }
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
template <int D, typename T> class T_vEpsGradu;
|
|
296
|
-
template <typename T> class T_vEpsGradu<2,T>
|
|
297
|
-
{
|
|
298
|
-
AutoDiffDiff<2,T> u,v;
|
|
299
|
-
public:
|
|
300
|
-
T_vEpsGradu (AutoDiffDiff<2,T> au, AutoDiffDiff<2,T> av) : u(au), v(av) { ; }
|
|
301
|
-
Vec<3,T> Shape() { return Vec<3,T> (u.DDValue(0,0)*v.Value(),
|
|
302
|
-
u.DDValue(1,1)*v.Value(), (u.DDValue(1,0)*v.Value()));}
|
|
303
|
-
Vec<2,T> CurlShape()
|
|
304
|
-
{
|
|
305
|
-
T uxx = u.DDValue(0,0), uyy = u.DDValue(1,1), uxy = u.DDValue(0,1);
|
|
306
|
-
T vx = v.DValue(0), vy = v.DValue(1);
|
|
307
|
-
|
|
308
|
-
//return Vec<2,T> (uyy*vx- uxy*vy, uxx*vy- uxy*vx);
|
|
309
|
-
return Vec<2,T> (uxy*vx - vy*uxx, uyy*vx - uxy*vy);
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
template <int D, typename T>
|
|
314
|
-
auto vEpsGradu (AutoDiffDiff<D,T> au, AutoDiffDiff<D,T> av) { return T_vEpsGradu<D,T>(au, av); }
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
template <int D, typename T>
|
|
318
|
-
class ReggeAD
|
|
319
|
-
{
|
|
320
|
-
Mat<D,D,T> value;
|
|
321
|
-
|
|
322
|
-
public:
|
|
323
|
-
ReggeAD ()
|
|
324
|
-
{
|
|
325
|
-
value = T(0);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
ReggeAD (AutoDiff<D,T> a, AutoDiff<D,T> b)
|
|
329
|
-
{
|
|
330
|
-
Vec<D,T> Da, Db;
|
|
331
|
-
for(int i=0; i<D; i++)
|
|
332
|
-
{
|
|
333
|
-
Da(i) = a.DValue(i);
|
|
334
|
-
Db(i) = b.DValue(i);
|
|
335
|
-
}
|
|
336
|
-
value = SymDyadProd(Da,Db);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
auto Value() const { return value; }
|
|
340
|
-
|
|
341
|
-
Mat<D,D,T> & Value() { return value; }
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
template <int D, typename T>
|
|
345
|
-
auto MakeReggeAD(AutoDiff<D,T> a, AutoDiff<D,T> b)
|
|
346
|
-
{
|
|
347
|
-
return ReggeAD<D,T>(a, b);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
template <int D, typename T>
|
|
353
|
-
ReggeAD<D,T> operator* (AutoDiff<D,T> s, ReggeAD<D,T> A)
|
|
354
|
-
{
|
|
355
|
-
ReggeAD<D,T> result;
|
|
356
|
-
result.Value() = s.Value()*A.Value();
|
|
357
|
-
return result;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
template <int D, typename T>
|
|
362
|
-
ReggeAD<D,T> operator* (T s, ReggeAD<D,T> A)
|
|
363
|
-
{
|
|
364
|
-
ReggeAD<D,T> result = A;
|
|
365
|
-
result.Value() *= s;
|
|
366
|
-
return result;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
template <int D, typename T>
|
|
370
|
-
ReggeAD<D,T> operator+ (ReggeAD<D,T> A, ReggeAD<D,T> B)
|
|
371
|
-
{
|
|
372
|
-
ReggeAD<D,T> result = A;
|
|
373
|
-
result.Value() += B.Value();
|
|
374
|
-
return result;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
template <int D, typename T>
|
|
378
|
-
ReggeAD<D,T> operator- (ReggeAD<D,T> A, ReggeAD<D,T> B)
|
|
379
|
-
{
|
|
380
|
-
ReggeAD<D,T> result = A;
|
|
381
|
-
result.Value() -= B.Value();
|
|
382
|
-
return result;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
template <int D, typename T> class ReggeADD;
|
|
386
|
-
|
|
387
|
-
template <typename T>
|
|
388
|
-
class ReggeADD<3,T>
|
|
389
|
-
{
|
|
390
|
-
Mat<3,3,T> value;
|
|
391
|
-
Mat<3,3,T> curl;
|
|
392
|
-
Mat<3,3,T> inc;
|
|
393
|
-
|
|
394
|
-
public:
|
|
395
|
-
ReggeADD ()
|
|
396
|
-
{
|
|
397
|
-
value = T(0);
|
|
398
|
-
curl = T(0);
|
|
399
|
-
inc = T(0);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
ReggeADD (AutoDiffDiff<3,T> a, AutoDiffDiff<3,T> b)
|
|
403
|
-
{
|
|
404
|
-
auto Da = Vec<3,T>(a.DValue(0),a.DValue(1),a.DValue(2));
|
|
405
|
-
auto Db = Vec<3,T>(b.DValue(0),b.DValue(1),b.DValue(2));
|
|
406
|
-
value = SymDyadProd(Da,Db);
|
|
407
|
-
// curl(s*v) = nabla s x v + s curl(v) in 3D
|
|
408
|
-
// | nabla a_1 x b + a_1 curl(b) |
|
|
409
|
-
// curl(a \otimes b) = | nabla a_2 x b + a_2 curl(b) |
|
|
410
|
-
// | nabla a_3 x b + a_3 curl(b) |
|
|
411
|
-
|
|
412
|
-
// curl( nabla s ) = 0
|
|
413
|
-
// | nabla d_x a x nabla b |
|
|
414
|
-
// -> curl( nabla a \otimes nabla b) = | nabla d_y a x nabla b |
|
|
415
|
-
// | nabla d_z a x nabla b |
|
|
416
|
-
|
|
417
|
-
Vec<3,T> Ddai [3] = { Vec<3,T>(a.DDValue(0,0), a.DDValue(0,1), a.DDValue(0,2)), Vec<3,T>(a.DDValue(1,0), a.DDValue(1,1), a.DDValue(1,2)), Vec<3,T>(a.DDValue(2,0), a.DDValue(2,1), a.DDValue(2,2)) };
|
|
418
|
-
Vec<3,T> Ddbi [3] = { Vec<3,T>(b.DDValue(0,0), b.DDValue(0,1), b.DDValue(0,2)), Vec<3,T>(b.DDValue(1,0), b.DDValue(1,1), b.DDValue(1,2)), Vec<3,T>(b.DDValue(2,0), b.DDValue(2,1), b.DDValue(2,2)) };
|
|
419
|
-
|
|
420
|
-
for (int i = 0; i < 3; i++)
|
|
421
|
-
curl.Row(i) = Cross(Ddai[i], Db) + Cross(Ddbi[i], Da);
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
// | nabla d_x a x nabla b |
|
|
425
|
-
// curl( nabla a \otimes nabla b) = | nabla d_y a x nabla b |
|
|
426
|
-
// | nabla d_z a x nabla b |
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
// curl T curl ( nabla a \otimes nabla b):
|
|
430
|
-
//11: d_yd_z(a) d_yd_z(b) - d^2_z(a) d^2_y(b) - d_y^2(a) d^2_z(b) + d_yd_z(a)d_yd_z(b)
|
|
431
|
-
//12: d_xd_y(a) d_z^2(b) - d_xd_z(a) d_yd_z(b) - d_yd_z(a) d_xd_z(b) + d_z^2(a)d_xd_y(b)
|
|
432
|
-
//13: d^2_y(a) d_xd_z(b) - d_yd_z(a) d_xd_y(b) - d_xd_y(a) d_yd_z(b) + d_xd_z(a)d^2_y(b)
|
|
433
|
-
//22: d_xd_z(a) d_xd_z(b) - d^2_x(a) d^2_z(b) - d^2_z(a) d^2_x(b) + d_xd_z(a)d_xd_z(b)
|
|
434
|
-
//23: d_yd_z(a) d^2_x(b) - d_xd_y(a) d_xd_z(b) - d_xd_z(a) d_xd_y(b) + d^2_x(a)d_yd_z(b)
|
|
435
|
-
//33: d^2_x(a) d^2_y(b) - d_xd_y(a) d_xd_y(b) - d_xd_y(a) d_xd_y(b) + d^2_y(a)d^2_x(b)
|
|
436
|
-
|
|
437
|
-
// = - hesse(a) x hesse(b) = -eps_imn eps_jlk d_md_l(a) d_nd_k b ??
|
|
438
|
-
|
|
439
|
-
/*inc(0,0) = a.DDValue(1,2)*b.DDValue(1,2) - a.DDValue(2,2)*b.DDValue(1,1) - a.DDValue(1,1)*b.DDValue(2,2) + a.DDValue(1,2)*b.DDValue(1,2);
|
|
440
|
-
inc(0,1) = a.DDValue(0,1)*b.DDValue(2,2) - a.DDValue(0,2)*b.DDValue(1,2) - a.DDValue(1,2)*b.DDValue(0,2) + a.DDValue(2,2)*b.DDValue(0,1);
|
|
441
|
-
inc(0,2) = a.DDValue(1,1)*b.DDValue(0,2) - a.DDValue(1,2)*b.DDValue(0,1) - a.DDValue(0,1)*b.DDValue(1,2) + a.DDValue(0,2)*b.DDValue(1,1);
|
|
442
|
-
inc(1,1) = a.DDValue(0,2)*b.DDValue(0,2) - a.DDValue(0,0)*b.DDValue(2,2) - a.DDValue(2,2)*b.DDValue(0,0) + a.DDValue(0,2)*b.DDValue(0,2);
|
|
443
|
-
inc(1,2) = a.DDValue(1,2)*b.DDValue(0,0) - a.DDValue(0,1)*b.DDValue(0,2) - a.DDValue(0,2)*b.DDValue(0,1) + a.DDValue(0,0)*b.DDValue(1,2);
|
|
444
|
-
inc(2,2) = a.DDValue(0,0)*b.DDValue(1,1) - a.DDValue(0,1)*b.DDValue(0,1) - a.DDValue(0,1)*b.DDValue(0,1) + a.DDValue(1,1)*b.DDValue(0,0);
|
|
445
|
-
// curl T curl ( nabla b \otimes nabla a):
|
|
446
|
-
inc(0,0) += b.DDValue(1,2)*a.DDValue(1,2) - b.DDValue(2,2)*a.DDValue(1,1) - b.DDValue(1,1)*a.DDValue(2,2) + b.DDValue(1,2)*a.DDValue(1,2);
|
|
447
|
-
inc(0,1) += b.DDValue(0,1)*a.DDValue(2,2) - b.DDValue(0,2)*a.DDValue(1,2) - b.DDValue(1,2)*a.DDValue(0,2) + b.DDValue(2,2)*a.DDValue(0,1);
|
|
448
|
-
inc(0,2) += b.DDValue(1,1)*a.DDValue(0,2) - b.DDValue(1,2)*a.DDValue(0,1) - b.DDValue(0,1)*a.DDValue(1,2) + b.DDValue(0,2)*a.DDValue(1,1);
|
|
449
|
-
inc(1,1) += b.DDValue(0,2)*a.DDValue(0,2) - b.DDValue(0,0)*a.DDValue(2,2) - b.DDValue(2,2)*a.DDValue(0,0) + b.DDValue(0,2)*a.DDValue(0,2);
|
|
450
|
-
inc(1,2) += b.DDValue(1,2)*a.DDValue(0,0) - b.DDValue(0,1)*a.DDValue(0,2) - b.DDValue(0,2)*a.DDValue(0,1) + b.DDValue(0,0)*a.DDValue(1,2);
|
|
451
|
-
inc(2,2) += b.DDValue(0,0)*a.DDValue(1,1) - b.DDValue(0,1)*a.DDValue(0,1) - b.DDValue(0,1)*a.DDValue(0,1) + b.DDValue(1,1)*a.DDValue(0,0);
|
|
452
|
-
// symmetry
|
|
453
|
-
inc(1,0) = inc(0,1);
|
|
454
|
-
inc(2,0) = inc(0,2);
|
|
455
|
-
inc(2,1) = inc(1,2);*/
|
|
456
|
-
|
|
457
|
-
Mat<3,3,T> hesse1, hesse2;
|
|
458
|
-
a.StoreHessian(hesse1.Data());
|
|
459
|
-
b.StoreHessian(hesse2.Data());
|
|
460
|
-
inc = -2*TensorCrossProduct(hesse1,hesse2);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
auto Value() const { return value; }
|
|
464
|
-
auto Curl() const { return curl; }
|
|
465
|
-
auto Inc() const { return inc; }
|
|
466
|
-
|
|
467
|
-
Mat<3,3,T> & Value() { return value; }
|
|
468
|
-
Mat<3,3,T> & Curl() { return curl; }
|
|
469
|
-
Mat<3,3,T> & Inc() { return inc; }
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
template <typename T>
|
|
474
|
-
class ReggeADD<2,T>
|
|
475
|
-
{
|
|
476
|
-
Mat<2,2,T> value;
|
|
477
|
-
Vec<2,T> curl;
|
|
478
|
-
T inc;
|
|
479
|
-
|
|
480
|
-
public:
|
|
481
|
-
ReggeADD ()
|
|
482
|
-
{
|
|
483
|
-
value = T(0);
|
|
484
|
-
curl = T(0);
|
|
485
|
-
inc = T(0);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
ReggeADD (AutoDiffDiff<2,T> a, AutoDiffDiff<2,T> b)
|
|
489
|
-
{
|
|
490
|
-
auto Da = Vec<2,T>(a.DValue(0),a.DValue(1));
|
|
491
|
-
auto Db = Vec<2,T>(b.DValue(0),b.DValue(1));
|
|
492
|
-
value = SymDyadProd(Da,Db);
|
|
493
|
-
// curl(s*v) = v* nabla s^perp + s curl(v) in 2D
|
|
494
|
-
// | b * nabla a_1^perp + a_1 curl(b) |
|
|
495
|
-
// curl(a \otimes b) = | b * nabla a_2^perp + a_2 curl(b) |
|
|
496
|
-
|
|
497
|
-
// curl( nabla s ) = 0
|
|
498
|
-
// | Db * nabla d_x a^perp |
|
|
499
|
-
// -> curl( nabla a \otimes nabla b) = | Db * nabla d_y a^perp |
|
|
500
|
-
|
|
501
|
-
Vec<2,T> Ddai_p [2] = { Vec<2,T>(-a.DDValue(0,1), a.DDValue(0,0)), Vec<2,T>(-a.DDValue(1,1), a.DDValue(1,0)) };
|
|
502
|
-
Vec<2,T> Ddbi_p [2] = { Vec<2,T>(-b.DDValue(0,1), b.DDValue(0,0)), Vec<2,T>(-b.DDValue(1,1), b.DDValue(1,0)) };
|
|
503
|
-
|
|
504
|
-
for (int i=0; i<2; i++)
|
|
505
|
-
curl(i) = InnerProduct(Db,Ddai_p[i]) + InnerProduct(Da,Ddbi_p[i]);
|
|
506
|
-
|
|
507
|
-
// | Db * nabla d_x a^perp |
|
|
508
|
-
// curl( nabla a \otimes nabla b) = | Db * nabla d_y a^perp |
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
// curl T curl ( nabla a \otimes nabla b) = d_x(Db * nabla d_y a^perp) - d_y(Db * nabla d_x a^perp)
|
|
512
|
-
// = (d_x Db) * nabla(d_y a)^perp - (d_y Db) * nabla(d_x a)^perp
|
|
513
|
-
|
|
514
|
-
inc = InnerProduct(Vec<2,T>(b.DDValue(0,0), b.DDValue(0,1)),Ddai_p[1]) - InnerProduct(Vec<2,T>(b.DDValue(1,0), b.DDValue(1,1)),Ddai_p[0]) + InnerProduct(Vec<2,T>(a.DDValue(0,0), a.DDValue(0,1)),Ddbi_p[1]) - InnerProduct(Vec<2,T>(a.DDValue(1,0), a.DDValue(1,1)),Ddbi_p[0]);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
auto Value() const { return value; }
|
|
518
|
-
auto Curl() const { return curl; }
|
|
519
|
-
auto Inc() const { return inc; }
|
|
520
|
-
|
|
521
|
-
Mat<2,2,T> & Value() { return value; }
|
|
522
|
-
Vec<2,T> & Curl() { return curl; }
|
|
523
|
-
T & Inc() { return inc; }
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
template <int D, typename T>
|
|
527
|
-
auto MakeReggeAD(AutoDiffDiff<D,T> a, AutoDiffDiff<D,T> b)
|
|
528
|
-
{
|
|
529
|
-
return ReggeADD<D,T>(a, b);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
template <typename T>
|
|
533
|
-
ReggeADD<3,T> operator* (AutoDiffDiff<3,T> s, ReggeADD<3,T> A)
|
|
534
|
-
{
|
|
535
|
-
ReggeADD<3,T> result;
|
|
536
|
-
result.Value() = s.Value()*A.Value();
|
|
537
|
-
|
|
538
|
-
// s scalar, v vector
|
|
539
|
-
// curl(s*v) = nabla s x v + s curl(v) in 3D
|
|
540
|
-
Vec<3,T> gradient;
|
|
541
|
-
s.StoreGradient(gradient.Data());
|
|
542
|
-
|
|
543
|
-
result.Curl() = s.Value()*A.Curl();
|
|
544
|
-
for (int i = 0; i < 3; i++)
|
|
545
|
-
result.Curl().Row(i) += Cross(gradient, Vec<3,T>(A.Value().Row(i)));
|
|
546
|
-
|
|
547
|
-
// inc(s A) = s inc(A) + 2sym(grad(s) x curl A) + hesse(s) x A, x...Tensor-Cross-Product
|
|
548
|
-
Mat<3,3,T> hesse;
|
|
549
|
-
s.StoreHessian(hesse.Data());
|
|
550
|
-
|
|
551
|
-
result.Inc() = s.Value()*A.Inc() + TensorCrossProduct(gradient,A.Curl()) + Trans(TensorCrossProduct(gradient,A.Curl())) + TensorCrossProduct(hesse,A.Value());
|
|
552
|
-
|
|
553
|
-
return result;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
template <int D, typename T>
|
|
558
|
-
ReggeADD<D,T> operator* (T s, ReggeADD<D,T> A)
|
|
559
|
-
{
|
|
560
|
-
ReggeADD<D,T> result = A;
|
|
561
|
-
result.Value() *= s;
|
|
562
|
-
result.Curl() *= s;
|
|
563
|
-
result.Inc() *= s;
|
|
564
|
-
return result;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
template <int D, typename T>
|
|
568
|
-
ReggeADD<D,T> operator+ (ReggeADD<D,T> A, ReggeADD<D,T> B)
|
|
569
|
-
{
|
|
570
|
-
ReggeADD<D,T> result = A;
|
|
571
|
-
result.Value() += B.Value();
|
|
572
|
-
result.Curl() += B.Curl();
|
|
573
|
-
result.Inc() += B.Inc();
|
|
574
|
-
return result;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
template <int D, typename T>
|
|
578
|
-
ReggeADD<D,T> operator- (ReggeADD<D,T> A, ReggeADD<D,T> B)
|
|
579
|
-
{
|
|
580
|
-
ReggeADD<D,T> result = A;
|
|
581
|
-
result.Value() -= B.Value();
|
|
582
|
-
result.Curl() -= B.Curl();
|
|
583
|
-
result.Inc() -= B.Inc();
|
|
584
|
-
return result;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
template <typename T>
|
|
589
|
-
ReggeADD<2,T> operator* (AutoDiffDiff<2,T> s, ReggeADD<2,T> A)
|
|
590
|
-
{
|
|
591
|
-
ReggeADD<2,T> result;
|
|
592
|
-
result.Value() = s.Value()*A.Value();
|
|
593
|
-
|
|
594
|
-
// s scalar, v vector
|
|
595
|
-
// curl(s*v) = v* nabla s^perp + s curl(v) in 2D
|
|
596
|
-
result.Curl() = A.Value()*Vec<2,T>(-s.DValue(1),s.DValue(0)) + s.Value()*A.Curl();
|
|
597
|
-
|
|
598
|
-
// inc(sA) = A:( dydy s & -dxdy s \\ -dxdy s & dxdx s) + 2*nabla s^\perp*curl(A) + s*inc(A)
|
|
599
|
-
Mat<2,2,T> hesse;
|
|
600
|
-
hesse(0,0) = s.DDValue(1,1);
|
|
601
|
-
hesse(1,0) = -s.DDValue(1,0);
|
|
602
|
-
hesse(0,1) = -s.DDValue(0,1);
|
|
603
|
-
hesse(1,1) = s.DDValue(0,0);
|
|
604
|
-
|
|
605
|
-
result.Inc() = s.Value()*A.Inc() + InnerProduct(hesse,A.Value()) + 2*InnerProduct(Vec<2,T>(-s.DValue(1),s.DValue(0)),A.Curl());
|
|
606
|
-
|
|
607
|
-
return result;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
template <ELEMENT_TYPE ET> class HCurlCurlFE;
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
template <ELEMENT_TYPE ET>
|
|
617
|
-
class T_HCurlCurlFE : public HCurlCurlFiniteElement<ET_trait<ET>::DIM>,
|
|
618
|
-
public VertexOrientedFE<ET>
|
|
619
|
-
{
|
|
620
|
-
protected:
|
|
621
|
-
static constexpr int DIM = ET_trait<ET>::DIM;
|
|
622
|
-
enum { DIM_STRESS = (DIM*(DIM+1))/2 };
|
|
623
|
-
// enum { DIM_DMAT = 7*DIM-12 };
|
|
624
|
-
// enum { DIM_DDMAT = 8*DIM-15 };
|
|
625
|
-
enum { DIM_DMAT = (5*DIM*DIM-11*DIM+6)/2 };
|
|
626
|
-
enum { DIM_DDMAT = (7*DIM*DIM-19*DIM+12)/2 };
|
|
627
|
-
|
|
628
|
-
using VertexOrientedFE<ET>::vnums;
|
|
629
|
-
using HCurlCurlFiniteElement<ET_trait<ET>::DIM>::ndof;
|
|
630
|
-
using HCurlCurlFiniteElement<ET_trait<ET>::DIM>::order;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
int order_edge[ET_trait<ET>::N_EDGE];
|
|
634
|
-
IVec<DIM-1> order_facet[ET_trait<ET>::N_FACET];
|
|
635
|
-
IVec<DIM> order_inner;
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
public:
|
|
639
|
-
using VertexOrientedFE<ET>::SetVertexNumbers;
|
|
640
|
-
|
|
641
|
-
T_HCurlCurlFE (int aorder)
|
|
642
|
-
{
|
|
643
|
-
order = aorder;
|
|
644
|
-
for (auto & of : order_facet) of = aorder;
|
|
645
|
-
order_inner = aorder;
|
|
646
|
-
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
virtual ELEMENT_TYPE ElementType() const override { return ET; }
|
|
650
|
-
const HCurlCurlFE<ET> * Cast() const { return static_cast<const HCurlCurlFE<ET>*> (this); }
|
|
651
|
-
|
|
652
|
-
INLINE void SetOrderFacet (int nr, IVec<DIM-1,int> order) { order_facet[nr] = order; }
|
|
653
|
-
INLINE void SetOrderEdge (int nr, int order) { order_edge[nr] = order; }
|
|
654
|
-
INLINE void SetOrderInner (IVec<DIM,int> order) { order_inner = order; }
|
|
655
|
-
|
|
656
|
-
virtual void ComputeNDof()
|
|
657
|
-
{
|
|
658
|
-
cout << "Error, T_HCurlCurlFE<ET>:: ComputeNDof not available, only for ET == TRIG" << endl;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
virtual void CalcMappedShape (const BaseMappedIntegrationPoint & bmip,
|
|
663
|
-
BareSliceMatrix<double> shapes) const override
|
|
664
|
-
{
|
|
665
|
-
Switch<4-DIM>
|
|
666
|
-
(bmip.DimSpace()-DIM,[this, &bmip, shapes](auto CODIM)
|
|
667
|
-
{
|
|
668
|
-
constexpr auto DIMSPACE = DIM+CODIM.value;
|
|
669
|
-
auto & mip = static_cast<const MappedIntegrationPoint<DIM, DIM+CODIM.value>&> (bmip);
|
|
670
|
-
|
|
671
|
-
Cast() -> T_CalcShape (GetTIP(mip),SBLambda([shapes,DIMSPACE](int nr,auto val)
|
|
672
|
-
{
|
|
673
|
-
shapes.Row(nr).Range(DIMSPACE*DIMSPACE) = val.Value().AsVector();
|
|
674
|
-
}));
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
virtual void EvaluateMappedShape (const BaseMappedIntegrationPoint & bmip,
|
|
681
|
-
BareSliceVector<double> coefs,
|
|
682
|
-
BareSliceMatrix<double> shape) const override
|
|
683
|
-
{
|
|
684
|
-
Switch<4-DIM>
|
|
685
|
-
(bmip.DimSpace()-DIM,[this, &bmip, coefs, shape](auto CODIM)
|
|
686
|
-
{
|
|
687
|
-
auto & mip = static_cast<const MappedIntegrationPoint<DIM,DIM+CODIM.value>&> (bmip);
|
|
688
|
-
|
|
689
|
-
Mat<DIM+CODIM.value,DIM+CODIM.value> summat(0);
|
|
690
|
-
Cast() -> T_CalcShape (GetTIP(mip), SBLambda ([&summat,coefs] (int nr, auto val)
|
|
691
|
-
{
|
|
692
|
-
summat += coefs(nr) * val.Value();
|
|
693
|
-
|
|
694
|
-
}));
|
|
695
|
-
for (int k = 0; k < sqr(DIM+CODIM.value); k++)
|
|
696
|
-
shape(k) = summat(k);
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
virtual void CalcMappedIncShape (const BaseMappedIntegrationPoint & bmip,
|
|
702
|
-
BareSliceMatrix<double> shapes) const override
|
|
703
|
-
{
|
|
704
|
-
auto & mip = static_cast<const MappedIntegrationPoint<DIM,DIM>&> (bmip);
|
|
705
|
-
if constexpr (ET == ET_TET || ET == ET_TRIG || ET == ET_QUAD)
|
|
706
|
-
Cast() -> T_CalcShape (GetTIPHesse(mip),SBLambda([shapes](int nr,auto val)
|
|
707
|
-
{
|
|
708
|
-
if constexpr (DIM==3)
|
|
709
|
-
shapes.Row(nr).Range(DIM_DDMAT) = val.Inc().AsVector();
|
|
710
|
-
else
|
|
711
|
-
shapes.Row(nr).Range(DIM_DDMAT) = val.Inc();
|
|
712
|
-
}));
|
|
713
|
-
else
|
|
714
|
-
throw Exception("HCurlCurl::CalcMappedIncShape implemented only for TRIG and TET");
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
virtual void EvaluateMappedIncShape (const BaseMappedIntegrationPoint & bmip,
|
|
719
|
-
BareSliceVector<double> coefs,
|
|
720
|
-
BareSliceVector<double> inc) const override
|
|
721
|
-
{
|
|
722
|
-
auto & mip = static_cast<const MappedIntegrationPoint<DIM,DIM>&> (bmip);
|
|
723
|
-
|
|
724
|
-
Mat<DIM*(DIM-1)/2,DIM*(DIM-1)/2> sum = 0.0;
|
|
725
|
-
if constexpr (ET == ET_TET || ET == ET_TRIG || ET == ET_QUAD)
|
|
726
|
-
Cast() -> T_CalcShape (GetTIPHesse(mip),SBLambda([coefs, &sum](int nr,auto val)
|
|
727
|
-
{
|
|
728
|
-
sum += coefs(nr) * Mat<DIM*(DIM-1)/2,DIM*(DIM-1)/2>(val.Inc());
|
|
729
|
-
}));
|
|
730
|
-
else
|
|
731
|
-
throw Exception("HCurlCurl::EvaluateMappedIncShape implemented only for TRIG and TET");
|
|
732
|
-
|
|
733
|
-
inc.Range(0,DIM_DDMAT) = sum.AsVector();
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
virtual void CalcMappedIncShape (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
737
|
-
BareSliceMatrix<SIMD<double>> shapes) const override
|
|
738
|
-
{
|
|
739
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM>&> (bmir);
|
|
740
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
741
|
-
{
|
|
742
|
-
if constexpr (ET == ET_TET || ET == ET_TRIG || ET == ET_QUAD)
|
|
743
|
-
{
|
|
744
|
-
Cast() -> T_CalcShape (GetTIPHesse(mir[i]),SBLambda([shapes,i](int j,auto val)
|
|
745
|
-
{
|
|
746
|
-
if constexpr (DIM==3)
|
|
747
|
-
shapes.Rows(j*sqr(DIM), (j+1)*sqr(DIM)).Col(i).Range(0,DIM_DDMAT) = val.Inc().AsVector();
|
|
748
|
-
else
|
|
749
|
-
shapes.Rows(j,j+1).Col(i).Range(0,DIM_DDMAT) = val.Inc();
|
|
750
|
-
}));
|
|
751
|
-
}
|
|
752
|
-
else
|
|
753
|
-
throw Exception("HCurlCurl::CalcMappedIncShape implemented only for TRIG and TET");
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
void EvaluateIncShape (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
759
|
-
BareSliceVector<> coefs,
|
|
760
|
-
BareSliceMatrix<SIMD<double>> values) const override
|
|
761
|
-
{
|
|
762
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM>&> (bmir);
|
|
763
|
-
for (size_t i = 0; i < bmir.Size(); i++)
|
|
764
|
-
{
|
|
765
|
-
double *pcoefs = &coefs(0);
|
|
766
|
-
const size_t dist = coefs.Dist();
|
|
767
|
-
if constexpr (ET == ET_TET && DIM == 3)
|
|
768
|
-
{
|
|
769
|
-
Mat<DIM,DIM,SIMD<double>> summat(0);
|
|
770
|
-
Cast() -> T_CalcShape (GetTIPHesse(mir[i]),
|
|
771
|
-
SBLambda ([&summat,&pcoefs,dist] (size_t j, auto val)
|
|
772
|
-
{
|
|
773
|
-
summat += (*pcoefs)*val.Inc();
|
|
774
|
-
pcoefs += dist;
|
|
775
|
-
}));
|
|
776
|
-
for (size_t k = 0; k < sqr(DIM); k++)
|
|
777
|
-
values(k,i) = summat(k);
|
|
778
|
-
}
|
|
779
|
-
if constexpr ((ET == ET_TRIG || ET == ET_QUAD) && DIM == 2)
|
|
780
|
-
{
|
|
781
|
-
SIMD<double> summat(0);
|
|
782
|
-
Cast() -> T_CalcShape (GetTIPHesse(mir[i]),
|
|
783
|
-
SBLambda ([&summat,&pcoefs,dist] (size_t j, auto val)
|
|
784
|
-
{
|
|
785
|
-
summat += (*pcoefs)*val.Inc();
|
|
786
|
-
pcoefs += dist;
|
|
787
|
-
}));
|
|
788
|
-
values(0,i) = summat;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/*if constexpr (ET == ET_TET || ET == ET_TRIG)
|
|
793
|
-
{
|
|
794
|
-
Switch<1>
|
|
795
|
-
(bmir.DimSpace()-DIM,[values,&bmir,coefs,this](auto CODIM)
|
|
796
|
-
{
|
|
797
|
-
constexpr auto DIMSPACE = DIM+CODIM.value;
|
|
798
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIMSPACE>&> (bmir);
|
|
799
|
-
for (size_t i = 0; i < bmir.Size(); i++)
|
|
800
|
-
{
|
|
801
|
-
double *pcoefs = &coefs(0);
|
|
802
|
-
const size_t dist = coefs.Dist();
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if constexpr (DIMSPACE==3)
|
|
806
|
-
{
|
|
807
|
-
Mat<DIMSPACE,DIMSPACE,SIMD<double>> summat(0);
|
|
808
|
-
Cast() -> T_CalcShape (GetTIPHesse(mir[i]),
|
|
809
|
-
SBLambda ([&summat,&pcoefs,dist] (size_t j, auto val)
|
|
810
|
-
{
|
|
811
|
-
summat += (*pcoefs)*val.Inc();
|
|
812
|
-
pcoefs += dist;
|
|
813
|
-
}));
|
|
814
|
-
for (size_t k = 0; k < sqr(DIMSPACE); k++)
|
|
815
|
-
values(k,i) = summat(k);
|
|
816
|
-
}
|
|
817
|
-
if constexpr (DIMSPACE==2)
|
|
818
|
-
{
|
|
819
|
-
SIMD<double> summat(0);
|
|
820
|
-
Cast() -> T_CalcShape (GetTIPHesse(mir[i]),
|
|
821
|
-
SBLambda ([&summat,&pcoefs,dist] (size_t j, auto val)
|
|
822
|
-
{
|
|
823
|
-
summat += (*pcoefs)*val.Inc();
|
|
824
|
-
pcoefs += dist;
|
|
825
|
-
}));
|
|
826
|
-
values(0,i) = summat;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
}*/
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
void AddTransIncShape (const SIMD_BaseMappedIntegrationRule & ir,
|
|
835
|
-
BareSliceMatrix<SIMD<double>> values,
|
|
836
|
-
BareSliceVector<> coefs) const override
|
|
837
|
-
{
|
|
838
|
-
throw ExceptionNOSIMD("HCurlCurl::AddTransIncShape not implemented yet");
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
virtual void CalcDualShape (const BaseMappedIntegrationPoint & bmip, BareSliceMatrix<> shape) const override
|
|
844
|
-
{
|
|
845
|
-
shape.AddSize(ndof, sqr(bmip.DimSpace())) = 0.0;
|
|
846
|
-
Switch<4-DIM>
|
|
847
|
-
(bmip.DimSpace()-DIM,[this, &bmip, shape](auto CODIM)
|
|
848
|
-
{
|
|
849
|
-
auto & mip = static_cast<const MappedIntegrationPoint<DIM,DIM+CODIM.value>&> (bmip);
|
|
850
|
-
|
|
851
|
-
Cast() -> CalcDualShape2 (mip, SBLambda([shape] (size_t nr, auto val)
|
|
852
|
-
{
|
|
853
|
-
shape.Row(nr) = val.AsVector();
|
|
854
|
-
}));
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
virtual void CalcDualShape (const SIMD_BaseMappedIntegrationRule& bmir, BareSliceMatrix<SIMD<double>> shapes) const override
|
|
859
|
-
{
|
|
860
|
-
Switch<4-DIM>
|
|
861
|
-
(bmir.DimSpace()-DIM,[this, &bmir, shapes](auto CODIM)
|
|
862
|
-
{
|
|
863
|
-
constexpr int DIMSPACE = DIM+CODIM.value;
|
|
864
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM+CODIM.value>&> (bmir);
|
|
865
|
-
|
|
866
|
-
shapes.AddSize(ndof*sqr(DIMSPACE), mir.Size()) = 0.0;
|
|
867
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
868
|
-
{
|
|
869
|
-
Cast() -> CalcDualShape2 (mir[i], SBLambda([shapes,i,DIMSPACE] (size_t j, auto val)
|
|
870
|
-
{
|
|
871
|
-
shapes.Rows(j*sqr(DIMSPACE), (j+1)*sqr(DIMSPACE)).Col(i).Range(0,sqr(DIMSPACE)) = val.AsVector();
|
|
872
|
-
}));
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
virtual void EvaluateDual (const SIMD_BaseMappedIntegrationRule & bmir, BareSliceVector<> coefs, BareSliceMatrix<SIMD<double>> values) const override
|
|
878
|
-
{
|
|
879
|
-
Switch<4-DIM>
|
|
880
|
-
(bmir.DimSpace()-DIM,[this,&bmir,coefs,values](auto CODIM)
|
|
881
|
-
{
|
|
882
|
-
constexpr int DIMSPACE = DIM+CODIM.value;
|
|
883
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM+CODIM.value>&> (bmir);
|
|
884
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
885
|
-
{
|
|
886
|
-
Mat<DIMSPACE,DIMSPACE,SIMD<double>> sum (SIMD<double>(0.0));
|
|
887
|
-
Cast() -> CalcDualShape2 (mir[i], SBLambda([&sum, coefs] (size_t j, auto val)
|
|
888
|
-
{
|
|
889
|
-
sum += coefs(j) * val;
|
|
890
|
-
}));
|
|
891
|
-
for (size_t k = 0; k < sqr(DIMSPACE); k++)
|
|
892
|
-
values(k, i) = sum(k);
|
|
893
|
-
}
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
virtual void AddDualTrans (const SIMD_BaseMappedIntegrationRule& bmir, BareSliceMatrix<SIMD<double>> values, BareSliceVector<double> coefs) const override
|
|
898
|
-
{
|
|
899
|
-
Switch<4-DIM>
|
|
900
|
-
(bmir.DimSpace()-DIM,[this,&bmir,coefs,values](auto CODIM)
|
|
901
|
-
{
|
|
902
|
-
constexpr int DIMSPACE = DIM+CODIM.value;
|
|
903
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM+CODIM.value>&> (bmir);
|
|
904
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
905
|
-
{
|
|
906
|
-
Mat<DIMSPACE,DIMSPACE,SIMD<double>> value;
|
|
907
|
-
for (size_t k = 0; k < sqr(DIMSPACE); k++)
|
|
908
|
-
value(k) = values(k, i);
|
|
909
|
-
|
|
910
|
-
Cast()-> CalcDualShape2 (mir[i], SBLambda([value, coefs] (size_t j, auto val)
|
|
911
|
-
{
|
|
912
|
-
coefs(j) += HSum(InnerProduct(val,value));
|
|
913
|
-
}));
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
virtual void CalcMappedCurlShape (const BaseMappedIntegrationPoint & bmip,
|
|
919
|
-
BareSliceMatrix<double> shape) const override
|
|
920
|
-
{
|
|
921
|
-
auto mip = static_cast<const MappedIntegrationPoint<DIM,DIM> &>(bmip);
|
|
922
|
-
|
|
923
|
-
if constexpr (ET == ET_TET || ET == ET_TRIG)
|
|
924
|
-
Cast() -> T_CalcShape (GetTIPHesse(mip),SBLambda([shape](int nr,auto val)
|
|
925
|
-
{
|
|
926
|
-
if constexpr (DIM==3)
|
|
927
|
-
shape.Row(nr).Range(DIM_DMAT) = val.Curl().AsVector();
|
|
928
|
-
else
|
|
929
|
-
shape.Row(nr).Range(DIM_DMAT) = val.Curl();
|
|
930
|
-
}));
|
|
931
|
-
else
|
|
932
|
-
throw Exception("HCurlCurl::CalcMappedCurlShape implemented only for TRIG and TET");
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
virtual void CalcMappedShape (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
936
|
-
BareSliceMatrix<SIMD<double>> shapes) const override
|
|
937
|
-
{
|
|
938
|
-
Switch<4-DIM>
|
|
939
|
-
(bmir.DimSpace()-DIM,[this, &bmir, shapes](auto CODIM)
|
|
940
|
-
{
|
|
941
|
-
constexpr auto DIMSPACE = DIM+CODIM.value;
|
|
942
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIM+CODIM.value>&> (bmir);
|
|
943
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
944
|
-
{
|
|
945
|
-
this->Cast() -> T_CalcShape (GetTIP(mir[i]),
|
|
946
|
-
SBLambda ([i,shapes,DIMSPACE] (size_t j, auto val)
|
|
947
|
-
{
|
|
948
|
-
shapes.Rows(j*sqr(DIMSPACE), (j+1)*sqr(DIMSPACE)).Col(i).Range(0,sqr(DIMSPACE)) = val.Value().AsVector();
|
|
949
|
-
}));
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
virtual void Evaluate (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
956
|
-
BareSliceVector<> coefs,
|
|
957
|
-
BareSliceMatrix<SIMD<double>> values) const override
|
|
958
|
-
{
|
|
959
|
-
Switch<4-DIM>
|
|
960
|
-
(bmir.DimSpace()-DIM,[values,&bmir, coefs,this](auto CODIM)
|
|
961
|
-
{
|
|
962
|
-
constexpr auto DIMSPACE = DIM+CODIM.value;
|
|
963
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIMSPACE>&> (bmir);
|
|
964
|
-
for (size_t i = 0; i < bmir.Size(); i++)
|
|
965
|
-
{
|
|
966
|
-
double *pcoefs = &coefs(0);
|
|
967
|
-
const size_t dist = coefs.Dist();
|
|
968
|
-
|
|
969
|
-
Mat<DIMSPACE,DIMSPACE,SIMD<double>> summat(0);
|
|
970
|
-
Cast() -> T_CalcShape (GetTIP(mir[i]),
|
|
971
|
-
SBLambda ([&summat,&pcoefs,dist] (size_t j, auto val)
|
|
972
|
-
{
|
|
973
|
-
summat += (*pcoefs)*val.Value();
|
|
974
|
-
pcoefs += dist;
|
|
975
|
-
}));
|
|
976
|
-
for (size_t k = 0; k < sqr(DIMSPACE); k++)
|
|
977
|
-
values(k,i) = summat(k);
|
|
978
|
-
}
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
virtual void AddTrans (const SIMD_BaseMappedIntegrationRule & bmir,
|
|
983
|
-
BareSliceMatrix<SIMD<double>> values,
|
|
984
|
-
BareSliceVector<> coefs) const override
|
|
985
|
-
{
|
|
986
|
-
Switch<4-DIM>
|
|
987
|
-
(bmir.DimSpace()-DIM,[this,&bmir,coefs,values](auto CODIM)
|
|
988
|
-
{
|
|
989
|
-
constexpr int DIMSPACE = DIM+CODIM.value;
|
|
990
|
-
auto & mir = static_cast<const SIMD_MappedIntegrationRule<DIM,DIMSPACE>&> (bmir);
|
|
991
|
-
for (size_t i = 0; i < mir.Size(); i++)
|
|
992
|
-
{
|
|
993
|
-
Mat<DIMSPACE,DIMSPACE,SIMD<double>> vali;
|
|
994
|
-
vali.AsVector()= values.Col(i);
|
|
995
|
-
|
|
996
|
-
double *pcoefs = &coefs(0);
|
|
997
|
-
const size_t dist = coefs.Dist();
|
|
998
|
-
Cast()->T_CalcShape (GetTIP(mir[i]),
|
|
999
|
-
SBLambda ([vali,&pcoefs,dist] (size_t j, auto s)
|
|
1000
|
-
{
|
|
1001
|
-
*pcoefs += HSum(InnerProduct(s.Value(), vali));
|
|
1002
|
-
pcoefs += dist;
|
|
1003
|
-
}));
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
#ifdef FILE_HCURLCURLFE_CPP
|
|
1015
|
-
#define HCURLCURLFE_EXTERN
|
|
1016
|
-
#else
|
|
1017
|
-
#define HCURLCURLFE_EXTERN extern
|
|
1018
|
-
#endif
|
|
1019
|
-
|
|
1020
|
-
HCURLCURLFE_EXTERN template class HCurlCurlFiniteElement<2>;
|
|
1021
|
-
HCURLCURLFE_EXTERN template class HCurlCurlFiniteElement<3>;
|
|
1022
|
-
|
|
1023
|
-
template <> class HCurlCurlFE<ET_SEGM> : public T_HCurlCurlFE<ET_SEGM>
|
|
1024
|
-
{
|
|
1025
|
-
|
|
1026
|
-
public:
|
|
1027
|
-
using T_HCurlCurlFE<ET_SEGM> :: T_HCurlCurlFE;
|
|
1028
|
-
|
|
1029
|
-
virtual void ComputeNDof()
|
|
1030
|
-
{
|
|
1031
|
-
order = 0;
|
|
1032
|
-
ndof = 0;
|
|
1033
|
-
ndof += order_inner[0]+1;
|
|
1034
|
-
order = max2(order,order_inner[0]);
|
|
1035
|
-
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
template <typename Tx, typename TFA>
|
|
1039
|
-
void T_CalcShape (TIP<1,Tx> ip, TFA & shape) const
|
|
1040
|
-
{
|
|
1041
|
-
Tx x = ip.x;
|
|
1042
|
-
Tx lami[2] ={ x, 1-x };
|
|
1043
|
-
int ii = 0;
|
|
1044
|
-
|
|
1045
|
-
IVec<2> e = ET_trait<ET_SEGM>::GetEdgeSort (0, vnums);
|
|
1046
|
-
Tx ls = lami[e[0]], le = lami[e[1]];
|
|
1047
|
-
|
|
1048
|
-
auto symdyadic = MakeReggeAD(ls, le);
|
|
1049
|
-
|
|
1050
|
-
LegendrePolynomial::Eval(order_inner[0], ls-le, SBLambda([symdyadic, &ii, shape] (size_t nr, auto val)
|
|
1051
|
-
{
|
|
1052
|
-
shape[ii++] = 0.5*val*symdyadic;
|
|
1053
|
-
}));
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
template <typename MIP, typename TFA>
|
|
1057
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
1058
|
-
{
|
|
1059
|
-
auto & ip = mip.IP();
|
|
1060
|
-
typedef typename std::remove_const<typename std::remove_reference<decltype(mip.IP()(0))>::type>::type T;
|
|
1061
|
-
T x = ip(0);
|
|
1062
|
-
T lam[2] = { x, 1-x };
|
|
1063
|
-
|
|
1064
|
-
int ii = 0;
|
|
1065
|
-
|
|
1066
|
-
IVec<2> e = ET_trait<ET_SEGM>::GetEdgeSort (0, vnums);
|
|
1067
|
-
T xi = lam[e[0]]-lam[e[1]];
|
|
1068
|
-
|
|
1069
|
-
auto tv = mip.GetJacobian()*Vec<1,T>(1);
|
|
1070
|
-
auto tt = DyadProd(tv,tv);
|
|
1071
|
-
|
|
1072
|
-
LegendrePolynomial::Eval(order_inner[0], xi, SBLambda([shape,mip,tt,&ii] (size_t nr, T val)
|
|
1073
|
-
{
|
|
1074
|
-
shape[ii++] = 1/mip.GetMeasure()*val*tt;
|
|
1075
|
-
}));
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
template <> class HCurlCurlFE<ET_TRIG> : public T_HCurlCurlFE<ET_TRIG>
|
|
1082
|
-
{
|
|
1083
|
-
|
|
1084
|
-
public:
|
|
1085
|
-
using T_HCurlCurlFE<ET_TRIG> :: T_HCurlCurlFE;
|
|
1086
|
-
|
|
1087
|
-
virtual void ComputeNDof()
|
|
1088
|
-
{
|
|
1089
|
-
order = 0;
|
|
1090
|
-
ndof = 0;
|
|
1091
|
-
for (int i=0; i<3; i++)
|
|
1092
|
-
{
|
|
1093
|
-
ndof += order_facet[i][0]+1;
|
|
1094
|
-
order = max2(order, order_facet[i][0]);
|
|
1095
|
-
}
|
|
1096
|
-
int ninner = 3*order_inner[0]*(order_inner[0]+1)/2 ;
|
|
1097
|
-
order = max2(order, order_inner[0]);
|
|
1098
|
-
|
|
1099
|
-
ndof += ninner;
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
template <typename Tx, typename TFA>
|
|
1105
|
-
void T_CalcShape (TIP<2,Tx> ip, TFA & shape) const
|
|
1106
|
-
{
|
|
1107
|
-
Tx x = ip.x, y = ip.y;
|
|
1108
|
-
Tx lami[3] ={ x, y, 1-x-y };
|
|
1109
|
-
int ii = 0;
|
|
1110
|
-
|
|
1111
|
-
// /*int maxorder_facet =
|
|
1112
|
-
// max2(order_facet[0][0],max2(order_facet[1][0],order_facet[2][0]));
|
|
1113
|
-
// ArrayMem<Tx,20> ha(maxorder_facet+1);
|
|
1114
|
-
// ArrayMem<Tx,20> u(order_inner[0]+2), v(order_inner[0]+2);
|
|
1115
|
-
|
|
1116
|
-
// for (int i = 0; i < 3; i++)
|
|
1117
|
-
// {
|
|
1118
|
-
// IVec<2> e = ET_trait<ET_TRIG>::GetEdgeSort(i,vnums);
|
|
1119
|
-
// Tx ls = llami[e[0]], le = llami[e[1]];
|
|
1120
|
-
|
|
1121
|
-
// // edge functions are all curl-free!
|
|
1122
|
-
// IntegratedLegendreMonomialExt::CalcTrigExt(maxorder_facet+2,
|
|
1123
|
-
// le-ls, 1-le-ls, ha);
|
|
1124
|
-
|
|
1125
|
-
// for (int l = 0; l <= order_facet[i][0]; l++)
|
|
1126
|
-
// shape[ii++] = EpsGrad (ha[l]);
|
|
1127
|
-
// }*/
|
|
1128
|
-
|
|
1129
|
-
for (int i = 0; i < 3; i++)
|
|
1130
|
-
{
|
|
1131
|
-
IVec<2> e = ET_trait<ET_TRIG>::GetEdgeSort (i, vnums);
|
|
1132
|
-
Tx ls = lami[e[1]], le = lami[e[0]];
|
|
1133
|
-
|
|
1134
|
-
auto symdyadic = MakeReggeAD(ls, le);
|
|
1135
|
-
|
|
1136
|
-
LegendrePolynomial::EvalScaled(order_facet[i][0], ls-le,ls+le, SBLambda([symdyadic, &ii, shape] (size_t nr, auto val)
|
|
1137
|
-
{
|
|
1138
|
-
shape[ii++] = -val*symdyadic;
|
|
1139
|
-
}));
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
if (order_inner[0] > 0)
|
|
1144
|
-
{
|
|
1145
|
-
IVec<4> f = ET_trait<ET_TRIG>::GetFaceSort(0, vnums);
|
|
1146
|
-
Tx ls = lami[f[0]], le = lami[f[1]], lt = lami[f[2]];
|
|
1147
|
-
|
|
1148
|
-
auto symdyadic1 = lt*MakeReggeAD(ls, le);
|
|
1149
|
-
auto symdyadic2 = ls*MakeReggeAD(lt, le);
|
|
1150
|
-
auto symdyadic3 = le*MakeReggeAD(ls, lt);
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
DubinerBasis::Eval(order_inner[0]-1, ls,le,
|
|
1154
|
-
SBLambda([symdyadic1,symdyadic2,symdyadic3, &ii, shape] (size_t nr, auto val)
|
|
1155
|
-
{
|
|
1156
|
-
shape[ii++] = 2*val*symdyadic1;
|
|
1157
|
-
shape[ii++] = 2*val*symdyadic2;
|
|
1158
|
-
shape[ii++] = 2*val*symdyadic3;
|
|
1159
|
-
}));
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
};
|
|
1163
|
-
|
|
1164
|
-
template <typename MIP, typename TFA>
|
|
1165
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
1166
|
-
{
|
|
1167
|
-
auto & ip = mip.IP();
|
|
1168
|
-
typedef typename std::remove_const<typename std::remove_reference<decltype(mip.IP()(0))>::type>::type T;
|
|
1169
|
-
T x = ip(0), y = ip(1);
|
|
1170
|
-
T lam[3] = { x, y, 1-x-y };
|
|
1171
|
-
Vec<2,T> pnts[3] = { { 1, 0 }, { 0, 1 } , { 0, 0 } };
|
|
1172
|
-
int facetnr = ip.FacetNr();
|
|
1173
|
-
|
|
1174
|
-
int ii = 0;
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
if (ip.VB() == BND)
|
|
1178
|
-
{ // facet shapes
|
|
1179
|
-
for (int i = 0; i < 3; i++)
|
|
1180
|
-
{
|
|
1181
|
-
int p = order_facet[i][0];
|
|
1182
|
-
|
|
1183
|
-
if (i == facetnr)
|
|
1184
|
-
{
|
|
1185
|
-
IVec<2> e = ET_trait<ET_TRIG>::GetEdgeSort (i, vnums);
|
|
1186
|
-
|
|
1187
|
-
T xi = lam[e[0]]-lam[e[1]];
|
|
1188
|
-
Vec<2,T> tauref = pnts[e[0]] - pnts[e[1]];
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
auto tv = mip.GetJacobian()*tauref;
|
|
1192
|
-
|
|
1193
|
-
auto tt = DyadProd(tv,tv);
|
|
1194
|
-
LegendrePolynomial::Eval
|
|
1195
|
-
(p, xi,
|
|
1196
|
-
SBLambda([&] (size_t nr, T val)
|
|
1197
|
-
{
|
|
1198
|
-
shape[nr+ii] = 1/mip.GetMeasure()*val*tt;
|
|
1199
|
-
}));
|
|
1200
|
-
}
|
|
1201
|
-
ii += (p+1);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
else
|
|
1205
|
-
{
|
|
1206
|
-
for (int i = 0; i < 3; i++)
|
|
1207
|
-
ii += order_facet[i][0]+1;
|
|
1208
|
-
}
|
|
1209
|
-
if (ip.VB() == VOL)
|
|
1210
|
-
{
|
|
1211
|
-
auto p = order_inner[0]-1;
|
|
1212
|
-
if( p >= 0 )
|
|
1213
|
-
{
|
|
1214
|
-
IVec<4> f = ET_trait<ET_TRIG>::GetFaceSort(0, vnums);
|
|
1215
|
-
|
|
1216
|
-
DubinerBasis::Eval (p, lam[f[0]], lam[f[1]],
|
|
1217
|
-
SBLambda([&] (size_t nr, T val)
|
|
1218
|
-
{
|
|
1219
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<2,2>({{1,0},{0,0}})*Trans(mip.GetJacobian());
|
|
1220
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<2,2>({{0,0},{0,1}})*Trans(mip.GetJacobian());
|
|
1221
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<2,2>({{0,1},{1,0}})*Trans(mip.GetJacobian());
|
|
1222
|
-
}));
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
};
|
|
1229
|
-
|
|
1230
|
-
template <> class HCurlCurlFE<ET_QUAD> : public T_HCurlCurlFE<ET_QUAD>
|
|
1231
|
-
{
|
|
1232
|
-
|
|
1233
|
-
public:
|
|
1234
|
-
using T_HCurlCurlFE<ET_QUAD> :: T_HCurlCurlFE;
|
|
1235
|
-
|
|
1236
|
-
virtual void ComputeNDof()
|
|
1237
|
-
{
|
|
1238
|
-
order = 0;
|
|
1239
|
-
ndof = 0;
|
|
1240
|
-
for (int i=0; i<4; i++)
|
|
1241
|
-
{
|
|
1242
|
-
ndof += order_facet[i][0]+1;
|
|
1243
|
-
order = max2(order, order_facet[i][0]);
|
|
1244
|
-
}
|
|
1245
|
-
int ninner = order_inner[0]*order_inner[0] + (order_inner[0]+2)*order_inner[0]*2 +1;//+ 2*order_inner[0];
|
|
1246
|
-
order = max2(order, order_inner[0]);
|
|
1247
|
-
order += 1;
|
|
1248
|
-
ndof += ninner;
|
|
1249
|
-
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
template <typename Tx, typename TFA>
|
|
1255
|
-
void T_CalcShape (TIP<2,Tx> ip, TFA & shape) const
|
|
1256
|
-
{
|
|
1257
|
-
Tx x = ip.x, y = ip.y;
|
|
1258
|
-
Tx lx[4] ={ 1-x, x, x, 1-x };
|
|
1259
|
-
Tx ly[4] ={ 1-y, 1-y, y, y };
|
|
1260
|
-
Tx lami[4] = {(1-x)*(1-y),x*(1-y),x*y,(1-x)*y};
|
|
1261
|
-
Tx sigma[4] = {(1-x)+(1-y),x+(1-y),x+y,(1-x)+y};
|
|
1262
|
-
int ii = 0;
|
|
1263
|
-
|
|
1264
|
-
ArrayMem<Tx,20> v(order+2), u(order+2);
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
for (int i = 0; i < 4; i++)
|
|
1268
|
-
{
|
|
1269
|
-
IVec<2> e = ET_trait<ET_QUAD>::GetEdgeSort (i, vnums);
|
|
1270
|
-
Tx xi = sigma[e[1]]-sigma[e[0]];
|
|
1271
|
-
Tx lam_e = lami[e[0]]+lami[e[1]];
|
|
1272
|
-
auto symdyadic = MakeReggeAD(xi, xi);
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
//IntLegNoBubble::
|
|
1276
|
-
LegendrePolynomial::
|
|
1277
|
-
EvalMult (order_facet[i][0],
|
|
1278
|
-
xi, 0.25*lam_e, SBLambda ([&](int i, auto val)
|
|
1279
|
-
{
|
|
1280
|
-
shape[ii++] = val*symdyadic;
|
|
1281
|
-
}));
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
int oi = order_inner[0];
|
|
1287
|
-
|
|
1288
|
-
auto symdyadic = MakeReggeAD(0.5*x,0.5*y); //(0,0.5, 0.5,0) * P(y) * P(x)
|
|
1289
|
-
|
|
1290
|
-
Tx eta = ly[2]-ly[1];
|
|
1291
|
-
Tx xi = lx[1]-lx[0];
|
|
1292
|
-
LegendrePolynomial (oi, eta, v);
|
|
1293
|
-
LegendrePolynomial (oi, xi, u);
|
|
1294
|
-
|
|
1295
|
-
for (int i = 0; i <= oi; i++)
|
|
1296
|
-
for (int j = 0; j <= oi; j++)
|
|
1297
|
-
{
|
|
1298
|
-
shape[ii++] = u[i]*v[j]*symdyadic;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
auto symdyad = lx[1]*lx[0]*MakeReggeAD(y,y);//x*(1-x)*(0,0, 0,1) * P(y) * P(x)
|
|
1303
|
-
for (int i = 0; i < oi; i++)
|
|
1304
|
-
for (int j = 0; j <= oi; j++)
|
|
1305
|
-
{
|
|
1306
|
-
shape[ii++] = u[i]*v[j]*symdyad;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
symdyad = ly[2]*ly[1]*MakeReggeAD(x,x); //y*(1-y)*(1,0, 0,0) * P(x) * P(y)
|
|
1310
|
-
|
|
1311
|
-
for (int j = 0; j < oi; j++)
|
|
1312
|
-
for (int i = 0; i <= oi; i++)
|
|
1313
|
-
{
|
|
1314
|
-
shape[ii++] = u[i]*v[j]*symdyad;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
//old version
|
|
1318
|
-
//ArrayMem<Tx,20> u(order+2);
|
|
1319
|
-
/*for (int i = 0; i < 4; i++)
|
|
1320
|
-
{
|
|
1321
|
-
IVec<2> e = ET_trait<ET_QUAD>::GetEdgeSort (i, vnums);
|
|
1322
|
-
Tx xi = llx[e[1]]+lly[e[1]]-llx[e[0]]-lly[e[0]];
|
|
1323
|
-
Tx eta = llx[e[0]]*lly[e[0]]+llx[e[1]]*lly[e[1]];
|
|
1324
|
-
|
|
1325
|
-
IntegratedLegendreMonomialExt::Calc(order_facet[i][0]+2,xi,u);
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
for (int l = 0; l <= order_facet[i][0]; l++)
|
|
1329
|
-
shape[ii++] = Eps_u_Gradv (eta, u[l]);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
IntegratedLegendreMonomialExt::Calc(oi+3,llx[0]-llx[1],u);
|
|
1333
|
-
IntegratedLegendreMonomialExt::Calc(oi+3,lly[0]-lly[2],v);
|
|
1334
|
-
|
|
1335
|
-
for(int i = 0; i <= oi-1; i++)
|
|
1336
|
-
for(int j = 0; j <= oi-1; j++)
|
|
1337
|
-
shape[ii++] = EpsGrad(u[i]*v[j]);
|
|
1338
|
-
|
|
1339
|
-
for(int i = 0; i <= oi+1; i++)
|
|
1340
|
-
for(int j = 0; j <= oi-1; j++)
|
|
1341
|
-
{
|
|
1342
|
-
shape[ii++] = vEpsGradu(u[i],v[j]);
|
|
1343
|
-
shape[ii++] = vEpsGradu(v[i],u[j]);
|
|
1344
|
-
}
|
|
1345
|
-
shape[ii++] = Eps_u_Gradv(lx[0], ly[0]);
|
|
1346
|
-
|
|
1347
|
-
for(int i = 0; i <= oi-1; i++)
|
|
1348
|
-
{
|
|
1349
|
-
shape[ii++] = Eps_u_Gradv(u[i], ly[0]);
|
|
1350
|
-
shape[ii++] = Eps_u_Gradv(v[i], lx[0]);
|
|
1351
|
-
}*/
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
template <typename MIP, typename TFA>
|
|
1358
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
1359
|
-
{
|
|
1360
|
-
auto & ip = mip.IP();
|
|
1361
|
-
typedef typename std::remove_const<typename std::remove_reference<decltype(mip.IP()(0))>::type>::type T;
|
|
1362
|
-
|
|
1363
|
-
T x = ip(0), y = ip(1);
|
|
1364
|
-
T lx[4] = { 1-x, x, x, 1-x };
|
|
1365
|
-
T ly[4] = { 1-y, 1-y, y, y };
|
|
1366
|
-
T sigma[4] = {(1-x)+(1-y),x+(1-y),x+y,(1-x)+y};
|
|
1367
|
-
|
|
1368
|
-
Vec<2,T> pnts[4] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
|
|
1369
|
-
int facetnr = ip.FacetNr();
|
|
1370
|
-
|
|
1371
|
-
int ii = 0;
|
|
1372
|
-
|
|
1373
|
-
ArrayMem<T,20> v(order+2), u(order+2);
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
if (mip.IP().VB() == BND)
|
|
1377
|
-
{ // facet shapes
|
|
1378
|
-
for (int i = 0; i < 4; i++)
|
|
1379
|
-
{
|
|
1380
|
-
int p = order_facet[i][0];
|
|
1381
|
-
|
|
1382
|
-
if (i == facetnr)
|
|
1383
|
-
{
|
|
1384
|
-
IVec<2> e = ET_trait<ET_QUAD>::GetEdgeSort (i, vnums);
|
|
1385
|
-
|
|
1386
|
-
//T xi = lam[e[0]]-lam[e[1]];
|
|
1387
|
-
T xi = sigma[e[1]]-sigma[e[0]];
|
|
1388
|
-
Vec<2,T> tauref = pnts[e[0]] - pnts[e[1]];
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
auto tv = mip.GetJacobian()*tauref;
|
|
1392
|
-
|
|
1393
|
-
auto tt = DyadProd(tv,tv);
|
|
1394
|
-
LegendrePolynomial::Eval
|
|
1395
|
-
(p, xi,
|
|
1396
|
-
SBLambda([&] (size_t nr, T val)
|
|
1397
|
-
{
|
|
1398
|
-
shape[nr+ii] = 1/mip.GetMeasure()*val*tt;
|
|
1399
|
-
}));
|
|
1400
|
-
/*IVec<2> e = ET_trait<ET_QUAD>::GetEdgeSort (i, vnums);
|
|
1401
|
-
AutoDiff<2,T> xi = sigma[e[1]]-sigma[e[0]];
|
|
1402
|
-
AutoDiff<2,T> lam_e = lami[e[0]]+lami[e[1]];
|
|
1403
|
-
Vec<3, AutoDiff<2,T>> symdyadic = SymDyadProd(xi,xi);
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
IntLegNoBubble::
|
|
1407
|
-
EvalMult (order_edge[i],
|
|
1408
|
-
xi, lam_e, SBLambda ([&](int nr, auto val)
|
|
1409
|
-
{
|
|
1410
|
-
VecToSymMat<2>(T_REGGE_Shape<2,T>(val*symdyadic).Shape(),tmp);
|
|
1411
|
-
shape[nr + ii] = mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1412
|
-
}));*/
|
|
1413
|
-
/*AutoDiff<2,T> xi = sigma[e[1]]-sigma[e[0]];
|
|
1414
|
-
AutoDiff<2,T> lam_e = lami[e[0]]+lami[e[1]];
|
|
1415
|
-
Vec<3, AutoDiff<2,T>> symdyadic = SymDyadProd(xi,xi);
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
IntLegNoBubble::
|
|
1419
|
-
EvalMult (p,xi, lam_e, SBLambda ([&](int nr, auto val)
|
|
1420
|
-
{
|
|
1421
|
-
VecToSymMat<2>(T_REGGE_Shape<2,T>(val*symdyadic).Shape(),tmp);
|
|
1422
|
-
shape[nr + ii] = 1/mip.GetMeasure()*tmp;
|
|
1423
|
-
}));*/
|
|
1424
|
-
}
|
|
1425
|
-
ii += (p+1);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
else
|
|
1429
|
-
{
|
|
1430
|
-
for (int i = 0; i < 4; i++)
|
|
1431
|
-
ii += order_facet[i][0]+1;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
if (mip.IP().VB() == VOL)
|
|
1435
|
-
{
|
|
1436
|
-
auto p = order_inner[0];
|
|
1437
|
-
|
|
1438
|
-
T eta = ly[2]-ly[1];
|
|
1439
|
-
T xi = lx[1]-lx[0];
|
|
1440
|
-
LegendrePolynomial (p, eta, v);
|
|
1441
|
-
LegendrePolynomial (p, xi, u);
|
|
1442
|
-
|
|
1443
|
-
for (int i = 0; i <= p; i++)
|
|
1444
|
-
for (int j = 0; j <= p; j++)
|
|
1445
|
-
{
|
|
1446
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{0,1},{1,0}}))*Trans(mip.GetJacobian());
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
//auto symdyad = lx[1]*lx[0]*SymDyadProd(Vec<2,T>(0,1),Vec<2,T>(0,1));//x*(1-x)*(0,0, 0,1) * P(y) * P(x)
|
|
1451
|
-
for (int i = 0; i < p; i++)
|
|
1452
|
-
for (int j = 0; j <= p; j++)
|
|
1453
|
-
{
|
|
1454
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{0,0},{0,1}}))*Trans(mip.GetJacobian());
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
//symdyad = ly[2]*ly[1]*SymDyadProd(Vec<2,T>(1,0),Vec<2,T>(1,0)); //y*(1-y)*(1,0, 0,0) * P(x) * P(y)
|
|
1458
|
-
|
|
1459
|
-
for (int j = 0; j < p; j++)
|
|
1460
|
-
for (int i = 0; i <= p; i++)
|
|
1461
|
-
{
|
|
1462
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{1,0},{0,0}}))*Trans(mip.GetJacobian());
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
//IVec<4> f = ET_trait<ET_QUAD>::GetFaceSort(0, vnums);
|
|
1466
|
-
|
|
1467
|
-
/*IntegratedLegendreMonomialExt::Calc(p+3,lx[0]-lx[1],u);
|
|
1468
|
-
IntegratedLegendreMonomialExt::Calc(p+3,ly[0]-ly[2],v);
|
|
1469
|
-
|
|
1470
|
-
Mat<2,2,T> tmp;
|
|
1471
|
-
|
|
1472
|
-
for(int i = 0; i <= p-1; i++)
|
|
1473
|
-
for(int j = 0; j <= p-1; j++)
|
|
1474
|
-
{
|
|
1475
|
-
VecToSymMat<2>(EpsGrad(u[i]*v[j]).Shape(),tmp);
|
|
1476
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
for(int i = 0; i <= p+1; i++)
|
|
1480
|
-
for(int j = 0; j <= p-1; j++)
|
|
1481
|
-
{
|
|
1482
|
-
VecToSymMat<2>(vEpsGradu(u[i],v[j]).Shape(),tmp);
|
|
1483
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1484
|
-
VecToSymMat<2>(vEpsGradu(v[i],u[j]).Shape(),tmp);
|
|
1485
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
VecToSymMat<2>(Eps_u_Gradv(lx[0], ly[0]).Shape(),tmp);
|
|
1489
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1490
|
-
|
|
1491
|
-
for(int i = 0; i <= p-1; i++)
|
|
1492
|
-
{
|
|
1493
|
-
VecToSymMat<2>(Eps_u_Gradv(u[i], ly[0]).Shape(),tmp);
|
|
1494
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1495
|
-
VecToSymMat<2>(Eps_u_Gradv(v[i], lx[0]).Shape(),tmp);
|
|
1496
|
-
shape[ii++] = 1/mip.GetMeasure()*mip.GetJacobian()*tmp*Trans(mip.GetJacobian());
|
|
1497
|
-
}*/
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
template <> class HCurlCurlFE<ET_PRISM> : public T_HCurlCurlFE<ET_PRISM>
|
|
1504
|
-
{
|
|
1505
|
-
public:
|
|
1506
|
-
enum { incrorder_xx1 = 0};
|
|
1507
|
-
enum { incrorder_zz1 = 0};
|
|
1508
|
-
enum { incrorder_xx2 = 0};
|
|
1509
|
-
enum { incrorder_zz2 = 0};
|
|
1510
|
-
enum { incrorder_xx1_bd = 0};
|
|
1511
|
-
enum { incrorder_zz1_bd = 0};
|
|
1512
|
-
enum { incrorder_xx2_bd = 0};
|
|
1513
|
-
enum { incrorder_zz2_bd = 0};
|
|
1514
|
-
using T_HCurlCurlFE<ET_PRISM> :: T_HCurlCurlFE;
|
|
1515
|
-
|
|
1516
|
-
virtual void ComputeNDof()
|
|
1517
|
-
{
|
|
1518
|
-
order = 0;
|
|
1519
|
-
ndof = 0;
|
|
1520
|
-
|
|
1521
|
-
for (int i=0; i < 9; i++)
|
|
1522
|
-
{
|
|
1523
|
-
ndof += order_edge[i]+1;
|
|
1524
|
-
order = max2(order,order_edge[i]);
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
for (int i=0; i<2; i++)
|
|
1528
|
-
{
|
|
1529
|
-
ndof += 3*(order_facet[i][0])*(order_facet[i][0]+1)/2;
|
|
1530
|
-
order = max2(order, order_facet[i][0]);
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
for (int i=2; i<5; i++)
|
|
1534
|
-
{
|
|
1535
|
-
ndof += order_facet[i][0]*order_facet[i][0] + (order_facet[i][0]+2)*order_facet[i][0]*2 +1;
|
|
1536
|
-
order = max2(order, order_facet[i][0]);
|
|
1537
|
-
}
|
|
1538
|
-
int p = order_inner[0];
|
|
1539
|
-
int ninner = 3*p*(p+1)/2*p + (p-1)*(p)/2*(p+1) + (p+1)*p*(p+1);
|
|
1540
|
-
ndof += ninner;
|
|
1541
|
-
|
|
1542
|
-
order = 1+max2(order, p);
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
template <typename Tx, typename TFA>
|
|
1547
|
-
void T_CalcShape (TIP<3,Tx> ip, TFA & shape) const
|
|
1548
|
-
{
|
|
1549
|
-
Tx x = ip.x, y = ip.y, z = ip.z;
|
|
1550
|
-
Tx lx[6] ={ x, y, 1-x-y, x, y, 1-x-y };
|
|
1551
|
-
Tx lz[6] ={ 1-z,1-z,1-z,z,z,z };
|
|
1552
|
-
|
|
1553
|
-
int ii = 0;
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
const FACE * faces = ElementTopology::GetFaces(ET_PRISM);
|
|
1557
|
-
|
|
1558
|
-
ArrayMem<Tx,20> leg_u(order+2), leg_v(order+3);
|
|
1559
|
-
ArrayMem<Tx,20> leg_w(order+2);
|
|
1560
|
-
|
|
1561
|
-
//horizontal edge shapes
|
|
1562
|
-
for (int i = 0; i < 6; i++)
|
|
1563
|
-
{
|
|
1564
|
-
IVec<2> e = ET_trait<ET_PRISM>::GetEdgeSort (i, vnums);
|
|
1565
|
-
Tx ls = lx[e[1]], le = lx[e[0]], lm = lz[e[0]];
|
|
1566
|
-
|
|
1567
|
-
auto symdyadic = lm*MakeReggeAD(ls,le);
|
|
1568
|
-
|
|
1569
|
-
LegendrePolynomial::EvalScaled(order_edge[i], ls-le,ls+le, SBLambda([symdyadic, &ii, shape] (size_t nr, auto val)
|
|
1570
|
-
{
|
|
1571
|
-
shape[ii++] = -val*symdyadic;
|
|
1572
|
-
}));
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
//vertical edge shapes
|
|
1578
|
-
for (int i = 6; i < 9; i++)
|
|
1579
|
-
{
|
|
1580
|
-
IVec<2> e = ET_trait<ET_PRISM>::GetEdgeSort (i, vnums);
|
|
1581
|
-
Tx ls = lx[e[0]], lm1 = lz[e[0]], lm2 = lz[e[1]];
|
|
1582
|
-
auto symdyadic = ls*MakeReggeAD(lm1,lm1);
|
|
1583
|
-
LegendrePolynomial (order_edge[i],lm1-lm2, leg_v);
|
|
1584
|
-
|
|
1585
|
-
for (int j=0; j <= order_edge[i]; j++)
|
|
1586
|
-
shape[ii++] = leg_v[j]*symdyadic;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
//horizontal face shaps
|
|
1592
|
-
for(int fa = 0; fa < 2; fa++)
|
|
1593
|
-
{
|
|
1594
|
-
if (order_facet[fa][0] > 0)
|
|
1595
|
-
{
|
|
1596
|
-
IVec<4> f = ET_trait<ET_PRISM>::GetFaceSort(fa, vnums);
|
|
1597
|
-
Tx ls = lx[f[0]], le = lx[f[1]], lt = lx[f[2]], lm = lz[f[0]];
|
|
1598
|
-
|
|
1599
|
-
auto symdyadic1 = lm*lt*MakeReggeAD(ls,le);
|
|
1600
|
-
auto symdyadic2 = lm*ls*MakeReggeAD(lt,le);
|
|
1601
|
-
auto symdyadic3 = lm*le*MakeReggeAD(ls,lt);
|
|
1602
|
-
|
|
1603
|
-
DubinerBasis::Eval(order_facet[fa][0]-1, ls,le,
|
|
1604
|
-
SBLambda([symdyadic1,symdyadic2,symdyadic3, &ii, shape] (size_t nr, auto val)
|
|
1605
|
-
{
|
|
1606
|
-
shape[ii++] = val*symdyadic1;
|
|
1607
|
-
shape[ii++] = val*symdyadic2;
|
|
1608
|
-
shape[ii++] = val*symdyadic3;
|
|
1609
|
-
}));
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
//vertical face shaps
|
|
1615
|
-
for(int fa = 2; fa < 5; fa++)
|
|
1616
|
-
{
|
|
1617
|
-
int of = order_facet[fa][0];
|
|
1618
|
-
|
|
1619
|
-
int fmax = 0;
|
|
1620
|
-
for(int j = 1; j < 4; j++)
|
|
1621
|
-
if(vnums[faces[fa][j]] > vnums[faces[fa][fmax]]) fmax = j;
|
|
1622
|
-
int fz,ftrig;
|
|
1623
|
-
fz = 3 - fmax;
|
|
1624
|
-
ftrig = fmax^1;
|
|
1625
|
-
fmax = faces[fa][fmax];
|
|
1626
|
-
fz = faces[fa][fz];
|
|
1627
|
-
ftrig = faces[fa][ftrig];
|
|
1628
|
-
|
|
1629
|
-
Tx eta = lz[fz]-lz[fmax];
|
|
1630
|
-
Tx xi = lx[ftrig]-lx[fmax];
|
|
1631
|
-
|
|
1632
|
-
LegendrePolynomial (of, eta, leg_v);
|
|
1633
|
-
LegendrePolynomial (of, xi, leg_u);
|
|
1634
|
-
|
|
1635
|
-
auto W = uDv_minus_vDu(lx[ftrig],lx[fmax]);
|
|
1636
|
-
Tx W_AD;
|
|
1637
|
-
W_AD.DValue(0) = W.Value()(0);
|
|
1638
|
-
W_AD.DValue(1) = W.Value()(1);
|
|
1639
|
-
W_AD.DValue(2) = W.Value()(2);
|
|
1640
|
-
auto symdyadic = MakeReggeAD(eta,0.25*W_AD); //^= (0,1, 1,0) * P(x)*P(y)
|
|
1641
|
-
for (int j = 0; j <= of; j++)
|
|
1642
|
-
for (int k = 0; k <= of; k++)
|
|
1643
|
-
shape[ii++] = leg_v[j]*leg_u[k]*symdyadic;
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
auto symdyad = 0.25*lx[ftrig]*lx[fmax]*MakeReggeAD(eta,eta); //^= x*(1-x)*(0,0, 0,1) * P(x) * P(y)
|
|
1647
|
-
for (int i = 0; i < of; i++)
|
|
1648
|
-
for (int j = 0; j <= of; j++)
|
|
1649
|
-
shape[ii++] = leg_u[i]*leg_v[j]*symdyad;
|
|
1650
|
-
|
|
1651
|
-
symdyad = 0.25*lz[fz]*lz[fmax]*MakeReggeAD(lx[ftrig],lx[fmax]); //^= y*(1-y)*(1,0, 0,0) * P(x)*P(y)
|
|
1652
|
-
for (int j = 0; j < of; j++)
|
|
1653
|
-
for (int i = 0; i <= of; i++)
|
|
1654
|
-
shape[ii++] = leg_u[i]*leg_v[j]*symdyad;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
//inner shapes
|
|
1658
|
-
int p = order_inner[0];
|
|
1659
|
-
if (p > 0)
|
|
1660
|
-
{
|
|
1661
|
-
|
|
1662
|
-
IVec<4> f = ET_trait<ET_PRISM>::GetFaceSort(0, vnums);
|
|
1663
|
-
|
|
1664
|
-
Tx ls = lx[f[0]], le = lx[f[1]], lt = lx[f[2]], lm = lz[0], ln = lz[3];
|
|
1665
|
-
|
|
1666
|
-
auto symdyadic1 = lm*ln*lt*MakeReggeAD(ls,le);
|
|
1667
|
-
auto symdyadic2 = lm*ln*ls*MakeReggeAD(lt,le);
|
|
1668
|
-
auto symdyadic3 = lm*ln*le*MakeReggeAD(ls,lt);
|
|
1669
|
-
|
|
1670
|
-
Tx eta = lz[0]-lz[4];
|
|
1671
|
-
LegendrePolynomial (p, eta, leg_w);
|
|
1672
|
-
|
|
1673
|
-
// Reg(T) x [0,1]
|
|
1674
|
-
DubinerBasis::Eval(p-1, ls,le,
|
|
1675
|
-
SBLambda([symdyadic1,symdyadic2,symdyadic3, &ii, shape,p,leg_w] (size_t nr, auto val)
|
|
1676
|
-
{
|
|
1677
|
-
for(int j=0; j < p; j++)
|
|
1678
|
-
{
|
|
1679
|
-
shape[ii++] = leg_w[j]*val*symdyadic1;
|
|
1680
|
-
shape[ii++] = leg_w[j]*val*symdyadic2;
|
|
1681
|
-
shape[ii++] = leg_w[j]*val*symdyadic3;
|
|
1682
|
-
}
|
|
1683
|
-
}));
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
// H1(T) x [0,1]
|
|
1687
|
-
auto symdyadic = ls*le*lt*MakeReggeAD(eta,eta);
|
|
1688
|
-
DubinerBasis::Eval(p-2, ls,le,
|
|
1689
|
-
SBLambda([symdyadic, &ii, shape,p,leg_w] (size_t nr, auto val)
|
|
1690
|
-
{
|
|
1691
|
-
for(int j=0; j <= p; j++)
|
|
1692
|
-
{
|
|
1693
|
-
shape[ii++] = val*leg_w[j]*symdyadic;
|
|
1694
|
-
}
|
|
1695
|
-
}));
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
// Nedelec_1 x [0,1]
|
|
1699
|
-
DubinerBasis::EvalMult(p-2, lx[f[0]], lx[f[1]],lx[f[0]]*lx[f[1]]*lx[f[2]],
|
|
1700
|
-
SBLambda([&](int nr, auto val)
|
|
1701
|
-
{
|
|
1702
|
-
auto tmp = Du(val);
|
|
1703
|
-
Tx tmp_AD;
|
|
1704
|
-
tmp_AD.DValue(0) = tmp.Value()(0);
|
|
1705
|
-
tmp_AD.DValue(1) = tmp.Value()(1);
|
|
1706
|
-
tmp_AD.DValue(2) = tmp.Value()(2);
|
|
1707
|
-
auto symdyadic = MakeReggeAD(tmp_AD,eta);
|
|
1708
|
-
for(int j=0; j <= p; j++)
|
|
1709
|
-
shape[ii++] = leg_w[j]*symdyadic;
|
|
1710
|
-
}));
|
|
1711
|
-
|
|
1712
|
-
DubinerBasis::EvalMult(p-1, lx[f[0]], lx[f[1]], lx[f[0]],
|
|
1713
|
-
SBLambda([&ii,shape,p,leg_w,eta,f,lx](int nr, auto val)
|
|
1714
|
-
{
|
|
1715
|
-
auto tmp = wuDv_minus_wvDu (lx[f[1]], lx[f[2]], val);
|
|
1716
|
-
Tx tmp_AD;
|
|
1717
|
-
tmp_AD.DValue(0) = tmp.Value()(0);
|
|
1718
|
-
tmp_AD.DValue(1) = tmp.Value()(1);
|
|
1719
|
-
tmp_AD.DValue(2) = tmp.Value()(2);
|
|
1720
|
-
auto symdyadic = MakeReggeAD(tmp_AD,eta);
|
|
1721
|
-
for(int j=0; j <= p; j++)
|
|
1722
|
-
shape[ii++] = leg_w[j]*symdyadic;
|
|
1723
|
-
}));
|
|
1724
|
-
|
|
1725
|
-
LegendrePolynomial::EvalMult(p-1, lx[f[2]]-lx[f[1]], lx[f[2]],
|
|
1726
|
-
SBLambda([&ii,shape,p,leg_w,eta,lx,f] (int j, auto val)
|
|
1727
|
-
{
|
|
1728
|
-
auto tmp = wuDv_minus_wvDu (lx[f[1]], lx[f[0]], val);
|
|
1729
|
-
Tx tmp_AD;
|
|
1730
|
-
tmp_AD.DValue(0) = tmp.Value()(0);
|
|
1731
|
-
tmp_AD.DValue(1) = tmp.Value()(1);
|
|
1732
|
-
tmp_AD.DValue(2) = tmp.Value()(2);
|
|
1733
|
-
auto symdyadic = MakeReggeAD(tmp_AD,eta);
|
|
1734
|
-
for(int j=0; j <= p; j++)
|
|
1735
|
-
shape[ii++] = leg_w[j]*symdyadic;
|
|
1736
|
-
}));
|
|
1737
|
-
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
template <typename MIP, typename TFA>
|
|
1744
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
1745
|
-
{
|
|
1746
|
-
throw Exception ("Hcurlcurlfe calcdualshape2 not implementend for element type ET_PRISM");
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
};
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
template <> class HCurlCurlFE<ET_TET> : public T_HCurlCurlFE<ET_TET>
|
|
1754
|
-
{
|
|
1755
|
-
public:
|
|
1756
|
-
using T_HCurlCurlFE<ET_TET> :: T_HCurlCurlFE;
|
|
1757
|
-
|
|
1758
|
-
virtual void ComputeNDof()
|
|
1759
|
-
{
|
|
1760
|
-
order = 0;
|
|
1761
|
-
ndof = 0;
|
|
1762
|
-
|
|
1763
|
-
for (int i=0; i<6; i++)
|
|
1764
|
-
{
|
|
1765
|
-
ndof += order_edge[i]+1;
|
|
1766
|
-
order = max2(order, order_edge[i]);
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
for (int i=0; i<4; i++)
|
|
1770
|
-
{
|
|
1771
|
-
ndof += 3*(order_facet[i][0])*(order_facet[i][0]+1)/2;
|
|
1772
|
-
order = max2(order, order_facet[i][0]);
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
int p = order_inner[0];
|
|
1776
|
-
int ninner = p > 1 ? 6*(p+1)*(p)*(p-1)/6 : 0;
|
|
1777
|
-
ndof += ninner;
|
|
1778
|
-
|
|
1779
|
-
order = max2(order, p);
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
template <typename Tx, typename TFA>
|
|
1785
|
-
void T_CalcShape (TIP<3,Tx> ip, TFA & shape) const
|
|
1786
|
-
{
|
|
1787
|
-
Tx x = ip.x, y = ip.y, z = ip.z;
|
|
1788
|
-
Tx lam[4] = {x, y, z, 1-x-y-z};
|
|
1789
|
-
int ii = 0;
|
|
1790
|
-
|
|
1791
|
-
for (int i = 0; i < 6; i++)
|
|
1792
|
-
{
|
|
1793
|
-
IVec<2> e = ET_trait<ET_TET>::GetEdgeSort (i, vnums);
|
|
1794
|
-
Tx ls = lam[e[1]], le = lam[e[0]];
|
|
1795
|
-
|
|
1796
|
-
auto symdyadic = MakeReggeAD(ls, le);
|
|
1797
|
-
LegendrePolynomial::EvalScaled(order_edge[i], ls-le,ls+le, SBLambda([symdyadic, &ii, shape] (size_t nr, auto val)
|
|
1798
|
-
{
|
|
1799
|
-
shape[ii++] = -val*symdyadic;
|
|
1800
|
-
}));
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
for(int fa = 0; fa < 4; fa++)
|
|
1805
|
-
{
|
|
1806
|
-
if (order_facet[fa][0] > 0)
|
|
1807
|
-
{
|
|
1808
|
-
IVec<4> f = ET_trait<ET_TET>::GetFaceSort(fa, vnums);
|
|
1809
|
-
Tx ls = lam[f[0]], le = lam[f[1]], lt = lam[f[2]];
|
|
1810
|
-
|
|
1811
|
-
auto symdyadic1 = lt*MakeReggeAD(ls, le);
|
|
1812
|
-
auto symdyadic2 = ls*MakeReggeAD(lt, le);
|
|
1813
|
-
auto symdyadic3 = le*MakeReggeAD(ls, lt);
|
|
1814
|
-
|
|
1815
|
-
DubinerBasis::Eval(order_facet[fa][0]-1, ls,le,
|
|
1816
|
-
SBLambda([symdyadic1,symdyadic2,symdyadic3, &ii, shape] (size_t nr, auto val)
|
|
1817
|
-
{
|
|
1818
|
-
shape[ii++] = val*symdyadic1;
|
|
1819
|
-
shape[ii++] = val*symdyadic2;
|
|
1820
|
-
shape[ii++] = val*symdyadic3;
|
|
1821
|
-
}));
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
if (order_inner[0] > 1)
|
|
1826
|
-
{
|
|
1827
|
-
Tx li = lam[0], lj = lam[1], lk = lam[2], ll = lam[3];
|
|
1828
|
-
|
|
1829
|
-
auto symdyadic1 = li*lj*MakeReggeAD(lk, ll);
|
|
1830
|
-
auto symdyadic2 = lj*lk*MakeReggeAD(ll, li);
|
|
1831
|
-
auto symdyadic3 = lk*ll*MakeReggeAD(li, lj);
|
|
1832
|
-
auto symdyadic4 = ll*li*MakeReggeAD(lj, lk);
|
|
1833
|
-
auto symdyadic5 = li*lk*MakeReggeAD(lj, ll);
|
|
1834
|
-
auto symdyadic6 = lj*ll*MakeReggeAD(li, lk);
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
DubinerBasis3D::Eval (order_inner[0]-2, lam[0], lam[1], lam[2], SBLambda([&ii, shape, symdyadic1, symdyadic2, symdyadic3, symdyadic4, symdyadic5, symdyadic6](size_t j, auto val)
|
|
1838
|
-
{
|
|
1839
|
-
shape[ii++] = val*symdyadic1;
|
|
1840
|
-
shape[ii++] = val*symdyadic2;
|
|
1841
|
-
shape[ii++] = val*symdyadic3;
|
|
1842
|
-
shape[ii++] = val*symdyadic4;
|
|
1843
|
-
shape[ii++] = val*symdyadic5;
|
|
1844
|
-
shape[ii++] = val*symdyadic6;
|
|
1845
|
-
}));
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
template <typename MIP, typename TFA>
|
|
1853
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
1854
|
-
{
|
|
1855
|
-
auto & ip = mip.IP();
|
|
1856
|
-
typedef typename std::remove_const<typename std::remove_reference<decltype(mip.IP()(0))>::type>::type T;
|
|
1857
|
-
T x = ip(0), y = ip(1), z = ip(2);
|
|
1858
|
-
T lam[4] = { x, y, z, 1-x-y-z };
|
|
1859
|
-
Vec<3,T> pnts[4] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } , { 0, 0, 0 } };
|
|
1860
|
-
int facetnr = ip.FacetNr();
|
|
1861
|
-
|
|
1862
|
-
int ii = 0;
|
|
1863
|
-
|
|
1864
|
-
if (ip.VB() == BBND)
|
|
1865
|
-
{ // facet shapes
|
|
1866
|
-
for (int i = 0; i < 6; i++)
|
|
1867
|
-
{
|
|
1868
|
-
int p = order_edge[i];
|
|
1869
|
-
|
|
1870
|
-
if (i == facetnr)
|
|
1871
|
-
{
|
|
1872
|
-
IVec<2> e = ET_trait<ET_TET>::GetEdgeSort (i, vnums);
|
|
1873
|
-
|
|
1874
|
-
T xi = lam[e[1]]-lam[e[0]];
|
|
1875
|
-
Vec<3,T> tauref = pnts[e[1]] - pnts[e[0]];
|
|
1876
|
-
Vec<3,T> tau = mip.GetJacobian()*tauref;
|
|
1877
|
-
Mat<3,3,T> tt = DyadProd(tau,tau);
|
|
1878
|
-
LegendrePolynomial::Eval
|
|
1879
|
-
(p, xi,
|
|
1880
|
-
SBLambda([&] (size_t nr, T val)
|
|
1881
|
-
{
|
|
1882
|
-
shape[nr+ii] = 1/mip.GetMeasure()*val*tt;
|
|
1883
|
-
}));
|
|
1884
|
-
}
|
|
1885
|
-
ii += (p+1);
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
else
|
|
1889
|
-
{
|
|
1890
|
-
for (int i = 0; i < 6; i++)
|
|
1891
|
-
ii += order_edge[i]+1;
|
|
1892
|
-
}
|
|
1893
|
-
if (ip.VB() == BND)
|
|
1894
|
-
{
|
|
1895
|
-
for (int i = 0; i < 4; i++)
|
|
1896
|
-
{
|
|
1897
|
-
auto p = order_facet[i][0]-1;
|
|
1898
|
-
if( p >= 0 && i == facetnr )
|
|
1899
|
-
{
|
|
1900
|
-
IVec<4> fav = ET_trait<ET_TET>:: GetFaceSort(facetnr, vnums);
|
|
1901
|
-
Vec<3,T> adxi = pnts[fav[0]] - pnts[fav[2]];
|
|
1902
|
-
Vec<3,T> adeta = pnts[fav[1]] - pnts[fav[2]];
|
|
1903
|
-
T xi = lam[fav[0]];
|
|
1904
|
-
T eta = lam[fav[1]];
|
|
1905
|
-
|
|
1906
|
-
Matrix<T> F(3,2);
|
|
1907
|
-
F.Col(0) = adxi;
|
|
1908
|
-
F.Col(1) = adeta;
|
|
1909
|
-
|
|
1910
|
-
Matrix<T> Ftmp(2,2);
|
|
1911
|
-
Ftmp = Trans(F)*F;
|
|
1912
|
-
auto det = sqrt(Ftmp(0,0)*Ftmp(1,1)-Ftmp(1,0)*Ftmp(0,1));
|
|
1913
|
-
|
|
1914
|
-
DubinerBasis::Eval (p, xi, eta,
|
|
1915
|
-
SBLambda([&] (size_t nr, T val)
|
|
1916
|
-
{
|
|
1917
|
-
shape[ii++] = 1/(det*mip.GetMeasure())*val*Mat<3,3,T>(mip.GetJacobian()*F*Matrix<>({{1,0},{0,0}})*Trans(mip.GetJacobian()*F));
|
|
1918
|
-
shape[ii++] = 1/(det*mip.GetMeasure())*val*Mat<3,3,T>(mip.GetJacobian()*F*Matrix<>({{0,0},{0,1}})*Trans(mip.GetJacobian()*F));
|
|
1919
|
-
shape[ii++] = 1/(det*mip.GetMeasure())*val*Mat<3,3,T>(mip.GetJacobian()*F*Matrix<>({{0,1},{1,0}})*Trans(mip.GetJacobian()*F));
|
|
1920
|
-
}));
|
|
1921
|
-
}
|
|
1922
|
-
else
|
|
1923
|
-
ii += 3*(order_facet[i][0])*(order_facet[i][0]+1)/2;
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
else
|
|
1927
|
-
{
|
|
1928
|
-
for (int i = 0; i < 4; i++)
|
|
1929
|
-
ii += 3*(order_facet[i][0])*(order_facet[i][0]+1)/2;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
if (ip.VB() == VOL && order_inner[0] >= 2)
|
|
1933
|
-
{
|
|
1934
|
-
DubinerBasis3D::Eval (order_inner[0]-2, lam[0], lam[1], lam[2], SBLambda([&](size_t j, T val)
|
|
1935
|
-
{
|
|
1936
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{1,0,0},{0,0,0},{0,0,0}}))*Trans(mip.GetJacobian());
|
|
1937
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{0,0,0},{0,1,0},{0,0,0}}))*Trans(mip.GetJacobian());
|
|
1938
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{0,0,0},{0,0,0},{0,0,1}}))*Trans(mip.GetJacobian());
|
|
1939
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{0,0,0},{0,0,1},{0,1,0}}))*Trans(mip.GetJacobian());
|
|
1940
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{0,0,1},{0,0,0},{1,0,0}}))*Trans(mip.GetJacobian());
|
|
1941
|
-
shape[ii++] = 1/mip.GetMeasure()*val*mip.GetJacobian()*Mat<3,3>(Matrix<>({{0,1,0},{1,0,0},{0,0,0}}))*Trans(mip.GetJacobian());
|
|
1942
|
-
}));
|
|
1943
|
-
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
};
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
template <> class HCurlCurlFE<ET_HEX> : public T_HCurlCurlFE<ET_HEX>
|
|
1951
|
-
{
|
|
1952
|
-
public:
|
|
1953
|
-
using T_HCurlCurlFE<ET_HEX> :: T_HCurlCurlFE;
|
|
1954
|
-
|
|
1955
|
-
virtual void ComputeNDof()
|
|
1956
|
-
{
|
|
1957
|
-
order = 0;
|
|
1958
|
-
ndof = 0;
|
|
1959
|
-
for (int i=0; i < 12; i++)
|
|
1960
|
-
{
|
|
1961
|
-
ndof += order_edge[i]+1;
|
|
1962
|
-
order = max2(order,order_edge[i]);
|
|
1963
|
-
}
|
|
1964
|
-
for (int i=0; i<6; i++)
|
|
1965
|
-
{
|
|
1966
|
-
ndof += order_facet[i][0]*order_facet[i][0] + 2*(order_facet[i][0]+2)*order_facet[i][0]+1;
|
|
1967
|
-
order = max2(order, order_facet[i][0]);
|
|
1968
|
-
}
|
|
1969
|
-
int p = order_inner[0];
|
|
1970
|
-
ndof += 3*(p*(p+1)*(p+1) + p*p*(p+1) );
|
|
1971
|
-
|
|
1972
|
-
order = 1 + max2(order, p);
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
template <typename Tx, typename TFA>
|
|
1977
|
-
void T_CalcShape (TIP<3,Tx> ip, TFA & shape) const
|
|
1978
|
-
{
|
|
1979
|
-
Tx x = ip.x, y = ip.y, z = ip.z;
|
|
1980
|
-
Tx lx[2] ={ 1-x, x};
|
|
1981
|
-
Tx ly[2] ={ 1-y, y};
|
|
1982
|
-
Tx lz[2] ={ 1-z, z};
|
|
1983
|
-
Tx lami[8]={(1-x)*(1-y)*(1-z),x*(1-y)*(1-z),x*y*(1-z),(1-x)*y*(1-z),
|
|
1984
|
-
(1-x)*(1-y)*z,x*(1-y)*z,x*y*z,(1-x)*y*z};
|
|
1985
|
-
Tx sigma[8]={(1-x)+(1-y)+(1-z),x+(1-y)+(1-z),x+y+(1-z),(1-x)+y+(1-z),
|
|
1986
|
-
(1-x)+(1-y)+z,x+(1-y)+z,x+y+z,(1-x)+y+z};
|
|
1987
|
-
int ii = 0;
|
|
1988
|
-
|
|
1989
|
-
const FACE * faces = ElementTopology::GetFaces(ET_HEX);
|
|
1990
|
-
|
|
1991
|
-
ArrayMem<Tx,20> leg_u(order+2), leg_v(order+2), leg_w(order+2);
|
|
1992
|
-
|
|
1993
|
-
// edges
|
|
1994
|
-
for (int i = 0; i < 12; i++)
|
|
1995
|
-
{
|
|
1996
|
-
int p = order_edge[i];
|
|
1997
|
-
IVec<2> e = ET_trait<ET_HEX>::GetEdgeSort (i, vnums);
|
|
1998
|
-
Tx xi = sigma[e[1]]-sigma[e[0]];
|
|
1999
|
-
Tx lam_e = lami[e[0]]+lami[e[1]];
|
|
2000
|
-
auto symdyadic = MakeReggeAD(xi,xi);
|
|
2001
|
-
|
|
2002
|
-
//IntLegNoBubble::
|
|
2003
|
-
LegendrePolynomial::
|
|
2004
|
-
EvalMult (p, xi, 0.25*lam_e, SBLambda ([&](int i, auto val)
|
|
2005
|
-
{
|
|
2006
|
-
shape[ii++] = val*symdyadic;
|
|
2007
|
-
}));
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
for (int i = 0; i<6; i++)
|
|
2012
|
-
{
|
|
2013
|
-
int p = order_facet[i][0];
|
|
2014
|
-
|
|
2015
|
-
Tx lam_f(0);
|
|
2016
|
-
for (int j = 0; j < 4; j++)
|
|
2017
|
-
lam_f += lami[faces[i][j]];
|
|
2018
|
-
|
|
2019
|
-
IVec<4> f = ET_trait<ET_HEX>::GetFaceSort (i, vnums);
|
|
2020
|
-
Tx xi = sigma[f[0]] - sigma[f[1]];
|
|
2021
|
-
Tx eta = sigma[f[0]] - sigma[f[3]];
|
|
2022
|
-
|
|
2023
|
-
LegendrePolynomial (p, eta, leg_u);
|
|
2024
|
-
LegendrePolynomial (p, xi, leg_v);
|
|
2025
|
-
|
|
2026
|
-
auto symdyadic = 0.25*lam_f*MakeReggeAD(eta,xi);
|
|
2027
|
-
for (int j = 0; j <= p; j++)
|
|
2028
|
-
for (int k = 0; k <= p; k++)
|
|
2029
|
-
shape[ii++] = leg_u[j]*leg_v[k]*symdyadic;
|
|
2030
|
-
|
|
2031
|
-
symdyadic = 0.25*lam_f*(1-eta*eta)*MakeReggeAD(xi,xi);
|
|
2032
|
-
for (int j = 0; j < p; j++)
|
|
2033
|
-
for (int k = 0; k <= p; k++)
|
|
2034
|
-
shape[ii++] = leg_u[j]*leg_v[k]*symdyadic;
|
|
2035
|
-
|
|
2036
|
-
symdyadic = 0.25*lam_f*(1-xi*xi)*MakeReggeAD(eta,eta);
|
|
2037
|
-
for (int k = 0; k < p; k++)
|
|
2038
|
-
for (int j = 0; j <= p; j++)
|
|
2039
|
-
shape[ii++] = leg_u[j]*leg_v[k]*symdyadic;
|
|
2040
|
-
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
int p = order_inner[0];
|
|
2044
|
-
if (p > 0)
|
|
2045
|
-
{
|
|
2046
|
-
Tx xi = sigma[0] - sigma[1];
|
|
2047
|
-
Tx eta = sigma[0] - sigma[3];
|
|
2048
|
-
Tx nv = sigma[0] - sigma[4];
|
|
2049
|
-
|
|
2050
|
-
LegendrePolynomial (p, xi, leg_u);
|
|
2051
|
-
LegendrePolynomial (p, eta, leg_v);
|
|
2052
|
-
LegendrePolynomial (p, nv, leg_w);
|
|
2053
|
-
|
|
2054
|
-
auto symdyadic1 = lz[0]*lz[1]*MakeReggeAD(eta,xi);
|
|
2055
|
-
auto symdyadic2 = lx[0]*lx[1]*MakeReggeAD(nv,eta);
|
|
2056
|
-
auto symdyadic3 = ly[0]*ly[1]*MakeReggeAD(xi,nv);
|
|
2057
|
-
for (int i = 0; i <= p; i++)
|
|
2058
|
-
for (int j = 0; j <= p; j++)
|
|
2059
|
-
for (int k = 0; k < p; k++)
|
|
2060
|
-
{
|
|
2061
|
-
shape[ii++] = leg_u[i]*leg_v[j]*leg_w[k]*symdyadic1;
|
|
2062
|
-
shape[ii++] = leg_v[i]*leg_w[j]*leg_u[k]*symdyadic2;
|
|
2063
|
-
shape[ii++] = leg_w[i]*leg_u[j]*leg_v[k]*symdyadic3;
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
symdyadic1 = ly[0]*ly[1]*lz[0]*lz[1]*MakeReggeAD(xi,xi);
|
|
2067
|
-
symdyadic2 = lz[0]*lz[1]*lx[0]*lx[1]*MakeReggeAD(eta,eta);
|
|
2068
|
-
symdyadic3 = lx[0]*lx[1]*ly[0]*ly[1]*MakeReggeAD(nv,nv);
|
|
2069
|
-
|
|
2070
|
-
for (int i = 0; i <= p; i++)
|
|
2071
|
-
for (int j = 0; j < p; j++)
|
|
2072
|
-
for (int k = 0; k < p; k++)
|
|
2073
|
-
{
|
|
2074
|
-
shape[ii++] = leg_u[i]*leg_v[j]*leg_w[k]*symdyadic1;
|
|
2075
|
-
shape[ii++] = leg_v[i]*leg_w[j]*leg_u[k]*symdyadic2;
|
|
2076
|
-
shape[ii++] = leg_w[i]*leg_u[j]*leg_v[k]*symdyadic3;
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
template <typename MIP, typename TFA>
|
|
2082
|
-
void CalcDualShape2 (const MIP & mip, TFA & shape) const
|
|
2083
|
-
{
|
|
2084
|
-
auto & ip = mip.IP();
|
|
2085
|
-
typedef typename std::remove_const<typename std::remove_reference<decltype(mip.IP()(0))>::type>::type T;
|
|
2086
|
-
|
|
2087
|
-
T x = ip(0), y = ip(1), z = ip(2);
|
|
2088
|
-
// T lx[4] = { 1-x, x, x, 1-x };
|
|
2089
|
-
// T ly[4] = { 1-y, 1-y, y, y };
|
|
2090
|
-
// T lz[4] = { 1-z, 1-z, z, z };
|
|
2091
|
-
// T lam[4] = { 1-x-y+x*y, x*(1-y), x*y, y*(1-x) };
|
|
2092
|
-
T sigma[8]={(1-x)+(1-y)+(1-z),x+(1-y)+(1-z),x+y+(1-z),(1-x)+y+(1-z),
|
|
2093
|
-
(1-x)+(1-y)+z,x+(1-y)+z,x+y+z,(1-x)+y+z};
|
|
2094
|
-
|
|
2095
|
-
/*Vec<2,AutoDiff<2,T>> adip = ip;
|
|
2096
|
-
auto tip = TIP<2,AutoDiffDiff<2,T>>(adip);
|
|
2097
|
-
AutoDiffDiff<2,T> xxx = tip.x, yyy = tip.y;
|
|
2098
|
-
AutoDiff<2,T> xx(xxx.Value(), &xxx.DValue(0));
|
|
2099
|
-
AutoDiff<2,T> yy(yyy.Value(), &yyy.DValue(0));
|
|
2100
|
-
AutoDiff<2,T> lami[4] = {(1-xx)*(1-yy),xx*(1-yy),xx*yy,(1-xx)*yy};
|
|
2101
|
-
AutoDiff<2,T> sigma[4] = {(1-xx)+(1-yy),xx+(1-yy),xx+yy,(1-xx)+yy}; */
|
|
2102
|
-
|
|
2103
|
-
Vec<3,T> pnts[8] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 0, 1, 0 }, { 0, 0, 1 }, { 1, 0, 1 }, { 1, 1, 1 }, { 0, 1, 1 } };
|
|
2104
|
-
int facetnr = ip.FacetNr();
|
|
2105
|
-
|
|
2106
|
-
int ii = 0;
|
|
2107
|
-
|
|
2108
|
-
ArrayMem<T,20> v(order+2), u(order+2), w(order+2);
|
|
2109
|
-
|
|
2110
|
-
if (mip.IP().VB() == BBND)
|
|
2111
|
-
{ // edge shapes
|
|
2112
|
-
for (int i = 0; i < 12; i++)
|
|
2113
|
-
{
|
|
2114
|
-
int p = order_edge[i];
|
|
2115
|
-
|
|
2116
|
-
if (i == facetnr)
|
|
2117
|
-
{
|
|
2118
|
-
IVec<2> e = ET_trait<ET_HEX>::GetEdgeSort (i, vnums);
|
|
2119
|
-
|
|
2120
|
-
T xi = sigma[e[1]]-sigma[e[0]];
|
|
2121
|
-
Vec<3,T> tauref = pnts[e[0]] - pnts[e[1]];
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
auto tv = mip.GetJacobian()*tauref;
|
|
2125
|
-
|
|
2126
|
-
auto tt = DyadProd(tv,tv);
|
|
2127
|
-
LegendrePolynomial::Eval
|
|
2128
|
-
(p, xi,
|
|
2129
|
-
SBLambda([&] (size_t nr, T val)
|
|
2130
|
-
{
|
|
2131
|
-
shape[nr+ii] = 1/mip.GetMeasure()*val*tt;
|
|
2132
|
-
}));
|
|
2133
|
-
|
|
2134
|
-
}
|
|
2135
|
-
ii += (p+1);
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
else
|
|
2139
|
-
{
|
|
2140
|
-
for (int i = 0; i < 12; i++)
|
|
2141
|
-
ii += order_edge[i]+1;
|
|
2142
|
-
}
|
|
2143
|
-
if (mip.IP().VB() == BND)
|
|
2144
|
-
{
|
|
2145
|
-
for (int i = 0; i < 6; i++)
|
|
2146
|
-
{
|
|
2147
|
-
int p = order_facet[i][0];
|
|
2148
|
-
|
|
2149
|
-
if (i == facetnr)
|
|
2150
|
-
{
|
|
2151
|
-
IVec<4> f = ET_trait<ET_HEX>::GetFaceSort (i, vnums);
|
|
2152
|
-
Vec<3,T> tauref1 = pnts[f[0]] - pnts[f[1]];
|
|
2153
|
-
Vec<3,T> tauref2 = pnts[f[0]] - pnts[f[3]];
|
|
2154
|
-
T xi = sigma[f[0]] - sigma[f[1]];
|
|
2155
|
-
T eta = sigma[f[0]] - sigma[f[3]];
|
|
2156
|
-
//Vec<6, T> symdyadic = SymDyadProd(GetGradient(etaa),GetGradient(xia));
|
|
2157
|
-
auto tv1 = mip.GetJacobian()*tauref1;
|
|
2158
|
-
auto tv2 = mip.GetJacobian()*tauref2;
|
|
2159
|
-
auto symdyadic = SymDyadProd(tv1,tv2);
|
|
2160
|
-
|
|
2161
|
-
LegendrePolynomial (p, eta, u);
|
|
2162
|
-
LegendrePolynomial (p, xi, v);
|
|
2163
|
-
for (int j = 0; j <= p; j++)
|
|
2164
|
-
for (int k = 0; k <= p; k++)
|
|
2165
|
-
shape[ii + j*(p+1) + k] = u[j]*v[k]*symdyadic;
|
|
2166
|
-
|
|
2167
|
-
/* T eta = ly[2]-ly[1];
|
|
2168
|
-
T xi = lx[1]-lx[0];
|
|
2169
|
-
LegendrePolynomial (p, eta, v);
|
|
2170
|
-
LegendrePolynomial (p, xi, u);
|
|
2171
|
-
|
|
2172
|
-
for (int i = 0; i <= p; i++)
|
|
2173
|
-
for (int j = 0; j <= p; j++)
|
|
2174
|
-
{
|
|
2175
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{0,1},{1,0}}))*Trans(mip.GetJacobian());
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
//auto symdyad = lx[1]*lx[0]*SymDyadProd(Vec<2,T>(0,1),Vec<2,T>(0,1));//x*(1-x)*(0,0, 0,1) * P(y) * P(x)
|
|
2180
|
-
for (int i = 0; i < p; i++)
|
|
2181
|
-
for (int j = 0; j <= p; j++)
|
|
2182
|
-
{
|
|
2183
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{0,0},{0,1}}))*Trans(mip.GetJacobian());
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
//symdyad = ly[2]*ly[1]*SymDyadProd(Vec<2,T>(1,0),Vec<2,T>(1,0)); //y*(1-y)*(1,0, 0,0) * P(x) * P(y)
|
|
2187
|
-
|
|
2188
|
-
for (int j = 0; j < p; j++)
|
|
2189
|
-
for (int i = 0; i <= p; i++)
|
|
2190
|
-
{
|
|
2191
|
-
shape[ii++] = 1/mip.GetMeasure()*u[i]*v[j]*mip.GetJacobian()*Mat<2,2>(Matrix<>({{1,0},{0,0}}))*Trans(mip.GetJacobian());
|
|
2192
|
-
}*/
|
|
2193
|
-
}
|
|
2194
|
-
ii += p*p + (p+2)*p*2 + 1;
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
else
|
|
2198
|
-
{
|
|
2199
|
-
for (int i = 0; i < 6; i++)
|
|
2200
|
-
ii += order_facet[i][0]*order_facet[i][0] + (order_facet[i][0]+2)*order_facet[i][0]*2 + 1;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
if (mip.IP().VB() == VOL)
|
|
2204
|
-
{
|
|
2205
|
-
if (order_inner[0])
|
|
2206
|
-
throw Exception ("Hcurlcurlfe calcdualshape2 not implementend for element type ET_HEX for high-order");
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
};
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_SEGM>;
|
|
2214
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_TRIG>;
|
|
2215
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_QUAD>;
|
|
2216
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_TET>;
|
|
2217
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_PRISM>;
|
|
2218
|
-
HCURLCURLFE_EXTERN template class T_HCurlCurlFE<ET_HEX>;
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
#endif
|