ngsolve 6.2.2506.post74.dev0__cp314-cp314-macosx_10_15_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ngsolve might be problematic. Click here for more details.
- netgen/include/analytic_integrals.hpp +10 -0
- netgen/include/arnoldi.hpp +55 -0
- netgen/include/bandmatrix.hpp +334 -0
- netgen/include/basematrix.hpp +957 -0
- netgen/include/basevector.hpp +1268 -0
- netgen/include/bdbequations.hpp +2805 -0
- netgen/include/bdbintegrator.hpp +1660 -0
- netgen/include/bem_diffops.hpp +475 -0
- netgen/include/bessel.hpp +1064 -0
- netgen/include/bilinearform.hpp +963 -0
- netgen/include/bla.hpp +29 -0
- netgen/include/blockalloc.hpp +95 -0
- netgen/include/blockjacobi.hpp +328 -0
- netgen/include/bspline.hpp +116 -0
- netgen/include/calcinverse.hpp +141 -0
- netgen/include/cg.hpp +368 -0
- netgen/include/chebyshev.hpp +44 -0
- netgen/include/cholesky.hpp +720 -0
- netgen/include/clapack.h +7254 -0
- netgen/include/code_generation.hpp +296 -0
- netgen/include/coefficient.hpp +2033 -0
- netgen/include/coefficient_impl.hpp +19 -0
- netgen/include/coefficient_stdmath.hpp +167 -0
- netgen/include/commutingAMG.hpp +106 -0
- netgen/include/comp.hpp +79 -0
- netgen/include/compatibility.hpp +41 -0
- netgen/include/complex_wrapper.hpp +73 -0
- netgen/include/compressedfespace.hpp +110 -0
- netgen/include/contact.hpp +235 -0
- netgen/include/diagonalmatrix.hpp +154 -0
- netgen/include/differentialoperator.hpp +276 -0
- netgen/include/diffop.hpp +1286 -0
- netgen/include/diffop_impl.hpp +328 -0
- netgen/include/diffopwithfactor.hpp +123 -0
- netgen/include/discontinuous.hpp +84 -0
- netgen/include/dump.hpp +949 -0
- netgen/include/ectypes.hpp +121 -0
- netgen/include/eigen.hpp +60 -0
- netgen/include/eigensystem.hpp +18 -0
- netgen/include/elasticity_equations.hpp +595 -0
- netgen/include/elementbyelement.hpp +195 -0
- netgen/include/elementtopology.hpp +1760 -0
- netgen/include/elementtransformation.hpp +339 -0
- netgen/include/evalfunc.hpp +405 -0
- netgen/include/expr.hpp +1686 -0
- netgen/include/facetfe.hpp +175 -0
- netgen/include/facetfespace.hpp +180 -0
- netgen/include/facethofe.hpp +111 -0
- netgen/include/facetsurffespace.hpp +112 -0
- netgen/include/fe_interfaces.hpp +32 -0
- netgen/include/fem.hpp +87 -0
- netgen/include/fesconvert.hpp +14 -0
- netgen/include/fespace.hpp +1449 -0
- netgen/include/finiteelement.hpp +286 -0
- netgen/include/globalinterfacespace.hpp +77 -0
- netgen/include/globalspace.hpp +115 -0
- netgen/include/gridfunction.hpp +525 -0
- netgen/include/h1amg.hpp +124 -0
- netgen/include/h1hofe.hpp +188 -0
- netgen/include/h1hofe_impl.hpp +1262 -0
- netgen/include/h1hofefo.hpp +148 -0
- netgen/include/h1hofefo_impl.hpp +185 -0
- netgen/include/h1hofespace.hpp +167 -0
- netgen/include/h1lofe.hpp +1240 -0
- netgen/include/h1lumping.hpp +41 -0
- netgen/include/hcurl_equations.hpp +1381 -0
- netgen/include/hcurlcurlfe.hpp +2241 -0
- netgen/include/hcurlcurlfespace.hpp +78 -0
- netgen/include/hcurlfe.hpp +259 -0
- netgen/include/hcurlfe_utils.hpp +107 -0
- netgen/include/hcurlhdiv_dshape.hpp +857 -0
- netgen/include/hcurlhdivfes.hpp +308 -0
- netgen/include/hcurlhofe.hpp +175 -0
- netgen/include/hcurlhofe_impl.hpp +1871 -0
- netgen/include/hcurlhofespace.hpp +193 -0
- netgen/include/hcurllofe.hpp +1146 -0
- netgen/include/hdiv_equations.hpp +880 -0
- netgen/include/hdivdivfe.hpp +2923 -0
- netgen/include/hdivdivsurfacespace.hpp +76 -0
- netgen/include/hdivfe.hpp +206 -0
- netgen/include/hdivfe_utils.hpp +717 -0
- netgen/include/hdivfes.hpp +75 -0
- netgen/include/hdivhofe.hpp +447 -0
- netgen/include/hdivhofe_impl.hpp +1107 -0
- netgen/include/hdivhofefo.hpp +229 -0
- netgen/include/hdivhofespace.hpp +177 -0
- netgen/include/hdivhosurfacefespace.hpp +106 -0
- netgen/include/hdivlofe.hpp +773 -0
- netgen/include/hidden.hpp +74 -0
- netgen/include/householder.hpp +181 -0
- netgen/include/hypre_ams_precond.hpp +123 -0
- netgen/include/hypre_precond.hpp +73 -0
- netgen/include/integrator.hpp +2012 -0
- netgen/include/integratorcf.hpp +253 -0
- netgen/include/interpolate.hpp +49 -0
- netgen/include/intrule.hpp +2542 -0
- netgen/include/intrules_SauterSchwab.hpp +25 -0
- netgen/include/irspace.hpp +49 -0
- netgen/include/jacobi.hpp +153 -0
- netgen/include/kernels.hpp +762 -0
- netgen/include/l2hofe.hpp +194 -0
- netgen/include/l2hofe_impl.hpp +564 -0
- netgen/include/l2hofefo.hpp +542 -0
- netgen/include/l2hofespace.hpp +344 -0
- netgen/include/la.hpp +38 -0
- netgen/include/linearform.hpp +266 -0
- netgen/include/matrix.hpp +2140 -0
- netgen/include/memusage.hpp +41 -0
- netgen/include/meshaccess.hpp +1359 -0
- netgen/include/mgpre.hpp +204 -0
- netgen/include/mp_coefficient.hpp +145 -0
- netgen/include/mptools.hpp +2281 -0
- netgen/include/multigrid.hpp +42 -0
- netgen/include/multivector.hpp +447 -0
- netgen/include/mumpsinverse.hpp +187 -0
- netgen/include/mycomplex.hpp +361 -0
- netgen/include/ng_lapack.hpp +1661 -0
- netgen/include/ngblas.hpp +1232 -0
- netgen/include/ngs_defines.hpp +30 -0
- netgen/include/ngs_stdcpp_include.hpp +106 -0
- netgen/include/ngs_utils.hpp +121 -0
- netgen/include/ngsobject.hpp +1019 -0
- netgen/include/ngsstream.hpp +113 -0
- netgen/include/ngstd.hpp +72 -0
- netgen/include/nodalhofe.hpp +96 -0
- netgen/include/nodalhofe_impl.hpp +141 -0
- netgen/include/normalfacetfe.hpp +223 -0
- netgen/include/normalfacetfespace.hpp +98 -0
- netgen/include/normalfacetsurfacefespace.hpp +84 -0
- netgen/include/order.hpp +251 -0
- netgen/include/parallel_matrices.hpp +222 -0
- netgen/include/paralleldofs.hpp +340 -0
- netgen/include/parallelngs.hpp +23 -0
- netgen/include/parallelvector.hpp +269 -0
- netgen/include/pardisoinverse.hpp +200 -0
- netgen/include/periodic.hpp +129 -0
- netgen/include/plateaufespace.hpp +25 -0
- netgen/include/pml.hpp +275 -0
- netgen/include/pmltrafo.hpp +631 -0
- netgen/include/postproc.hpp +142 -0
- netgen/include/potentialtools.hpp +22 -0
- netgen/include/precomp.hpp +60 -0
- netgen/include/preconditioner.hpp +602 -0
- netgen/include/prolongation.hpp +377 -0
- netgen/include/python_comp.hpp +107 -0
- netgen/include/python_fem.hpp +89 -0
- netgen/include/python_linalg.hpp +58 -0
- netgen/include/python_ngstd.hpp +386 -0
- netgen/include/recursive_pol.hpp +4896 -0
- netgen/include/recursive_pol_tet.hpp +395 -0
- netgen/include/recursive_pol_trig.hpp +492 -0
- netgen/include/reorderedfespace.hpp +81 -0
- netgen/include/sample_sort.hpp +105 -0
- netgen/include/scalarfe.hpp +335 -0
- netgen/include/shapefunction_utils.hpp +113 -0
- netgen/include/simd_complex.hpp +329 -0
- netgen/include/smoother.hpp +253 -0
- netgen/include/solve.hpp +89 -0
- netgen/include/sparsecholesky.hpp +313 -0
- netgen/include/sparsematrix.hpp +1038 -0
- netgen/include/sparsematrix_dyn.hpp +90 -0
- netgen/include/sparsematrix_impl.hpp +1013 -0
- netgen/include/special_matrix.hpp +463 -0
- netgen/include/specialelement.hpp +125 -0
- netgen/include/statushandler.hpp +33 -0
- netgen/include/stringops.hpp +12 -0
- netgen/include/superluinverse.hpp +136 -0
- netgen/include/symbolicintegrator.hpp +850 -0
- netgen/include/symmetricmatrix.hpp +144 -0
- netgen/include/tangentialfacetfe.hpp +224 -0
- netgen/include/tangentialfacetfespace.hpp +91 -0
- netgen/include/tensor.hpp +522 -0
- netgen/include/tensorcoefficient.hpp +446 -0
- netgen/include/tensorproductintegrator.hpp +113 -0
- netgen/include/thcurlfe.hpp +128 -0
- netgen/include/thcurlfe_impl.hpp +380 -0
- netgen/include/thdivfe.hpp +80 -0
- netgen/include/thdivfe_impl.hpp +492 -0
- netgen/include/tpdiffop.hpp +461 -0
- netgen/include/tpfes.hpp +133 -0
- netgen/include/tpintrule.hpp +224 -0
- netgen/include/triangular.hpp +465 -0
- netgen/include/tscalarfe.hpp +245 -0
- netgen/include/tscalarfe_impl.hpp +1029 -0
- netgen/include/umfpackinverse.hpp +148 -0
- netgen/include/vector.hpp +1273 -0
- netgen/include/voxelcoefficientfunction.hpp +41 -0
- netgen/include/vtkoutput.hpp +198 -0
- netgen/include/vvector.hpp +208 -0
- netgen/include/webgui.hpp +92 -0
- netgen/libngbla.dylib +0 -0
- netgen/libngcomp.dylib +0 -0
- netgen/libngfem.dylib +0 -0
- netgen/libngla.dylib +0 -0
- netgen/libngsbem.dylib +0 -0
- netgen/libngsolve.dylib +0 -0
- netgen/libngstd.dylib +0 -0
- ngsolve/TensorProductTools.py +210 -0
- ngsolve/__console.py +94 -0
- ngsolve/__expr.py +181 -0
- ngsolve/__init__.py +148 -0
- ngsolve/__init__.pyi +233 -0
- ngsolve/_scikit_build_core_dependencies.py +30 -0
- ngsolve/bla.pyi +1153 -0
- ngsolve/bvp.py +78 -0
- ngsolve/bvp.pyi +32 -0
- ngsolve/cmake/NGSolveConfig.cmake +102 -0
- ngsolve/cmake/ngsolve-targets-release.cmake +79 -0
- ngsolve/cmake/ngsolve-targets.cmake +163 -0
- ngsolve/comp/__init__.pyi +5449 -0
- ngsolve/comp/pml.pyi +89 -0
- ngsolve/config/__init__.py +1 -0
- ngsolve/config/__init__.pyi +43 -0
- ngsolve/config/__main__.py +4 -0
- ngsolve/config/config.py +60 -0
- ngsolve/config/config.pyi +45 -0
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +44 -0
- ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve/demos/howto/mixed.py +30 -0
- ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve/demos/howto/pickling.py +26 -0
- ngsolve/demos/howto/pml.py +31 -0
- ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve/demos/intro/cmagnet.py +59 -0
- ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve/demos/intro/poisson.py +41 -0
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
- ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve/demos/mpi/mpi_timeDG.py +82 -0
- ngsolve/directsolvers.py +26 -0
- ngsolve/directsolvers.pyi +15 -0
- ngsolve/eigenvalues.py +364 -0
- ngsolve/eigenvalues.pyi +30 -0
- ngsolve/fem.pyi +1647 -0
- ngsolve/internal.py +89 -0
- ngsolve/krylovspace.py +1013 -0
- ngsolve/krylovspace.pyi +298 -0
- ngsolve/la.pyi +1230 -0
- ngsolve/meshes.py +748 -0
- ngsolve/ngs2petsc.py +310 -0
- ngsolve/ngscxx.py +42 -0
- ngsolve/ngslib.so +0 -0
- ngsolve/ngstd.pyi +59 -0
- ngsolve/nonlinearsolvers.py +203 -0
- ngsolve/nonlinearsolvers.pyi +95 -0
- ngsolve/preconditioners.py +11 -0
- ngsolve/preconditioners.pyi +7 -0
- ngsolve/solve.pyi +109 -0
- ngsolve/solve_implementation.py +168 -0
- ngsolve/solve_implementation.pyi +42 -0
- ngsolve/solvers.py +7 -0
- ngsolve/solvers.pyi +14 -0
- ngsolve/timestepping.py +185 -0
- ngsolve/timestepping.pyi +28 -0
- ngsolve/timing.py +108 -0
- ngsolve/timing.pyi +54 -0
- ngsolve/utils.py +167 -0
- ngsolve/utils.pyi +273 -0
- ngsolve/webgui.py +670 -0
- ngsolve-6.2.2506.post74.dev0.data/data/Netgen.icns +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngscxx +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsld +13 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsolve.tcl +648 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngspy +2 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.geo +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.vol +240 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.in2d +41 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.vol +614 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.geo +12 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.vol +2560 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.geo +19 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.vol +1832 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.geo +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.in2d +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.vol +149 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/METADATA +13 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/RECORD +315 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/WHEEL +5 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/licenses/LICENSE +504 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,2542 @@
|
|
|
1
|
+
#ifndef FILE_INTRULE
|
|
2
|
+
#define FILE_INTRULE
|
|
3
|
+
|
|
4
|
+
/*********************************************************************/
|
|
5
|
+
/* File: intrule.hpp */
|
|
6
|
+
/* Author: Joachim Schoeberl */
|
|
7
|
+
/* Date: 25. Mar. 2000 */
|
|
8
|
+
/*********************************************************************/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#include "elementtopology.hpp" // for VorB
|
|
12
|
+
|
|
13
|
+
namespace ngcomp { class MeshAccess; }
|
|
14
|
+
|
|
15
|
+
namespace ngfem
|
|
16
|
+
{
|
|
17
|
+
template <int DIM, typename T>
|
|
18
|
+
class TIP;
|
|
19
|
+
|
|
20
|
+
template <typename T>
|
|
21
|
+
class TIP<0,T>
|
|
22
|
+
{
|
|
23
|
+
public:
|
|
24
|
+
int8_t facetnr = -1;
|
|
25
|
+
VorB vb = VOL;
|
|
26
|
+
|
|
27
|
+
[[deprecated("Use TIP(facetnr, vb) instead")]]
|
|
28
|
+
TIP () = default;
|
|
29
|
+
TIP (const TIP &) = default;
|
|
30
|
+
TIP (TIP &&) = default;
|
|
31
|
+
template <typename T2>
|
|
32
|
+
TIP (const TIP<0,T2> & tip)
|
|
33
|
+
: facetnr(tip.facetnr), vb(tip.vb) { }
|
|
34
|
+
|
|
35
|
+
TIP (int8_t afacetnr, VorB avb)
|
|
36
|
+
: facetnr(afacetnr), vb(avb) { }
|
|
37
|
+
|
|
38
|
+
TIP & operator= (const TIP &) = default;
|
|
39
|
+
TIP & operator= (TIP &&) = default;
|
|
40
|
+
|
|
41
|
+
explicit TIP (Vec<0,T> v, int8_t afacetnr=-1, VorB avb=VOL)
|
|
42
|
+
: facetnr(afacetnr), vb(avb) { ; }
|
|
43
|
+
template <typename T1, typename T2>
|
|
44
|
+
TIP (TIP<0,T1> ip1, TIP<0,T2> ip2) { ; }
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
template <typename T>
|
|
49
|
+
class TIP<1,T>
|
|
50
|
+
{
|
|
51
|
+
public:
|
|
52
|
+
T x;
|
|
53
|
+
int8_t facetnr = -1;
|
|
54
|
+
VorB vb = VOL;
|
|
55
|
+
|
|
56
|
+
[[deprecated("Use TIP(facetnr, vb) instead")]]
|
|
57
|
+
TIP () = default;
|
|
58
|
+
TIP (int8_t afacetnr, VorB avb)
|
|
59
|
+
: facetnr(afacetnr), vb(avb) { }
|
|
60
|
+
|
|
61
|
+
TIP (const TIP &) = default;
|
|
62
|
+
TIP (TIP &&) = default;
|
|
63
|
+
template <typename T2>
|
|
64
|
+
TIP (const TIP<1,T2> & tip)
|
|
65
|
+
: x(tip.x), facetnr(tip.facetnr), vb(tip.vb) { }
|
|
66
|
+
|
|
67
|
+
TIP & operator= (const TIP &) = default;
|
|
68
|
+
TIP & operator= (TIP &&) = default;
|
|
69
|
+
|
|
70
|
+
TIP (T _x, int8_t afacetnr, VorB avb)
|
|
71
|
+
: x(_x), facetnr(afacetnr), vb(avb) { ; }
|
|
72
|
+
|
|
73
|
+
explicit TIP (Vec<1,T> v, int8_t afacetnr = -1, VorB avb = VOL)
|
|
74
|
+
: x(v(0)), facetnr(afacetnr), vb(avb) { ; }
|
|
75
|
+
|
|
76
|
+
template <typename T1, typename T2>
|
|
77
|
+
TIP (TIP<1,T1> ip1, TIP<1,T2> ip2)
|
|
78
|
+
: x(ip1.x, ip2.x), facetnr(ip1.facetnr), vb(ip1.vb) { ; }
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
template <typename T>
|
|
82
|
+
class TIP<2,T>
|
|
83
|
+
{
|
|
84
|
+
public:
|
|
85
|
+
T x, y;
|
|
86
|
+
int8_t facetnr = -1;
|
|
87
|
+
VorB vb = VOL;
|
|
88
|
+
|
|
89
|
+
[[deprecated("Use TIP(facetnr, vb) instead")]]
|
|
90
|
+
TIP () = default;
|
|
91
|
+
TIP (int8_t afacetnr, VorB avb)
|
|
92
|
+
: facetnr(afacetnr), vb(avb) { }
|
|
93
|
+
|
|
94
|
+
TIP (const TIP &) = default;
|
|
95
|
+
TIP (TIP &&) = default;
|
|
96
|
+
template <typename T2>
|
|
97
|
+
TIP (const TIP<2,T2> & tip)
|
|
98
|
+
: x(tip.x), y(tip.y), facetnr(tip.facetnr), vb(tip.vb) { }
|
|
99
|
+
|
|
100
|
+
TIP & operator= (const TIP &) = default;
|
|
101
|
+
TIP & operator= (TIP &&) = default;
|
|
102
|
+
|
|
103
|
+
TIP (T _x, T _y, int8_t afacetnr, VorB avb)
|
|
104
|
+
: x(_x), y(_y), facetnr(afacetnr), vb(avb) { ; }
|
|
105
|
+
explicit TIP (Vec<2,T> v, int8_t afacetnr = -1, VorB avb = VOL)
|
|
106
|
+
: x(v(0)), y(v(1)), facetnr(afacetnr), vb(avb) { ; }
|
|
107
|
+
|
|
108
|
+
template <typename T1, typename T2>
|
|
109
|
+
TIP (TIP<2,T1> ip1, TIP<2,T2> ip2)
|
|
110
|
+
: x(ip1.x, ip2.x), y(ip1.y, ip2.y), facetnr(ip1.facetnr), vb(ip1.vb) { ; }
|
|
111
|
+
};
|
|
112
|
+
template <typename T>
|
|
113
|
+
class TIP<3,T>
|
|
114
|
+
{
|
|
115
|
+
public:
|
|
116
|
+
T x, y, z;
|
|
117
|
+
int8_t facetnr = -1;
|
|
118
|
+
VorB vb = VOL;
|
|
119
|
+
|
|
120
|
+
[[deprecated("Use TIP(facetnr, vb) instead")]]
|
|
121
|
+
TIP () = default;
|
|
122
|
+
TIP (int8_t afacetnr, VorB avb)
|
|
123
|
+
: facetnr(afacetnr), vb(avb) { }
|
|
124
|
+
|
|
125
|
+
TIP (const TIP &) = default;
|
|
126
|
+
TIP (TIP &&) = default;
|
|
127
|
+
template <typename T2>
|
|
128
|
+
TIP (const TIP<3,T2> & tip)
|
|
129
|
+
: x(tip.x), y(tip.y), z(tip.z), facetnr(tip.facetnr), vb(tip.vb) { }
|
|
130
|
+
|
|
131
|
+
TIP & operator= (const TIP &) = default;
|
|
132
|
+
TIP & operator= (TIP &&) = default;
|
|
133
|
+
|
|
134
|
+
TIP (T _x, T _y, T _z, int8_t afacetnr, VorB avb)
|
|
135
|
+
: x(_x), y(_y), z(_z), facetnr(afacetnr), vb(avb) { ; }
|
|
136
|
+
|
|
137
|
+
explicit TIP (Vec<3,T> v, int8_t afacetnr = -1, VorB avb = VOL)
|
|
138
|
+
: x(v(0)), y(v(1)), z(v(2)), facetnr(afacetnr), vb(avb) { ; }
|
|
139
|
+
|
|
140
|
+
template <typename T1, typename T2>
|
|
141
|
+
TIP (TIP<3,T1> ip1, TIP<3,T2> ip2)
|
|
142
|
+
: x(ip1.x, ip2.x), y(ip1.y, ip2.y), z(ip1.z, ip2.z),
|
|
143
|
+
facetnr(ip1.facetnr), vb(ip1.vb) { ; }
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
template <typename T>
|
|
147
|
+
inline ostream & operator<< (ostream & ost, TIP<0,T> tip)
|
|
148
|
+
{
|
|
149
|
+
return ost;
|
|
150
|
+
}
|
|
151
|
+
template <typename T>
|
|
152
|
+
inline ostream & operator<< (ostream & ost, TIP<1,T> tip)
|
|
153
|
+
{
|
|
154
|
+
return ost << "x = " << tip.x;
|
|
155
|
+
}
|
|
156
|
+
template <typename T>
|
|
157
|
+
inline ostream & operator<< (ostream & ost, TIP<2,T> tip)
|
|
158
|
+
{
|
|
159
|
+
return ost << "x = " << tip.x << ", y = " << tip.y;
|
|
160
|
+
}
|
|
161
|
+
template <typename T>
|
|
162
|
+
inline ostream & operator<< (ostream & ost, TIP<3,T> tip)
|
|
163
|
+
{
|
|
164
|
+
return ost << "x = " << tip.x << ", y = " << tip.y << ", z = " << tip.z;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
/// An integration point
|
|
170
|
+
class IntegrationPoint
|
|
171
|
+
{
|
|
172
|
+
private:
|
|
173
|
+
/// number within integration Rule
|
|
174
|
+
int nr;
|
|
175
|
+
/// coordinates (empty values for 1D and 2D)
|
|
176
|
+
double pi[3];
|
|
177
|
+
/// weight of integration point
|
|
178
|
+
double weight;
|
|
179
|
+
/// point is on facetnr, -1 for volume
|
|
180
|
+
int8_t facetnr = -1;
|
|
181
|
+
/// co-dimension of point (0..vol, 1..bnd, 2..bbnd, 3..bbbnd=vertex)
|
|
182
|
+
VorB vb = VOL;
|
|
183
|
+
///
|
|
184
|
+
// bool precomputed_geometry;
|
|
185
|
+
public:
|
|
186
|
+
///
|
|
187
|
+
INLINE IntegrationPoint & operator=(const IntegrationPoint & aip)
|
|
188
|
+
{
|
|
189
|
+
nr = aip.Nr();
|
|
190
|
+
pi[0] = aip(0);
|
|
191
|
+
pi[1] = aip(1);
|
|
192
|
+
pi[2] = aip(2);
|
|
193
|
+
weight = aip.Weight();
|
|
194
|
+
// precomputed_geometry = aip.precomputed_geometry;
|
|
195
|
+
facetnr = aip.facetnr;
|
|
196
|
+
vb = aip.vb;
|
|
197
|
+
return *this;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
///
|
|
201
|
+
INLINE IntegrationPoint (const double api[3], double aw)
|
|
202
|
+
{
|
|
203
|
+
nr = -1;
|
|
204
|
+
pi[0] = api[0];
|
|
205
|
+
pi[1] = api[1];
|
|
206
|
+
pi[2] = api[2];
|
|
207
|
+
weight = aw;
|
|
208
|
+
facetnr = -1;
|
|
209
|
+
// precomputed_geometry = 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
///
|
|
213
|
+
INLINE IntegrationPoint (double p1 = 0, double p2 = 0, double p3 = 0, double aw = 0)
|
|
214
|
+
{
|
|
215
|
+
nr = -1;
|
|
216
|
+
pi[0] = p1;
|
|
217
|
+
pi[1] = p2;
|
|
218
|
+
pi[2] = p3;
|
|
219
|
+
weight = aw;
|
|
220
|
+
facetnr = -1;
|
|
221
|
+
// precomputed_geometry = 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
///
|
|
225
|
+
INLINE IntegrationPoint (const FlatVector<double> & ap, double aw)
|
|
226
|
+
{
|
|
227
|
+
nr = -1;
|
|
228
|
+
pi[0] = (ap.Size() >= 1) ? ap(0) : 0;
|
|
229
|
+
pi[1] = (ap.Size() >= 2) ? ap(1) : 0;
|
|
230
|
+
pi[2] = (ap.Size() >= 3) ? ap(2) : 0;
|
|
231
|
+
weight = aw;
|
|
232
|
+
facetnr = -1;
|
|
233
|
+
// precomputed_geometry = 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
template <int D>
|
|
238
|
+
INLINE IntegrationPoint (const Vec<D> & ap, double aw = -1)
|
|
239
|
+
{
|
|
240
|
+
nr = -1;
|
|
241
|
+
for (int j = 0; j < D; j++)
|
|
242
|
+
pi[j] = ap(j);
|
|
243
|
+
weight = aw;
|
|
244
|
+
facetnr = -1;
|
|
245
|
+
// precomputed_geometry = 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
///
|
|
249
|
+
INLINE IntegrationPoint (const IntegrationPoint & aip)
|
|
250
|
+
{ *this = aip; }
|
|
251
|
+
|
|
252
|
+
// void SetPrecomputedGeometry(bool value) { precomputed_geometry = value; }
|
|
253
|
+
// bool GetPrecomputedGeometry() const { return precomputed_geometry; }
|
|
254
|
+
///
|
|
255
|
+
INLINE void SetNr (int anr) { nr = anr; }
|
|
256
|
+
///
|
|
257
|
+
// const double * Point () const { return pi; }
|
|
258
|
+
///
|
|
259
|
+
INLINE int Size() const { return 3; }
|
|
260
|
+
///
|
|
261
|
+
INLINE const double & operator() (int i) const { return pi[i]; }
|
|
262
|
+
///
|
|
263
|
+
INLINE double & operator() (int i) { return pi[i]; }
|
|
264
|
+
///
|
|
265
|
+
INLINE double Weight () const { return weight; }
|
|
266
|
+
///
|
|
267
|
+
INLINE void SetWeight (double w) { weight = w; }
|
|
268
|
+
|
|
269
|
+
/// number within integration rule
|
|
270
|
+
INLINE int Nr () const { return nr; }
|
|
271
|
+
|
|
272
|
+
/// global number of ip
|
|
273
|
+
// INLINE int IPNr () const { return -1; }
|
|
274
|
+
|
|
275
|
+
INLINE auto Point() { return FlatVec<3> (&pi[0]); }
|
|
276
|
+
INLINE auto Point() const { return FlatVec<3, const double> (&pi[0]); }
|
|
277
|
+
|
|
278
|
+
void SetFacetNr (int afacetnr, VorB avb = BND)
|
|
279
|
+
{ facetnr = afacetnr; vb = avb; }
|
|
280
|
+
INLINE auto FacetNr() const { return facetnr; }
|
|
281
|
+
INLINE VorB VB() const { return vb; }
|
|
282
|
+
|
|
283
|
+
template <int DIM>
|
|
284
|
+
INLINE operator Vec<DIM, AutoDiff<DIM>> () const
|
|
285
|
+
{
|
|
286
|
+
Vec<DIM, AutoDiff<DIM> > adp;
|
|
287
|
+
for (int i = 0; i < DIM; i++)
|
|
288
|
+
adp[i] = AutoDiff<DIM> (pi[i], i);
|
|
289
|
+
return adp;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
INLINE operator TIP<0,double> () const { return TIP<0,double>(facetnr, vb); }
|
|
293
|
+
INLINE operator TIP<1,double> () const { return TIP<1,double>(pi[0], facetnr, vb); }
|
|
294
|
+
INLINE operator TIP<2,double> () const { return TIP<2,double>(pi[0], pi[1], facetnr, vb); }
|
|
295
|
+
INLINE operator TIP<3,double> () const { return TIP<3,double>(pi[0], pi[1], pi[2], facetnr, vb); }
|
|
296
|
+
|
|
297
|
+
INLINE operator TIP<0,AutoDiff<0>> () const
|
|
298
|
+
{ return TIP<0,AutoDiff<0>>(facetnr, vb); }
|
|
299
|
+
INLINE operator TIP<1,AutoDiff<1>> () const
|
|
300
|
+
{ return TIP<1,AutoDiff<1>>(AutoDiff<1> (pi[0],0), facetnr, vb); }
|
|
301
|
+
INLINE operator TIP<2,AutoDiff<2>> () const
|
|
302
|
+
{ return TIP<2,AutoDiff<2>>(AutoDiff<2> (pi[0],0), AutoDiff<2> (pi[1],1), facetnr, vb); }
|
|
303
|
+
INLINE operator TIP<3,AutoDiff<3>> () const
|
|
304
|
+
{ return TIP<3,AutoDiff<3>>(AutoDiff<3> (pi[0],0), AutoDiff<3> (pi[1],1), AutoDiff<3> (pi[2],2), facetnr, vb); }
|
|
305
|
+
|
|
306
|
+
template <int D>
|
|
307
|
+
INLINE ngfem::TIP<D,double> TIp() const;
|
|
308
|
+
|
|
309
|
+
friend NGS_DLL_HEADER ostream & operator<< (ostream & ost, const IntegrationPoint & ip);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
template <int D> INLINE ngfem::TIP<D,double> IntegrationPoint :: TIp() const
|
|
313
|
+
{ return ngfem::TIP<D,double> (*this); }
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
struct MeshPoint
|
|
317
|
+
{
|
|
318
|
+
double x,y,z;
|
|
319
|
+
ngcomp::MeshAccess* mesh;
|
|
320
|
+
VorB vb;
|
|
321
|
+
int nr;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class NGS_DLL_HEADER ElementTransformation;
|
|
326
|
+
class NGS_DLL_HEADER BaseMappedIntegrationRule;
|
|
327
|
+
/**
|
|
328
|
+
Base class for MappedIntegrationPoint.
|
|
329
|
+
A specific integration point is the mapped point, and stores
|
|
330
|
+
point coordinates, the Jacobimatrix, and the determinant of the Jacobimatrix.
|
|
331
|
+
*/
|
|
332
|
+
class BaseMappedIntegrationPoint
|
|
333
|
+
{
|
|
334
|
+
protected:
|
|
335
|
+
/// IP on the reference element
|
|
336
|
+
IntegrationPoint ip;
|
|
337
|
+
/// computed by the transformation
|
|
338
|
+
const ElementTransformation * eltrans;
|
|
339
|
+
///
|
|
340
|
+
bool owns_trafo = false;
|
|
341
|
+
///
|
|
342
|
+
bool is_complex;
|
|
343
|
+
/// fabs(det)
|
|
344
|
+
double measure;
|
|
345
|
+
|
|
346
|
+
BaseMappedIntegrationPoint (const BaseMappedIntegrationPoint&) = default;
|
|
347
|
+
public:
|
|
348
|
+
///
|
|
349
|
+
INLINE BaseMappedIntegrationPoint () = default;
|
|
350
|
+
///
|
|
351
|
+
INLINE BaseMappedIntegrationPoint (const IntegrationPoint & aip,
|
|
352
|
+
const ElementTransformation & aeltrans)
|
|
353
|
+
: ip(aip), eltrans(&aeltrans) { ; }
|
|
354
|
+
///
|
|
355
|
+
NGS_DLL_HEADER virtual ~BaseMappedIntegrationPoint ();
|
|
356
|
+
///
|
|
357
|
+
INLINE const IntegrationPoint & IP () const { return ip; }
|
|
358
|
+
///
|
|
359
|
+
INLINE const ElementTransformation & GetTransformation () const { return *eltrans; }
|
|
360
|
+
///
|
|
361
|
+
INLINE int GetIPNr() const { return ip.Nr(); }
|
|
362
|
+
///
|
|
363
|
+
INLINE double GetMeasure() const { return measure; }
|
|
364
|
+
void SetMeasure (double _measure) { measure = _measure; }
|
|
365
|
+
///
|
|
366
|
+
INLINE double GetWeight() const { return measure * ip.Weight(); }
|
|
367
|
+
|
|
368
|
+
NGS_DLL_HEADER FlatVector<> GetPoint() const;
|
|
369
|
+
FlatMatrix<> GetJacobian() const;
|
|
370
|
+
|
|
371
|
+
// implemented in elementtransformation.hpp
|
|
372
|
+
INLINE int DimElement() const; // { return eltrans->ElementDim(); }
|
|
373
|
+
INLINE int DimSpace() const; // { return eltrans->SpaceDim(); }
|
|
374
|
+
|
|
375
|
+
FlatVector<Complex> GetPointComplex() const;
|
|
376
|
+
FlatMatrix<Complex> GetJacobianComplex() const;
|
|
377
|
+
// dimension of range
|
|
378
|
+
// [[deprecated("Use DimSpace instead")]]
|
|
379
|
+
// NGS_DLL_HEADER int Dim() const;
|
|
380
|
+
// VorB ElementVB() const;
|
|
381
|
+
bool IsComplex() const { return is_complex; }
|
|
382
|
+
void SetOwnsTrafo (bool aowns_trafo = true) { owns_trafo = aowns_trafo; }
|
|
383
|
+
virtual void IntegrationRuleFromPoint(std::function<void(const BaseMappedIntegrationRule&)> func) const { ; }
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
template <typename SCAL = double>
|
|
387
|
+
class alignas (sizeof(SCAL)) ScalMappedIntegrationPoint : public BaseMappedIntegrationPoint
|
|
388
|
+
{
|
|
389
|
+
protected:
|
|
390
|
+
SCAL det;
|
|
391
|
+
public:
|
|
392
|
+
using BaseMappedIntegrationPoint :: BaseMappedIntegrationPoint;
|
|
393
|
+
ScalMappedIntegrationPoint() { is_complex = false; }
|
|
394
|
+
|
|
395
|
+
ScalMappedIntegrationPoint(const IntegrationPoint & aip,
|
|
396
|
+
const ElementTransformation & aeltrans)
|
|
397
|
+
: BaseMappedIntegrationPoint(aip,aeltrans){ is_complex = false; }
|
|
398
|
+
///
|
|
399
|
+
INLINE SCAL GetJacobiDet() const { return det; }
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
template<> INLINE ScalMappedIntegrationPoint<Complex> :: ScalMappedIntegrationPoint()
|
|
403
|
+
{ is_complex = true; }
|
|
404
|
+
|
|
405
|
+
template<> INLINE ScalMappedIntegrationPoint<Complex>
|
|
406
|
+
:: ScalMappedIntegrationPoint(const IntegrationPoint & aip,
|
|
407
|
+
const ElementTransformation & aeltrans)
|
|
408
|
+
: BaseMappedIntegrationPoint(aip,aeltrans) {
|
|
409
|
+
is_complex = true; }
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
template <int R, typename SCAL = double>
|
|
413
|
+
class DimMappedIntegrationPoint : public ScalMappedIntegrationPoint<SCAL>
|
|
414
|
+
{
|
|
415
|
+
protected:
|
|
416
|
+
///
|
|
417
|
+
Vec<R,SCAL> point;
|
|
418
|
+
Vec<R,SCAL> normalvec;
|
|
419
|
+
Vec<R,SCAL> tangentialvec; // for independent integrator
|
|
420
|
+
using ScalMappedIntegrationPoint<SCAL>::det;
|
|
421
|
+
public:
|
|
422
|
+
///
|
|
423
|
+
using ScalMappedIntegrationPoint<SCAL>::ScalMappedIntegrationPoint;
|
|
424
|
+
/*
|
|
425
|
+
INLINE DimMappedIntegrationPoint () = default;
|
|
426
|
+
///
|
|
427
|
+
INLINE DimMappedIntegrationPoint (const IntegrationPoint & aip,
|
|
428
|
+
const ElementTransformation & aeltrans)
|
|
429
|
+
: BaseMappedIntegrationPoint (aip, aeltrans)
|
|
430
|
+
{ ; }
|
|
431
|
+
*/
|
|
432
|
+
///
|
|
433
|
+
INLINE const Vec<R,SCAL> & GetPoint () const { return point; }
|
|
434
|
+
INLINE Vec<R,SCAL> & Point () { return point; }
|
|
435
|
+
///
|
|
436
|
+
INLINE SCAL operator() (int i) const { return point(i); }
|
|
437
|
+
|
|
438
|
+
///
|
|
439
|
+
INLINE const Vec<R,SCAL> & GetNV () const { return normalvec; }
|
|
440
|
+
///
|
|
441
|
+
INLINE void SetNV ( Vec<R,SCAL> vec) { normalvec = vec; }
|
|
442
|
+
///
|
|
443
|
+
INLINE void SetTV ( Vec<R,SCAL> vec) { tangentialvec = vec; }
|
|
444
|
+
///
|
|
445
|
+
INLINE const Vec<R,SCAL> GetTV () const { return tangentialvec; }
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
/// ip, dimension source, dimension range
|
|
450
|
+
template <int DIMS, int DIMR, typename SCAL = double>
|
|
451
|
+
class MappedIntegrationPoint : public DimMappedIntegrationPoint<DIMR,SCAL>
|
|
452
|
+
{
|
|
453
|
+
static_assert(DIMS <= DIMR, "DIM-source > DIM-range !!");
|
|
454
|
+
private:
|
|
455
|
+
/// Jacobi matrix
|
|
456
|
+
Mat<DIMR,DIMS,SCAL> dxdxi;
|
|
457
|
+
/// for boundary points
|
|
458
|
+
using DimMappedIntegrationPoint<DIMR,SCAL>::normalvec;
|
|
459
|
+
using DimMappedIntegrationPoint<DIMR,SCAL>::tangentialvec;
|
|
460
|
+
using DimMappedIntegrationPoint<DIMR,SCAL>::det;
|
|
461
|
+
|
|
462
|
+
public:
|
|
463
|
+
typedef SCAL TSCAL;
|
|
464
|
+
///
|
|
465
|
+
NGS_DLL_HEADER MappedIntegrationPoint () = default;
|
|
466
|
+
///
|
|
467
|
+
NGS_DLL_HEADER MappedIntegrationPoint (const IntegrationPoint & aip,
|
|
468
|
+
const ElementTransformation & aeltrans)
|
|
469
|
+
: DimMappedIntegrationPoint<DIMR,SCAL> (aip, aeltrans)
|
|
470
|
+
{
|
|
471
|
+
this->eltrans->CalcPointJacobian(this->IP(), this->point, dxdxi);
|
|
472
|
+
this->Compute();
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
INLINE MappedIntegrationPoint (const IntegrationPoint & aip,
|
|
476
|
+
const ElementTransformation & aeltrans,
|
|
477
|
+
int /* dummy */)
|
|
478
|
+
: DimMappedIntegrationPoint<DIMR,SCAL> (aip, aeltrans)
|
|
479
|
+
{ ; }
|
|
480
|
+
|
|
481
|
+
///
|
|
482
|
+
INLINE MappedIntegrationPoint (const IntegrationPoint & aip,
|
|
483
|
+
const ElementTransformation & aeltrans,
|
|
484
|
+
const FlatVec<DIMR, SCAL> ax,
|
|
485
|
+
const Mat<DIMR, DIMS, SCAL> & adxdxi)
|
|
486
|
+
: DimMappedIntegrationPoint<DIMR,SCAL> (aip, aeltrans)
|
|
487
|
+
{
|
|
488
|
+
this->point = ax;
|
|
489
|
+
dxdxi = adxdxi;
|
|
490
|
+
Compute();
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
INLINE void CheckDims() const
|
|
494
|
+
{
|
|
495
|
+
static_assert(DIMR >= DIMS, "DIMR >= DIMS not satisfied");
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
INLINE void Compute ()
|
|
499
|
+
{
|
|
500
|
+
if constexpr (DIMS == DIMR)
|
|
501
|
+
{
|
|
502
|
+
det = Det (dxdxi);
|
|
503
|
+
normalvec = TSCAL(0.0);
|
|
504
|
+
tangentialvec = TSCAL(0.0);
|
|
505
|
+
}
|
|
506
|
+
else
|
|
507
|
+
{
|
|
508
|
+
if (DIMR == 3)
|
|
509
|
+
{
|
|
510
|
+
if(DIMS == 2)
|
|
511
|
+
{
|
|
512
|
+
normalvec = Cross (Vec<3,SCAL> (dxdxi.Col(0)),
|
|
513
|
+
Vec<3,SCAL> (dxdxi.Col(1)));
|
|
514
|
+
det = L2Norm (normalvec);
|
|
515
|
+
normalvec /= det;
|
|
516
|
+
tangentialvec = TSCAL(0.0);
|
|
517
|
+
}
|
|
518
|
+
else if (DIMS == 1)
|
|
519
|
+
{
|
|
520
|
+
// CHECK!
|
|
521
|
+
normalvec = TSCAL(0.0);
|
|
522
|
+
tangentialvec = Vec<3,SCAL>(dxdxi.Col(0));
|
|
523
|
+
det = L2Norm(tangentialvec);
|
|
524
|
+
tangentialvec /= det;
|
|
525
|
+
}
|
|
526
|
+
else
|
|
527
|
+
{
|
|
528
|
+
det = 1;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
else if (DIMR == 2)
|
|
532
|
+
{
|
|
533
|
+
if (DIMS == 1)
|
|
534
|
+
{
|
|
535
|
+
det = sqrt ( ngstd::sqr (dxdxi(0,0)) + ngstd::sqr (dxdxi(1,0)));
|
|
536
|
+
|
|
537
|
+
normalvec(0) = -dxdxi(1,0) / det;
|
|
538
|
+
normalvec(1) = dxdxi(0,0) / det;
|
|
539
|
+
//tangentialvec = TSCAL(0.0);
|
|
540
|
+
tangentialvec(0) = -normalvec(1);
|
|
541
|
+
tangentialvec(1) = normalvec(0);
|
|
542
|
+
}
|
|
543
|
+
else
|
|
544
|
+
{
|
|
545
|
+
det = 1;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else
|
|
549
|
+
{
|
|
550
|
+
det = 1.0;
|
|
551
|
+
normalvec = 1.0;
|
|
552
|
+
tangentialvec = TSCAL(0.0);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
this->measure = fabs (det);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
///
|
|
559
|
+
INLINE const Mat<DIMR,DIMS,SCAL> & GetJacobian() const { return dxdxi; }
|
|
560
|
+
INLINE Mat<DIMR,DIMS,SCAL> & Jacobian() { return dxdxi; }
|
|
561
|
+
///
|
|
562
|
+
// const Mat<DIMS,DIMR,SCAL> & GetJacobianInverse() const { return dxidx; }
|
|
563
|
+
INLINE const Mat<DIMS,DIMR,SCAL> GetJacobianInverse() const
|
|
564
|
+
{
|
|
565
|
+
if (DIMS == DIMR)
|
|
566
|
+
// return Inv (dxdxi);
|
|
567
|
+
return 1.0/det * Trans (Cof (dxdxi));
|
|
568
|
+
else
|
|
569
|
+
{
|
|
570
|
+
// Mat<DIMS,DIMS,SCAL> ata, iata;
|
|
571
|
+
// ata = Trans (dxdxi) * dxdxi;
|
|
572
|
+
// iata = Inv (ata);
|
|
573
|
+
// auto iata = Inv (Trans (dxdxi) * dxdxi);
|
|
574
|
+
// return iata * Trans (dxdxi);
|
|
575
|
+
return Inv (Trans (dxdxi) * dxdxi) * Trans (dxdxi);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
INLINE const Mat<DIMR,DIMS,SCAL> GetJacobianCofactor() const
|
|
580
|
+
{
|
|
581
|
+
if (DIMS == DIMR)
|
|
582
|
+
return Cof (dxdxi);
|
|
583
|
+
else
|
|
584
|
+
return det * Trans(GetJacobianInverse());
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
INLINE operator Vec<DIMS, AutoDiff<DIMR,TSCAL>> () const
|
|
588
|
+
{
|
|
589
|
+
Vec<DIMS, AutoDiff<DIMR, TSCAL> > adp;
|
|
590
|
+
|
|
591
|
+
/*
|
|
592
|
+
for (int i = 0; i < DIMS; i++)
|
|
593
|
+
adp[i].Value() = this->IP()(i);
|
|
594
|
+
for (int i = 0; i < DIMS; i++)
|
|
595
|
+
for (int j = 0; j < DIMR; j++)
|
|
596
|
+
adp[i].DValue(j) = GetJacobianInverse()(i,j);
|
|
597
|
+
*/
|
|
598
|
+
Mat<DIMS,DIMR,TSCAL> ijac = GetJacobianInverse();
|
|
599
|
+
for (int i = 0; i < DIMS; i++)
|
|
600
|
+
adp[i] = AutoDiff<DIMR,TSCAL> (this->IP()(i), &ijac(i,0));
|
|
601
|
+
return adp;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
///
|
|
605
|
+
// INLINE VorB VB() const { return VorB(DIMR-DIMS); }
|
|
606
|
+
//INLINE int IsBoundary () const { return DIMS != DIMR; }
|
|
607
|
+
|
|
608
|
+
///
|
|
609
|
+
void CalcHesse (Mat<1> & ddx1, Mat<1> & ddx2) const;
|
|
610
|
+
void CalcHesse (Mat<2> & ddx1, Mat<2> & ddx2) const;
|
|
611
|
+
void CalcHesse (Mat<1> & ddx1, Mat<1> & ddx2, Mat<1> & ddx3) const;
|
|
612
|
+
void CalcHesse (Mat<2> & ddx1, Mat<2> & ddx2, Mat<2> & ddx3) const;
|
|
613
|
+
void CalcHesse (Mat<3> & ddx1, Mat<3> & ddx2, Mat<3> & ddx3) const;
|
|
614
|
+
|
|
615
|
+
void CalcHesse (Vec<DIMR,Mat<DIMS,DIMS>> & ddx1) const;
|
|
616
|
+
Vec<DIMR,Mat<DIMS,DIMS>> CalcHesse() const
|
|
617
|
+
{
|
|
618
|
+
if constexpr(std::is_same<SCAL,double>::value)
|
|
619
|
+
{
|
|
620
|
+
Vec<DIMR,Mat<DIMS,DIMS>> hesse;
|
|
621
|
+
CalcHesse (hesse);
|
|
622
|
+
return hesse;
|
|
623
|
+
}
|
|
624
|
+
throw Exception ("CalcHesse not available for complex mips");
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
void IntegrationRuleFromPoint(std::function<void(const BaseMappedIntegrationRule&)> func) const override;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
inline ostream & operator<< (ostream & ost, const BaseMappedIntegrationPoint & mip)
|
|
635
|
+
{
|
|
636
|
+
ost << mip.GetPoint(); // << ", dxdxi = " << mip.GetJacobian();
|
|
637
|
+
return ost;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
template <int DIMS, int DIMR, typename SCAL>
|
|
641
|
+
inline ostream & operator<< (ostream & ost, const MappedIntegrationPoint<DIMS,DIMR,SCAL> & mip)
|
|
642
|
+
{
|
|
643
|
+
ost << mip.GetPoint() << ", dxdxi = " << mip.GetJacobian();
|
|
644
|
+
return ost;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
An integration rule.
|
|
653
|
+
Contains array of integration points
|
|
654
|
+
*/
|
|
655
|
+
|
|
656
|
+
class IntegrationRule : public Array<IntegrationPoint>
|
|
657
|
+
{
|
|
658
|
+
int dimension = -1;
|
|
659
|
+
public:
|
|
660
|
+
///
|
|
661
|
+
INLINE IntegrationRule () { ; }
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
An integration rule for element type of certain order.
|
|
665
|
+
Obtains a reference to the precomputed integration rule
|
|
666
|
+
*/
|
|
667
|
+
NGS_DLL_HEADER IntegrationRule (ELEMENT_TYPE eltype, int order);
|
|
668
|
+
|
|
669
|
+
INLINE IntegrationRule (int asize, IntegrationPoint * pip)
|
|
670
|
+
: Array<IntegrationPoint> (asize, pip) { ; }
|
|
671
|
+
|
|
672
|
+
// copies pointers
|
|
673
|
+
INLINE NGS_DLL_HEADER IntegrationRule (const IntegrationRule & ir2)
|
|
674
|
+
: Array<IntegrationPoint> (ir2.Size(), ir2.data), dimension(ir2.dimension)
|
|
675
|
+
{ ; }
|
|
676
|
+
|
|
677
|
+
INLINE NGS_DLL_HEADER IntegrationRule (IntegrationRule && ir2) = default;
|
|
678
|
+
|
|
679
|
+
INLINE NGS_DLL_HEADER IntegrationRule (size_t asize, LocalHeap & lh)
|
|
680
|
+
: Array<IntegrationPoint> (asize, lh)
|
|
681
|
+
{ ; }
|
|
682
|
+
|
|
683
|
+
INLINE NGS_DLL_HEADER IntegrationRule (size_t asize, double (*pts)[3], double * weights);
|
|
684
|
+
|
|
685
|
+
// make it polymorphic
|
|
686
|
+
HD virtual ~IntegrationRule() { ; }
|
|
687
|
+
|
|
688
|
+
IntegrationRule & operator= (IntegrationRule && ir2) = default;
|
|
689
|
+
IntegrationRule & operator= (const IntegrationRule & ir2) = delete;
|
|
690
|
+
|
|
691
|
+
///
|
|
692
|
+
INLINE void AddIntegrationPoint (const IntegrationPoint & ip)
|
|
693
|
+
{
|
|
694
|
+
Append (ip);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
IntegrationRule Copy() const;
|
|
698
|
+
|
|
699
|
+
/// number of integration points
|
|
700
|
+
INLINE size_t GetNIP() const { return Size(); }
|
|
701
|
+
|
|
702
|
+
INLINE IntegrationRule Range (size_t first, size_t next) const
|
|
703
|
+
{
|
|
704
|
+
return IntegrationRule (next-first, &(*this)[first]);
|
|
705
|
+
}
|
|
706
|
+
int Dim() const { return dimension; }
|
|
707
|
+
void SetDim (int dim) { dimension = dim; }
|
|
708
|
+
|
|
709
|
+
struct IntegrationRuleSplitArray
|
|
710
|
+
{
|
|
711
|
+
const IntegrationRule & ir;
|
|
712
|
+
static constexpr size_t BS=128;
|
|
713
|
+
size_t size;
|
|
714
|
+
|
|
715
|
+
IntegrationRuleSplitArray(const IntegrationRule & ir_)
|
|
716
|
+
: ir(ir_)
|
|
717
|
+
{
|
|
718
|
+
size = (ir.Size()+BS-1)/BS;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
IntegrationRule operator[](size_t i) const
|
|
722
|
+
{
|
|
723
|
+
size_t first = i*BS;
|
|
724
|
+
size_t next = min((i+1)*BS, ir.Size());
|
|
725
|
+
return ir.Range(first, next);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
auto begin() const { return AOWrapperIterator(*this, 0); }
|
|
729
|
+
auto end() const { return AOWrapperIterator(*this, size); }
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
IntegrationRuleSplitArray Split() { return *this; }
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
NGS_DLL_HEADER ostream & operator<< (ostream & ost, const IntegrationRule & ir);
|
|
736
|
+
|
|
737
|
+
/*
|
|
738
|
+
DG Integration rule:
|
|
739
|
+
volume IR contains points of facet IR.
|
|
740
|
+
facet IR are Gauss-rules
|
|
741
|
+
boundary_volume_factor is maximal ration of boundary-weight to volume-weight
|
|
742
|
+
*/
|
|
743
|
+
class DGIntegrationRule : public IntegrationRule
|
|
744
|
+
{
|
|
745
|
+
Array<IntegrationRule*> facetrules;
|
|
746
|
+
double boundary_volume_factor;
|
|
747
|
+
public:
|
|
748
|
+
NGS_DLL_HEADER DGIntegrationRule (ELEMENT_TYPE eltype, int order);
|
|
749
|
+
int GetNFacets () const { return facetrules.Size(); }
|
|
750
|
+
const IntegrationRule & GetFacetIntegrationRule (int fnr) const
|
|
751
|
+
{ return *facetrules[fnr]; }
|
|
752
|
+
double BoundaryVolumeFactor () const { return boundary_volume_factor; }
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
NGS_DLL_HEADER ostream & operator<< (ostream & ost, const DGIntegrationRule & ir);
|
|
756
|
+
|
|
757
|
+
template <int D>
|
|
758
|
+
class IntegrationRuleTP : public IntegrationRule
|
|
759
|
+
{
|
|
760
|
+
const IntegrationRule *irx, *iry, *irz;
|
|
761
|
+
|
|
762
|
+
ArrayMem<Mat<D,D>, 100> dxdxi_duffy;
|
|
763
|
+
Mat<D,D> dxdxi_permute;
|
|
764
|
+
|
|
765
|
+
public:
|
|
766
|
+
NGS_DLL_HEADER IntegrationRuleTP (const ElementTransformation & eltrans,
|
|
767
|
+
IVec<D> order, bool compute_duffy = true, bool compute_points = true);
|
|
768
|
+
|
|
769
|
+
// tensor product rule for a facet
|
|
770
|
+
NGS_DLL_HEADER IntegrationRuleTP (ELEMENT_TYPE eltype, FlatArray<int> sort,
|
|
771
|
+
NODE_TYPE nt, int nodenr, int order, LocalHeap & lh);
|
|
772
|
+
|
|
773
|
+
const IntegrationRule & GetIRX() const { return *irx; }
|
|
774
|
+
const IntegrationRule & GetIRY() const { return *iry; }
|
|
775
|
+
const IntegrationRule & GetIRZ() const { return *irz; }
|
|
776
|
+
|
|
777
|
+
int GetNIP() const
|
|
778
|
+
{
|
|
779
|
+
switch (D)
|
|
780
|
+
{
|
|
781
|
+
case 1: return irx->GetNIP();
|
|
782
|
+
case 2: return irx->GetNIP()*iry->GetNIP();
|
|
783
|
+
case 3: return irx->GetNIP()*iry->GetNIP()*irz->GetNIP();
|
|
784
|
+
}
|
|
785
|
+
return 0;
|
|
786
|
+
}
|
|
787
|
+
double GetWeight (int i) const { return (*this)[i].Weight(); } // weight[i]; }
|
|
788
|
+
const Vec<D> GetXi(int i) const
|
|
789
|
+
{
|
|
790
|
+
Vec<D> ret;
|
|
791
|
+
for (int j = 0; j < D; j++)
|
|
792
|
+
ret(j) = (*this)[i](j);
|
|
793
|
+
return ret; // return xi[i];
|
|
794
|
+
}
|
|
795
|
+
// Vec<D> & GetPoint(int i) const { return x[i]; }
|
|
796
|
+
// Mat<D,D> & GetJacobian(int i) const { return dxdxi[i]; }
|
|
797
|
+
Mat<D,D> & GetDuffyJacobian(int i) const { return dxdxi_duffy[i]; }
|
|
798
|
+
|
|
799
|
+
template <ELEMENT_TYPE ET>
|
|
800
|
+
Mat<D,D> GetDuffyJacobian(int ix, int iy, int iz) const
|
|
801
|
+
{
|
|
802
|
+
if (dxdxi_duffy.Size())
|
|
803
|
+
return dxdxi_duffy[(ix*iry->GetNIP()+iy)*irz->GetNIP()+iz];
|
|
804
|
+
else
|
|
805
|
+
{
|
|
806
|
+
if (ET == ET_TET)
|
|
807
|
+
{
|
|
808
|
+
double x = (*irx)[ix](0);
|
|
809
|
+
double invx = 1.0 / (1-x);
|
|
810
|
+
|
|
811
|
+
double y = (*iry)[iy](0);
|
|
812
|
+
double invxy = 1.0 / ( (1-x) * (1-y) );
|
|
813
|
+
|
|
814
|
+
double z = (*irz)[iz](0);
|
|
815
|
+
|
|
816
|
+
Mat<3> trans3;
|
|
817
|
+
|
|
818
|
+
// hex -> tet transform
|
|
819
|
+
trans3(0,0) = 1;
|
|
820
|
+
trans3(0,1) = 0;
|
|
821
|
+
trans3(0,2) = 0;
|
|
822
|
+
|
|
823
|
+
trans3(1,0) = y*invx;
|
|
824
|
+
trans3(1,1) = 1*invx;
|
|
825
|
+
trans3(1,2) = 0;
|
|
826
|
+
|
|
827
|
+
trans3(2,0) = z*invxy;
|
|
828
|
+
trans3(2,1) = z*invxy;
|
|
829
|
+
trans3(2,2) = 1*invxy;
|
|
830
|
+
|
|
831
|
+
return trans3 * dxdxi_permute;
|
|
832
|
+
}
|
|
833
|
+
else
|
|
834
|
+
{
|
|
835
|
+
cout << "need to compute duffy for ET " << ET << endl;
|
|
836
|
+
return Mat<D,D> (0.0);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
Mat<D,D> GetPermutationJacobian() const { return dxdxi_permute; }
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
Computes Gaussean integration.
|
|
848
|
+
Integration rule on (0,1), contains n points,
|
|
849
|
+
Exact for polynomials up to order 2n-1
|
|
850
|
+
*/
|
|
851
|
+
NGS_DLL_HEADER extern void ComputeGaussRule (int n,
|
|
852
|
+
Array<double> & xi,
|
|
853
|
+
Array<double> & wi);
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
Computes Gauss-Jacobi integration rule.
|
|
860
|
+
Integration rule on (0,1), contains n points.
|
|
861
|
+
Assumes that the polynomial has alpha roots in 1, and beta roots in 0.
|
|
862
|
+
Exact for polynomials up to order 2n-1 + alpha + beta
|
|
863
|
+
*/
|
|
864
|
+
NGS_DLL_HEADER extern void ComputeGaussJacobiRule (int n,
|
|
865
|
+
Array<double> & xi,
|
|
866
|
+
Array<double> & wi,
|
|
867
|
+
double alf,
|
|
868
|
+
double bet);
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
Gauss-Lobatto Rule with n points on interval [0,1].
|
|
872
|
+
Contains 0 and 1 as points
|
|
873
|
+
exact for polynomials up to order 2n-3
|
|
874
|
+
*/
|
|
875
|
+
NGS_DLL_HEADER extern
|
|
876
|
+
void ComputeGaussLobattoRule (int n, Array<double>& xi, Array<double>& wi);
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
Gauss-Lobatto Rule with n points on interval [0,1].
|
|
880
|
+
Contains 0 as points
|
|
881
|
+
exact for polynomials up to order 2n-2
|
|
882
|
+
*/
|
|
883
|
+
NGS_DLL_HEADER extern
|
|
884
|
+
void ComputeGaussRadauRule (int n, Array<double>& xi, Array<double>& wi);
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
Computes Gauss-Hermite integration rule.
|
|
889
|
+
Integration rule on R, contains n points.
|
|
890
|
+
Exact for exp{-x*x} * p(x), with polynomials p(x) up to order 2n-1
|
|
891
|
+
*/
|
|
892
|
+
NGS_DLL_HEADER extern void ComputeHermiteRule (int n,
|
|
893
|
+
Array<double> & x,
|
|
894
|
+
Array<double> & w);
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
extern NGS_DLL_HEADER const IntegrationRule & SelectIntegrationRule (ELEMENT_TYPE eltype, int order);
|
|
898
|
+
extern NGS_DLL_HEADER const IntegrationRule & SelectIntegrationRuleJacobi10 (int order);
|
|
899
|
+
extern NGS_DLL_HEADER const IntegrationRule & SelectIntegrationRuleJacobi20 (int order);
|
|
900
|
+
|
|
901
|
+
INLINE IntegrationRule :: IntegrationRule (ELEMENT_TYPE eltype, int order)
|
|
902
|
+
{
|
|
903
|
+
const IntegrationRule & ir = SelectIntegrationRule (eltype, order);
|
|
904
|
+
size = ir.Size();
|
|
905
|
+
data = &ir[0];
|
|
906
|
+
mem_to_delete = NULL;
|
|
907
|
+
dimension = ElementTopology::GetSpaceDim(eltype);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
// transformation of (d-1) dimensional integration points on facets to
|
|
913
|
+
// d-dimensional point in volumes
|
|
914
|
+
class Facet2ElementTrafo
|
|
915
|
+
{
|
|
916
|
+
protected:
|
|
917
|
+
// mutable IntegrationPoint elpoint;
|
|
918
|
+
ELEMENT_TYPE eltype;
|
|
919
|
+
// const POINT3D * points;
|
|
920
|
+
FlatVector<Vec<3> > points;
|
|
921
|
+
const EDGE * edges;
|
|
922
|
+
const FACE * faces;
|
|
923
|
+
EDGE hedges[4];
|
|
924
|
+
FACE hfaces[6];
|
|
925
|
+
bool swapped = false; // new orientation with 2 tet-classes
|
|
926
|
+
VorB vb = BND; // facet codimension
|
|
927
|
+
public:
|
|
928
|
+
Facet2ElementTrafo(ELEMENT_TYPE aeltype, VorB _vb = BND)
|
|
929
|
+
: eltype(aeltype),
|
|
930
|
+
points(99,(Vec<3>*)ElementTopology::GetVertices (aeltype)),
|
|
931
|
+
vb(_vb)
|
|
932
|
+
{
|
|
933
|
+
// points = ElementTopology::GetVertices (eltype);
|
|
934
|
+
edges = ElementTopology::GetEdges (eltype);
|
|
935
|
+
faces = ElementTopology::GetFaces (eltype);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// Facet2ElementTrafo(ELEMENT_TYPE aeltype, const FlatArray<int> & vnums)
|
|
939
|
+
|
|
940
|
+
template <typename T>
|
|
941
|
+
Facet2ElementTrafo(ELEMENT_TYPE aeltype, const BaseArrayObject<T> & vnums)
|
|
942
|
+
: eltype(aeltype),
|
|
943
|
+
points(99,(Vec<3>*)ElementTopology::GetVertices (aeltype))
|
|
944
|
+
{
|
|
945
|
+
// points = ElementTopology::GetVertices (eltype);
|
|
946
|
+
edges = ElementTopology::GetEdges (eltype);
|
|
947
|
+
faces = ElementTopology::GetFaces (eltype);
|
|
948
|
+
|
|
949
|
+
if (eltype == ET_TRIG)
|
|
950
|
+
{
|
|
951
|
+
for (int i = 0; i < 3; i++)
|
|
952
|
+
{
|
|
953
|
+
hedges[i][0] = edges[i][0];
|
|
954
|
+
hedges[i][1] = edges[i][1];
|
|
955
|
+
if (vnums[hedges[i][0]] > vnums[hedges[i][1]])
|
|
956
|
+
swap (hedges[i][0], hedges[i][1]);
|
|
957
|
+
}
|
|
958
|
+
edges = &hedges[0];
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
if (eltype == ET_QUAD)
|
|
962
|
+
{
|
|
963
|
+
for (int i = 0; i < 4; i++)
|
|
964
|
+
{
|
|
965
|
+
hedges[i][0] = edges[i][0];
|
|
966
|
+
hedges[i][1] = edges[i][1];
|
|
967
|
+
if (vnums[hedges[i][0]] > vnums[hedges[i][1]])
|
|
968
|
+
swap (hedges[i][0], hedges[i][1]);
|
|
969
|
+
}
|
|
970
|
+
edges = &hedges[0];
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
if (eltype == ET_TET)
|
|
974
|
+
{
|
|
975
|
+
for (int i = 0; i < 4; i++)
|
|
976
|
+
{
|
|
977
|
+
hfaces[i][0] = faces[i][0];
|
|
978
|
+
hfaces[i][1] = faces[i][1];
|
|
979
|
+
hfaces[i][2] = faces[i][2];
|
|
980
|
+
if (vnums[hfaces[i][0]] > vnums[hfaces[i][1]]) swap (hfaces[i][0], hfaces[i][1]);
|
|
981
|
+
if (vnums[hfaces[i][1]] > vnums[hfaces[i][2]]) swap (hfaces[i][1], hfaces[i][2]);
|
|
982
|
+
if (vnums[hfaces[i][0]] > vnums[hfaces[i][1]]) swap (hfaces[i][0], hfaces[i][1]);
|
|
983
|
+
}
|
|
984
|
+
faces = &hfaces[0];
|
|
985
|
+
swapped = vnums[2] > vnums[3];
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
if (eltype == ET_PRISM)
|
|
990
|
+
{
|
|
991
|
+
for (int i = 0; i < 2; i++)
|
|
992
|
+
{
|
|
993
|
+
hfaces[i][0] = faces[i][0];
|
|
994
|
+
hfaces[i][1] = faces[i][1];
|
|
995
|
+
hfaces[i][2] = faces[i][2];
|
|
996
|
+
if (vnums[hfaces[i][0]] > vnums[hfaces[i][1]]) swap (hfaces[i][0], hfaces[i][1]);
|
|
997
|
+
if (vnums[hfaces[i][1]] > vnums[hfaces[i][2]]) swap (hfaces[i][1], hfaces[i][2]);
|
|
998
|
+
if (vnums[hfaces[i][0]] > vnums[hfaces[i][1]]) swap (hfaces[i][0], hfaces[i][1]);
|
|
999
|
+
}
|
|
1000
|
+
for (int i = 2; i < 5; i++)
|
|
1001
|
+
{
|
|
1002
|
+
int jmin = 0;
|
|
1003
|
+
for (int j = 1; j < 4; j++)
|
|
1004
|
+
if (vnums[faces[i][j]] < vnums[faces[i][jmin]]) jmin = j;
|
|
1005
|
+
int j1 = (jmin+1)%4;
|
|
1006
|
+
int j2 = (jmin+2)%4;
|
|
1007
|
+
int j3 = (jmin+3)%4;
|
|
1008
|
+
if (vnums[faces[i][j3]] < vnums[faces[i][j1]]) swap (j1, j3);
|
|
1009
|
+
|
|
1010
|
+
hfaces[i][0] = faces[i][jmin];
|
|
1011
|
+
hfaces[i][1] = faces[i][j1];
|
|
1012
|
+
hfaces[i][2] = faces[i][j2];
|
|
1013
|
+
hfaces[i][3] = faces[i][j3];
|
|
1014
|
+
}
|
|
1015
|
+
faces = &hfaces[0];
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if (eltype == ET_HEX)
|
|
1019
|
+
{
|
|
1020
|
+
for (int i = 0; i < 6; i++)
|
|
1021
|
+
{
|
|
1022
|
+
int jmin = 0;
|
|
1023
|
+
for (int j = 1; j < 4; j++)
|
|
1024
|
+
if (vnums[faces[i][j]] < vnums[faces[i][jmin]]) jmin = j;
|
|
1025
|
+
int j1 = (jmin+1)%4;
|
|
1026
|
+
int j2 = (jmin+2)%4;
|
|
1027
|
+
int j3 = (jmin+3)%4;
|
|
1028
|
+
if (vnums[faces[i][j3]] < vnums[faces[i][j1]]) swap (j1, j3);
|
|
1029
|
+
|
|
1030
|
+
hfaces[i][0] = faces[i][jmin];
|
|
1031
|
+
hfaces[i][1] = faces[i][j1];
|
|
1032
|
+
hfaces[i][2] = faces[i][j2];
|
|
1033
|
+
hfaces[i][3] = faces[i][j3];
|
|
1034
|
+
}
|
|
1035
|
+
faces = &hfaces[0];
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
ELEMENT_TYPE FacetType (int fnr) const
|
|
1040
|
+
{
|
|
1041
|
+
if (vb == VOL)
|
|
1042
|
+
return eltype;
|
|
1043
|
+
if (vb == BND)
|
|
1044
|
+
return ElementTopology::GetFacetType(eltype, fnr);
|
|
1045
|
+
else
|
|
1046
|
+
{
|
|
1047
|
+
if (Dim(eltype)-int(vb) == 1)
|
|
1048
|
+
return ET_SEGM;
|
|
1049
|
+
else
|
|
1050
|
+
return ET_POINT;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
size_t GetNFacets () const
|
|
1055
|
+
{
|
|
1056
|
+
if (vb == VOL)
|
|
1057
|
+
return 1;
|
|
1058
|
+
else if (vb == BND)
|
|
1059
|
+
return ElementTopology::GetNFacets(eltype);
|
|
1060
|
+
else
|
|
1061
|
+
{
|
|
1062
|
+
if (Dim(eltype)-int(vb) == 1)
|
|
1063
|
+
return ElementTopology::GetNEdges(eltype);
|
|
1064
|
+
else
|
|
1065
|
+
return ElementTopology::GetNVertices(eltype); // points
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
void operator()(int fnr, const IntegrationPoint &ipfac, IntegrationPoint & ipvol) const
|
|
1070
|
+
{
|
|
1071
|
+
if (vb == VOL)
|
|
1072
|
+
{
|
|
1073
|
+
ipvol = ipfac;
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
switch (FacetType(fnr))
|
|
1078
|
+
{
|
|
1079
|
+
case ET_POINT:
|
|
1080
|
+
{
|
|
1081
|
+
ipvol = Vec<3> (points (fnr) );
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
case ET_SEGM:
|
|
1086
|
+
{
|
|
1087
|
+
FlatVec<3> p1 = points (edges[fnr][0]);
|
|
1088
|
+
FlatVec<3> p2 = points (edges[fnr][1]);
|
|
1089
|
+
|
|
1090
|
+
ipvol = Vec<3> (p2 + ipfac(0) * (p1-p2));
|
|
1091
|
+
break;
|
|
1092
|
+
}
|
|
1093
|
+
case ET_TRIG:
|
|
1094
|
+
{
|
|
1095
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1096
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1097
|
+
FlatVec<3> p2 = points(faces[fnr][2]);
|
|
1098
|
+
|
|
1099
|
+
ipvol = Vec<3> (p2 + ipfac(0) * (p0-p2) + ipfac(1)*(p1-p2));
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
case ET_QUAD:
|
|
1103
|
+
{
|
|
1104
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1105
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1106
|
+
FlatVec<3> p2 = points(faces[fnr][3]);
|
|
1107
|
+
|
|
1108
|
+
ipvol = Vec<3> (p0 + ipfac(0) * (p1-p0) + ipfac(1)*(p2-p0));
|
|
1109
|
+
break;
|
|
1110
|
+
}
|
|
1111
|
+
default:
|
|
1112
|
+
throw Exception ("undefined facet type in Facet2ElementTrafo()\n");
|
|
1113
|
+
}
|
|
1114
|
+
ipvol.SetWeight(ipfac.Weight());
|
|
1115
|
+
// ipvol.FacetNr() = fnr;
|
|
1116
|
+
ipvol.SetFacetNr(fnr, vb);
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
FlatMatrix<> GetJacobian(int fnr, LocalHeap & lh) const
|
|
1120
|
+
{
|
|
1121
|
+
// ELEMENT_TYPE facettype = ElementTopology::GetFacetType(eltype, fnr);
|
|
1122
|
+
// switch (facettype)
|
|
1123
|
+
switch (FacetType(fnr))
|
|
1124
|
+
{
|
|
1125
|
+
case ET_SEGM:
|
|
1126
|
+
{
|
|
1127
|
+
FlatMatrix<> mat(2,1,lh);
|
|
1128
|
+
FlatVec<3> p1 = points (edges[fnr][0]);
|
|
1129
|
+
FlatVec<3> p2 = points (edges[fnr][1]);
|
|
1130
|
+
mat.Col(0) = (p1 - p2).Range(0,2);
|
|
1131
|
+
return mat;
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
case ET_TRIG:
|
|
1135
|
+
{
|
|
1136
|
+
FlatMatrix<> mat(3,2,lh);
|
|
1137
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1138
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1139
|
+
FlatVec<3> p2 = points(faces[fnr][2]);
|
|
1140
|
+
mat.Col(0) = p0 - p2;
|
|
1141
|
+
mat.Col(1) = p1 - p2;
|
|
1142
|
+
return mat;
|
|
1143
|
+
break;
|
|
1144
|
+
}
|
|
1145
|
+
case ET_QUAD:
|
|
1146
|
+
{
|
|
1147
|
+
FlatMatrix<> mat(3,2,lh);
|
|
1148
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1149
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1150
|
+
FlatVec<3> p2 = points(faces[fnr][3]);
|
|
1151
|
+
mat.Col(0) = p1 - p0;
|
|
1152
|
+
mat.Col(1) = p2 - p0;
|
|
1153
|
+
return mat;
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
default:
|
|
1157
|
+
throw Exception ("undefined facet type in Facet2ElementTrafo::GetJacobian(..)\n");
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
const IntegrationPoint operator()(int fnr, const IntegrationPoint &ip1d) const
|
|
1163
|
+
{
|
|
1164
|
+
IntegrationPoint elpoint;
|
|
1165
|
+
operator()(fnr, ip1d, elpoint);
|
|
1166
|
+
return elpoint;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
IntegrationRule & operator() (int fnr, const IntegrationRule & irfacet, LocalHeap & lh)
|
|
1170
|
+
{
|
|
1171
|
+
if (vb == VOL) return const_cast<IntegrationRule&> (irfacet);
|
|
1172
|
+
|
|
1173
|
+
IntegrationRule & irvol = *new (lh) IntegrationRule (irfacet.GetNIP(), lh);
|
|
1174
|
+
|
|
1175
|
+
// switch (ElementTopology::GetFacetType(eltype, fnr))
|
|
1176
|
+
switch (FacetType(fnr))
|
|
1177
|
+
{
|
|
1178
|
+
case ET_POINT:
|
|
1179
|
+
{
|
|
1180
|
+
irvol[0] = Vec<3> (points (fnr) );
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
case ET_SEGM:
|
|
1184
|
+
{
|
|
1185
|
+
FlatVec<3> p1 = points (edges[fnr][0]);
|
|
1186
|
+
FlatVec<3> p2 = points (edges[fnr][1]);
|
|
1187
|
+
|
|
1188
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1189
|
+
irvol[i] = Vec<3> (p2 + irfacet[i](0) * (p1-p2));
|
|
1190
|
+
break;
|
|
1191
|
+
}
|
|
1192
|
+
case ET_TRIG:
|
|
1193
|
+
{
|
|
1194
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1195
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1196
|
+
FlatVec<3> p2 = points(faces[fnr][2]);
|
|
1197
|
+
|
|
1198
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1199
|
+
irvol[i] = Vec<3> (p2 + irfacet[i](0) * (p0-p2) + irfacet[i](1)*(p1-p2));
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
case ET_QUAD:
|
|
1203
|
+
{
|
|
1204
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1205
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1206
|
+
FlatVec<3> p2 = points(faces[fnr][3]);
|
|
1207
|
+
|
|
1208
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1209
|
+
irvol[i] = Vec<3> (p0 + irfacet[i](0) * (p1-p0) + irfacet[i](1)*(p2-p0));
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
default:
|
|
1213
|
+
throw Exception ("undefined facet type in Facet2ElementTrafo()\n");
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1217
|
+
{
|
|
1218
|
+
irvol[i].SetFacetNr(fnr, vb);
|
|
1219
|
+
irvol[i].SetWeight(irfacet[i].Weight());
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return irvol;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
NGS_DLL_HEADER const class SIMD_IntegrationRule & operator() (int fnr, const class SIMD_IntegrationRule & irfacet, LocalHeap & lh);
|
|
1227
|
+
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
// transformation of (d-1) dimensional integration points on facets to
|
|
1237
|
+
// d-dimensional point in volumes
|
|
1238
|
+
class Facet2SurfaceElementTrafo
|
|
1239
|
+
{
|
|
1240
|
+
protected:
|
|
1241
|
+
// mutable IntegrationPoint elpoint;
|
|
1242
|
+
ELEMENT_TYPE eltype;
|
|
1243
|
+
// const POINT3D * points;
|
|
1244
|
+
FlatVector<Vec<3> > points;
|
|
1245
|
+
const EDGE * edges;
|
|
1246
|
+
const FACE * faces;
|
|
1247
|
+
EDGE hedges[4];
|
|
1248
|
+
FACE hfaces[6];
|
|
1249
|
+
public:
|
|
1250
|
+
Facet2SurfaceElementTrafo(ELEMENT_TYPE aeltype) :
|
|
1251
|
+
eltype(aeltype),
|
|
1252
|
+
points(99,(Vec<3>*)ElementTopology::GetVertices (aeltype))
|
|
1253
|
+
{
|
|
1254
|
+
// points = ElementTopology::GetVertices (eltype);
|
|
1255
|
+
edges = ElementTopology::GetEdges (eltype);
|
|
1256
|
+
faces = ElementTopology::GetFaces (eltype);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
Facet2SurfaceElementTrafo(ELEMENT_TYPE aeltype, FlatArray<int> & vnums)
|
|
1260
|
+
: eltype(aeltype),
|
|
1261
|
+
points(99,(Vec<3>*)ElementTopology::GetVertices (aeltype))
|
|
1262
|
+
{
|
|
1263
|
+
// points = ElementTopology::GetVertices (eltype);
|
|
1264
|
+
edges = ElementTopology::GetEdges (eltype);
|
|
1265
|
+
faces = ElementTopology::GetFaces (eltype);
|
|
1266
|
+
|
|
1267
|
+
if (eltype == ET_SEGM)
|
|
1268
|
+
{
|
|
1269
|
+
hedges[0][0] = edges[0][0];
|
|
1270
|
+
hedges[0][1] = edges[0][1];
|
|
1271
|
+
if (vnums[hedges[0][0]] > vnums[hedges[0][1]])
|
|
1272
|
+
swap (hedges[0][0], hedges[0][1]);
|
|
1273
|
+
edges = &hedges[0];
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
if (eltype == ET_TRIG)
|
|
1277
|
+
{
|
|
1278
|
+
hfaces[0][0] = faces[0][0];
|
|
1279
|
+
hfaces[0][1] = faces[0][1];
|
|
1280
|
+
hfaces[0][2] = faces[0][2];
|
|
1281
|
+
if (vnums[hfaces[0][0]] > vnums[hfaces[0][1]]) swap (hfaces[0][0], hfaces[0][1]);
|
|
1282
|
+
if (vnums[hfaces[0][1]] > vnums[hfaces[0][2]]) swap (hfaces[0][1], hfaces[0][2]);
|
|
1283
|
+
if (vnums[hfaces[0][0]] > vnums[hfaces[0][1]]) swap (hfaces[0][0], hfaces[0][1]);
|
|
1284
|
+
|
|
1285
|
+
faces = &hfaces[0];
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
if (eltype == ET_QUAD)
|
|
1289
|
+
{
|
|
1290
|
+
int jmin = 0;
|
|
1291
|
+
for (int j = 1; j < 4; j++)
|
|
1292
|
+
if (vnums[faces[0][j]] < vnums[faces[0][jmin]]) jmin = j;
|
|
1293
|
+
int j1 = (jmin+1)%4;
|
|
1294
|
+
int j2 = (jmin+2)%4;
|
|
1295
|
+
int j3 = (jmin+3)%4;
|
|
1296
|
+
if (vnums[faces[0][j3]] < vnums[faces[0][j1]]) swap (j1, j3);
|
|
1297
|
+
|
|
1298
|
+
hfaces[0][0] = faces[0][jmin];
|
|
1299
|
+
hfaces[0][1] = faces[0][j1];
|
|
1300
|
+
hfaces[0][2] = faces[0][j2];
|
|
1301
|
+
hfaces[0][3] = faces[0][j3];
|
|
1302
|
+
faces = &hfaces[0];
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
void operator()(const IntegrationPoint &ipfac, IntegrationPoint & ipvol) const
|
|
1308
|
+
{
|
|
1309
|
+
int fnr = 0;
|
|
1310
|
+
switch (eltype)
|
|
1311
|
+
{
|
|
1312
|
+
case ET_POINT:
|
|
1313
|
+
{
|
|
1314
|
+
ipvol = Vec<3> (points (fnr) );
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
case ET_SEGM:
|
|
1319
|
+
{
|
|
1320
|
+
/*
|
|
1321
|
+
const POINT3D & p1 = points[edges[fnr][0]];
|
|
1322
|
+
const POINT3D & p2 = points[edges[fnr][1]];
|
|
1323
|
+
for (int j = 0; j < 3; j++)
|
|
1324
|
+
ipvol(j) = p2[j] + (ipfac(0))*(p1[j]-p2[j]);
|
|
1325
|
+
*/
|
|
1326
|
+
FlatVec<3> p1 = points (edges[fnr][0]);
|
|
1327
|
+
FlatVec<3> p2 = points (edges[fnr][1]);
|
|
1328
|
+
ipvol = Vec<3> (p2 + ipfac(0) * (p1-p2));
|
|
1329
|
+
break;
|
|
1330
|
+
}
|
|
1331
|
+
case ET_TRIG:
|
|
1332
|
+
{
|
|
1333
|
+
/*
|
|
1334
|
+
const POINT3D & p0 = points[faces[fnr][0]];
|
|
1335
|
+
const POINT3D & p1 = points[faces[fnr][1]];
|
|
1336
|
+
const POINT3D & p2 = points[faces[fnr][2]];
|
|
1337
|
+
ipvol(0) = p2[0] + ipfac(0)*(p0[0]-p2[0]) + ipfac(1)*(p1[0]-p2[0]);
|
|
1338
|
+
ipvol(1) = p2[1] + ipfac(0)*(p0[1]-p2[1]) + ipfac(1)*(p1[1]-p2[1]);
|
|
1339
|
+
ipvol(2) = p2[2] + ipfac(0)*(p0[2]-p2[2]) + ipfac(1)*(p1[2]-p2[2]);
|
|
1340
|
+
*/
|
|
1341
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1342
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1343
|
+
FlatVec<3> p2 = points(faces[fnr][2]);
|
|
1344
|
+
ipvol = Vec<3> (p2 + ipfac(0) * (p0-p2) + ipfac(1)*(p1-p2));
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
case ET_QUAD:
|
|
1348
|
+
{
|
|
1349
|
+
/*
|
|
1350
|
+
const POINT3D & p0 = points[faces[fnr][0]];
|
|
1351
|
+
const POINT3D & p1 = points[faces[fnr][1]];
|
|
1352
|
+
const POINT3D & p2 = points[faces[fnr][3]];
|
|
1353
|
+
ipvol(0) = p0[0] + ipfac(0)*(p1[0]-p0[0]) + ipfac(1)*(p2[0]-p0[0]);
|
|
1354
|
+
ipvol(1) = p0[1] + ipfac(0)*(p1[1]-p0[1]) + ipfac(1)*(p2[1]-p0[1]);
|
|
1355
|
+
ipvol(2) = p0[2] + ipfac(0)*(p1[2]-p0[2]) + ipfac(1)*(p2[2]-p0[2]);
|
|
1356
|
+
*/
|
|
1357
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1358
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1359
|
+
FlatVec<3> p2 = points(faces[fnr][3]);
|
|
1360
|
+
ipvol = Vec<3> (p0 + ipfac(0) * (p1-p0) + ipfac(1)*(p2-p0));
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
default:
|
|
1364
|
+
throw Exception ("undefined facet type in Facet2ElementTrafo()\n");
|
|
1365
|
+
|
|
1366
|
+
}
|
|
1367
|
+
/* cerr << "*** mapping integrationpoint for element " << eltype << " and facel " << fnr << " of type " << facettype << endl;
|
|
1368
|
+
cerr << " * ipfac = " << ipfac;
|
|
1369
|
+
cerr << " * ipvol = " << ipvol;*/
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
IntegrationRule & operator() (const IntegrationRule & irfacet, LocalHeap & lh)
|
|
1373
|
+
{
|
|
1374
|
+
IntegrationRule & irvol = *new (lh) IntegrationRule (irfacet.GetNIP(), lh);
|
|
1375
|
+
int fnr = 0;
|
|
1376
|
+
switch (eltype)
|
|
1377
|
+
{
|
|
1378
|
+
case ET_POINT:
|
|
1379
|
+
{
|
|
1380
|
+
irvol[0] = Vec<3> (points (fnr) );
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
case ET_SEGM:
|
|
1384
|
+
{
|
|
1385
|
+
FlatVec<3> p1 = points (edges[fnr][0]);
|
|
1386
|
+
FlatVec<3> p2 = points (edges[fnr][1]);
|
|
1387
|
+
|
|
1388
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1389
|
+
irvol[i] = Vec<3> (p2 + irfacet[i](0) * (p1-p2));
|
|
1390
|
+
break;
|
|
1391
|
+
}
|
|
1392
|
+
case ET_TRIG:
|
|
1393
|
+
{
|
|
1394
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1395
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1396
|
+
FlatVec<3> p2 = points(faces[fnr][2]);
|
|
1397
|
+
|
|
1398
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1399
|
+
irvol[i] = Vec<3> (p2 + irfacet[i](0) * (p0-p2) + irfacet[i](1)*(p1-p2));
|
|
1400
|
+
break;
|
|
1401
|
+
}
|
|
1402
|
+
case ET_QUAD:
|
|
1403
|
+
{
|
|
1404
|
+
FlatVec<3> p0 = points(faces[fnr][0]);
|
|
1405
|
+
FlatVec<3> p1 = points(faces[fnr][1]);
|
|
1406
|
+
FlatVec<3> p2 = points(faces[fnr][3]);
|
|
1407
|
+
|
|
1408
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1409
|
+
irvol[i] = Vec<3> (p0 + irfacet[i](0) * (p1-p0) + irfacet[i](1)*(p2-p0));
|
|
1410
|
+
break;
|
|
1411
|
+
}
|
|
1412
|
+
default:
|
|
1413
|
+
throw Exception ("undefined facet type in Facet2SurfaceElementTrafo()\n");
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
for (int i = 0; i < irfacet.GetNIP(); i++)
|
|
1417
|
+
{
|
|
1418
|
+
// irvol[i].SetFacetNr(fnr);
|
|
1419
|
+
irvol[i].SetWeight(irfacet[i].Weight());
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
return irvol;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
const IntegrationPoint operator()(const IntegrationPoint &ip1d) const
|
|
1426
|
+
{
|
|
1427
|
+
IntegrationPoint elpoint;
|
|
1428
|
+
operator()(ip1d, elpoint);
|
|
1429
|
+
return elpoint;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
NGS_DLL_HEADER class SIMD_IntegrationRule & operator() (const class SIMD_IntegrationRule & irfacet, LocalHeap & lh);
|
|
1433
|
+
|
|
1434
|
+
IntegrationRule & Inverse (const IntegrationRule & ir, LocalHeap & lh);
|
|
1435
|
+
class SIMD_IntegrationRule & Inverse (const class SIMD_IntegrationRule & ir, LocalHeap & lh);
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
class NGS_DLL_HEADER BaseMappedIntegrationRule
|
|
1451
|
+
{
|
|
1452
|
+
protected:
|
|
1453
|
+
IntegrationRule ir;
|
|
1454
|
+
const ElementTransformation & eltrans;
|
|
1455
|
+
char * baseip;
|
|
1456
|
+
size_t incr;
|
|
1457
|
+
// mir on other element as needed for evaluating DG jump terms
|
|
1458
|
+
const BaseMappedIntegrationRule * other_mir = nullptr;
|
|
1459
|
+
|
|
1460
|
+
public:
|
|
1461
|
+
INLINE BaseMappedIntegrationRule (const IntegrationRule & air,
|
|
1462
|
+
const ElementTransformation & aeltrans)
|
|
1463
|
+
: ir(air.Size(),&air[0]), eltrans(aeltrans) { ; }
|
|
1464
|
+
INLINE ~BaseMappedIntegrationRule ()
|
|
1465
|
+
{
|
|
1466
|
+
ir.NothingToDelete();
|
|
1467
|
+
}
|
|
1468
|
+
INLINE size_t Size() const { return ir.Size(); }
|
|
1469
|
+
INLINE const IntegrationRule & IR() const { return ir; }
|
|
1470
|
+
INLINE const ElementTransformation & GetTransformation () const { return eltrans; }
|
|
1471
|
+
|
|
1472
|
+
INLINE BaseMappedIntegrationPoint & operator[] (size_t i) const
|
|
1473
|
+
{ return *static_cast<BaseMappedIntegrationPoint*> ((void*)(baseip+i*incr)); }
|
|
1474
|
+
|
|
1475
|
+
virtual BaseMappedIntegrationRule & Range(size_t first, size_t next, LocalHeap & lh) const = 0;
|
|
1476
|
+
|
|
1477
|
+
auto begin () const { return AOWrapperIterator<BaseMappedIntegrationRule> (*this, 0); }
|
|
1478
|
+
auto end () const { return AOWrapperIterator<BaseMappedIntegrationRule> (*this, Size()); }
|
|
1479
|
+
|
|
1480
|
+
int DimElement() const;
|
|
1481
|
+
int DimSpace() const;
|
|
1482
|
+
|
|
1483
|
+
virtual SliceMatrix<> GetPoints() const = 0;
|
|
1484
|
+
virtual SliceMatrix<> GetNormals() const = 0;
|
|
1485
|
+
virtual SliceMatrix<Complex> GetPointsComplex() const
|
|
1486
|
+
{ throw Exception("don't have complex ir"); }
|
|
1487
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et) { throw Exception ("ComputeNormalsAndMeasure(ET) not overloaded"); }
|
|
1488
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr) = 0;
|
|
1489
|
+
virtual bool IsComplex() const = 0;
|
|
1490
|
+
|
|
1491
|
+
// for DG jump terms
|
|
1492
|
+
void SetOtherMIR (const BaseMappedIntegrationRule * other) { other_mir = other; }
|
|
1493
|
+
auto GetOtherMIR () const { return other_mir; }
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
template <int DIM_ELEMENT, int DIM_SPACE, typename SCAL = double>
|
|
1497
|
+
class NGS_DLL_HEADER MappedIntegrationRule : public BaseMappedIntegrationRule
|
|
1498
|
+
{
|
|
1499
|
+
static_assert(DIM_ELEMENT <= DIM_SPACE, "DIM-source > DIM-range !!");
|
|
1500
|
+
FlatArray< MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE, SCAL> > mips;
|
|
1501
|
+
public:
|
|
1502
|
+
typedef SCAL TSCAL;
|
|
1503
|
+
MappedIntegrationRule (const IntegrationRule & ir,
|
|
1504
|
+
const ElementTransformation & aeltrans,
|
|
1505
|
+
Allocator & lh);
|
|
1506
|
+
|
|
1507
|
+
INLINE MappedIntegrationRule (const IntegrationRule & ir,
|
|
1508
|
+
const ElementTransformation & eltrans,
|
|
1509
|
+
int dummy,
|
|
1510
|
+
Allocator & lh)
|
|
1511
|
+
: BaseMappedIntegrationRule (ir, eltrans), mips(ir.Size(), lh)
|
|
1512
|
+
{
|
|
1513
|
+
baseip = (char*)(void*)(BaseMappedIntegrationPoint*)(&mips[0]);
|
|
1514
|
+
incr = sizeof (MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE,SCAL>);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
INLINE MappedIntegrationRule (const IntegrationRule & air,
|
|
1518
|
+
const ElementTransformation & aeltrans,
|
|
1519
|
+
FlatArray< MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE,SCAL> > amips)
|
|
1520
|
+
: BaseMappedIntegrationRule (air, aeltrans), mips(amips)
|
|
1521
|
+
{
|
|
1522
|
+
baseip = (char*)(void*)(BaseMappedIntegrationPoint*)(&mips[0]);
|
|
1523
|
+
if (mips.Size() > 1)
|
|
1524
|
+
incr = (char*)(void*)(&mips[1]) - (char*)(void*)(&mips[0]);
|
|
1525
|
+
else
|
|
1526
|
+
incr = 0;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
virtual ~MappedIntegrationRule() { }
|
|
1530
|
+
INLINE MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE> & operator[] (size_t i) const
|
|
1531
|
+
{
|
|
1532
|
+
// return mips[i];
|
|
1533
|
+
return static_cast<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE> &> (BaseMappedIntegrationRule::operator[] (i));
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
INLINE MappedIntegrationRule Range(size_t first, size_t next) const
|
|
1537
|
+
{
|
|
1538
|
+
return MappedIntegrationRule (ir.Range(first,next), eltrans, mips.Range(first,next));
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
virtual BaseMappedIntegrationRule & Range(size_t first, size_t next, LocalHeap & lh) const
|
|
1542
|
+
{
|
|
1543
|
+
return *new (lh) MappedIntegrationRule (ir.Range(first,next), eltrans, mips.Range(first,next));
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
auto begin() { return mips.begin(); }
|
|
1547
|
+
auto end() { return mips.end(); }
|
|
1548
|
+
|
|
1549
|
+
virtual SliceMatrix<> GetPoints() const
|
|
1550
|
+
{
|
|
1551
|
+
return SliceMatrix<> (mips.Size(), DIM_SPACE*sizeof(SCAL)/sizeof(double),
|
|
1552
|
+
sizeof(MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE, SCAL>) / sizeof(double),
|
|
1553
|
+
const_cast<double*> (&mips[0].GetPoint()(0)));
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
virtual SliceMatrix<> GetNormals() const
|
|
1557
|
+
{
|
|
1558
|
+
return SliceMatrix<> (mips.Size(), DIM_SPACE*sizeof(SCAL)/sizeof(double),
|
|
1559
|
+
sizeof(MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE, SCAL>) / sizeof(double),
|
|
1560
|
+
const_cast<double*> (&mips[0].GetNV()(0)));
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et);
|
|
1564
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr);
|
|
1565
|
+
virtual bool IsComplex() const { return false; }
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
template <int DIM_ELEMENT, int DIM_SPACE>
|
|
1569
|
+
class NGS_DLL_HEADER MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE,Complex> : public BaseMappedIntegrationRule
|
|
1570
|
+
{
|
|
1571
|
+
using SCAL = Complex;
|
|
1572
|
+
FlatArray< MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE, Complex> > mips;
|
|
1573
|
+
public:
|
|
1574
|
+
MappedIntegrationRule (const IntegrationRule & ir,
|
|
1575
|
+
const ElementTransformation & aeltrans,
|
|
1576
|
+
Allocator & lh);
|
|
1577
|
+
|
|
1578
|
+
INLINE MappedIntegrationRule (const IntegrationRule & ir,
|
|
1579
|
+
const ElementTransformation & eltrans,
|
|
1580
|
+
int dummy,
|
|
1581
|
+
Allocator & lh)
|
|
1582
|
+
: BaseMappedIntegrationRule (ir, eltrans), mips(ir.Size(), lh)
|
|
1583
|
+
{
|
|
1584
|
+
baseip = (char*)(void*)(BaseMappedIntegrationPoint*)(&mips[0]);
|
|
1585
|
+
incr = sizeof (MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE,SCAL>);
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
INLINE MappedIntegrationRule (const IntegrationRule & air,
|
|
1589
|
+
const ElementTransformation & aeltrans,
|
|
1590
|
+
FlatArray< MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE,SCAL> > amips)
|
|
1591
|
+
: BaseMappedIntegrationRule (air, aeltrans), mips(amips)
|
|
1592
|
+
{
|
|
1593
|
+
baseip = (char*)(void*)(BaseMappedIntegrationPoint*)(&mips[0]);
|
|
1594
|
+
if (mips.Size() > 1)
|
|
1595
|
+
incr = (char*)(void*)(&mips[1]) - (char*)(void*)(&mips[0]);
|
|
1596
|
+
else
|
|
1597
|
+
incr = 0;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
INLINE MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE,SCAL> & operator[] (int i) const
|
|
1601
|
+
{
|
|
1602
|
+
return mips[i];
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
INLINE MappedIntegrationRule Range(size_t first, size_t next) const
|
|
1606
|
+
{
|
|
1607
|
+
return MappedIntegrationRule (ir.Range(first,next), eltrans, mips.Range(first,next));
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
virtual BaseMappedIntegrationRule & Range(size_t first, size_t next, LocalHeap & lh) const
|
|
1611
|
+
{
|
|
1612
|
+
return *new (lh) MappedIntegrationRule (ir.Range(first,next), eltrans, mips.Range(first,next));
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
virtual SliceMatrix<> GetPoints() const
|
|
1616
|
+
{
|
|
1617
|
+
throw Exception("don't have real points for complex ir");
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
virtual SliceMatrix<Complex> GetPointsComplex() const
|
|
1621
|
+
{
|
|
1622
|
+
return SliceMatrix<Complex> (mips.Size(), DIM_SPACE,
|
|
1623
|
+
//&mips[1].GetPoint()(0) - &mips[0].GetPoint()(0),
|
|
1624
|
+
sizeof(MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE, SCAL>) / sizeof(Complex),
|
|
1625
|
+
const_cast<Complex*> (&mips[0].GetPointComplex()(0)));
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
virtual SliceMatrix<> GetNormals() const
|
|
1629
|
+
{
|
|
1630
|
+
throw Exception("never tested");
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr);
|
|
1635
|
+
virtual bool IsComplex() const { return true; }
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
ostream & operator<< (ostream & ost, const BaseMappedIntegrationRule & mir);
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
template <int DIM_ELEMENT, int DIM_SPACE, typename SCAL>
|
|
1643
|
+
inline ostream & operator<< (ostream & ost, const MappedIntegrationRule<DIM_ELEMENT,DIM_SPACE,SCAL> & mir)
|
|
1644
|
+
{
|
|
1645
|
+
for (auto & mip : mir)
|
|
1646
|
+
ost << mip << endl;
|
|
1647
|
+
return ost;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
template <int DIMS, int DIMR, typename SCAL>
|
|
1651
|
+
void MappedIntegrationPoint<DIMS,DIMR,SCAL>::
|
|
1652
|
+
IntegrationRuleFromPoint(std::function<void(const BaseMappedIntegrationRule&)> func) const
|
|
1653
|
+
{
|
|
1654
|
+
if constexpr (std::is_same_v<SCAL,double> || std::is_same_v<SCAL,Complex>)
|
|
1655
|
+
{
|
|
1656
|
+
FlatArray<MappedIntegrationPoint<DIMS,DIMR,SCAL>> ia(1, const_cast<MappedIntegrationPoint*>(this));
|
|
1657
|
+
IntegrationRule ir(1, const_cast<IntegrationPoint*>(&this->IP()));
|
|
1658
|
+
MappedIntegrationRule<DIMS,DIMR,SCAL> mir(ir, this->GetTransformation(), ia);
|
|
1659
|
+
func (mir);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
// deprecated, don't use SpecificIntegrationPoint anymore
|
|
1668
|
+
template <int DIMS, int DIMR, typename SCAL>
|
|
1669
|
+
using SpecificIntegrationPoint = MappedIntegrationPoint<DIMS,DIMR,SCAL>;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
namespace ngcore
|
|
1673
|
+
{
|
|
1674
|
+
using ngbla::Vec;
|
|
1675
|
+
using ngbla::Mat;
|
|
1676
|
+
using ngbla::FlatVector;
|
|
1677
|
+
|
|
1678
|
+
template<>
|
|
1679
|
+
class alignas(sizeof(SIMD<double>)) SIMD<ngfem::IntegrationPoint>
|
|
1680
|
+
{
|
|
1681
|
+
SIMD<double> x[3], weight;
|
|
1682
|
+
int facetnr = -1;
|
|
1683
|
+
ngfem::VorB vb = ngfem::VOL;
|
|
1684
|
+
public:
|
|
1685
|
+
static constexpr size_t Size() { return SIMD<double>::Size(); }
|
|
1686
|
+
|
|
1687
|
+
SIMD() = default;
|
|
1688
|
+
SIMD (const SIMD &) = default;
|
|
1689
|
+
SIMD & operator= (const SIMD &) = default;
|
|
1690
|
+
|
|
1691
|
+
template <typename Function>
|
|
1692
|
+
SIMD (const Function & func)
|
|
1693
|
+
{
|
|
1694
|
+
ngfem::IntegrationPoint ip[Size()];
|
|
1695
|
+
for (int i = 0; i < Size(); i++) ip[i] = func(i);
|
|
1696
|
+
for (int j = 0; j < 3; j++)
|
|
1697
|
+
x[j] = [&ip,j] (int i) { return ip[i](j); };
|
|
1698
|
+
weight = [&ip] (int i) { return ip[i].Weight(); };
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
template <int DIM>
|
|
1702
|
+
operator Vec<DIM,SIMD<double>>() const
|
|
1703
|
+
{
|
|
1704
|
+
Vec<DIM,SIMD<double>> hp;
|
|
1705
|
+
for (int i = 0; i < DIM; i++)
|
|
1706
|
+
hp(i) = x[i];
|
|
1707
|
+
return hp;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
const SIMD<double> & operator() (size_t i) const { return x[i]; }
|
|
1711
|
+
SIMD<double> & operator() (size_t i) { return x[i]; }
|
|
1712
|
+
SIMD<double> Weight() const { return weight; }
|
|
1713
|
+
SIMD<double> & Weight() { return weight; }
|
|
1714
|
+
ngfem::IntegrationPoint operator[] (size_t i) const
|
|
1715
|
+
{ return ngfem::IntegrationPoint(x[0][i], x[1][i], x[2][i], weight[i]); }
|
|
1716
|
+
|
|
1717
|
+
template<int I>
|
|
1718
|
+
auto Get()
|
|
1719
|
+
{
|
|
1720
|
+
static_assert(I>=0 && I<SIMD<double>::Size(), "Index out of range");
|
|
1721
|
+
return (*this)[I];
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
int FacetNr() const { return facetnr; }
|
|
1725
|
+
void SetFacetNr (int afacetnr, ngfem::VorB avb = ngfem::BND)
|
|
1726
|
+
{ facetnr = afacetnr; vb = avb; }
|
|
1727
|
+
INLINE ngfem::VorB VB() const { return vb; }
|
|
1728
|
+
|
|
1729
|
+
template <int DIM>
|
|
1730
|
+
INLINE operator Vec<DIM, ngstd::AutoDiff<DIM,SIMD<double>>> () const
|
|
1731
|
+
{
|
|
1732
|
+
Vec<DIM, ngstd::AutoDiff<DIM,SIMD<double>> > adp;
|
|
1733
|
+
for (int i = 0; i < DIM; i++)
|
|
1734
|
+
adp[i] = ngstd::AutoDiff<DIM,SIMD<double>> (x[i], i);
|
|
1735
|
+
return adp;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
template <int D>
|
|
1739
|
+
INLINE ngfem::TIP<D,SIMD<double>> TIp() const;
|
|
1740
|
+
INLINE operator ngfem::TIP<0,ngcore::SIMD<double>> () const { return ngfem::TIP<0,ngcore::SIMD<double>>(facetnr, vb); }
|
|
1741
|
+
INLINE operator ngfem::TIP<1,ngcore::SIMD<double>> () const { return ngfem::TIP<1,ngcore::SIMD<double>>(x[0], facetnr, vb); }
|
|
1742
|
+
INLINE operator ngfem::TIP<2,ngcore::SIMD<double>> () const { return ngfem::TIP<2,ngcore::SIMD<double>>(x[0], x[1], facetnr, vb); }
|
|
1743
|
+
INLINE operator ngfem::TIP<3,ngcore::SIMD<double>> () const { return ngfem::TIP<3,ngcore::SIMD<double>>(x[0], x[1], x[2], facetnr, vb); }
|
|
1744
|
+
|
|
1745
|
+
/*
|
|
1746
|
+
template <int DIM>
|
|
1747
|
+
INLINE operator Vec<DIM, AutoDiff<DIM,SIMD<double>>> () const
|
|
1748
|
+
{
|
|
1749
|
+
Vec<DIM, AutoDiff<DIM,SIMD<double>> > adp;
|
|
1750
|
+
for (int i = 0; i < DIM; i++)
|
|
1751
|
+
adp[i] = AutoDiff<DIM,SIMD<double>> (x[i], i);
|
|
1752
|
+
return adp;
|
|
1753
|
+
}
|
|
1754
|
+
*/
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
/*
|
|
1758
|
+
template <> INLINE ngfem::TIP<0,SIMD<double>> SIMD<ngfem::IntegrationPoint> :: TIp<0>() const
|
|
1759
|
+
{ return ngfem::TIP<0,ngstd::SIMD<double>>(); }
|
|
1760
|
+
template <> INLINE ngfem::TIP<1,SIMD<double>> SIMD<ngfem::IntegrationPoint> :: TIp<1>() const
|
|
1761
|
+
{ return ngfem::TIP<1,ngstd::SIMD<double>>(x[0]); }
|
|
1762
|
+
template <> INLINE ngfem::TIP<2,SIMD<double>> SIMD<ngfem::IntegrationPoint> :: TIp<2>() const
|
|
1763
|
+
{ return ngfem::TIP<2,ngstd::SIMD<double>>(x[0], x[1]); }
|
|
1764
|
+
template <> INLINE ngfem::TIP<3,SIMD<double>> SIMD<ngfem::IntegrationPoint> :: TIp<3>() const
|
|
1765
|
+
{ return ngfem::TIP<3,ngstd::SIMD<double>>(x[0], x[1], x[2]); }
|
|
1766
|
+
*/
|
|
1767
|
+
template <int D> INLINE ngfem::TIP<D,SIMD<double>> SIMD<ngfem::IntegrationPoint> :: TIp() const
|
|
1768
|
+
{
|
|
1769
|
+
// return ngfem::TIP<D,ngstd::SIMD<double>> (*this);
|
|
1770
|
+
ngfem::TIP<D,ngcore::SIMD<double>> tip = *this;
|
|
1771
|
+
return tip;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
template <>
|
|
1776
|
+
class SIMD<ngfem::BaseMappedIntegrationPoint>
|
|
1777
|
+
{
|
|
1778
|
+
protected:
|
|
1779
|
+
SIMD<ngfem::IntegrationPoint> ip;
|
|
1780
|
+
const ngfem::ElementTransformation * eltrans;
|
|
1781
|
+
SIMD<double> measure;
|
|
1782
|
+
SIMD<double> det;
|
|
1783
|
+
// bool owns_trafo = false;
|
|
1784
|
+
public:
|
|
1785
|
+
SIMD() = default;
|
|
1786
|
+
SIMD (const SIMD<ngfem::IntegrationPoint> & aip,
|
|
1787
|
+
const ngfem::ElementTransformation & aeltrans)
|
|
1788
|
+
: ip(aip), eltrans(&aeltrans) { ; }
|
|
1789
|
+
// ~SIMD();
|
|
1790
|
+
const SIMD<ngfem::IntegrationPoint> & IP () const { return ip; }
|
|
1791
|
+
const ngfem::ElementTransformation & GetTransformation () const { return *eltrans; }
|
|
1792
|
+
// int GetIPNr() const { return ip.Nr(); }
|
|
1793
|
+
|
|
1794
|
+
int DimElement() const;
|
|
1795
|
+
int DimSpace() const;
|
|
1796
|
+
|
|
1797
|
+
void SetMeasure (SIMD<double> _measure) { measure = _measure; }
|
|
1798
|
+
SIMD<double> GetMeasure() const { return measure; }
|
|
1799
|
+
SIMD<double> GetWeight() const { return measure * ip.Weight(); }
|
|
1800
|
+
SIMD<double> GetJacobiDet() const { return det; }
|
|
1801
|
+
NGS_DLL_HEADER FlatVector<SIMD<double>> GetPoint() const;
|
|
1802
|
+
// virtual void Print (ostream & ost) const = 0;
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
template <int R>
|
|
1806
|
+
class SIMD<ngfem::DimMappedIntegrationPoint<R>> : public SIMD<ngfem::BaseMappedIntegrationPoint>
|
|
1807
|
+
{
|
|
1808
|
+
protected:
|
|
1809
|
+
ngbla::Vec<R,SIMD<double>> point, normalvec, tangentialvec;
|
|
1810
|
+
public:
|
|
1811
|
+
SIMD() = default;
|
|
1812
|
+
SIMD (const SIMD<ngfem::IntegrationPoint> & aip,
|
|
1813
|
+
const ngfem::ElementTransformation & eltrans)
|
|
1814
|
+
: SIMD<ngfem::BaseMappedIntegrationPoint> (aip, eltrans) { ; }
|
|
1815
|
+
const ngbla::Vec<R,SIMD<double>> & GetPoint() const { return point; }
|
|
1816
|
+
ngbla::Vec<R,SIMD<double>> & Point() { return point; }
|
|
1817
|
+
|
|
1818
|
+
INLINE const Vec<R,SIMD<double>> GetNV () const { return normalvec; }
|
|
1819
|
+
INLINE Vec<R,SIMD<double>> & NV () { return normalvec; }
|
|
1820
|
+
INLINE void SetNV (Vec<R,SIMD<double>> vec) { normalvec = vec; }
|
|
1821
|
+
|
|
1822
|
+
INLINE const Vec<R,SIMD<double>> & GetTV () const { return tangentialvec; }
|
|
1823
|
+
INLINE void SetTV (Vec<R,SIMD<double>> vec) { tangentialvec = vec; }
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
template <int DIMS, int DIMR>
|
|
1827
|
+
class SIMD<ngfem::MappedIntegrationPoint<DIMS,DIMR>> : public SIMD<ngfem::DimMappedIntegrationPoint<DIMR>>
|
|
1828
|
+
{
|
|
1829
|
+
static_assert(DIMS <= DIMR, "DIM-source > DIM-range !!");
|
|
1830
|
+
protected:
|
|
1831
|
+
using SIMD<ngfem::DimMappedIntegrationPoint<DIMR>>::measure;
|
|
1832
|
+
using SIMD<ngfem::DimMappedIntegrationPoint<DIMR>>::det;
|
|
1833
|
+
using SIMD<ngfem::DimMappedIntegrationPoint<DIMR>>::normalvec;
|
|
1834
|
+
using SIMD<ngfem::DimMappedIntegrationPoint<DIMR>>::tangentialvec;
|
|
1835
|
+
ngbla::Mat<DIMR,DIMS,SIMD<double>> dxdxi;
|
|
1836
|
+
public:
|
|
1837
|
+
SIMD () = default;
|
|
1838
|
+
SIMD (const SIMD<ngfem::IntegrationPoint> & aip,
|
|
1839
|
+
const ngfem::ElementTransformation & aeltrans,
|
|
1840
|
+
int /* dummy */)
|
|
1841
|
+
: SIMD<ngfem::DimMappedIntegrationPoint<DIMR>> (aip, aeltrans)
|
|
1842
|
+
{ ; }
|
|
1843
|
+
|
|
1844
|
+
SIMD (const SIMD<ngfem::IntegrationPoint> & aip,
|
|
1845
|
+
const ngfem::ElementTransformation & aeltrans,
|
|
1846
|
+
const Vec<DIMR, SIMD<double>> ax,
|
|
1847
|
+
const Mat<DIMR, DIMS, SIMD<double> > & adxdxi)
|
|
1848
|
+
: SIMD<ngfem::DimMappedIntegrationPoint<DIMR>> (aip, aeltrans)
|
|
1849
|
+
{
|
|
1850
|
+
this->point = ax;
|
|
1851
|
+
dxdxi = adxdxi;
|
|
1852
|
+
Compute();
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
const Mat<DIMR,DIMS,SIMD<double>> & GetJacobian() const { return dxdxi; }
|
|
1856
|
+
Mat<DIMR,DIMS,SIMD<double>> & Jacobian() { return dxdxi; }
|
|
1857
|
+
|
|
1858
|
+
int Dim() const { return DIMR; }
|
|
1859
|
+
|
|
1860
|
+
INLINE void Compute ()
|
|
1861
|
+
{
|
|
1862
|
+
if constexpr (DIMS == DIMR)
|
|
1863
|
+
{
|
|
1864
|
+
det = Det (dxdxi);
|
|
1865
|
+
normalvec = SIMD<double>(0.0);
|
|
1866
|
+
tangentialvec = SIMD<double>(0.0);
|
|
1867
|
+
}
|
|
1868
|
+
else
|
|
1869
|
+
{
|
|
1870
|
+
if (DIMR == 3)
|
|
1871
|
+
{
|
|
1872
|
+
if (DIMS == 2)
|
|
1873
|
+
{
|
|
1874
|
+
normalvec = Cross (Vec<3,SIMD<double>> (dxdxi.Col(0)),
|
|
1875
|
+
Vec<3,SIMD<double>> (dxdxi.Col(1)));
|
|
1876
|
+
det = L2Norm (normalvec);
|
|
1877
|
+
normalvec /= det;
|
|
1878
|
+
tangentialvec = SIMD<double>(0.0);
|
|
1879
|
+
}
|
|
1880
|
+
else if (DIMS == 1)
|
|
1881
|
+
{
|
|
1882
|
+
normalvec = SIMD<double>(0.0);
|
|
1883
|
+
tangentialvec = Vec<3,SIMD<double>>(dxdxi.Col(0));
|
|
1884
|
+
det = L2Norm(tangentialvec);
|
|
1885
|
+
tangentialvec /= det;
|
|
1886
|
+
}
|
|
1887
|
+
else
|
|
1888
|
+
{
|
|
1889
|
+
det = 1;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
else if (DIMR == 2)
|
|
1893
|
+
{
|
|
1894
|
+
if (DIMS == 1)
|
|
1895
|
+
{
|
|
1896
|
+
det = sqrt ( ngstd::sqr (dxdxi(0,0)) + ngstd::sqr (dxdxi(1,0)));
|
|
1897
|
+
|
|
1898
|
+
normalvec(0) = -dxdxi(1,0) / det;
|
|
1899
|
+
normalvec(1) = dxdxi(0,0) / det;
|
|
1900
|
+
//tangentialvec = SIMD<double>(0.0);
|
|
1901
|
+
tangentialvec(0) = -normalvec(1);
|
|
1902
|
+
tangentialvec(1) = normalvec(0);
|
|
1903
|
+
}
|
|
1904
|
+
else
|
|
1905
|
+
{
|
|
1906
|
+
det = 1;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
else
|
|
1910
|
+
{
|
|
1911
|
+
det = 1.0;
|
|
1912
|
+
normalvec = 1.0;
|
|
1913
|
+
tangentialvec = SIMD<double>(0.0);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
measure = fabs (det);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
// SIMD<double> GetJacobiDet() const { return det; }
|
|
1920
|
+
///
|
|
1921
|
+
// const Mat<DIMS,DIMR,SCAL> & GetJacobianInverse() const { return dxidx; }
|
|
1922
|
+
INLINE const Mat<DIMS,DIMR,SIMD<double>> GetJacobianInverse() const
|
|
1923
|
+
{
|
|
1924
|
+
if (DIMS == DIMR)
|
|
1925
|
+
return 1.0/det * Trans (Cof (dxdxi));
|
|
1926
|
+
else
|
|
1927
|
+
{
|
|
1928
|
+
Mat<DIMS,DIMS,SIMD<double>> ata, iata;
|
|
1929
|
+
ata = Trans (dxdxi) * dxdxi;
|
|
1930
|
+
iata = Inv (ata);
|
|
1931
|
+
return (iata * Trans (dxdxi));
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
INLINE const Mat<DIMR,DIMS,SIMD<double>> GetJacobianCofactor() const
|
|
1936
|
+
{
|
|
1937
|
+
if (DIMS == DIMR)
|
|
1938
|
+
return Cof (dxdxi);
|
|
1939
|
+
else
|
|
1940
|
+
return det * Trans(GetJacobianInverse());
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
INLINE operator Vec<DIMS, ngstd::AutoDiff<DIMR,SIMD<double>>> () const
|
|
1945
|
+
{
|
|
1946
|
+
Vec<DIMS, ngstd::AutoDiff<DIMR, SIMD<double>> > adp;
|
|
1947
|
+
|
|
1948
|
+
Mat<DIMS,DIMR,SIMD<double>> ijac = GetJacobianInverse();
|
|
1949
|
+
for (int i = 0; i < DIMS; i++)
|
|
1950
|
+
adp[i].Value() = this->IP()(i);
|
|
1951
|
+
for (int i = 0; i < DIMS; i++)
|
|
1952
|
+
for (int j = 0; j < DIMR; j++)
|
|
1953
|
+
adp[i].DValue(j) = ijac(i,j);
|
|
1954
|
+
/*
|
|
1955
|
+
Mat<DIMS,DIMR,SIMD<double>> ijac = GetJacobianInverse();
|
|
1956
|
+
for (int i = 0; i < DIMS; i++)
|
|
1957
|
+
adp[i] = AutoDiff<DIMR,SIMD<double>> (this->IP()(i), &ijac(i,0));
|
|
1958
|
+
*/
|
|
1959
|
+
return adp;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
void CalcHesse (Vec<DIMR,Mat<DIMS,DIMS,SIMD<double>>> & ddx1) const;
|
|
1963
|
+
|
|
1964
|
+
void Print (ostream & ost) const
|
|
1965
|
+
{
|
|
1966
|
+
ost << "ip = " << this->ip << std::endl;
|
|
1967
|
+
ost << "Point = " << this->point << std::endl;
|
|
1968
|
+
ost << "Jacobian = " << dxdxi << std::endl;
|
|
1969
|
+
ost << "normal = " << this->GetNV() << std::endl;
|
|
1970
|
+
}
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
namespace ngfem
|
|
1975
|
+
{
|
|
1976
|
+
template <int D>
|
|
1977
|
+
INLINE auto GetTIP (const IntegrationPoint & ip)
|
|
1978
|
+
{
|
|
1979
|
+
return ngfem::TIP<D,double> (ip);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
template <int D>
|
|
1983
|
+
INLINE auto GetTIPGrad (const IntegrationPoint & ip)
|
|
1984
|
+
{
|
|
1985
|
+
TIP<D,AutoDiff<D>> tip = ip;
|
|
1986
|
+
return tip;
|
|
1987
|
+
// return TIP<D,AutoDiff<D>>(ip);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
template <int D>
|
|
1991
|
+
INLINE auto GetTIP (const SIMD<IntegrationPoint> & ip)
|
|
1992
|
+
{
|
|
1993
|
+
// return ngfem::TIP<D,SIMD<double> (ip);
|
|
1994
|
+
return ip.TIp<D>();
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
template <int D>
|
|
1998
|
+
INLINE auto GetTIPGrad (const SIMD<IntegrationPoint> & ip)
|
|
1999
|
+
{
|
|
2000
|
+
Vec<D, AutoDiff<D,SIMD<double>>> adp = ip;
|
|
2001
|
+
return TIP<D,AutoDiff<D,SIMD<double>>> (adp, ip.FacetNr(), ip.VB());
|
|
2002
|
+
// TIP<D,AutoDiff<D,SIMD<double>>> tip = ip;
|
|
2003
|
+
// return tip;
|
|
2004
|
+
// return TIP<D,AutoDiff<D>>(ip);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
template<int DIMS, int DIMR>
|
|
2009
|
+
INLINE void GetTIP1( const SIMD<MappedIntegrationPoint<DIMS,DIMR>> & mip, TIP<DIMS,AutoDiff<DIMR,SIMD<double>>> & adp);
|
|
2010
|
+
|
|
2011
|
+
template<int DIMR>
|
|
2012
|
+
INLINE void GetTIP1( const SIMD<MappedIntegrationPoint<0,DIMR>> & mip, TIP<0,AutoDiff<DIMR,SIMD<double>>> & adp)
|
|
2013
|
+
{
|
|
2014
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2015
|
+
adp.vb = mip.IP().VB();
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
template<int DIMR>
|
|
2019
|
+
INLINE void GetTIP1 (const SIMD<MappedIntegrationPoint<1,DIMR>> & mip, TIP<1,AutoDiff<DIMR,SIMD<double>>> & adp)
|
|
2020
|
+
{
|
|
2021
|
+
Mat<1,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2022
|
+
const auto &ip = mip.IP();
|
|
2023
|
+
adp.x.Value() = ip(0);
|
|
2024
|
+
for (int j = 0; j < DIMR; j++)
|
|
2025
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2026
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2027
|
+
adp.vb = mip.IP().VB();
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
template<int DIMR>
|
|
2032
|
+
INLINE void GetTIP1 (const SIMD<MappedIntegrationPoint<2,DIMR>> & mip, TIP<2,AutoDiff<DIMR,SIMD<double>>> & adp)
|
|
2033
|
+
{
|
|
2034
|
+
Mat<2,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2035
|
+
const auto &ip = mip.IP();
|
|
2036
|
+
adp.x.Value() = ip(0);
|
|
2037
|
+
adp.y.Value() = ip(1);
|
|
2038
|
+
for (int j = 0; j < DIMR; j++)
|
|
2039
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2040
|
+
for (int j = 0; j < DIMR; j++)
|
|
2041
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2042
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2043
|
+
adp.vb = mip.IP().VB();
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
template<int DIMR>
|
|
2048
|
+
INLINE void GetTIP1 (const SIMD<MappedIntegrationPoint<3,DIMR>> & mip, TIP<3, AutoDiff<DIMR,SIMD<double>>> & adp)
|
|
2049
|
+
{
|
|
2050
|
+
Mat<3,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2051
|
+
const auto &ip = mip.IP();
|
|
2052
|
+
adp.x.Value() = ip(0);
|
|
2053
|
+
adp.y.Value() = ip(1);
|
|
2054
|
+
adp.z.Value() = ip(2);
|
|
2055
|
+
for (int j = 0; j < DIMR; j++)
|
|
2056
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2057
|
+
for (int j = 0; j < DIMR; j++)
|
|
2058
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2059
|
+
for (int j = 0; j < DIMR; j++)
|
|
2060
|
+
adp.z.DValue(j) = ijac(2,j);
|
|
2061
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2062
|
+
adp.vb = mip.IP().VB();
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
template<int DIMS, int DIMR>
|
|
2072
|
+
INLINE auto GetTIP (const SIMD<MappedIntegrationPoint<DIMS,DIMR>> & mip)
|
|
2073
|
+
{
|
|
2074
|
+
TIP<DIMS,AutoDiff<DIMR,SIMD<double>>> tip(mip.IP().FacetNr(), mip.IP().VB());
|
|
2075
|
+
GetTIP1 (mip, tip);
|
|
2076
|
+
return tip;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/*
|
|
2080
|
+
template<int DIMR>
|
|
2081
|
+
INLINE auto GetTIP( const SIMD<MappedIntegrationPoint<0,DIMR>> & mip) -> TIP<0,AutoDiff<DIMR,SIMD<double>>>
|
|
2082
|
+
{
|
|
2083
|
+
TIP<0,AutoDiff<DIMR,SIMD<double>>> adp;
|
|
2084
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2085
|
+
adp.vb = mip.IP().VB();
|
|
2086
|
+
return adp;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
template<int DIMR>
|
|
2090
|
+
INLINE auto GetTIP( const SIMD<MappedIntegrationPoint<1,DIMR>> & mip) -> TIP<1,AutoDiff<DIMR,SIMD<double>>>
|
|
2091
|
+
{
|
|
2092
|
+
TIP<1,AutoDiff<DIMR,SIMD<double>>> adp;
|
|
2093
|
+
Mat<1,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2094
|
+
const auto &ip = mip.IP();
|
|
2095
|
+
adp.x.Value() = ip(0);
|
|
2096
|
+
for (int j = 0; j < DIMR; j++)
|
|
2097
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2098
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2099
|
+
adp.vb = mip.IP().VB();
|
|
2100
|
+
return adp;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
template<int DIMR>
|
|
2105
|
+
INLINE auto GetTIP( const SIMD<MappedIntegrationPoint<2,DIMR>> & mip) -> TIP<2,AutoDiff<DIMR,SIMD<double>>>
|
|
2106
|
+
{
|
|
2107
|
+
TIP<2,AutoDiff<DIMR,SIMD<double>>> adp;
|
|
2108
|
+
Mat<2,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2109
|
+
const auto &ip = mip.IP();
|
|
2110
|
+
adp.x.Value() = ip(0);
|
|
2111
|
+
adp.y.Value() = ip(1);
|
|
2112
|
+
for (int j = 0; j < DIMR; j++)
|
|
2113
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2114
|
+
for (int j = 0; j < DIMR; j++)
|
|
2115
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2116
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2117
|
+
adp.vb = mip.IP().VB();
|
|
2118
|
+
return adp;
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
template<int DIMR>
|
|
2123
|
+
INLINE auto GetTIP(const SIMD<MappedIntegrationPoint<3,DIMR>> & mip) -> TIP<3, AutoDiff<DIMR,SIMD<double>>>
|
|
2124
|
+
{
|
|
2125
|
+
Mat<3,DIMR,SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2126
|
+
TIP<3, AutoDiff<DIMR,SIMD<double>>> adp;
|
|
2127
|
+
const auto &ip = mip.IP();
|
|
2128
|
+
adp.x.Value() = ip(0);
|
|
2129
|
+
adp.y.Value() = ip(1);
|
|
2130
|
+
adp.z.Value() = ip(2);
|
|
2131
|
+
for (int j = 0; j < DIMR; j++)
|
|
2132
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2133
|
+
for (int j = 0; j < DIMR; j++)
|
|
2134
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2135
|
+
for (int j = 0; j < DIMR; j++)
|
|
2136
|
+
adp.z.DValue(j) = ijac(2,j);
|
|
2137
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2138
|
+
adp.vb = mip.IP().VB();
|
|
2139
|
+
return adp;
|
|
2140
|
+
}
|
|
2141
|
+
*/
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
template <int DIMS, int DIMR>
|
|
2145
|
+
INLINE void GetTIP1( const MappedIntegrationPoint<DIMS,DIMR> & mip);
|
|
2146
|
+
|
|
2147
|
+
template<int DIMR>
|
|
2148
|
+
INLINE void GetTIP1( const MappedIntegrationPoint<0,DIMR> & mip, TIP<0,AutoDiff<DIMR>> & adp)
|
|
2149
|
+
{
|
|
2150
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2151
|
+
adp.vb = mip.IP().VB();
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
template<int DIMR>
|
|
2155
|
+
INLINE void GetTIP1( const MappedIntegrationPoint<1,DIMR> & mip, TIP<1,AutoDiff<DIMR>> & adp)
|
|
2156
|
+
{
|
|
2157
|
+
Mat<1,DIMR> ijac = mip.GetJacobianInverse();
|
|
2158
|
+
const auto &ip = mip.IP();
|
|
2159
|
+
adp.x.Value() = ip(0);
|
|
2160
|
+
for (int j = 0; j < DIMR; j++)
|
|
2161
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2162
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2163
|
+
adp.vb = mip.IP().VB();
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
template<int DIMR>
|
|
2167
|
+
INLINE void GetTIP1( const MappedIntegrationPoint<2,DIMR> & mip, TIP<2,AutoDiff<DIMR>> &adp)
|
|
2168
|
+
{
|
|
2169
|
+
Mat<2,DIMR> ijac = mip.GetJacobianInverse();
|
|
2170
|
+
const auto &ip = mip.IP();
|
|
2171
|
+
adp.x.Value() = ip(0);
|
|
2172
|
+
adp.y.Value() = ip(1);
|
|
2173
|
+
for (int j = 0; j < DIMR; j++)
|
|
2174
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2175
|
+
for (int j = 0; j < DIMR; j++)
|
|
2176
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2177
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2178
|
+
adp.vb = mip.IP().VB();
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
template<int DIMR>
|
|
2183
|
+
INLINE void GetTIP1(const MappedIntegrationPoint<3,DIMR> & mip, TIP<3, AutoDiff<DIMR>> & adp)
|
|
2184
|
+
{
|
|
2185
|
+
Mat<3,DIMR> ijac = mip.GetJacobianInverse();
|
|
2186
|
+
const auto &ip = mip.IP();
|
|
2187
|
+
adp.x.Value() = ip(0);
|
|
2188
|
+
adp.y.Value() = ip(1);
|
|
2189
|
+
adp.z.Value() = ip(2);
|
|
2190
|
+
for (int j = 0; j < DIMR; j++)
|
|
2191
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2192
|
+
for (int j = 0; j < DIMR; j++)
|
|
2193
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2194
|
+
for (int j = 0; j < DIMR; j++)
|
|
2195
|
+
adp.z.DValue(j) = ijac(2,j);
|
|
2196
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2197
|
+
adp.vb = mip.IP().VB();
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
template<int DIMS, int DIMR>
|
|
2203
|
+
INLINE auto GetTIP (const MappedIntegrationPoint<DIMS,DIMR> & mip) // -> TIP<DIMS,AutoDiff<DIMR>>;
|
|
2204
|
+
{
|
|
2205
|
+
TIP<DIMS,AutoDiff<DIMR>> tip(mip.IP().FacetNr(), mip.IP().VB());
|
|
2206
|
+
GetTIP1(mip, tip);
|
|
2207
|
+
return tip;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
template <int DIMS, int DIMR>
|
|
2212
|
+
auto GetTIPHesse (const MappedIntegrationPoint<DIMS, DIMR> & mip)
|
|
2213
|
+
{
|
|
2214
|
+
Vec<DIMR, Mat<DIMS,DIMS>> hesse;
|
|
2215
|
+
mip.CalcHesse(hesse);
|
|
2216
|
+
Mat<DIMS,DIMR> ijac = mip.GetJacobianInverse();
|
|
2217
|
+
|
|
2218
|
+
Vec<DIMR, Mat<DIMR,DIMR>> hessemapped;
|
|
2219
|
+
for (int i = 0; i < DIMR; i++)
|
|
2220
|
+
hessemapped(i) = Trans(ijac) * hesse(i) * ijac;
|
|
2221
|
+
|
|
2222
|
+
Vec<DIMS, Mat<DIMR,DIMR>> hessemapped2 = Mat<DIMR,DIMR>(0.0);
|
|
2223
|
+
for (int i = 0; i < DIMR; i++)
|
|
2224
|
+
for (int j = 0; j < DIMS; j++)
|
|
2225
|
+
hessemapped2(j) += ijac(j,i) * hessemapped(i);
|
|
2226
|
+
|
|
2227
|
+
TIP<DIMS, AutoDiffDiff<DIMR>> tip = GetTIP(mip);
|
|
2228
|
+
|
|
2229
|
+
if constexpr(DIMS >= 1)
|
|
2230
|
+
for (int j = 0; j < DIMR; j++)
|
|
2231
|
+
for (int k = 0; k < DIMR; k++)
|
|
2232
|
+
tip.x.DDValue(j,k) = -hessemapped2(0)(j,k);
|
|
2233
|
+
if constexpr(DIMS >= 2)
|
|
2234
|
+
for (int j = 0; j < DIMR; j++)
|
|
2235
|
+
for (int k = 0; k < DIMR; k++)
|
|
2236
|
+
tip.y.DDValue(j,k) = -hessemapped2(1)(j,k);
|
|
2237
|
+
if constexpr(DIMS >= 3)
|
|
2238
|
+
for (int j = 0; j < DIMR; j++)
|
|
2239
|
+
for (int k = 0; k < DIMR; k++)
|
|
2240
|
+
tip.z.DDValue(j,k) = -hessemapped2(2)(j,k);
|
|
2241
|
+
|
|
2242
|
+
return tip;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
template <int DIMS, int DIMR>
|
|
2247
|
+
auto GetTIPHesse (const SIMD<MappedIntegrationPoint<DIMS, DIMR>> & mip)
|
|
2248
|
+
{
|
|
2249
|
+
Vec<DIMR, Mat<DIMS,DIMS, SIMD<double>>> hesse;
|
|
2250
|
+
mip.CalcHesse(hesse);
|
|
2251
|
+
Mat<DIMS,DIMR, SIMD<double>> ijac = mip.GetJacobianInverse();
|
|
2252
|
+
|
|
2253
|
+
Vec<DIMR, Mat<DIMR,DIMR, SIMD<double>>> hessemapped;
|
|
2254
|
+
for (int i = 0; i < DIMR; i++)
|
|
2255
|
+
hessemapped(i) = Trans(ijac) * hesse(i) * ijac;
|
|
2256
|
+
|
|
2257
|
+
Vec<DIMS, Mat<DIMR,DIMR, SIMD<double>>> hessemapped2 = Mat<DIMR,DIMR,SIMD<double>>(0.0);
|
|
2258
|
+
for (int i = 0; i < DIMR; i++)
|
|
2259
|
+
for (int j = 0; j < DIMS; j++)
|
|
2260
|
+
hessemapped2(j) += ijac(j,i) * hessemapped(i);
|
|
2261
|
+
|
|
2262
|
+
TIP<DIMS, AutoDiffDiff<DIMR, SIMD<double>>> tip = GetTIP(mip);
|
|
2263
|
+
|
|
2264
|
+
if constexpr(DIMS >= 1)
|
|
2265
|
+
for (int j = 0; j < DIMR; j++)
|
|
2266
|
+
for (int k = 0; k < DIMR; k++)
|
|
2267
|
+
tip.x.DDValue(j,k) = -hessemapped2(0)(j,k);
|
|
2268
|
+
if constexpr(DIMS >= 2)
|
|
2269
|
+
for (int j = 0; j < DIMR; j++)
|
|
2270
|
+
for (int k = 0; k < DIMR; k++)
|
|
2271
|
+
tip.y.DDValue(j,k) = -hessemapped2(1)(j,k);
|
|
2272
|
+
if constexpr(DIMS >= 3)
|
|
2273
|
+
for (int j = 0; j < DIMR; j++)
|
|
2274
|
+
for (int k = 0; k < DIMR; k++)
|
|
2275
|
+
tip.z.DDValue(j,k) = -hessemapped2(2)(j,k);
|
|
2276
|
+
|
|
2277
|
+
return tip;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
/*
|
|
2283
|
+
template<int DIMR>
|
|
2284
|
+
INLINE auto GetTIP( const MappedIntegrationPoint<0,DIMR> & mip) -> TIP<0,AutoDiff<DIMR>>
|
|
2285
|
+
{
|
|
2286
|
+
TIP<0,AutoDiff<DIMR>> adp;
|
|
2287
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2288
|
+
adp.vb = mip.IP().VB();
|
|
2289
|
+
return adp;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
template<int DIMR>
|
|
2293
|
+
INLINE auto GetTIP( const MappedIntegrationPoint<1,DIMR> & mip) -> TIP<1,AutoDiff<DIMR>>
|
|
2294
|
+
{
|
|
2295
|
+
TIP<1,AutoDiff<DIMR>> adp;
|
|
2296
|
+
Mat<1,DIMR> ijac = mip.GetJacobianInverse();
|
|
2297
|
+
const auto &ip = mip.IP();
|
|
2298
|
+
adp.x.Value() = ip(0);
|
|
2299
|
+
for (int j = 0; j < DIMR; j++)
|
|
2300
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2301
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2302
|
+
adp.vb = mip.IP().VB();
|
|
2303
|
+
return adp;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
template<int DIMR>
|
|
2308
|
+
INLINE auto GetTIP( const MappedIntegrationPoint<2,DIMR> & mip) -> TIP<2,AutoDiff<DIMR>>
|
|
2309
|
+
{
|
|
2310
|
+
TIP<2,AutoDiff<DIMR>> adp;
|
|
2311
|
+
Mat<2,DIMR> ijac = mip.GetJacobianInverse();
|
|
2312
|
+
const auto &ip = mip.IP();
|
|
2313
|
+
adp.x.Value() = ip(0);
|
|
2314
|
+
adp.y.Value() = ip(1);
|
|
2315
|
+
for (int j = 0; j < DIMR; j++)
|
|
2316
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2317
|
+
for (int j = 0; j < DIMR; j++)
|
|
2318
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2319
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2320
|
+
adp.vb = mip.IP().VB();
|
|
2321
|
+
return adp;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
template<int DIMR>
|
|
2326
|
+
INLINE auto GetTIP(const MappedIntegrationPoint<3,DIMR> & mip) -> TIP<3, AutoDiff<DIMR>>
|
|
2327
|
+
{
|
|
2328
|
+
Mat<3,DIMR> ijac = mip.GetJacobianInverse();
|
|
2329
|
+
TIP<3, AutoDiff<DIMR>> adp;
|
|
2330
|
+
const auto &ip = mip.IP();
|
|
2331
|
+
adp.x.Value() = ip(0);
|
|
2332
|
+
adp.y.Value() = ip(1);
|
|
2333
|
+
adp.z.Value() = ip(2);
|
|
2334
|
+
for (int j = 0; j < DIMR; j++)
|
|
2335
|
+
adp.x.DValue(j) = ijac(0,j);
|
|
2336
|
+
for (int j = 0; j < DIMR; j++)
|
|
2337
|
+
adp.y.DValue(j) = ijac(1,j);
|
|
2338
|
+
for (int j = 0; j < DIMR; j++)
|
|
2339
|
+
adp.z.DValue(j) = ijac(2,j);
|
|
2340
|
+
adp.facetnr = mip.IP().FacetNr();
|
|
2341
|
+
adp.vb = mip.IP().VB();
|
|
2342
|
+
return adp;
|
|
2343
|
+
}
|
|
2344
|
+
*/
|
|
2345
|
+
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
class SIMD_IntegrationRule : public Array<SIMD<IntegrationPoint>>
|
|
2352
|
+
{
|
|
2353
|
+
int dimension = -1;
|
|
2354
|
+
size_t nip = -47;
|
|
2355
|
+
const SIMD_IntegrationRule *irx = nullptr, *iry = nullptr, *irz = nullptr; // for tensor product IR
|
|
2356
|
+
public:
|
|
2357
|
+
SIMD_IntegrationRule () = default;
|
|
2358
|
+
inline SIMD_IntegrationRule (ELEMENT_TYPE eltype, int order);
|
|
2359
|
+
SIMD_IntegrationRule (const SIMD_IntegrationRule & ir) = delete;
|
|
2360
|
+
SIMD_IntegrationRule (SIMD_IntegrationRule && ir) = default;
|
|
2361
|
+
NGS_DLL_HEADER SIMD_IntegrationRule (const IntegrationRule & ir);
|
|
2362
|
+
NGS_DLL_HEADER SIMD_IntegrationRule (const IntegrationRule & ir, LocalHeap & lh);
|
|
2363
|
+
NGS_DLL_HEADER SIMD_IntegrationRule (int nip, LocalHeap & lh);
|
|
2364
|
+
NGS_DLL_HEADER ~SIMD_IntegrationRule ()
|
|
2365
|
+
{
|
|
2366
|
+
delete [] mem_to_delete;
|
|
2367
|
+
mem_to_delete = nullptr;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
SIMD_IntegrationRule & operator= (const SIMD_IntegrationRule &) = delete;
|
|
2371
|
+
SIMD_IntegrationRule & operator= (SIMD_IntegrationRule &&) = default;
|
|
2372
|
+
|
|
2373
|
+
SIMD_IntegrationRule (size_t asize, SIMD<IntegrationPoint> * pip)
|
|
2374
|
+
: Array<SIMD<IntegrationPoint>> (asize, pip), nip(asize*SIMD<IntegrationPoint>::Size()) { }
|
|
2375
|
+
|
|
2376
|
+
INLINE SIMD_IntegrationRule Range (size_t first, size_t next) const
|
|
2377
|
+
{
|
|
2378
|
+
return SIMD_IntegrationRule (next-first, &(*this)[first]);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
size_t GetNIP() const { return nip; } // Size()*SIMD<double>::Size(); }
|
|
2382
|
+
void SetNIP(size_t _nip) { nip = _nip; }
|
|
2383
|
+
|
|
2384
|
+
SIMD_IntegrationRule Clone() const
|
|
2385
|
+
{
|
|
2386
|
+
SIMD_IntegrationRule ir2(Size(), &(*this)[0]);
|
|
2387
|
+
ir2.dimension = dimension;
|
|
2388
|
+
ir2.nip = nip;
|
|
2389
|
+
ir2.irx = irx;
|
|
2390
|
+
ir2.iry = iry;
|
|
2391
|
+
ir2.irz = irz;
|
|
2392
|
+
return ir2;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
bool IsTP() const { return irx != nullptr; }
|
|
2398
|
+
const SIMD_IntegrationRule & GetIRX() const { return *irx; }
|
|
2399
|
+
const SIMD_IntegrationRule & GetIRY() const { return *iry; }
|
|
2400
|
+
const SIMD_IntegrationRule & GetIRZ() const { return *irz; }
|
|
2401
|
+
void SetIRX(const SIMD_IntegrationRule * ir) { irx = ir; }
|
|
2402
|
+
void SetIRY(const SIMD_IntegrationRule * ir) { iry = ir; }
|
|
2403
|
+
void SetIRZ(const SIMD_IntegrationRule * ir) { irz = ir; }
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
extern NGS_DLL_HEADER const SIMD_IntegrationRule & SIMD_SelectIntegrationRule (ELEMENT_TYPE eltype, int order);
|
|
2407
|
+
|
|
2408
|
+
inline SIMD_IntegrationRule :: SIMD_IntegrationRule (ELEMENT_TYPE eltype, int order)
|
|
2409
|
+
{
|
|
2410
|
+
const SIMD_IntegrationRule & ir = SIMD_SelectIntegrationRule (eltype, order);
|
|
2411
|
+
size = ir.Size();
|
|
2412
|
+
data = &ir[0];
|
|
2413
|
+
mem_to_delete = NULL;
|
|
2414
|
+
dimension = ElementTopology::GetSpaceDim(eltype);
|
|
2415
|
+
nip = ir.nip;
|
|
2416
|
+
irx = ir.irx;
|
|
2417
|
+
iry = ir.iry;
|
|
2418
|
+
irz = ir.irz;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
|
|
2424
|
+
class NGS_DLL_HEADER SIMD_BaseMappedIntegrationRule
|
|
2425
|
+
{
|
|
2426
|
+
protected:
|
|
2427
|
+
SIMD_IntegrationRule ir;
|
|
2428
|
+
const ElementTransformation & eltrans;
|
|
2429
|
+
char * baseip;
|
|
2430
|
+
size_t incr;
|
|
2431
|
+
int dim_element, dim_space;
|
|
2432
|
+
|
|
2433
|
+
// mir on other element as needed for evaluating DG jump terms
|
|
2434
|
+
const SIMD_BaseMappedIntegrationRule * other_mir = nullptr;
|
|
2435
|
+
|
|
2436
|
+
BareSliceMatrix<SIMD<double>> points{0,0,0, nullptr};
|
|
2437
|
+
BareSliceMatrix<SIMD<double>> normals{0,0,0, nullptr};
|
|
2438
|
+
public:
|
|
2439
|
+
SIMD_BaseMappedIntegrationRule (const SIMD_IntegrationRule & air,
|
|
2440
|
+
const ElementTransformation & aeltrans)
|
|
2441
|
+
: ir(air.Size(),&air[0]), eltrans(aeltrans)
|
|
2442
|
+
{
|
|
2443
|
+
ir.SetIRX(&air.GetIRX());
|
|
2444
|
+
ir.SetIRY(&air.GetIRY());
|
|
2445
|
+
ir.SetIRZ(&air.GetIRZ());
|
|
2446
|
+
ir.SetNIP(air.GetNIP());
|
|
2447
|
+
}
|
|
2448
|
+
~SIMD_BaseMappedIntegrationRule ()
|
|
2449
|
+
{ ir.NothingToDelete(); }
|
|
2450
|
+
|
|
2451
|
+
INLINE size_t Size() const { return ir.Size(); }
|
|
2452
|
+
INLINE const SIMD_IntegrationRule & IR() const { return ir; }
|
|
2453
|
+
INLINE const ElementTransformation & GetTransformation () const { return eltrans; }
|
|
2454
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr) = 0;
|
|
2455
|
+
INLINE const SIMD<BaseMappedIntegrationPoint> & operator[] (size_t i) const
|
|
2456
|
+
{ return *static_cast<const SIMD<BaseMappedIntegrationPoint>*> ((void*)(baseip+i*incr)); }
|
|
2457
|
+
INLINE int DimElement() const { return dim_element; }
|
|
2458
|
+
INLINE int DimSpace() const { return dim_space; }
|
|
2459
|
+
// virtual ABareMatrix<double> GetPoints() const = 0;
|
|
2460
|
+
// virtual BareSliceMatrix<SIMD<double>> GetPoints() const = 0;
|
|
2461
|
+
SliceMatrix<SIMD<double>> GetPoints() const { return points.AddSize(ir.Size(), dim_space) ; }
|
|
2462
|
+
SliceMatrix<SIMD<double>> GetNormals() const { return normals.AddSize(ir.Size(), dim_space) ; }
|
|
2463
|
+
virtual void Print (ostream & ost) const = 0;
|
|
2464
|
+
bool IsComplex() const { return false; }
|
|
2465
|
+
BareSliceMatrix<SIMD<Complex>> GetPointsComplex() const { throw ExceptionNOSIMD("Not implemented"); }
|
|
2466
|
+
|
|
2467
|
+
// for DG jump terms
|
|
2468
|
+
void SetOtherMIR (const SIMD_BaseMappedIntegrationRule * other) { other_mir = other; }
|
|
2469
|
+
auto GetOtherMIR () const { return other_mir; }
|
|
2470
|
+
|
|
2471
|
+
virtual void TransformGradient (BareSliceMatrix<SIMD<double>> grad) const = 0; // covariant transformation
|
|
2472
|
+
virtual void TransformGradientTrans (BareSliceMatrix<SIMD<double>> grad) const = 0; // covariant transformation transpose
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
inline ostream & operator<< (ostream & ost, const SIMD_BaseMappedIntegrationRule & mir)
|
|
2476
|
+
{
|
|
2477
|
+
mir.Print (ost);
|
|
2478
|
+
return ost;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
template <int DIM_ELEMENT, int DIM_SPACE>
|
|
2482
|
+
class NGS_DLL_HEADER SIMD_MappedIntegrationRule : public SIMD_BaseMappedIntegrationRule
|
|
2483
|
+
{
|
|
2484
|
+
FlatArray<SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>> mips;
|
|
2485
|
+
public:
|
|
2486
|
+
SIMD_MappedIntegrationRule (const SIMD_IntegrationRule & ir,
|
|
2487
|
+
const ElementTransformation & aeltrans,
|
|
2488
|
+
Allocator & lh);
|
|
2489
|
+
SIMD_MappedIntegrationRule (const SIMD_IntegrationRule & ir,
|
|
2490
|
+
const ElementTransformation & aeltrans,
|
|
2491
|
+
int dummy,
|
|
2492
|
+
Allocator & lh)
|
|
2493
|
+
: SIMD_BaseMappedIntegrationRule (ir, aeltrans), mips(ir.Size(), lh)
|
|
2494
|
+
{
|
|
2495
|
+
dim_element = DIM_ELEMENT;
|
|
2496
|
+
dim_space = DIM_SPACE;
|
|
2497
|
+
baseip = (char*)(void*)(SIMD<BaseMappedIntegrationPoint>*)(&mips[0]);
|
|
2498
|
+
incr = sizeof (SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>);
|
|
2499
|
+
|
|
2500
|
+
for (size_t i = 0; i < ir.Size(); i++)
|
|
2501
|
+
new (&mips[i]) SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>> (ir[i], eltrans, -1);
|
|
2502
|
+
|
|
2503
|
+
/*
|
|
2504
|
+
new (&points) BareSliceMatrix<SIMD<double>> (sizeof(SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>)/sizeof(SIMD<double>),
|
|
2505
|
+
&mips[0].Point()(0),
|
|
2506
|
+
DummySize(mips.Size(), DIM_SPACE));
|
|
2507
|
+
|
|
2508
|
+
new (&normals) BareSliceMatrix<SIMD<double>> (sizeof(SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>)/sizeof(SIMD<double>),
|
|
2509
|
+
&mips[0].NV()(0),
|
|
2510
|
+
DummySize(mips.Size(), DIM_SPACE));
|
|
2511
|
+
*/
|
|
2512
|
+
new (&points) BareSliceMatrix<SIMD<double>> (mips.Size(), DIM_SPACE,
|
|
2513
|
+
sizeof(SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>)/sizeof(SIMD<double>),
|
|
2514
|
+
&mips[0].Point()(0));
|
|
2515
|
+
|
|
2516
|
+
new (&normals) BareSliceMatrix<SIMD<double>> (mips.Size(), DIM_SPACE,
|
|
2517
|
+
sizeof(SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>)/sizeof(SIMD<double>),
|
|
2518
|
+
&mips[0].NV()(0));
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
virtual void ComputeNormalsAndMeasure (ELEMENT_TYPE et, int facetnr) override;
|
|
2522
|
+
SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>> & operator[] (size_t i) const
|
|
2523
|
+
{
|
|
2524
|
+
return mips[i];
|
|
2525
|
+
}
|
|
2526
|
+
/*
|
|
2527
|
+
virtual BareSliceMatrix<SIMD<double>> GetPoints() const
|
|
2528
|
+
{
|
|
2529
|
+
return BareSliceMatrix<SIMD<double>> (sizeof(SIMD<MappedIntegrationPoint<DIM_ELEMENT, DIM_SPACE>>)/sizeof(SIMD<double>),
|
|
2530
|
+
&mips[0].Point()(0),
|
|
2531
|
+
DummySize(mips.Size(), DIM_SPACE));
|
|
2532
|
+
}
|
|
2533
|
+
*/
|
|
2534
|
+
virtual void Print (ostream & ost) const override;
|
|
2535
|
+
|
|
2536
|
+
virtual void TransformGradient (BareSliceMatrix<SIMD<double>> grad) const override;
|
|
2537
|
+
virtual void TransformGradientTrans (BareSliceMatrix<SIMD<double>> grad) const override;
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
#endif
|