ngsolve 6.2.2506.post216.dev0__cp314-cp314-manylinux_2_28_x86_64.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.
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngs_nvcc +22 -0
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngs_nvlink +17 -0
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngscxx +15 -0
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngsld +11 -0
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngsolve.tcl +648 -0
- ngsolve-6.2.2506.post216.dev0.data/data/bin/ngspy +2 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/analytic_integrals.hpp +10 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/arnoldi.hpp +55 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bandmatrix.hpp +334 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/basematrix.hpp +963 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/basevector.hpp +1268 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bdbequations.hpp +2807 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bdbintegrator.hpp +1660 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bem_diffops.hpp +475 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bessel.hpp +1064 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bilinearform.hpp +966 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bla.hpp +29 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/blockalloc.hpp +95 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/blockjacobi.hpp +328 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/bspline.hpp +116 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/calcinverse.hpp +141 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cg.hpp +368 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/chebyshev.hpp +44 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cholesky.hpp +720 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/clapack.h +7254 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/code_generation.hpp +296 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient.hpp +2033 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient_impl.hpp +19 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/coefficient_stdmath.hpp +167 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/commutingAMG.hpp +106 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/comp.hpp +79 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/compatibility.hpp +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/complex_wrapper.hpp +101 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/compressedfespace.hpp +110 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/contact.hpp +239 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_core.hpp +216 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_linalg.hpp +185 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_ngbla.hpp +317 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_ngstd.hpp +414 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/cuda_profiler.hpp +240 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diagonalmatrix.hpp +160 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/differentialoperator.hpp +276 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffop.hpp +1286 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffop_impl.hpp +328 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/diffopwithfactor.hpp +123 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/discontinuous.hpp +84 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/dump.hpp +949 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ectypes.hpp +121 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/eigen.hpp +60 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/eigensystem.hpp +18 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elasticity_equations.hpp +595 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementbyelement.hpp +201 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementtopology.hpp +1760 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/elementtransformation.hpp +339 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/evalfunc.hpp +405 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/expr.hpp +1693 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetfe.hpp +175 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetfespace.hpp +180 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facethofe.hpp +111 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/facetsurffespace.hpp +112 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fe_interfaces.hpp +32 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fem.hpp +87 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fesconvert.hpp +14 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/fespace.hpp +1454 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/finiteelement.hpp +286 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/globalinterfacespace.hpp +77 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/globalspace.hpp +115 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/gridfunction.hpp +525 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1amg.hpp +124 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofe.hpp +188 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofe_impl.hpp +1262 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofefo.hpp +148 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofefo_impl.hpp +185 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1hofespace.hpp +167 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1lofe.hpp +1240 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/h1lumping.hpp +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurl_equations.hpp +1381 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlcurlfe.hpp +2241 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlcurlfespace.hpp +78 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlfe.hpp +259 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlfe_utils.hpp +107 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhdiv_dshape.hpp +857 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhdivfes.hpp +308 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofe.hpp +175 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofe_impl.hpp +1871 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurlhofespace.hpp +193 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hcurllofe.hpp +1146 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdiv_equations.hpp +880 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivdivfe.hpp +2923 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivdivsurfacespace.hpp +76 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfe.hpp +206 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfe_utils.hpp +717 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivfes.hpp +75 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofe.hpp +447 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofe_impl.hpp +1107 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofefo.hpp +229 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhofespace.hpp +177 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivhosurfacefespace.hpp +106 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hdivlofe.hpp +773 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hidden.hpp +74 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/householder.hpp +181 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hypre_ams_precond.hpp +123 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/hypre_precond.hpp +73 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/integrator.hpp +2012 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/integratorcf.hpp +253 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/interpolate.hpp +49 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/intrule.hpp +2542 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/intrules_SauterSchwab.hpp +25 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/irspace.hpp +49 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/jacobi.hpp +153 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/kernels.hpp +724 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofe.hpp +194 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofe_impl.hpp +564 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofefo.hpp +542 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/l2hofespace.hpp +344 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/la.hpp +38 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/linalg_kernels.hpp +70 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/linearform.hpp +266 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/matrix.hpp +2145 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/memusage.hpp +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/meshaccess.hpp +1359 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mgpre.hpp +204 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mp_coefficient.hpp +145 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mptools.hpp +2281 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/multigrid.hpp +42 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/multivector.hpp +447 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mumpsinverse.hpp +187 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/mycomplex.hpp +361 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ng_lapack.hpp +1661 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngblas.hpp +1232 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_defines.hpp +30 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_stdcpp_include.hpp +106 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngs_utils.hpp +121 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngsobject.hpp +1019 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngsstream.hpp +113 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/ngstd.hpp +72 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/nodalhofe.hpp +96 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/nodalhofe_impl.hpp +141 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetfe.hpp +223 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetfespace.hpp +98 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/normalfacetsurfacefespace.hpp +84 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/order.hpp +251 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallel_matrices.hpp +222 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/paralleldofs.hpp +340 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallelngs.hpp +23 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/parallelvector.hpp +269 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pardisoinverse.hpp +200 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/periodic.hpp +129 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/plateaufespace.hpp +25 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pml.hpp +275 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/pmltrafo.hpp +631 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/postproc.hpp +142 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/potentialtools.hpp +22 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/precomp.hpp +60 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/preconditioner.hpp +602 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/prolongation.hpp +380 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_comp.hpp +107 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_fem.hpp +89 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_linalg.hpp +58 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/python_ngstd.hpp +386 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol.hpp +4896 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol_tet.hpp +395 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/recursive_pol_trig.hpp +492 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/reorderedfespace.hpp +81 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sample_sort.hpp +105 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/scalarfe.hpp +335 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/shapefunction_utils.hpp +113 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/simd_complex.hpp +329 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/smoother.hpp +253 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/solve.hpp +89 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsecholesky.hpp +317 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsefactorization_interface.hpp +159 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix.hpp +1052 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix_dyn.hpp +90 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/sparsematrix_impl.hpp +1055 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/special_matrix.hpp +463 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/specialelement.hpp +125 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/statushandler.hpp +33 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/stringops.hpp +12 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/superluinverse.hpp +136 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/symbolicintegrator.hpp +850 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/symmetricmatrix.hpp +144 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tangentialfacetfe.hpp +224 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tangentialfacetfespace.hpp +91 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensor.hpp +522 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensorcoefficient.hpp +446 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tensorproductintegrator.hpp +113 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thcurlfe.hpp +128 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thcurlfe_impl.hpp +380 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thdivfe.hpp +80 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/thdivfe_impl.hpp +492 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpdiffop.hpp +461 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpfes.hpp +133 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tpintrule.hpp +224 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/triangular.hpp +465 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tscalarfe.hpp +245 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/tscalarfe_impl.hpp +1029 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/umfpackinverse.hpp +148 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/unifiedvector.hpp +103 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vector.hpp +1452 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/voxelcoefficientfunction.hpp +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vtkoutput.hpp +198 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/vvector.hpp +208 -0
- ngsolve-6.2.2506.post216.dev0.data/data/include/netgen/webgui.hpp +92 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/NGSolveConfig.cmake +102 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets-release.cmake +89 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/cmake/ngsolve/ngsolve-targets.cmake +180 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngbla.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngcomp.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngfem.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngla.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsbem.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngscudalib.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngsolve.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/netgen_mesher.libs/libngstd.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/TensorProductTools.py +210 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__console.py +94 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__expr.py +181 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/__init__.py +148 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/_scikit_build_core_dependencies.py +30 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/bvp.py +78 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__init__.py +1 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/__main__.py +4 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/config/config.py +60 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/__init__.py +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/__init__.py +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hhj.py +44 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/mixed.py +30 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pickling.py +26 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/pml.py +31 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/__init__.py +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/cmagnet.py +59 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/intro/poisson.py +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/demos/mpi/mpi_timeDG.py +82 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/directsolvers.py +14 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/eigenvalues.py +364 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/internal.py +89 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/krylovspace.py +1182 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/meshes.py +748 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngs2petsc.py +310 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscuda.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngscxx.py +42 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/ngslib.so +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/nonlinearsolvers.py +203 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/preconditioners.py +11 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solve_implementation.py +168 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solvers/__init__.py +7 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/solvers/cudss.py +112 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/timestepping.py +185 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/timing.py +108 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/utils.py +167 -0
- ngsolve-6.2.2506.post216.dev0.data/data/lib/python3.14/site-packages/ngsolve/webgui.py +671 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/beam.geo +17 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/beam.vol +240 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/chip.in2d +41 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/chip.vol +614 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coil.geo +12 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coil.vol +2560 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/cube.geo +19 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/cube.vol +1832 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/shaft.geo +73 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/square.in2d +17 -0
- ngsolve-6.2.2506.post216.dev0.data/data/share/ngsolve/square.vol +149 -0
- ngsolve-6.2.2506.post216.dev0.dist-info/METADATA +14 -0
- ngsolve-6.2.2506.post216.dev0.dist-info/RECORD +306 -0
- ngsolve-6.2.2506.post216.dev0.dist-info/WHEEL +5 -0
- ngsolve-6.2.2506.post216.dev0.dist-info/licenses/LICENSE +504 -0
- ngsolve-6.2.2506.post216.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2807 @@
|
|
|
1
|
+
#ifndef FILE_BDBEQUATIONS
|
|
2
|
+
#define FILE_BDBEQUATIONS
|
|
3
|
+
|
|
4
|
+
/*********************************************************************/
|
|
5
|
+
/* File: bdbequations.hpp */
|
|
6
|
+
/* Author: Joachim Schoeberl */
|
|
7
|
+
/* Date: 25. Mar. 2000 */
|
|
8
|
+
/*********************************************************************/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#include "diffop.hpp"
|
|
12
|
+
#include "scalarfe.hpp"
|
|
13
|
+
#include "bdbintegrator.hpp"
|
|
14
|
+
#include "coefficient.hpp"
|
|
15
|
+
|
|
16
|
+
namespace ngfem
|
|
17
|
+
{
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
realizations of bdb integrators for many equations.
|
|
21
|
+
The differential operators provide the B-matrix,
|
|
22
|
+
the DMatOps provide the coefficient tensors
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
29
|
+
class DiffOpGradientBoundary; // : public DiffOp<DiffOpGradientBoundary<D, FEL> >
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/// Gradient operator of dimension D
|
|
34
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
35
|
+
class DiffOpGradient : public DiffOp<DiffOpGradient<D, FEL> >
|
|
36
|
+
{
|
|
37
|
+
public:
|
|
38
|
+
enum { DIM = 1 };
|
|
39
|
+
enum { DIM_SPACE = D };
|
|
40
|
+
enum { DIM_ELEMENT = D };
|
|
41
|
+
enum { DIM_DMAT = D };
|
|
42
|
+
enum { DIFFORDER = 1 };
|
|
43
|
+
|
|
44
|
+
typedef DiffOpGradientBoundary<D> DIFFOP_TRACE;
|
|
45
|
+
|
|
46
|
+
static string Name() { return "grad"; }
|
|
47
|
+
static constexpr bool SUPPORT_PML = true;
|
|
48
|
+
|
|
49
|
+
static const FEL & Cast (const FiniteElement & fel)
|
|
50
|
+
{ return static_cast<const FEL&> (fel); }
|
|
51
|
+
|
|
52
|
+
// using DiffOp<DiffOpGradient<D, FEL> >::GenerateMatrix;
|
|
53
|
+
static void GenerateMatrix (const FiniteElement & fel,
|
|
54
|
+
const MappedIntegrationPoint<D,D> & mip,
|
|
55
|
+
BareSliceMatrix<double,ColMajor> mat, LocalHeap & lh)
|
|
56
|
+
{
|
|
57
|
+
Cast(fel).CalcMappedDShape (mip, Trans(mat));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template <typename SCALMIP>
|
|
61
|
+
static void GenerateMatrix (const FiniteElement & fel,
|
|
62
|
+
const MappedIntegrationPoint<D,D,SCALMIP> & mip,
|
|
63
|
+
BareSliceMatrix<Complex,ColMajor> mat, LocalHeap & lh)
|
|
64
|
+
{
|
|
65
|
+
HeapReset hr(lh);
|
|
66
|
+
FlatMatrixFixWidth<D> dshape(fel.GetNDof(), lh);
|
|
67
|
+
Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
68
|
+
mat = Trans (dshape * mip.GetJacobianInverse ());
|
|
69
|
+
// mat = Trans (Cast(fel).GetDShape(mip.IP(),lh) * mip.GetJacobianInverse ());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
template <typename SCALMIP, typename MAT>
|
|
75
|
+
static void GenerateMatrix (const FiniteElement & fel,
|
|
76
|
+
const MappedIntegrationPoint<D,D,SCALMIP> & mip,
|
|
77
|
+
MAT && mat, LocalHeap & lh)
|
|
78
|
+
{
|
|
79
|
+
HeapReset hr(lh);
|
|
80
|
+
FlatMatrixFixWidth<D> dshape(fel.GetNDof(), lh);
|
|
81
|
+
Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
82
|
+
mat = Trans (dshape * mip.GetJacobianInverse ());
|
|
83
|
+
// mat = Trans (Cast(fel).GetDShape(mip.IP(),lh) * mip.GetJacobianInverse ());
|
|
84
|
+
}
|
|
85
|
+
*/
|
|
86
|
+
static int DimRef() { return D; }
|
|
87
|
+
|
|
88
|
+
template <typename IP, typename MAT>
|
|
89
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
90
|
+
MAT && mat, LocalHeap & lh)
|
|
91
|
+
{
|
|
92
|
+
Cast(fel).CalcDShape (ip, Trans(mat));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
template <typename MIP, typename MAT>
|
|
96
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
97
|
+
MAT & mat, LocalHeap & lh)
|
|
98
|
+
{
|
|
99
|
+
mat = Trans(static_cast<const MappedIntegrationPoint<D,D>&>(mip).GetJacobianInverse());
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
static void GenerateMatrixIR (const FiniteElement & fel,
|
|
104
|
+
const MappedIntegrationRule<D,D> & mir,
|
|
105
|
+
BareSliceMatrix<double,ColMajor> mat, LocalHeap & lh)
|
|
106
|
+
{
|
|
107
|
+
Cast(fel).CalcMappedDShape (mir, Trans(mat));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
111
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
112
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
113
|
+
{
|
|
114
|
+
Cast(fel).CalcMappedDShape (mir, mat);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
///
|
|
118
|
+
template <typename MIP, class TVX, class TVY>
|
|
119
|
+
static void Apply (const FiniteElement & fel, const MIP & mip,
|
|
120
|
+
const TVX & x, TVY && y,
|
|
121
|
+
LocalHeap & lh)
|
|
122
|
+
{
|
|
123
|
+
HeapReset hr(lh);
|
|
124
|
+
typedef typename TVX::TSCAL TSCAL;
|
|
125
|
+
FlatMatrixFixWidth<D> dshape(fel.GetNDof(), lh);
|
|
126
|
+
Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
127
|
+
Vec<D,TSCAL> hv = Trans (dshape) * x;
|
|
128
|
+
// Vec<D,TSCAL> hv = Trans (Cast(fel).GetDShape(mip.IP(), lh)) * x;
|
|
129
|
+
y = Trans (mip.GetJacobianInverse()) * hv;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
template <class TVY>
|
|
133
|
+
static void Apply (const FiniteElement & fel, const MappedIntegrationPoint<D,D> & mip,
|
|
134
|
+
BareSliceVector<> x, TVY && y,
|
|
135
|
+
LocalHeap & lh)
|
|
136
|
+
{
|
|
137
|
+
Vec<D> hv = Cast(fel).EvaluateGrad(mip.IP(), x);
|
|
138
|
+
y = Trans (mip.GetJacobianInverse()) * hv;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
using DiffOp<DiffOpGradient<D, FEL> >::ApplyIR;
|
|
142
|
+
|
|
143
|
+
template <class MIR>
|
|
144
|
+
static void ApplyIR (const FiniteElement & fel, const MIR & mir,
|
|
145
|
+
BareSliceVector<double> x, SliceMatrix<double> y,
|
|
146
|
+
LocalHeap & lh)
|
|
147
|
+
{
|
|
148
|
+
// FlatMatrixFixWidth<D> grad(mir.Size(), &y(0));
|
|
149
|
+
Cast(fel).EvaluateGrad (mir.IR(), x, y);
|
|
150
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
151
|
+
{
|
|
152
|
+
Vec<D> hv = y.Row(i);
|
|
153
|
+
y.Row(i) = Trans (mir[i].GetJacobianInverse()) * hv;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
using DiffOp<DiffOpGradient<D, FEL> >::ApplySIMDIR;
|
|
158
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
159
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
160
|
+
{
|
|
161
|
+
Cast(fel).EvaluateGrad (mir, x, y);
|
|
162
|
+
}
|
|
163
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
164
|
+
BareSliceVector<Complex> x, BareSliceMatrix<SIMD<Complex>> y)
|
|
165
|
+
{
|
|
166
|
+
Cast(fel).EvaluateGrad (mir, x, y);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
///
|
|
171
|
+
template <typename MIP, class TVX, class TVY>
|
|
172
|
+
static void ApplyTrans (const FiniteElement & fel, const MIP & mip,
|
|
173
|
+
const TVX & x, TVY & y,
|
|
174
|
+
LocalHeap & lh)
|
|
175
|
+
{
|
|
176
|
+
HeapReset hr(lh);
|
|
177
|
+
typedef typename TVX::TSCAL TSCAL;
|
|
178
|
+
Vec<D,TSCAL> vx = x;
|
|
179
|
+
auto hv = mip.GetJacobianInverse() * vx;
|
|
180
|
+
// y = Cast(fel).GetDShape(mip.IP(),lh) * hv;
|
|
181
|
+
FlatMatrixFixWidth<D> dshape(fel.GetNDof(), lh);
|
|
182
|
+
Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
183
|
+
y.Range(0,fel.GetNDof()) = dshape * hv;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
using DiffOp<DiffOpGradient<D, FEL> >::AddTransSIMDIR;
|
|
187
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
188
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
189
|
+
{
|
|
190
|
+
Cast(fel).AddGradTrans (mir, y, x);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
static shared_ptr<CoefficientFunction>
|
|
195
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
196
|
+
shared_ptr<CoefficientFunction> dir,
|
|
197
|
+
bool Eulerian);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
/// Boundary Gradient operator of dimension D
|
|
204
|
+
template <int D, typename FEL> // = ScalarFiniteElement<D-1> >
|
|
205
|
+
class DiffOpGradientBoundary : public DiffOp<DiffOpGradientBoundary<D, FEL> >
|
|
206
|
+
{
|
|
207
|
+
public:
|
|
208
|
+
enum { DIM = 1 };
|
|
209
|
+
enum { DIM_SPACE = D };
|
|
210
|
+
enum { DIM_ELEMENT = D-1 };
|
|
211
|
+
enum { DIM_DMAT = D };
|
|
212
|
+
enum { DIFFORDER = 1 };
|
|
213
|
+
|
|
214
|
+
static string Name() { return "gradboundary"; }
|
|
215
|
+
|
|
216
|
+
static const FEL & Cast (const FiniteElement & fel)
|
|
217
|
+
{ return static_cast<const FEL&> (fel); }
|
|
218
|
+
|
|
219
|
+
///
|
|
220
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
221
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
222
|
+
MAT && mat, LocalHeap & lh)
|
|
223
|
+
{
|
|
224
|
+
// mat = Trans (mip.GetJacobianInverse ()) * Trans (static_cast<const FEL&>(fel).GetDShape(mip.IP(),lh));
|
|
225
|
+
// HeapReset hr(lh);
|
|
226
|
+
// FlatMatrixFixWidth<DIM_ELEMENT> dshape(fel.GetNDof(), lh);
|
|
227
|
+
// Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
228
|
+
// mat = Trans (dshape * mip.GetJacobianInverse ());
|
|
229
|
+
Cast(fel).CalcMappedDShape (mip, Trans(mat));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
static int DimRef() { return D-1; }
|
|
234
|
+
|
|
235
|
+
template <typename IP, typename MAT>
|
|
236
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
237
|
+
MAT && mat, LocalHeap & lh)
|
|
238
|
+
{
|
|
239
|
+
Cast(fel).CalcDShape (ip, Trans(mat));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
template <typename MIP, typename MAT>
|
|
243
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
244
|
+
MAT & mat, LocalHeap & lh)
|
|
245
|
+
{
|
|
246
|
+
mat = Trans(static_cast<const MappedIntegrationPoint<D-1,D>&>(mip).GetJacobianInverse());
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
253
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
254
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
255
|
+
{
|
|
256
|
+
Cast(fel).CalcMappedDShape (mir, mat);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
using DiffOp<DiffOpGradientBoundary<D, FEL> >::ApplySIMDIR;
|
|
260
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
261
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
262
|
+
{
|
|
263
|
+
Cast(fel).EvaluateGrad (mir, x, y);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
using DiffOp<DiffOpGradientBoundary<D, FEL> >::AddTransSIMDIR;
|
|
267
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
268
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
269
|
+
{
|
|
270
|
+
Cast(fel).AddGradTrans (mir, y, x);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
static shared_ptr<CoefficientFunction>
|
|
274
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
275
|
+
shared_ptr<CoefficientFunction> dir,
|
|
276
|
+
bool Eulerian);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
/// Boundary Gradient operator of dimension D
|
|
282
|
+
template <int D, typename FEL = ScalarFiniteElement<D-2> >
|
|
283
|
+
class DiffOpGradientBBoundary : public DiffOp<DiffOpGradientBBoundary<D, FEL> >
|
|
284
|
+
{
|
|
285
|
+
public:
|
|
286
|
+
enum { DIM = 1 };
|
|
287
|
+
enum { DIM_SPACE = D };
|
|
288
|
+
enum { DIM_ELEMENT = D-2 };
|
|
289
|
+
enum { DIM_DMAT = D };
|
|
290
|
+
enum { DIFFORDER = 1 };
|
|
291
|
+
|
|
292
|
+
static string Name() { return "gradbboundary"; }
|
|
293
|
+
static constexpr bool SUPPORT_PML = true;
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
static const FEL & Cast (const FiniteElement & fel)
|
|
297
|
+
{ return static_cast<const FEL&> (fel); }
|
|
298
|
+
|
|
299
|
+
///
|
|
300
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
301
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
302
|
+
MAT && mat, LocalHeap & lh)
|
|
303
|
+
{
|
|
304
|
+
// mat = Trans (mip.GetJacobianInverse ()) *
|
|
305
|
+
// Trans (static_cast<const FEL&>(fel).GetDShape(mip.IP(),lh));
|
|
306
|
+
HeapReset hr(lh);
|
|
307
|
+
FlatMatrixFixWidth<DIM_ELEMENT> dshape(fel.GetNDof(), lh);
|
|
308
|
+
Cast(fel).CalcDShape (mip.IP(), dshape);
|
|
309
|
+
mat = Trans (dshape * mip.GetJacobianInverse ());
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
/// Gradient operator in r-z coordinates
|
|
317
|
+
template <int D>
|
|
318
|
+
class DiffOpGradientRotSym :
|
|
319
|
+
public DiffOp<DiffOpGradientRotSym<D> >
|
|
320
|
+
{
|
|
321
|
+
public:
|
|
322
|
+
enum { DIM = 1 };
|
|
323
|
+
enum { DIM_SPACE = D };
|
|
324
|
+
enum { DIM_ELEMENT = D };
|
|
325
|
+
enum { DIM_DMAT = D };
|
|
326
|
+
enum { DIFFORDER = 1 };
|
|
327
|
+
|
|
328
|
+
///
|
|
329
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
330
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
331
|
+
MAT & mat, LocalHeap & lh)
|
|
332
|
+
{
|
|
333
|
+
typedef typename MAT::TSCAL TSCAL;
|
|
334
|
+
|
|
335
|
+
mat = Trans (mip.GetJacobianInverse ()) *
|
|
336
|
+
Trans (fel.GetDShape(mip.IP(),lh));
|
|
337
|
+
|
|
338
|
+
double cx = mip.GetPoint()(0);
|
|
339
|
+
if (cx == 0) cx = 1e-10;
|
|
340
|
+
for (int i = 0; i < mat.Width(); i++)
|
|
341
|
+
mat(0,i) += fel.GetShape(mip.IP(), lh)(i) / cx;
|
|
342
|
+
|
|
343
|
+
// do the rot
|
|
344
|
+
for (int i = 0; i < mat.Width(); i++)
|
|
345
|
+
{
|
|
346
|
+
TSCAL hv = mat(0,i);
|
|
347
|
+
mat(0,i) = mat(1,i);
|
|
348
|
+
mat(1,i) = -hv;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
/// Identity
|
|
356
|
+
template <int D, typename FEL = BaseScalarFiniteElement>
|
|
357
|
+
class DiffOpId : public DiffOp<DiffOpId<D, FEL> >
|
|
358
|
+
{
|
|
359
|
+
public:
|
|
360
|
+
enum { DIM = 1 };
|
|
361
|
+
enum { DIM_SPACE = D };
|
|
362
|
+
enum { DIM_ELEMENT = D };
|
|
363
|
+
enum { DIM_DMAT = 1 };
|
|
364
|
+
enum { DIFFORDER = 0 };
|
|
365
|
+
static IVec<0> GetDimensions() { return IVec<0>(); };
|
|
366
|
+
|
|
367
|
+
static bool SupportsVB (VorB checkvb) { return true; }
|
|
368
|
+
|
|
369
|
+
static string Name() { return "Id"; }
|
|
370
|
+
static constexpr bool SUPPORT_PML = true;
|
|
371
|
+
|
|
372
|
+
static const FEL & Cast (const FiniteElement & fel)
|
|
373
|
+
{ return static_cast<const FEL&> (fel); }
|
|
374
|
+
|
|
375
|
+
template <typename MIP, typename MAT>
|
|
376
|
+
static void GenerateMatrix (const FiniteElement & fel, const MIP & mip,
|
|
377
|
+
MAT && mat, LocalHeap & lh)
|
|
378
|
+
{
|
|
379
|
+
Cast(fel).CalcShape (mip.IP(), mat.Row(0));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
static int DimRef() { return 1; }
|
|
383
|
+
|
|
384
|
+
template <typename IP, typename MAT>
|
|
385
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
386
|
+
MAT && mat, LocalHeap & lh)
|
|
387
|
+
{
|
|
388
|
+
Cast(fel).CalcShape (ip, mat.Row(0));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
template <typename MIP, typename MAT>
|
|
392
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
393
|
+
MAT & mat, LocalHeap & lh)
|
|
394
|
+
{
|
|
395
|
+
mat(0,0) = 1;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
/*
|
|
400
|
+
static void GenerateMatrix (const FiniteElement & fel,
|
|
401
|
+
const BaseMappedIntegrationPoint & mip,
|
|
402
|
+
FlatMatrixFixHeight<1> & mat, LocalHeap & lh)
|
|
403
|
+
{
|
|
404
|
+
Cast(fel).CalcShape (mip.IP(), mat.Row(0)); // FlatVector<> (fel.GetNDof(), &mat(0,0)));
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
template <typename MIP>
|
|
408
|
+
static void GenerateMatrix (const FiniteElement & fel,
|
|
409
|
+
// const BaseMappedIntegrationPoint & mip,
|
|
410
|
+
const MIP & mip,
|
|
411
|
+
SliceMatrix<double,ColMajor> mat, LocalHeap & lh)
|
|
412
|
+
{
|
|
413
|
+
Cast(fel).CalcShape (mip.IP(), mat.Row(0));
|
|
414
|
+
}
|
|
415
|
+
*/
|
|
416
|
+
// using DiffOp<DiffOpId<D, FEL> > :: GenerateMatrixIR;
|
|
417
|
+
template <typename MAT>
|
|
418
|
+
static void GenerateMatrixIR (const FiniteElement & fel,
|
|
419
|
+
const BaseMappedIntegrationRule & mir,
|
|
420
|
+
MAT & mat, LocalHeap & lh)
|
|
421
|
+
{
|
|
422
|
+
Cast(fel).CalcShape (mir.IR(), Trans(mat));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
426
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
427
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
428
|
+
{
|
|
429
|
+
Cast(fel).CalcShape (mir.IR(), mat);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
static void Apply (const FiniteElement & fel, const BaseMappedIntegrationPoint & mip,
|
|
433
|
+
BareSliceVector<Complex> x, BareVector<Complex> y,
|
|
434
|
+
LocalHeap & lh)
|
|
435
|
+
{
|
|
436
|
+
y(0) = Cast(fel).Evaluate(mip.IP(), x);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
static void Apply (const FiniteElement & fel, const BaseMappedIntegrationPoint & mip,
|
|
440
|
+
BareSliceVector<double> x, BareVector<double> y,
|
|
441
|
+
LocalHeap & lh)
|
|
442
|
+
{
|
|
443
|
+
y(0) = Cast(fel).Evaluate(mip.IP(), x);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
// using DiffOp<DiffOpId<D, FEL> >::ApplyIR;
|
|
448
|
+
|
|
449
|
+
template <class MIR, class TMY>
|
|
450
|
+
static void ApplyIR (const FiniteElement & fel, const MIR & mir,
|
|
451
|
+
BareSliceVector<double> x, TMY y,
|
|
452
|
+
LocalHeap & lh)
|
|
453
|
+
{
|
|
454
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Col(0)); // FlatVector<> (mir.Size(), &y(0,0)));
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
template <class MIR>
|
|
458
|
+
static void ApplyIR (const FiniteElement & fel, const MIR & mir,
|
|
459
|
+
BareSliceVector<Complex> x, SliceMatrix<Complex> y,
|
|
460
|
+
LocalHeap & lh)
|
|
461
|
+
{
|
|
462
|
+
Cast(fel).Evaluate (mir.IR(),
|
|
463
|
+
SliceMatrix<double> (fel.GetNDof(), 2, 2, reinterpret_cast<double*> (&x(0))),
|
|
464
|
+
SliceMatrix<double> (mir.Size(), 2, 2*y.Dist(), reinterpret_cast<double*> (&y(0))));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// using ApplySIMDIR;
|
|
468
|
+
using DiffOp<DiffOpId<D, FEL> >::ApplySIMDIR;
|
|
469
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
470
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
471
|
+
{
|
|
472
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Row(0));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
476
|
+
BareSliceVector<Complex> x, BareSliceMatrix<SIMD<Complex>> y)
|
|
477
|
+
{
|
|
478
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Row(0));
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
template <typename MIP, class TVX, class TVY>
|
|
484
|
+
static void ApplyTrans (const FiniteElement & fel, const MIP & mip,
|
|
485
|
+
const TVX & x, TVY & y,
|
|
486
|
+
LocalHeap & lh)
|
|
487
|
+
{
|
|
488
|
+
HeapReset hr(lh);
|
|
489
|
+
y.Range(0,fel.GetNDof()) = x(0) * Cast(fel).GetShape (mip.IP(), lh);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
// using DiffOp<DiffOpId<D, FEL> >::ApplyTransIR;
|
|
494
|
+
template <class MIR>
|
|
495
|
+
static void ApplyTransIR (const FiniteElement & fel,
|
|
496
|
+
const MIR & mir,
|
|
497
|
+
FlatMatrix<double> x, BareSliceVector<double> y,
|
|
498
|
+
LocalHeap & lh)
|
|
499
|
+
{
|
|
500
|
+
// Cast(fel).EvaluateTrans (mir.IR(), FlatVector<> (mir.Size(), &x(0,0)), y);
|
|
501
|
+
Cast(fel).EvaluateTrans (mir.IR(), x.Col(0), y);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
template <class MIR>
|
|
505
|
+
static void ApplyTransIR (const FiniteElement & fel,
|
|
506
|
+
const MIR & mir,
|
|
507
|
+
FlatMatrix<Complex> x, BareSliceVector<Complex> y,
|
|
508
|
+
LocalHeap & lh)
|
|
509
|
+
{
|
|
510
|
+
DiffOp<DiffOpId<D, FEL> > :: ApplyTransIR (fel, mir, x, y, lh);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
using DiffOp<DiffOpId<D, FEL> >::AddTransSIMDIR;
|
|
514
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
515
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
516
|
+
{
|
|
517
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
521
|
+
BareSliceMatrix<SIMD<Complex>> y, BareSliceVector<Complex> x)
|
|
522
|
+
{
|
|
523
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
static shared_ptr<CoefficientFunction>
|
|
529
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
530
|
+
shared_ptr<CoefficientFunction> dir,
|
|
531
|
+
bool Eulerian);
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
template <int _DIM_SPACE, int _DIM_ELEMENT>
|
|
536
|
+
class DiffOpIdH1 : public DiffOpId<_DIM_SPACE>
|
|
537
|
+
{
|
|
538
|
+
public:
|
|
539
|
+
enum { DIM_SPACE = _DIM_SPACE };
|
|
540
|
+
enum { DIM_ELEMENT = _DIM_ELEMENT };
|
|
541
|
+
|
|
542
|
+
typedef DiffOpIdH1<_DIM_SPACE, _DIM_ELEMENT-1> DIFFOP_TRACE;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
template <int _DIM_SPACE>
|
|
546
|
+
class DiffOpIdH1<_DIM_SPACE,0> : public DiffOpId<_DIM_SPACE>
|
|
547
|
+
{
|
|
548
|
+
public:
|
|
549
|
+
enum { DIM_SPACE = _DIM_SPACE };
|
|
550
|
+
enum { DIM_ELEMENT = 0 };
|
|
551
|
+
|
|
552
|
+
typedef void DIFFOP_TRACE;
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
/// Identity
|
|
558
|
+
template <int D, int SYSDIM>
|
|
559
|
+
class DiffOpIdSys : public DiffOp<DiffOpIdSys<D,SYSDIM> >
|
|
560
|
+
{
|
|
561
|
+
public:
|
|
562
|
+
enum { DIM = SYSDIM };
|
|
563
|
+
enum { DIM_SPACE = D };
|
|
564
|
+
enum { DIM_ELEMENT = D };
|
|
565
|
+
enum { DIM_DMAT = SYSDIM };
|
|
566
|
+
enum { DIFFORDER = 0 };
|
|
567
|
+
|
|
568
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
569
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
570
|
+
MAT & mat, LocalHeap & lh)
|
|
571
|
+
{
|
|
572
|
+
HeapReset hr(lh);
|
|
573
|
+
const FlatVector<> shape = fel.GetShape (mip.IP(), lh);
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
typedef typename MAT::TSCAL TSCAL;
|
|
577
|
+
mat = TSCAL(0.);
|
|
578
|
+
for (int j = 0; j < shape.Height(); j++)
|
|
579
|
+
for (int i = 0; i < SYSDIM; i++)
|
|
580
|
+
mat(i, j*SYSDIM+i) = shape(j);
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
/// Identity on boundary
|
|
589
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
590
|
+
class DiffOpIdBoundary : public DiffOp<DiffOpIdBoundary<D, FEL> >
|
|
591
|
+
{
|
|
592
|
+
public:
|
|
593
|
+
enum { DIM = 1 };
|
|
594
|
+
enum { DIM_SPACE = D };
|
|
595
|
+
enum { DIM_ELEMENT = D-1 };
|
|
596
|
+
enum { DIM_DMAT = 1 };
|
|
597
|
+
enum { DIFFORDER = 0 };
|
|
598
|
+
|
|
599
|
+
static string Name() { return "IdBoundary"; }
|
|
600
|
+
static constexpr bool SUPPORT_PML = true;
|
|
601
|
+
static IVec<0> GetDimensions() { return IVec<0>(); };
|
|
602
|
+
|
|
603
|
+
static const FEL & Cast (const FiniteElement & fel)
|
|
604
|
+
{ return static_cast<const FEL&> (fel); }
|
|
605
|
+
|
|
606
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
607
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
608
|
+
MAT && mat, LocalHeap & lh)
|
|
609
|
+
{
|
|
610
|
+
Cast(fel).CalcShape (mip.IP(), mat.Row(0));
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
static int DimRef() { return 1; }
|
|
615
|
+
|
|
616
|
+
template <typename IP, typename MAT>
|
|
617
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
618
|
+
MAT && mat, LocalHeap & lh)
|
|
619
|
+
{
|
|
620
|
+
Cast(fel).CalcShape (ip, mat.Row(0));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
template <typename MIP, typename MAT>
|
|
624
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
625
|
+
MAT & mat, LocalHeap & lh)
|
|
626
|
+
{
|
|
627
|
+
mat(0,0) = 1;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
633
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
634
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
635
|
+
{
|
|
636
|
+
Cast(fel).CalcShape (mir.IR(), mat);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
template <typename AFEL, typename MIP, class TVX, class TVY>
|
|
640
|
+
static void Apply (const AFEL & fel, const MIP & mip,
|
|
641
|
+
const TVX & x, TVY && y,
|
|
642
|
+
LocalHeap & lh)
|
|
643
|
+
{
|
|
644
|
+
HeapReset hr(lh);
|
|
645
|
+
y = Trans (Cast(fel).GetShape (mip.IP(), lh)) * x;
|
|
646
|
+
// y(0) = InnerProduct (x, static_cast<const FEL&>(fel).GetShape (mip.IP(), lh));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
static void Apply (const ScalarFiniteElement<D-1> & fel, const MappedIntegrationPoint<D-1,D> & mip,
|
|
650
|
+
const FlatVector<double> & x, FlatVector<double> & y,
|
|
651
|
+
LocalHeap & lh)
|
|
652
|
+
{
|
|
653
|
+
y(0) = Cast(fel).Evaluate(mip.IP(), x);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
template <typename AFEL, typename MIP, class TVX, class TVY>
|
|
658
|
+
static void ApplyTrans (const AFEL & fel, const MIP & mip,
|
|
659
|
+
const TVX & x, TVY & y,
|
|
660
|
+
LocalHeap & lh)
|
|
661
|
+
{
|
|
662
|
+
HeapReset hr(lh);
|
|
663
|
+
y.Range(0,fel.GetNDof()) = Cast(fel).GetShape (mip.IP(), lh) * x;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
// using DiffOp<DiffOpIdBoundary<D, FEL> >::ApplyTransIR;
|
|
670
|
+
template <class MIR>
|
|
671
|
+
static void ApplyTransIR (const FiniteElement & fel, const MIR & mir,
|
|
672
|
+
FlatMatrix<double> x, BareSliceVector<double> y,
|
|
673
|
+
LocalHeap & lh)
|
|
674
|
+
{
|
|
675
|
+
Cast(fel).EvaluateTrans (mir.IR(), FlatVector<> (mir.Size(), &x(0,0)), y);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
template <class MIR>
|
|
679
|
+
static void ApplyTransIR (const FiniteElement & fel, const MIR & mir,
|
|
680
|
+
FlatMatrix<Complex> x, BareSliceVector<Complex> y,
|
|
681
|
+
LocalHeap & lh)
|
|
682
|
+
{
|
|
683
|
+
DiffOp<DiffOpIdBoundary<D, FEL> > :: ApplyTransIR (fel, mir, x, y, lh);
|
|
684
|
+
// static_cast<const FEL&>(fel).
|
|
685
|
+
// EvaluateTrans (mir.IR(), FlatVector<> (mir.Size(), &x(0,0)), y);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
using DiffOp<DiffOpIdBoundary<D, FEL> >::ApplySIMDIR;
|
|
689
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
690
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
691
|
+
{
|
|
692
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Row(0));
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
696
|
+
BareSliceVector<Complex> x, BareSliceMatrix<SIMD<Complex>> y)
|
|
697
|
+
{
|
|
698
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Row(0));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// using DiffOp<DiffOpIdBoundary<D, FEL> >::AddTransSIMDIR;
|
|
702
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
703
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
704
|
+
{
|
|
705
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
709
|
+
BareSliceMatrix<SIMD<Complex>> y, BareSliceVector<Complex> x)
|
|
710
|
+
{
|
|
711
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
/// Identity
|
|
719
|
+
template <int D, int SYSDIM>
|
|
720
|
+
class DiffOpIdBoundarySys : public DiffOp<DiffOpIdBoundarySys<D,SYSDIM> >
|
|
721
|
+
{
|
|
722
|
+
public:
|
|
723
|
+
enum { DIM = SYSDIM };
|
|
724
|
+
enum { DIM_SPACE = D };
|
|
725
|
+
enum { DIM_ELEMENT = D-1 };
|
|
726
|
+
enum { DIM_DMAT = SYSDIM };
|
|
727
|
+
enum { DIFFORDER = 0 };
|
|
728
|
+
|
|
729
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
730
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
731
|
+
MAT & mat, LocalHeap & lh)
|
|
732
|
+
{
|
|
733
|
+
mat = 0.;
|
|
734
|
+
const FlatVector<> shape = fel.GetShape (mip.IP(), lh);
|
|
735
|
+
for (int j = 0; j < shape.Height(); j++)
|
|
736
|
+
for (int i = 0; i < SYSDIM; i++)
|
|
737
|
+
mat(i, j*SYSDIM+i) = shape(j);
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
743
|
+
class DiffOpHesseBoundary;
|
|
744
|
+
|
|
745
|
+
template <int D>
|
|
746
|
+
class DiffOpHesse : public DiffOp<DiffOpHesse<D>>
|
|
747
|
+
{
|
|
748
|
+
public:
|
|
749
|
+
enum { DIM = 1 };
|
|
750
|
+
enum { DIM_SPACE = D };
|
|
751
|
+
enum { DIM_ELEMENT = D };
|
|
752
|
+
enum { DIM_DMAT = D*D };
|
|
753
|
+
enum { DIFFORDER = 2 };
|
|
754
|
+
|
|
755
|
+
typedef DiffOpHesseBoundary<D> DIFFOP_TRACE;
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
static string Name() { return "hesse"; }
|
|
759
|
+
static IVec<2> GetDimensions() { return { D,D }; }
|
|
760
|
+
|
|
761
|
+
static auto & Cast (const FiniteElement & fel)
|
|
762
|
+
{ return static_cast<const ScalarFiniteElement<D>&> (fel); }
|
|
763
|
+
|
|
764
|
+
template <typename MIP, typename MAT>
|
|
765
|
+
static void GenerateMatrix (const FiniteElement & fel, const MIP & mip,
|
|
766
|
+
MAT && mat, LocalHeap & lh)
|
|
767
|
+
{
|
|
768
|
+
Cast(fel).CalcMappedDDShape(mip, Trans(mat));
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
static shared_ptr<CoefficientFunction>
|
|
772
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
773
|
+
shared_ptr<CoefficientFunction> dir,
|
|
774
|
+
bool eulerian);
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
template <int D, typename FEL>
|
|
779
|
+
class DiffOpHesseBoundary : public DiffOp<DiffOpHesseBoundary<D, FEL> >
|
|
780
|
+
{
|
|
781
|
+
public:
|
|
782
|
+
enum { DIM = 1 };
|
|
783
|
+
enum { DIM_SPACE = D };
|
|
784
|
+
enum { DIM_ELEMENT = D-1 };
|
|
785
|
+
enum { DIM_DMAT = D*D };
|
|
786
|
+
enum { DIFFORDER = 2 };
|
|
787
|
+
|
|
788
|
+
typedef void DIFFOP_TRACE;
|
|
789
|
+
|
|
790
|
+
static string Name() { return "hesseboundary"; }
|
|
791
|
+
static IVec<2> GetDimensions() { return { D,D }; }
|
|
792
|
+
|
|
793
|
+
static auto & Cast (const FiniteElement & fel)
|
|
794
|
+
{ return static_cast<const FEL&> (fel); }
|
|
795
|
+
|
|
796
|
+
///
|
|
797
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
798
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
799
|
+
MAT && mat, LocalHeap & lh)
|
|
800
|
+
{
|
|
801
|
+
HeapReset hr(lh);
|
|
802
|
+
|
|
803
|
+
/*
|
|
804
|
+
// old
|
|
805
|
+
int nd = Cast(fel).GetNDof();
|
|
806
|
+
auto ddshape = Cast(fel).GetDDShape(mip.IP(), lh);
|
|
807
|
+
auto jinv = mip.GetJacobianInverse();
|
|
808
|
+
auto dshape = Cast(fel).GetDShape (mip.IP(), lh);
|
|
809
|
+
|
|
810
|
+
for( int n = 0; n < nd; n++)
|
|
811
|
+
{
|
|
812
|
+
for( int i = 0; i < D; i++)
|
|
813
|
+
{
|
|
814
|
+
for( int j = 0; j < D; j++)
|
|
815
|
+
{
|
|
816
|
+
mat(i*D+j,n) = 0.0;
|
|
817
|
+
for( int k = 0; k < D-1; k++)
|
|
818
|
+
{
|
|
819
|
+
for( int l = 0; l < D-1; l++)
|
|
820
|
+
{
|
|
821
|
+
mat(i*D+j,n) += jinv(k,i)*ddshape(n,k*(D-1)+l)*jinv(l,j);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
//for non-curved elements, we are finished, otherwise derivatives of Jacobian have to be computed...
|
|
829
|
+
if (!mip.GetTransformation().IsCurvedElement()) return;
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
Mat<D-1,D-1> hesse[D];
|
|
833
|
+
switch(D)
|
|
834
|
+
{
|
|
835
|
+
case 3:
|
|
836
|
+
mip.CalcHesse (hesse[0], hesse[1], hesse[2]);
|
|
837
|
+
break;
|
|
838
|
+
case 2:
|
|
839
|
+
mip.CalcHesse (hesse[0], hesse[1]);
|
|
840
|
+
break;
|
|
841
|
+
default:
|
|
842
|
+
throw Exception("Not implemented in DiffOpHesseBoundary!");
|
|
843
|
+
break;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
FlatMatrix<> tmp(D, (D-1)*(D-1), lh);
|
|
847
|
+
|
|
848
|
+
for (int i = 0; i < D; i++)
|
|
849
|
+
{
|
|
850
|
+
for (int j = 0; j < D-1; j++)
|
|
851
|
+
{
|
|
852
|
+
for (int k = 0; k < D-1; k++)
|
|
853
|
+
tmp(i,j*(D-1)+k) = hesse[i](j,k);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
FlatMatrix<> tmpmat(nd, (D-1)*(D-1), lh);
|
|
858
|
+
tmpmat = dshape*jinv*tmp;
|
|
859
|
+
|
|
860
|
+
for( int n = 0; n < nd; n++)
|
|
861
|
+
{
|
|
862
|
+
for( int i = 0; i < D; i++)
|
|
863
|
+
{
|
|
864
|
+
for( int j = 0; j < D; j++)
|
|
865
|
+
{
|
|
866
|
+
for( int k = 0; k < D-1; k++)
|
|
867
|
+
{
|
|
868
|
+
for( int l = 0; l < D-1; l++)
|
|
869
|
+
{
|
|
870
|
+
mat(i*D+j,n) -= jinv(k,i)*tmpmat(n,k*(D-1)+l)*jinv(l,j);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
*/
|
|
877
|
+
|
|
878
|
+
/*
|
|
879
|
+
// new
|
|
880
|
+
int nd = Cast(fel).GetNDof();
|
|
881
|
+
|
|
882
|
+
auto ddshape = Cast(fel).GetDDShape(mip.IP(), lh);
|
|
883
|
+
auto dshape = Cast(fel).GetDShape (mip.IP(), lh);
|
|
884
|
+
Mat<D-1,D> jinv = mip.GetJacobianInverse();
|
|
885
|
+
|
|
886
|
+
for( int n = 0; n < nd; n++)
|
|
887
|
+
{
|
|
888
|
+
Mat<D-1,D-1> ddref = ddshape.Row(n).AsMatrix(D-1,D-1);
|
|
889
|
+
Mat<D,D> ddphys = Trans(jinv)*ddref*jinv;
|
|
890
|
+
mat.Col(n).AsMatrix(D,D) = ddphys;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
//for non-curved elements, we are finished, otherwise derivatives of Jacobian have to be computed...
|
|
894
|
+
if (!mip.GetTransformation().IsCurvedElement()) return;
|
|
895
|
+
|
|
896
|
+
Vec<D,Mat<D-1,D-1>> hesse;
|
|
897
|
+
mip.CalcHesse(hesse);
|
|
898
|
+
|
|
899
|
+
Mat<D,(D-1)*(D-1)> tmp;
|
|
900
|
+
|
|
901
|
+
for (int i = 0; i < D; i++)
|
|
902
|
+
for (int j = 0; j < D-1; j++)
|
|
903
|
+
for (int k = 0; k < D-1; k++)
|
|
904
|
+
tmp(i,j*(D-1)+k) = hesse[i](j,k);
|
|
905
|
+
|
|
906
|
+
FlatMatrix<> tmpmat(nd, (D-1)*(D-1), lh);
|
|
907
|
+
tmpmat = dshape*(jinv*tmp);
|
|
908
|
+
|
|
909
|
+
for( int n = 0; n < nd; n++)
|
|
910
|
+
{
|
|
911
|
+
Mat<D-1,D-1> ddref = tmpmat.Row(n).AsMatrix(D-1,D-1);
|
|
912
|
+
Mat<D,D> ddphys = Trans(jinv)*ddref*jinv;
|
|
913
|
+
mat.Col(n).AsMatrix(D,D) -= ddphys;
|
|
914
|
+
}
|
|
915
|
+
*/
|
|
916
|
+
/*
|
|
917
|
+
// new new
|
|
918
|
+
auto ddshape = Cast(fel).GetDDShape(mip.IP(), lh);
|
|
919
|
+
Mat<D-1,D> jinv = mip.GetJacobianInverse();
|
|
920
|
+
|
|
921
|
+
Mat<(D-1)*(D-1),D*D> trans;
|
|
922
|
+
for (int i = 0; i < D; i++)
|
|
923
|
+
for (int j = 0; j < D; j++)
|
|
924
|
+
for (int k = 0; k < D-1; k++)
|
|
925
|
+
for (int l = 0; l < D-1; l++)
|
|
926
|
+
trans(k*(D-1)+l, i*D+j) = jinv(k,i)*jinv(l,j);
|
|
927
|
+
|
|
928
|
+
if (mip.GetTransformation().IsCurvedElement())
|
|
929
|
+
{
|
|
930
|
+
auto dshape = Cast(fel).GetDShape (mip.IP(), lh);
|
|
931
|
+
|
|
932
|
+
Vec<D,Mat<D-1,D-1>> hesse = mip.CalcHesse();
|
|
933
|
+
Mat<D,(D-1)*(D-1)> tmp;
|
|
934
|
+
|
|
935
|
+
for (int i = 0; i < D; i++)
|
|
936
|
+
for (int j = 0; j < D-1; j++)
|
|
937
|
+
for (int k = 0; k < D-1; k++)
|
|
938
|
+
tmp(i,j*(D-1)+k) = hesse[i](j,k);
|
|
939
|
+
|
|
940
|
+
ddshape -= dshape*(jinv*tmp);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
mat = Trans(ddshape*trans);
|
|
944
|
+
*/
|
|
945
|
+
Cast(fel).CalcMappedDDShape(mip, Trans(mat));
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
static constexpr double eps() { return 1e-4; }
|
|
950
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
951
|
+
const SIMD_BaseMappedIntegrationRule & bmir,
|
|
952
|
+
BareSliceMatrix<SIMD<double>> mat);
|
|
953
|
+
|
|
954
|
+
using DiffOp<DiffOpHesseBoundary<D,FEL>>::ApplySIMDIR;
|
|
955
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & bmir,
|
|
956
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y);
|
|
957
|
+
|
|
958
|
+
using DiffOp<DiffOpHesseBoundary<D,FEL>>::AddTransSIMDIR;
|
|
959
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & bmir,
|
|
960
|
+
BareSliceMatrix<SIMD<double>> x, BareSliceVector<double> y);
|
|
961
|
+
|
|
962
|
+
static shared_ptr<CoefficientFunction>
|
|
963
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
964
|
+
shared_ptr<CoefficientFunction> dir,
|
|
965
|
+
bool eulerian);
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
template <typename FEL>
|
|
970
|
+
class DiffOpHesseBoundary<1,FEL> : public DiffOp<DiffOpHesseBoundary<1, FEL> >
|
|
971
|
+
{
|
|
972
|
+
public:
|
|
973
|
+
enum { DIM = 1 };
|
|
974
|
+
enum { DIM_SPACE = 1 };
|
|
975
|
+
enum { DIM_ELEMENT = 0 };
|
|
976
|
+
enum { DIM_DMAT = 1 };
|
|
977
|
+
enum { DIFFORDER = 2 };
|
|
978
|
+
|
|
979
|
+
typedef void DIFFOP_TRACE;
|
|
980
|
+
|
|
981
|
+
static string Name() { return "hesseboundary"; }
|
|
982
|
+
///
|
|
983
|
+
template <typename AFEL, typename MIP, typename MAT>
|
|
984
|
+
static void GenerateMatrix (const AFEL & fel, const MIP & mip,
|
|
985
|
+
MAT && mat, LocalHeap & lh)
|
|
986
|
+
{
|
|
987
|
+
throw Exception("hesseboundary not implemented for 1D!");
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
/// diagonal tensor, all values are the same
|
|
998
|
+
template <int DIM>
|
|
999
|
+
class DiagDMat : public DMatOp<DiagDMat<DIM>,DIM>
|
|
1000
|
+
{
|
|
1001
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1002
|
+
public:
|
|
1003
|
+
// typedef SCAL TSCAL;
|
|
1004
|
+
enum { DIM_DMAT = DIM };
|
|
1005
|
+
DiagDMat (shared_ptr<CoefficientFunction> acoef)
|
|
1006
|
+
: coef(acoef) { ; }
|
|
1007
|
+
|
|
1008
|
+
// compatibility
|
|
1009
|
+
DiagDMat (const CoefficientFunction * acoef)
|
|
1010
|
+
: coef(const_cast<CoefficientFunction*>(acoef), NOOP_Deleter) { ; }
|
|
1011
|
+
|
|
1012
|
+
DiagDMat (const Array<shared_ptr<CoefficientFunction>> & acoefs)
|
|
1013
|
+
: coef(acoefs[0]) { ; }
|
|
1014
|
+
|
|
1015
|
+
template <typename SCAL>
|
|
1016
|
+
static DiagMat<DIM_DMAT,SCAL> GetMatrixType(SCAL s) { return SCAL(0); }
|
|
1017
|
+
|
|
1018
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1019
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1020
|
+
MAT & mat, LocalHeap & lh) const
|
|
1021
|
+
{
|
|
1022
|
+
typedef typename MAT::TSCAL TRESULT;
|
|
1023
|
+
TRESULT val = coef -> T_Evaluate<TRESULT> (mip);
|
|
1024
|
+
mat = val * Id<DIM>();
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
template <typename FEL, typename MIR, typename MAT>
|
|
1028
|
+
void GenerateMatrixIR (const FEL & fel, const MIR & mir,
|
|
1029
|
+
const FlatArray<MAT> & mats, LocalHeap & lh) const
|
|
1030
|
+
{
|
|
1031
|
+
typedef typename MAT::TSCAL TRESULT;
|
|
1032
|
+
FlatMatrix<TRESULT> vals(mir.IR().GetNIP(), 1, lh);
|
|
1033
|
+
coef -> Evaluate (mir, vals);
|
|
1034
|
+
|
|
1035
|
+
for (int j = 0; j < mir.IR().GetNIP(); j++)
|
|
1036
|
+
mats[j] = vals(j,0) * Id<DIM>();
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
template <typename FEL, class VECX, class VECY>
|
|
1040
|
+
void Apply (const FEL & fel, const BaseMappedIntegrationPoint & mip,
|
|
1041
|
+
const VECX & x, VECY && y, LocalHeap & lh) const
|
|
1042
|
+
{
|
|
1043
|
+
typedef typename remove_reference<VECY>::type::TSCAL TRESULT;
|
|
1044
|
+
TRESULT val = coef -> T_Evaluate<TRESULT> (mip);
|
|
1045
|
+
for (int i = 0; i < DIM; i++)
|
|
1046
|
+
y(i) = val * x(i);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
template <typename FEL, class VECX>
|
|
1050
|
+
void Apply1 (const FEL & fel, const BaseMappedIntegrationPoint & mip,
|
|
1051
|
+
const VECX & x, LocalHeap & lh) const
|
|
1052
|
+
{
|
|
1053
|
+
typedef typename VECX::TSCAL TSCAL;
|
|
1054
|
+
auto val = coef -> T_Evaluate<TSCAL> (mip);
|
|
1055
|
+
for (int i = 0; i < DIM; i++)
|
|
1056
|
+
x(i) *= val;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
template <typename FEL, typename MIR, typename TVX>
|
|
1060
|
+
void ApplyIR (const FEL & fel, const MIR & mir,
|
|
1061
|
+
TVX & x, LocalHeap & lh) const
|
|
1062
|
+
{
|
|
1063
|
+
typedef typename TVX::TSCAL TSCAL;
|
|
1064
|
+
FlatMatrix<TSCAL> values(mir.Size(), 1, lh);
|
|
1065
|
+
coef -> Evaluate (mir, values);
|
|
1066
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
1067
|
+
for (int j = 0; j < DIM; j++)
|
|
1068
|
+
x(i,j) *= values(i, 0);
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
/// orthotropic tensor.
|
|
1078
|
+
template <int N>
|
|
1079
|
+
class OrthoDMat
|
|
1080
|
+
{
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
template <> class OrthoDMat<1> : public DMatOp<OrthoDMat<1>,1>
|
|
1084
|
+
{
|
|
1085
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1086
|
+
public:
|
|
1087
|
+
enum { DIM_DMAT = 1 };
|
|
1088
|
+
OrthoDMat (shared_ptr<CoefficientFunction> acoef) : coef(acoef) { ; }
|
|
1089
|
+
OrthoDMat (const Array<shared_ptr<CoefficientFunction>> & acoef) : coef(acoef[0]) { ; }
|
|
1090
|
+
|
|
1091
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1092
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1093
|
+
MAT & mat, LocalHeap & lh) const
|
|
1094
|
+
{
|
|
1095
|
+
mat(0,0) = Evaluate (*coef, mip);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1099
|
+
void Apply (const FEL & fel, const MIP & mip,
|
|
1100
|
+
const VECX & x, VECY & y, LocalHeap & lh) const
|
|
1101
|
+
{
|
|
1102
|
+
y(0) = Evaluate (*coef, mip) * x(0);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1106
|
+
void ApplyTrans (const FEL & fel, const MIP & mip,
|
|
1107
|
+
const VECX & x, VECY & y, LocalHeap & lh) const
|
|
1108
|
+
{
|
|
1109
|
+
y(0) = Evaluate (*coef, mip) * x(0);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
template <> class OrthoDMat<2>: public DMatOp<OrthoDMat<2>,2>
|
|
1116
|
+
{
|
|
1117
|
+
shared_ptr<CoefficientFunction> coef1, coef2;
|
|
1118
|
+
public:
|
|
1119
|
+
enum { DIM_DMAT = 2 };
|
|
1120
|
+
OrthoDMat (const Array<shared_ptr<CoefficientFunction>> & acoefs)
|
|
1121
|
+
: coef1(acoefs[0]), coef2(acoefs[1]) { ; }
|
|
1122
|
+
|
|
1123
|
+
/*
|
|
1124
|
+
OrthoDMat (CoefficientFunction * acoef1,
|
|
1125
|
+
CoefficientFunction * acoef2)
|
|
1126
|
+
: coef1(acoef1), coef2(acoef2) { ; }
|
|
1127
|
+
OrthoDMat (CoefficientFunction * acoef1,
|
|
1128
|
+
CoefficientFunction * acoef2,
|
|
1129
|
+
CoefficientFunction * acoef3)
|
|
1130
|
+
: coef1(acoef1), coef2(acoef2) { ; }
|
|
1131
|
+
*/
|
|
1132
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1133
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1134
|
+
MAT & mat, LocalHeap & lh) const
|
|
1135
|
+
{
|
|
1136
|
+
mat = 0;
|
|
1137
|
+
mat(0,0) = Evaluate (*coef1, mip);
|
|
1138
|
+
mat(1,1) = Evaluate (*coef2, mip);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
template <typename FEL, typename MIP>
|
|
1142
|
+
void GetEigensystem (const FEL & fel, const MIP & mip,
|
|
1143
|
+
Array<double> & eigenvalues,
|
|
1144
|
+
Array<double> & eigenvectors,
|
|
1145
|
+
LocalHeap & lh) const
|
|
1146
|
+
{
|
|
1147
|
+
eigenvalues[0] = Evaluate (*coef1, mip);
|
|
1148
|
+
eigenvalues[1] = Evaluate (*coef2, mip);
|
|
1149
|
+
eigenvectors[0] = eigenvectors[3] = 1.;
|
|
1150
|
+
eigenvectors[1] = eigenvectors[2] = 0.;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1154
|
+
void Apply (const FEL & fel, const MIP & mip,
|
|
1155
|
+
const VECX & x, VECY && y, LocalHeap & lh) const
|
|
1156
|
+
{
|
|
1157
|
+
y(0) = Evaluate (*coef1, mip) * x(0);
|
|
1158
|
+
y(1) = Evaluate (*coef2, mip) * x(1);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1162
|
+
void ApplyTrans (const FEL & fel, const MIP & mip,
|
|
1163
|
+
const VECX & x, VECY & y, LocalHeap & lh) const
|
|
1164
|
+
{
|
|
1165
|
+
y(0) = Evaluate (*coef1, mip) * x(0);
|
|
1166
|
+
y(1) = Evaluate (*coef2, mip) * x(1);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
template <> class OrthoDMat<3> : public DMatOp<OrthoDMat<3>,3>
|
|
1171
|
+
{
|
|
1172
|
+
shared_ptr<CoefficientFunction> coef1, coef2, coef3;
|
|
1173
|
+
|
|
1174
|
+
public:
|
|
1175
|
+
enum { DIM_DMAT = 3 };
|
|
1176
|
+
OrthoDMat (const Array<shared_ptr<CoefficientFunction>> & acoefs)
|
|
1177
|
+
: coef1(acoefs[0]), coef2(acoefs[1]), coef3(acoefs[2]) { ; }
|
|
1178
|
+
/*
|
|
1179
|
+
OrthoDMat (CoefficientFunction * acoef1,
|
|
1180
|
+
CoefficientFunction * acoef2)
|
|
1181
|
+
: coef1(acoef1), coef2(acoef2), coef3(acoef2) { ; }
|
|
1182
|
+
OrthoDMat (CoefficientFunction * acoef1,
|
|
1183
|
+
CoefficientFunction * acoef2,
|
|
1184
|
+
CoefficientFunction * acoef3)
|
|
1185
|
+
: coef1(acoef1), coef2(acoef2), coef3(acoef3) { ; }
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1188
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1189
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1190
|
+
MAT & mat, LocalHeap & lh) const
|
|
1191
|
+
{
|
|
1192
|
+
mat = 0;
|
|
1193
|
+
mat(0,0) = Evaluate (*coef1, mip);
|
|
1194
|
+
mat(1,1) = Evaluate (*coef2, mip);
|
|
1195
|
+
mat(2,2) = Evaluate (*coef3, mip);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
template <typename FEL, typename MIP>
|
|
1200
|
+
void GetEigensystem (const FEL & fel, const MIP & mip,
|
|
1201
|
+
Array<double> & eigenvalues,
|
|
1202
|
+
Array<double> & eigenvectors,
|
|
1203
|
+
LocalHeap & lh) const
|
|
1204
|
+
{
|
|
1205
|
+
|
|
1206
|
+
eigenvalues[0] = Evaluate(*coef1,mip);
|
|
1207
|
+
eigenvalues[1] = Evaluate(*coef2,mip);
|
|
1208
|
+
eigenvalues[2] = Evaluate(*coef3,mip);
|
|
1209
|
+
|
|
1210
|
+
eigenvectors = 0.;
|
|
1211
|
+
eigenvectors[0] = eigenvectors[4] = eigenvectors[8] = 1.;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1216
|
+
void Apply (const FEL & fel, const MIP & mip,
|
|
1217
|
+
const VECX & x, VECY && y, LocalHeap & lh) const
|
|
1218
|
+
{
|
|
1219
|
+
y(0) = Evaluate (*coef1, mip) * x(0);
|
|
1220
|
+
y(1) = Evaluate (*coef2, mip) * x(1);
|
|
1221
|
+
y(2) = Evaluate (*coef3, mip) * x(2);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1225
|
+
void ApplyTrans (const FEL & fel, const MIP & mip,
|
|
1226
|
+
const VECX & x, VECY & y, LocalHeap & lh) const
|
|
1227
|
+
{
|
|
1228
|
+
y(0) = Evaluate (*coef1, mip) * x(0);
|
|
1229
|
+
y(1) = Evaluate (*coef2, mip) * x(1);
|
|
1230
|
+
y(2) = Evaluate (*coef3, mip) * x(2);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
void SetCoefficientFunctions( shared_ptr<CoefficientFunction> acoef1,
|
|
1234
|
+
shared_ptr<CoefficientFunction> acoef2,
|
|
1235
|
+
shared_ptr<CoefficientFunction> acoef3 )
|
|
1236
|
+
{
|
|
1237
|
+
// NOTE: alte coefficient-functions werden nicht geloescht!
|
|
1238
|
+
coef1 = acoef1;
|
|
1239
|
+
coef2 = acoef2;
|
|
1240
|
+
coef3 = acoef3;
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
/// full symmetric tensor
|
|
1253
|
+
template <int N>
|
|
1254
|
+
class SymDMat : public DMatOp<SymDMat<N>,0>
|
|
1255
|
+
{
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
template <> class SymDMat<1> : public DMatOp<SymDMat<1>,1>
|
|
1259
|
+
{
|
|
1260
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1261
|
+
public:
|
|
1262
|
+
enum { DIM_DMAT = 1 };
|
|
1263
|
+
|
|
1264
|
+
SymDMat (shared_ptr<CoefficientFunction> acoef) : coef(acoef) { ; }
|
|
1265
|
+
SymDMat (const Array<shared_ptr<CoefficientFunction>> & coefs) : coef(coefs[0]) { ; }
|
|
1266
|
+
|
|
1267
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1268
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1269
|
+
MAT & mat, LocalHeap & lh) const
|
|
1270
|
+
{
|
|
1271
|
+
mat(0,0) = Evaluate (*coef, mip);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
template <> class SymDMat<2> : public DMatOp<SymDMat<2>,3>
|
|
1277
|
+
{
|
|
1278
|
+
shared_ptr<CoefficientFunction> coef00;
|
|
1279
|
+
shared_ptr<CoefficientFunction> coef01;
|
|
1280
|
+
shared_ptr<CoefficientFunction> coef11;
|
|
1281
|
+
public:
|
|
1282
|
+
enum { DIM_DMAT = 2 };
|
|
1283
|
+
|
|
1284
|
+
SymDMat (shared_ptr<CoefficientFunction> acoef00,
|
|
1285
|
+
shared_ptr<CoefficientFunction> acoef01,
|
|
1286
|
+
shared_ptr<CoefficientFunction> acoef11)
|
|
1287
|
+
: coef00(acoef00), coef01(acoef01), coef11(acoef11) { ; }
|
|
1288
|
+
|
|
1289
|
+
SymDMat (const Array<shared_ptr<CoefficientFunction>> & coefs)
|
|
1290
|
+
: coef00(coefs[0]), coef01(coefs[1]), coef11(coefs[2]) { ; }
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1294
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1295
|
+
MAT & mat, LocalHeap & lh) const
|
|
1296
|
+
{
|
|
1297
|
+
mat = 0;
|
|
1298
|
+
mat(0,0) = Evaluate (*coef00, mip);
|
|
1299
|
+
mat(0,1) = mat(1,0) = Evaluate (*coef01, mip);
|
|
1300
|
+
mat(1,1) = Evaluate (*coef11, mip);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
|
|
1304
|
+
template <> class SymDMat<3> : public DMatOp<SymDMat<3>,6>
|
|
1305
|
+
{
|
|
1306
|
+
shared_ptr<CoefficientFunction> coef00;
|
|
1307
|
+
shared_ptr<CoefficientFunction> coef10;
|
|
1308
|
+
shared_ptr<CoefficientFunction> coef11;
|
|
1309
|
+
shared_ptr<CoefficientFunction> coef20;
|
|
1310
|
+
shared_ptr<CoefficientFunction> coef21;
|
|
1311
|
+
shared_ptr<CoefficientFunction> coef22;
|
|
1312
|
+
public:
|
|
1313
|
+
enum { DIM_DMAT = 3 };
|
|
1314
|
+
|
|
1315
|
+
SymDMat (shared_ptr<CoefficientFunction> acoef00,
|
|
1316
|
+
shared_ptr<CoefficientFunction> acoef10,
|
|
1317
|
+
shared_ptr<CoefficientFunction> acoef11,
|
|
1318
|
+
shared_ptr<CoefficientFunction> acoef20,
|
|
1319
|
+
shared_ptr<CoefficientFunction> acoef21,
|
|
1320
|
+
shared_ptr<CoefficientFunction> acoef22)
|
|
1321
|
+
: coef00(acoef00), coef10(acoef10), coef11(acoef11),
|
|
1322
|
+
coef20(acoef20), coef21(acoef21), coef22(acoef22) { ; }
|
|
1323
|
+
|
|
1324
|
+
SymDMat (const Array<shared_ptr<CoefficientFunction>> & coefs)
|
|
1325
|
+
: coef00(coefs[0]), coef10(coefs[1]), coef11(coefs[2]),
|
|
1326
|
+
coef20(coefs[3]), coef21(coefs[4]), coef22(coefs[5])
|
|
1327
|
+
{ ; }
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1331
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1332
|
+
MAT & mat, LocalHeap & lh) const
|
|
1333
|
+
{
|
|
1334
|
+
mat = 0;
|
|
1335
|
+
mat(0,0) = Evaluate (*coef00, mip);
|
|
1336
|
+
mat(1,0) = mat(0,1) = Evaluate (*coef10, mip);
|
|
1337
|
+
mat(1,1) = Evaluate (*coef11, mip);
|
|
1338
|
+
mat(2,0) = mat(0,2) = Evaluate (*coef20, mip);
|
|
1339
|
+
mat(2,1) = mat(1,2) = Evaluate (*coef21, mip);
|
|
1340
|
+
mat(2,2) = Evaluate (*coef22, mip);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
///
|
|
1353
|
+
template <int DIM>
|
|
1354
|
+
class NormalDMat : public DMatOp<NormalDMat<DIM>,DIM>
|
|
1355
|
+
{
|
|
1356
|
+
CoefficientFunction * coef;
|
|
1357
|
+
public:
|
|
1358
|
+
enum { DIM_DMAT = DIM };
|
|
1359
|
+
NormalDMat (CoefficientFunction * acoef) : coef(acoef) { ; }
|
|
1360
|
+
|
|
1361
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1362
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1363
|
+
MAT & mat, LocalHeap & lh) const
|
|
1364
|
+
{
|
|
1365
|
+
mat = 0;
|
|
1366
|
+
double val = Evaluate (*coef, mip);
|
|
1367
|
+
Vec<DIM> nv = mip.GetNV();
|
|
1368
|
+
for (int i = 0; i < DIM; i++)
|
|
1369
|
+
for (int j = 0; j < DIM; j++)
|
|
1370
|
+
mat(i, j) = val * nv(i) * nv(j);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
template <int N>
|
|
1380
|
+
class NGS_DLL_HEADER DVec // : public DVecBase<N,T>
|
|
1381
|
+
{
|
|
1382
|
+
shared_ptr<CoefficientFunction> coefs[N];
|
|
1383
|
+
bool vectorial;
|
|
1384
|
+
public:
|
|
1385
|
+
DVec (const Array<shared_ptr<CoefficientFunction>> & acoeffs)
|
|
1386
|
+
{
|
|
1387
|
+
vectorial = (N > 1) && (N == acoeffs[0]->Dimension());
|
|
1388
|
+
|
|
1389
|
+
if (vectorial)
|
|
1390
|
+
coefs[0] = acoeffs[0];
|
|
1391
|
+
else
|
|
1392
|
+
{
|
|
1393
|
+
if (acoeffs.Size() != N)
|
|
1394
|
+
throw Exception (string("need ")+ToString(N)+" components, but have "+ToString(acoeffs.Size()));
|
|
1395
|
+
for (int i = 0; i < N; i++)
|
|
1396
|
+
coefs[i] = acoeffs[i];
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
DVec (shared_ptr<CoefficientFunction> acoef)
|
|
1401
|
+
{
|
|
1402
|
+
vectorial = (N > 1) && (N == acoef->Dimension());
|
|
1403
|
+
coefs[0] = acoef;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
DVec (shared_ptr<CoefficientFunction> acoef1,
|
|
1407
|
+
shared_ptr<CoefficientFunction> acoef2,
|
|
1408
|
+
shared_ptr<CoefficientFunction> acoef3 = NULL,
|
|
1409
|
+
shared_ptr<CoefficientFunction> acoef4 = NULL,
|
|
1410
|
+
shared_ptr<CoefficientFunction> acoef5 = NULL,
|
|
1411
|
+
shared_ptr<CoefficientFunction> acoef6 = NULL)
|
|
1412
|
+
{
|
|
1413
|
+
vectorial = false;
|
|
1414
|
+
|
|
1415
|
+
coefs[0] = acoef1;
|
|
1416
|
+
coefs[1] = acoef2;
|
|
1417
|
+
if (N >= 3) coefs[2] = acoef3;
|
|
1418
|
+
if (N >= 4) coefs[3] = acoef4;
|
|
1419
|
+
if (N >= 5) coefs[4] = acoef5;
|
|
1420
|
+
if (N >= 6) coefs[5] = acoef6;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
template <typename FEL, typename MIP, typename VEC>
|
|
1425
|
+
void GenerateVector (const FEL & fel, const MIP & mip,
|
|
1426
|
+
VEC & vec, LocalHeap & lh) const
|
|
1427
|
+
{
|
|
1428
|
+
typedef typename VEC::TSCAL TSCAL;
|
|
1429
|
+
|
|
1430
|
+
if (vectorial)
|
|
1431
|
+
{
|
|
1432
|
+
coefs[0] -> Evaluate (mip, vec);
|
|
1433
|
+
}
|
|
1434
|
+
else
|
|
1435
|
+
for (int i = 0; i < N; i++)
|
|
1436
|
+
{
|
|
1437
|
+
// does not compile with gcc 4.6 ...
|
|
1438
|
+
// vec(i) = coefs[i] -> T_Evaluate<TSCAL> (mip);
|
|
1439
|
+
|
|
1440
|
+
// this works ...
|
|
1441
|
+
// CoefficientFunction * hp = coefs[i];
|
|
1442
|
+
// vec(i) = hp -> T_Evaluate<TSCAL> (mip);
|
|
1443
|
+
|
|
1444
|
+
// solution thx to Matthias Hochsteger
|
|
1445
|
+
vec(i) = coefs[i] -> template T_Evaluate<TSCAL> (mip);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
template <typename FEL, typename MIR, typename VEC>
|
|
1452
|
+
void GenerateVectorIR (const FEL & fel, const MIR & mir,
|
|
1453
|
+
VEC & vecs, LocalHeap & lh) const
|
|
1454
|
+
{
|
|
1455
|
+
typedef typename VEC::TSCAL TSCAL;
|
|
1456
|
+
|
|
1457
|
+
if (vectorial || N == 1)
|
|
1458
|
+
{
|
|
1459
|
+
coefs[0] -> Evaluate (mir, vecs);
|
|
1460
|
+
}
|
|
1461
|
+
else
|
|
1462
|
+
for (int j = 0; j < mir.Size(); j++)
|
|
1463
|
+
for (int i = 0; i < N; i++)
|
|
1464
|
+
{
|
|
1465
|
+
vecs(j,i) =
|
|
1466
|
+
coefs[i] -> template T_Evaluate<TSCAL> (mir[j]);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
template <int N, typename T = double>
|
|
1475
|
+
class DVecN
|
|
1476
|
+
{
|
|
1477
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1478
|
+
public:
|
|
1479
|
+
typedef T TSCAL;
|
|
1480
|
+
DVecN (shared_ptr<CoefficientFunction> acoef)
|
|
1481
|
+
: coef(acoef) { ; }
|
|
1482
|
+
DVecN (const Array<shared_ptr<CoefficientFunction>> & acoef)
|
|
1483
|
+
: coef(acoef[0]) { ; }
|
|
1484
|
+
|
|
1485
|
+
template <typename FEL, typename MIP, typename VEC>
|
|
1486
|
+
void GenerateVector (const FEL & fel, const MIP & mip,
|
|
1487
|
+
VEC && vec, LocalHeap & lh) const
|
|
1488
|
+
{
|
|
1489
|
+
Vec<N> hv;
|
|
1490
|
+
coef -> Evaluate (mip, hv);
|
|
1491
|
+
for (int i = 0; i < N; i++)
|
|
1492
|
+
vec(i) = hv(i);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
template <typename FEL, typename MIR, typename VEC>
|
|
1496
|
+
void GenerateVectorIR (const FEL & fel, const MIR & mir,
|
|
1497
|
+
VEC & vecs, LocalHeap & lh) const
|
|
1498
|
+
{
|
|
1499
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
1500
|
+
GenerateVector (fel, mir[i], vecs.Row(i), lh);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
template <int N>
|
|
1507
|
+
class TVec
|
|
1508
|
+
{
|
|
1509
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1510
|
+
|
|
1511
|
+
public:
|
|
1512
|
+
typedef double TSCAL;
|
|
1513
|
+
|
|
1514
|
+
TVec (shared_ptr<CoefficientFunction> acoef) : coef(acoef) {;}
|
|
1515
|
+
TVec (const Array<shared_ptr<CoefficientFunction>> & coefs) : coef(coefs[0]) {;}
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
template <typename FEL, typename MIP, typename VEC>
|
|
1519
|
+
void GenerateVector (const FEL & fel, const MIP & mip,
|
|
1520
|
+
VEC && vec, LocalHeap & lh) const
|
|
1521
|
+
{
|
|
1522
|
+
vec = 0.0;
|
|
1523
|
+
|
|
1524
|
+
typedef typename remove_reference<VEC>::type::TSCAL TSCAL;
|
|
1525
|
+
|
|
1526
|
+
TSCAL length = 0.;
|
|
1527
|
+
for(int i=0; i<N; i++)
|
|
1528
|
+
{
|
|
1529
|
+
//vec(i) = mip.GetJacobian()(i,0);
|
|
1530
|
+
vec(i) = mip.GetTV()(i);
|
|
1531
|
+
length += vec(i)*vec(i);
|
|
1532
|
+
}
|
|
1533
|
+
//(*testout) << "point " << mip.GetPoint() << " tv " << vec;
|
|
1534
|
+
vec *= Evaluate (*coef, mip)/sqrt(length);
|
|
1535
|
+
//(*testout) << " retval " << vec << endl;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
template <typename FEL, typename MIR, typename VEC>
|
|
1539
|
+
void GenerateVectorIR (const FEL & fel, const MIR & mir,
|
|
1540
|
+
VEC & vecs, LocalHeap & lh) const
|
|
1541
|
+
{
|
|
1542
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
1543
|
+
GenerateVector (fel, mir[i], vecs.Row(i), lh);
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
/// DMat for rot.-sym. Laplace operator
|
|
1559
|
+
template <int DIM>
|
|
1560
|
+
class RotSymLaplaceDMat : public DMatOp<RotSymLaplaceDMat<DIM>,DIM>
|
|
1561
|
+
{
|
|
1562
|
+
shared_ptr<CoefficientFunction> coef;
|
|
1563
|
+
public:
|
|
1564
|
+
enum { DIM_DMAT = DIM };
|
|
1565
|
+
|
|
1566
|
+
RotSymLaplaceDMat (shared_ptr<CoefficientFunction> acoef) : coef(acoef) { ; }
|
|
1567
|
+
RotSymLaplaceDMat (const Array<shared_ptr<CoefficientFunction>> & acoef) : coef(acoef[0]) { ; }
|
|
1568
|
+
|
|
1569
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1570
|
+
void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1571
|
+
MAT & mat, LocalHeap & lh) const
|
|
1572
|
+
{
|
|
1573
|
+
mat = 0;
|
|
1574
|
+
const double r = mip.GetPoint()(0);
|
|
1575
|
+
double val = r*Evaluate (*coef, mip);
|
|
1576
|
+
for (int i = 0; i < DIM; i++)
|
|
1577
|
+
mat(i, i) = val;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
template <typename FEL, typename MIP, class VECX, class VECY>
|
|
1582
|
+
void Apply (const FEL & fel, const MIP & mip,
|
|
1583
|
+
const VECX & x, VECY && y, LocalHeap & lh) const
|
|
1584
|
+
{
|
|
1585
|
+
const double r = mip.GetPoint()(0);
|
|
1586
|
+
double val = r*Evaluate (*coef, mip);
|
|
1587
|
+
y = val * x;
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
/// Identity on boundary
|
|
1597
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1598
|
+
class DiffOpNormal : public DiffOp<DiffOpNormal<D, FEL> >
|
|
1599
|
+
{
|
|
1600
|
+
public:
|
|
1601
|
+
enum { DIM = D };
|
|
1602
|
+
enum { DIM_SPACE = D };
|
|
1603
|
+
enum { DIM_ELEMENT = D-1 };
|
|
1604
|
+
enum { DIM_DMAT = 1 };
|
|
1605
|
+
enum { DIFFORDER = 0 };
|
|
1606
|
+
|
|
1607
|
+
template <typename MIP, typename MAT>
|
|
1608
|
+
static void GenerateMatrix (const FiniteElement & fel, const MIP & mip,
|
|
1609
|
+
MAT && mat, LocalHeap & lh)
|
|
1610
|
+
{
|
|
1611
|
+
FlatVector<> shape = static_cast<const FEL&> (fel).GetShape (mip.IP(), lh);
|
|
1612
|
+
// Vec<D> nv = mip.GetNV();
|
|
1613
|
+
auto nv = mip.GetNV();
|
|
1614
|
+
//Vec<D> p = mip.GetPoint();
|
|
1615
|
+
for (int j = 0; j < shape.Size(); j++)
|
|
1616
|
+
for (int i = 0; i < D; i++)
|
|
1617
|
+
mat(0, j*D+i) = shape(j) * nv(i);
|
|
1618
|
+
|
|
1619
|
+
//(*testout) << "mip = " << p << ", nv = " << nv << endl;
|
|
1620
|
+
//p(0) = 0.0;
|
|
1621
|
+
//p /= L2Norm(p);
|
|
1622
|
+
//nv /= L2Norm(nv);
|
|
1623
|
+
//(*testout) << "normalized, mip = " << p << ", nv = " << nv << endl;
|
|
1624
|
+
//(*testout) << "mat = " << mat << endl;
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
/// integrator for \f$\int_\Gamma u_n v_n \, ds\f$
|
|
1633
|
+
template <int D>
|
|
1634
|
+
class NormalRobinIntegrator
|
|
1635
|
+
: public T_BDBIntegrator<DiffOpNormal<D>, DiagDMat<1>, ScalarFiniteElement<D-1> >
|
|
1636
|
+
{
|
|
1637
|
+
typedef T_BDBIntegrator<DiffOpNormal<D>, DiagDMat<1>, ScalarFiniteElement<D-1> > BASE;
|
|
1638
|
+
public:
|
|
1639
|
+
using T_BDBIntegrator<DiffOpNormal<D>, DiagDMat<1>, ScalarFiniteElement<D-1> >::T_BDBIntegrator;
|
|
1640
|
+
/*
|
|
1641
|
+
NormalRobinIntegrator (CoefficientFunction * coeff)
|
|
1642
|
+
: T_BDBIntegrator<DiffOpNormal<D>, DiagDMat<1>, ScalarFiniteElement<D-1> > (DiagDMat<1> (coeff))
|
|
1643
|
+
{ ; }
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
static Integrator * Create (Array<CoefficientFunction*> & coeffs)
|
|
1647
|
+
{
|
|
1648
|
+
return new NormalRobinIntegrator (coeffs[0]);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
virtual bool BoundaryForm () const { return 1; }
|
|
1652
|
+
*/
|
|
1653
|
+
virtual string Name () const { return "NormalRobin"; }
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
// ********************************* Scalar integrators: ********************
|
|
1662
|
+
|
|
1663
|
+
/// Integrator for grad u grad v
|
|
1664
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1665
|
+
class NGS_DLL_HEADER LaplaceIntegrator
|
|
1666
|
+
: public T_BDBIntegrator<DiffOpGradient<D>, DiagDMat<D>, FEL>
|
|
1667
|
+
{
|
|
1668
|
+
typedef T_BDBIntegrator<DiffOpGradient<D>, DiagDMat<D>, FEL> BASE;
|
|
1669
|
+
|
|
1670
|
+
public:
|
|
1671
|
+
using T_BDBIntegrator<DiffOpGradient<D>, DiagDMat<D>, FEL>::T_BDBIntegrator;
|
|
1672
|
+
virtual string Name () const { return "Laplace"; }
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
///
|
|
1677
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
1678
|
+
class LaplaceBoundaryIntegrator
|
|
1679
|
+
: public T_BDBIntegrator<DiffOpGradientBoundary<D>, DiagDMat<D>, FEL>
|
|
1680
|
+
{
|
|
1681
|
+
typedef T_BDBIntegrator<DiffOpGradientBoundary<D>, DiagDMat<D>, FEL> BASE;
|
|
1682
|
+
public:
|
|
1683
|
+
using T_BDBIntegrator<DiffOpGradientBoundary<D>, DiagDMat<D>, FEL>::T_BDBIntegrator;
|
|
1684
|
+
/*
|
|
1685
|
+
LaplaceBoundaryIntegrator (shared_ptr<CoefficientFunction> coeff)
|
|
1686
|
+
: BASE(DiagDMat<D>(coeff)) { ; }
|
|
1687
|
+
*/
|
|
1688
|
+
virtual string Name () const { return "Laplace-Boundary"; }
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
///
|
|
1694
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1695
|
+
class RotSymLaplaceIntegrator
|
|
1696
|
+
: public T_BDBIntegrator<DiffOpGradient<D>, RotSymLaplaceDMat<D>, FEL>
|
|
1697
|
+
{
|
|
1698
|
+
typedef T_BDBIntegrator<DiffOpGradient<D>, RotSymLaplaceDMat<D>, FEL> BASE;
|
|
1699
|
+
public:
|
|
1700
|
+
using T_BDBIntegrator<DiffOpGradient<D>, RotSymLaplaceDMat<D>, FEL>::T_BDBIntegrator;
|
|
1701
|
+
virtual string Name () const { return "RotSymLaplace"; }
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
///
|
|
1706
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1707
|
+
class OrthoLaplaceIntegrator
|
|
1708
|
+
: public T_BDBIntegrator<DiffOpGradient<D>, OrthoDMat<D>, FEL>
|
|
1709
|
+
{
|
|
1710
|
+
typedef T_BDBIntegrator<DiffOpGradient<D>, OrthoDMat<D>, FEL> BASE;
|
|
1711
|
+
public:
|
|
1712
|
+
using T_BDBIntegrator<DiffOpGradient<D>, OrthoDMat<D>, FEL>::T_BDBIntegrator;
|
|
1713
|
+
virtual string Name () const { return "OrthoLaplace"; }
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
///
|
|
1718
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1719
|
+
class NGS_DLL_HEADER MassIntegrator
|
|
1720
|
+
: public T_BDBIntegrator<DiffOpId<D>, DiagDMat<1>, FEL >
|
|
1721
|
+
{
|
|
1722
|
+
typedef T_BDBIntegrator<DiffOpId<D>, DiagDMat<1>, FEL> BASE;
|
|
1723
|
+
public:
|
|
1724
|
+
using T_BDBIntegrator<DiffOpId<D>, DiagDMat<1>, FEL>::T_BDBIntegrator;
|
|
1725
|
+
virtual string Name () const { return "Mass"; }
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
/// integrator for \f$\int_\Gamma u v \, ds\f$
|
|
1730
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
1731
|
+
class NGS_DLL_HEADER RobinIntegrator
|
|
1732
|
+
: public T_BDBIntegrator<DiffOpIdBoundary<D>, DiagDMat<1>, FEL>
|
|
1733
|
+
{
|
|
1734
|
+
typedef T_BDBIntegrator<DiffOpIdBoundary<D>, DiagDMat<1>, FEL> BASE;
|
|
1735
|
+
public:
|
|
1736
|
+
using T_BDBIntegrator<DiffOpIdBoundary<D>, DiagDMat<1>, FEL>::T_BDBIntegrator;
|
|
1737
|
+
// RobinIntegrator (shared_ptr<CoefficientFunction> coeff) : BASE(DiagDMat<1> (coeff)) { ; }
|
|
1738
|
+
// nvirtual ~RobinIntegrator () { ; }
|
|
1739
|
+
// virtual bool BoundaryForm () const { return 1; }
|
|
1740
|
+
virtual string Name () const { return "Robin"; }
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
/*
|
|
1748
|
+
template <int D>
|
|
1749
|
+
class NormalRobinIntegrator
|
|
1750
|
+
: public T_BDBIntegrator<DiffOpIdBoundary<D,D>, NormalDMat<D>, ScalarFiniteElement<D> >
|
|
1751
|
+
{
|
|
1752
|
+
public:
|
|
1753
|
+
NormalRobinIntegrator (CoefficientFunction * coeff)
|
|
1754
|
+
: T_BDBIntegrator<DiffOpIdBoundary<D,D>, NormalDMat<D>, ScalarFiniteElement<D> > (NormalDMat<D> (coeff))
|
|
1755
|
+
{ ; }
|
|
1756
|
+
|
|
1757
|
+
static Integrator * Create (Array<CoefficientFunction*> & coeffs)
|
|
1758
|
+
{
|
|
1759
|
+
return new NormalRobinIntegrator (coeffs[0]);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
virtual bool BoundaryForm () const { return 1; }
|
|
1763
|
+
virtual string Name () const { return "NormalRobin"; }
|
|
1764
|
+
};
|
|
1765
|
+
*/
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
///
|
|
1769
|
+
template <int D>
|
|
1770
|
+
class DiffOpDiv : public DiffOp<DiffOpDiv<D> >
|
|
1771
|
+
{
|
|
1772
|
+
public:
|
|
1773
|
+
enum { DIM = D };
|
|
1774
|
+
enum { DIM_SPACE = D };
|
|
1775
|
+
enum { DIM_ELEMENT = D };
|
|
1776
|
+
enum { DIM_DMAT = 1 };
|
|
1777
|
+
enum { DIFFORDER = 1 };
|
|
1778
|
+
|
|
1779
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1780
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1781
|
+
MAT & mat, LocalHeap & lh)
|
|
1782
|
+
{
|
|
1783
|
+
int nd = fel.GetNDof();
|
|
1784
|
+
|
|
1785
|
+
FlatMatrix<> grad (D, nd, lh);
|
|
1786
|
+
grad = Trans (mip.GetJacobianInverse ()) *
|
|
1787
|
+
Trans (fel.GetDShape(mip.IP(), lh));
|
|
1788
|
+
|
|
1789
|
+
mat = 0;
|
|
1790
|
+
for (int i = 0; i < nd; i++)
|
|
1791
|
+
for (int j = 0; j < DIM; j++)
|
|
1792
|
+
mat(0, DIM*i+j) = grad(j, i);
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
1798
|
+
class DivDivIntegrator
|
|
1799
|
+
: public T_BDBIntegrator<DiffOpDiv<D>, DiagDMat<1>, FEL>
|
|
1800
|
+
{
|
|
1801
|
+
typedef T_BDBIntegrator<DiffOpDiv<D>, DiagDMat<1>, FEL> BASE;
|
|
1802
|
+
public:
|
|
1803
|
+
using T_BDBIntegrator<DiffOpDiv<D>, DiagDMat<1>, FEL>::T_BDBIntegrator;
|
|
1804
|
+
virtual string Name () const { return "DivDiv"; }
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
///
|
|
1810
|
+
class DiffOpCurl : public DiffOp<DiffOpCurl>
|
|
1811
|
+
{
|
|
1812
|
+
public:
|
|
1813
|
+
enum { DIM = 2 };
|
|
1814
|
+
enum { DIM_SPACE = 2 };
|
|
1815
|
+
enum { DIM_ELEMENT = 2 };
|
|
1816
|
+
enum { DIM_DMAT = 1 };
|
|
1817
|
+
enum { DIFFORDER = 1 };
|
|
1818
|
+
|
|
1819
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1820
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1821
|
+
MAT & mat, LocalHeap & lh)
|
|
1822
|
+
{
|
|
1823
|
+
int nd = fel.GetNDof();
|
|
1824
|
+
|
|
1825
|
+
FlatMatrix<> grad (2, nd, lh);
|
|
1826
|
+
grad = Trans (mip.GetJacobianInverse ()) *
|
|
1827
|
+
Trans (fel.GetDShape(mip.IP(), lh));
|
|
1828
|
+
|
|
1829
|
+
mat = 0;
|
|
1830
|
+
for (int i = 0; i < nd; i++)
|
|
1831
|
+
{
|
|
1832
|
+
mat(0, DIM*i ) = grad(1, i);
|
|
1833
|
+
mat(0, DIM*i+1) = -grad(0, i);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
template <typename FEL = ScalarFiniteElement<2> >
|
|
1840
|
+
class CurlCurlIntegrator
|
|
1841
|
+
: public T_BDBIntegrator<DiffOpCurl, DiagDMat<1>, FEL>
|
|
1842
|
+
{
|
|
1843
|
+
typedef T_BDBIntegrator<DiffOpCurl, DiagDMat<1>, FEL> BASE;
|
|
1844
|
+
public:
|
|
1845
|
+
using T_BDBIntegrator<DiffOpCurl, DiagDMat<1>, FEL>::T_BDBIntegrator;
|
|
1846
|
+
virtual string Name () const { return "CurlCurl"; }
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
///
|
|
1852
|
+
class DiffOpCurl3d : public DiffOp<DiffOpCurl3d>
|
|
1853
|
+
{
|
|
1854
|
+
public:
|
|
1855
|
+
enum { DIM = 3 };
|
|
1856
|
+
enum { DIM_SPACE = 3 };
|
|
1857
|
+
enum { DIM_ELEMENT = 3 };
|
|
1858
|
+
enum { DIM_DMAT = 3 };
|
|
1859
|
+
enum { DIFFORDER = 1 };
|
|
1860
|
+
|
|
1861
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1862
|
+
static void GenerateMatrix (const FEL & fel, const MIP & mip,
|
|
1863
|
+
MAT & mat, LocalHeap & lh)
|
|
1864
|
+
{
|
|
1865
|
+
int nd = fel.GetNDof();
|
|
1866
|
+
|
|
1867
|
+
FlatMatrix<> grad (3, nd, lh);
|
|
1868
|
+
grad = Trans (mip.GetJacobianInverse ()) *
|
|
1869
|
+
Trans (fel.GetDShape(mip.IP(), lh));
|
|
1870
|
+
|
|
1871
|
+
mat = 0;
|
|
1872
|
+
for (int i = 0; i < nd; i++)
|
|
1873
|
+
{
|
|
1874
|
+
mat(0, DIM*i+2) = grad(1, i);
|
|
1875
|
+
mat(0, DIM*i+1) = -grad(2, i);
|
|
1876
|
+
mat(1, DIM*i+0) = grad(2, i);
|
|
1877
|
+
mat(1, DIM*i+2) = -grad(0, i);
|
|
1878
|
+
mat(2, DIM*i+1) = grad(0, i);
|
|
1879
|
+
mat(2, DIM*i+0) = -grad(1, i);
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
template <typename FEL = ScalarFiniteElement<3> >
|
|
1886
|
+
class CurlCurl3dIntegrator
|
|
1887
|
+
: public T_BDBIntegrator<DiffOpCurl3d, DiagDMat<3>, FEL>
|
|
1888
|
+
{
|
|
1889
|
+
typedef T_BDBIntegrator<DiffOpCurl3d, DiagDMat<3>, FEL> BASE;
|
|
1890
|
+
public:
|
|
1891
|
+
using T_BDBIntegrator<DiffOpCurl3d, DiagDMat<3>, FEL>::T_BDBIntegrator;
|
|
1892
|
+
virtual string Name () const { return "CurlCurl3d"; }
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
/* ********************* Vectorial Diffops ******************************** */
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
template <int DIM_SPC, VorB VB = VOL>
|
|
1917
|
+
class DiffOpIdVectorH1 : public DiffOp<DiffOpIdVectorH1<DIM_SPC, VB> >
|
|
1918
|
+
{
|
|
1919
|
+
public:
|
|
1920
|
+
enum { DIM = 1 };
|
|
1921
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
1922
|
+
enum { DIM_ELEMENT = DIM_SPC-VB };
|
|
1923
|
+
enum { DIM_DMAT = DIM_SPC };
|
|
1924
|
+
enum { DIFFORDER = 0 };
|
|
1925
|
+
|
|
1926
|
+
static string Name() { return "Id"; }
|
|
1927
|
+
static constexpr bool SUPPORT_PML = true;
|
|
1928
|
+
static bool SupportsVB (VorB checkvb) { return true; }
|
|
1929
|
+
|
|
1930
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
1931
|
+
static void GenerateMatrix (const FEL & bfel, const MIP & mip,
|
|
1932
|
+
MAT && mat, LocalHeap & lh)
|
|
1933
|
+
{
|
|
1934
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
1935
|
+
mat.AddSize(DIM_DMAT, bfel.GetNDof()) = 0.0;
|
|
1936
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
1937
|
+
{
|
|
1938
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
1939
|
+
feli.CalcShape (mip.IP(), mat.Row(i).Range(fel.GetRange(i)));
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
static int DimRef() { return DIM_SPC; }
|
|
1946
|
+
|
|
1947
|
+
template <typename IP, typename MAT>
|
|
1948
|
+
static void GenerateMatrixRef (const FiniteElement & bfel, const IP & ip,
|
|
1949
|
+
MAT && mat, LocalHeap & lh)
|
|
1950
|
+
{
|
|
1951
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
1952
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
1953
|
+
int ndofi = feli.GetNDof();
|
|
1954
|
+
mat.Rows(DIM_SPC).Cols(fel.GetNDof()) = 0.0;
|
|
1955
|
+
feli.CalcShape (ip, mat.Row(0).Range(ndofi));
|
|
1956
|
+
for (int i = 1; i < DIM_SPC; i++)
|
|
1957
|
+
mat.Row(i).Range(i*ndofi, (i+1)*ndofi) = mat.Row(0).Range(ndofi);
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
template <typename MIP, typename MAT>
|
|
1961
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
1962
|
+
MAT & mat, LocalHeap & lh)
|
|
1963
|
+
{
|
|
1964
|
+
mat = Identity(DIM_SPC);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
1970
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
1971
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
1972
|
+
{
|
|
1973
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
1974
|
+
mat.AddSize(DIM_SPC*bfel.GetNDof(), mir.Size()) = 0.0;
|
|
1975
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
1976
|
+
{
|
|
1977
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
1978
|
+
feli.CalcShape (mir.IR(), mat.Rows(DIM_SPC*fel.GetRange(i)).RowSlice(i, DIM_SPC));
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
using DiffOp<DiffOpIdVectorH1<DIM_SPC, VB>>::ApplySIMDIR;
|
|
1983
|
+
static void ApplySIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
1984
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
1985
|
+
{
|
|
1986
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
1987
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
1988
|
+
{
|
|
1989
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
1990
|
+
feli.Evaluate (mir.IR(), x.Range(fel.GetRange(i)), y.Row(i));
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
using DiffOp<DiffOpIdVectorH1<DIM_SPC, VB>>::AddTransSIMDIR;
|
|
1995
|
+
static void AddTransSIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
1996
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
1997
|
+
{
|
|
1998
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
1999
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2000
|
+
{
|
|
2001
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2002
|
+
feli.AddTrans (mir.IR(), y.Row(i), x.Range(fel.GetRange(i)));
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
static shared_ptr<CoefficientFunction>
|
|
2007
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
2008
|
+
shared_ptr<CoefficientFunction> dir,
|
|
2009
|
+
bool Eulerian);
|
|
2010
|
+
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
/// Identity
|
|
2018
|
+
template <int DIM_EL, int DIM_SPC>
|
|
2019
|
+
class DiffOpIdDual : public DiffOp<DiffOpIdDual<DIM_EL, DIM_SPC> >
|
|
2020
|
+
{
|
|
2021
|
+
public:
|
|
2022
|
+
enum { DIM = 1 };
|
|
2023
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
2024
|
+
enum { DIM_ELEMENT = DIM_EL };
|
|
2025
|
+
enum { DIM_DMAT = 1 };
|
|
2026
|
+
enum { DIFFORDER = 0 };
|
|
2027
|
+
static IVec<0> GetDimensions() { return IVec<0>(); };
|
|
2028
|
+
|
|
2029
|
+
static bool SupportsVB (VorB checkvb) { return true; }
|
|
2030
|
+
|
|
2031
|
+
static string Name() { return "IdDual"; }
|
|
2032
|
+
// static constexpr bool SUPPORT_PML = true;
|
|
2033
|
+
|
|
2034
|
+
static const BaseScalarFiniteElement & Cast (const FiniteElement & fel)
|
|
2035
|
+
{ return static_cast<const BaseScalarFiniteElement&> (fel); }
|
|
2036
|
+
|
|
2037
|
+
template <typename MIP, typename MAT>
|
|
2038
|
+
static void GenerateMatrix (const FiniteElement & fel, const MIP & mip,
|
|
2039
|
+
MAT && mat, LocalHeap & lh)
|
|
2040
|
+
{
|
|
2041
|
+
Cast(fel).CalcShape (mip.IP(), mat.Row(0));
|
|
2042
|
+
mat.Row(0).Range(fel.GetNDof()) /= mip.GetMeasure();
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
static int DimRef() { return 1; }
|
|
2046
|
+
|
|
2047
|
+
template <typename IP, typename MAT>
|
|
2048
|
+
static void GenerateMatrixRef (const FiniteElement & fel, const IP & ip,
|
|
2049
|
+
MAT && mat, LocalHeap & lh)
|
|
2050
|
+
{
|
|
2051
|
+
Cast(fel).CalcShape (ip, mat.Row(0));
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
template <typename MIP, typename MAT>
|
|
2055
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
2056
|
+
MAT & mat, LocalHeap & lh)
|
|
2057
|
+
{
|
|
2058
|
+
mat(0,0) = 1.0 / mip.GetMeasure();
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
|
|
2062
|
+
|
|
2063
|
+
#ifdef UNUSED
|
|
2064
|
+
template <typename MAT>
|
|
2065
|
+
static void GenerateMatrixIR (const FiniteElement & fel,
|
|
2066
|
+
const BaseMappedIntegrationRule & mir,
|
|
2067
|
+
MAT & mat, LocalHeap & lh)
|
|
2068
|
+
{
|
|
2069
|
+
Cast(fel).CalcShape (mir.IR(), Trans(mat));
|
|
2070
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
2071
|
+
mat.Row(i) /= mir[i].GetMeasure();
|
|
2072
|
+
}
|
|
2073
|
+
#endif
|
|
2074
|
+
|
|
2075
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & fel,
|
|
2076
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
2077
|
+
BareSliceMatrix<SIMD<double>> mat)
|
|
2078
|
+
{
|
|
2079
|
+
Cast(fel).CalcShape (mir.IR(), mat);
|
|
2080
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
2081
|
+
mat.Col(i).Range(0,fel.GetNDof()) /= mir[i].GetMeasure();
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
#ifdef UNSUED
|
|
2085
|
+
template <typename MIP, class TVX, class TVY>
|
|
2086
|
+
static void Apply (const FiniteElement & fel, const MIP & mip,
|
|
2087
|
+
const TVX & x, TVY & y,
|
|
2088
|
+
LocalHeap & lh)
|
|
2089
|
+
{
|
|
2090
|
+
HeapReset hr(lh);
|
|
2091
|
+
y = Trans (Cast(fel).GetShape (mip.IP(), lh)) * x;
|
|
2092
|
+
y(0) /= mip.GetMeasure();
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
static void Apply (const FiniteElement & fel, const MappedIntegrationPoint<D,D> & mip,
|
|
2096
|
+
BareSliceVector<double> x, FlatVector<double> y,
|
|
2097
|
+
LocalHeap & lh)
|
|
2098
|
+
{
|
|
2099
|
+
y(0) = Cast(fel).Evaluate(mip.IP(), x);
|
|
2100
|
+
y(0) /= mip.GetMeasure();
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
using DiffOp<DiffOpIdDual>::ApplyIR;
|
|
2105
|
+
template <class MIR, class TMY>
|
|
2106
|
+
static void ApplyIR (const FiniteElement & fel, const MIR & mir,
|
|
2107
|
+
BareSliceVector<double> x, TMY y,
|
|
2108
|
+
LocalHeap & lh)
|
|
2109
|
+
{
|
|
2110
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Col(0));
|
|
2111
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
2112
|
+
y(i,0) /= mir[i].GetMeasure();
|
|
2113
|
+
}
|
|
2114
|
+
#endif
|
|
2115
|
+
|
|
2116
|
+
// using ApplySIMDIR;
|
|
2117
|
+
using DiffOp<DiffOpIdDual>::ApplySIMDIR;
|
|
2118
|
+
static void ApplySIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2119
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
2120
|
+
{
|
|
2121
|
+
Cast(fel).Evaluate (mir.IR(), x, y.Row(0));
|
|
2122
|
+
for (int i = 0; i < mir.Size(); i++)
|
|
2123
|
+
y(0,i) /= mir[i].GetMeasure();
|
|
2124
|
+
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
#ifdef UNSUED
|
|
2128
|
+
template <typename MIP, class TVX, class TVY>
|
|
2129
|
+
static void ApplyTrans (const FiniteElement & fel, const MIP & mip,
|
|
2130
|
+
const TVX & x, TVY & y,
|
|
2131
|
+
LocalHeap & lh)
|
|
2132
|
+
{
|
|
2133
|
+
HeapReset hr(lh);
|
|
2134
|
+
y.Range(0,fel.GetNDof()) = (x(0)/mip.GetMeasure()) * Cast(fel).GetShape (mip.IP(), lh);
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/*
|
|
2138
|
+
// using DiffOp<DiffOpId<D, FEL> >::ApplyTransIR;
|
|
2139
|
+
template <class MIR>
|
|
2140
|
+
static void ApplyTransIR (const FiniteElement & fel,
|
|
2141
|
+
const MIR & mir,
|
|
2142
|
+
FlatMatrix<double> x, BareSliceVector<double> y,
|
|
2143
|
+
LocalHeap & lh)
|
|
2144
|
+
{
|
|
2145
|
+
Cast(fel).EvaluateTrans (mir.IR(), FlatVector<> (mir.Size(), &x(0,0)), y);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
template <class MIR>
|
|
2149
|
+
static void ApplyTransIR (const FiniteElement & fel,
|
|
2150
|
+
const MIR & mir,
|
|
2151
|
+
FlatMatrix<Complex> x, BareSliceVector<Complex> y,
|
|
2152
|
+
LocalHeap & lh)
|
|
2153
|
+
{
|
|
2154
|
+
DiffOp<DiffOpId<D, FEL> > :: ApplyTransIR (fel, mir, x, y, lh);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
using DiffOp<DiffOpId<D, FEL> >::AddTransSIMDIR;
|
|
2158
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2159
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
2160
|
+
{
|
|
2161
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
static void AddTransSIMDIR (const FiniteElement & fel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2165
|
+
BareSliceMatrix<SIMD<Complex>> y, BareSliceVector<Complex> x)
|
|
2166
|
+
{
|
|
2167
|
+
Cast(fel).AddTrans (mir.IR(), y.Row(0), x);
|
|
2168
|
+
}
|
|
2169
|
+
*/
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
/*
|
|
2173
|
+
static shared_ptr<CoefficientFunction>
|
|
2174
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
2175
|
+
shared_ptr<CoefficientFunction> dir);
|
|
2176
|
+
*/
|
|
2177
|
+
#endif
|
|
2178
|
+
};
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
template <int DIM_SPC> class DiffOpGradBoundaryVectorH1;
|
|
2187
|
+
|
|
2188
|
+
template <int DIM_SPC>
|
|
2189
|
+
class DiffOpGradVectorH1 : public DiffOp<DiffOpGradVectorH1<DIM_SPC> >
|
|
2190
|
+
{
|
|
2191
|
+
public:
|
|
2192
|
+
enum { DIM = 1 };
|
|
2193
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
2194
|
+
enum { DIM_ELEMENT = DIM_SPC };
|
|
2195
|
+
enum { DIM_DMAT = DIM_SPC*DIM_SPC };
|
|
2196
|
+
enum { DIFFORDER = 1 };
|
|
2197
|
+
|
|
2198
|
+
typedef DiffOpGradBoundaryVectorH1<DIM_SPC> DIFFOP_TRACE;
|
|
2199
|
+
|
|
2200
|
+
static string Name() { return "grad"; }
|
|
2201
|
+
static constexpr bool SUPPORT_PML = true;
|
|
2202
|
+
static IVec<2> GetDimensions() { return { DIM_SPC, DIM_SPC }; }
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
2206
|
+
static void GenerateMatrix (const FEL & bfel, const MIP & mip,
|
|
2207
|
+
MAT && mat, LocalHeap & lh)
|
|
2208
|
+
{
|
|
2209
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2210
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_SPC>&> (fel[0]);
|
|
2211
|
+
|
|
2212
|
+
HeapReset hr(lh);
|
|
2213
|
+
FlatMatrix<> hmat(feli.GetNDof(), DIM_SPC, lh);
|
|
2214
|
+
feli.CalcMappedDShape (mip, hmat);
|
|
2215
|
+
mat.AddSize(DIM_DMAT, bfel.GetNDof()) = 0.0;
|
|
2216
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2217
|
+
mat.Rows(DIM_SPC*i, DIM_SPC*(i+1)).Cols(fel.GetRange(i)) = Trans(hmat);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
static int DimRef() { return DIM_SPC*DIM_ELEMENT; }
|
|
2222
|
+
|
|
2223
|
+
template <typename IP, typename MAT>
|
|
2224
|
+
static void GenerateMatrixRef (const FiniteElement & bfel, const IP & ip,
|
|
2225
|
+
MAT && mat, LocalHeap & lh)
|
|
2226
|
+
{
|
|
2227
|
+
HeapReset hr(lh);
|
|
2228
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2229
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_SPC>&> (fel[0]);
|
|
2230
|
+
FlatMatrix<> hmat(feli.GetNDof(), DIM_ELEMENT, lh);
|
|
2231
|
+
feli.CalcDShape(ip, hmat);
|
|
2232
|
+
int ndof = feli.GetNDof();
|
|
2233
|
+
mat.Rows(DIM_DMAT).Cols(DIM_SPC*ndof) = 0.0;
|
|
2234
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2235
|
+
mat.Rows(i*DIM_ELEMENT, (i+1)*DIM_ELEMENT).Cols(i*ndof,(i+1)*ndof)
|
|
2236
|
+
= Trans(hmat);
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
template <typename MIP, typename MAT>
|
|
2240
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
2241
|
+
MAT & mat, LocalHeap & lh)
|
|
2242
|
+
{
|
|
2243
|
+
FlatMatrix<> hmat(DIM_SPC, DIM_SPC, lh);
|
|
2244
|
+
hmat = Trans(static_cast<const MappedIntegrationPoint<DIM_SPC,DIM_SPC>&>(mip).GetJacobianInverse());
|
|
2245
|
+
mat.Rows(DIM_DMAT).Cols(DIM_DMAT) = 0.0;
|
|
2246
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2247
|
+
mat.Rows(i*DIM_SPC, (i+1)*DIM_SPC).Cols(i*DIM_SPC, (i+1)*DIM_SPC) = hmat;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
2254
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
2255
|
+
BareSliceMatrix<SIMD<double>> bmat)
|
|
2256
|
+
{
|
|
2257
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2258
|
+
/*
|
|
2259
|
+
mat.AddSize(DIM_SPC*DIM_SPC*bfel.GetNDof(), mir.Size()) = 0.0;
|
|
2260
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2261
|
+
{
|
|
2262
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2263
|
+
feli.CalcMappedDShape (mir, mat.Rows(DIM_SPC*DIM_SPC*fel.GetRange(i)).RowSlice(i,DIM_SPC));
|
|
2264
|
+
// cout << "grad-mat, i = " << i << ":" << endl << mat.AddSize(DIM_SPC*DIM_SPC*bfel.GetNDof(), mir.Size()) << endl;
|
|
2265
|
+
}
|
|
2266
|
+
*/
|
|
2267
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2268
|
+
auto mat = bmat.AddSize(DIM_SPC*DIM_SPC*bfel.GetNDof(), mir.Size());
|
|
2269
|
+
mat = 0.0;
|
|
2270
|
+
feli.CalcMappedDShape (mir, mat);
|
|
2271
|
+
for (int i = 1; i < DIM_SPC; i++)
|
|
2272
|
+
{
|
|
2273
|
+
auto mati = mat.Rows(DIM_SPC*DIM_SPC*fel.GetRange(i));
|
|
2274
|
+
for (int j = 0; j < feli.GetNDof(); j++)
|
|
2275
|
+
mati.Rows(j*DIM_SPC*DIM_SPC+i*DIM_SPC, j*DIM_SPC*DIM_SPC+(i+1)*DIM_SPC)
|
|
2276
|
+
= mat.Rows(j*DIM_SPC, (j+1)*DIM_SPC);
|
|
2277
|
+
}
|
|
2278
|
+
for (int j = feli.GetNDof()-1; j >= 0; j--)
|
|
2279
|
+
mat.Rows(j*DIM_SPC*DIM_SPC, j*DIM_SPC*DIM_SPC+DIM_SPC) = mat.Rows(j*DIM_SPC, (j+1)*DIM_SPC);
|
|
2280
|
+
for (int j = feli.GetNDof()-1; j >= 0; j--)
|
|
2281
|
+
mat.Rows(j*DIM_SPC*DIM_SPC+DIM_SPC, (j+1)*DIM_SPC*DIM_SPC) = 0.0;
|
|
2282
|
+
// cout << "mat = " << endl << mat << endl;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
using DiffOp<DiffOpGradVectorH1<DIM_SPC>>::ApplySIMDIR;
|
|
2286
|
+
static void ApplySIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2287
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
2288
|
+
{
|
|
2289
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2290
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2291
|
+
{
|
|
2292
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2293
|
+
feli.EvaluateGrad (mir, x.Range(fel.GetRange(i)), y.Rows(i*DIM_SPC, (i+1)*DIM_SPC));
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
using DiffOp<DiffOpGradVectorH1<DIM_SPC>>::AddTransSIMDIR;
|
|
2298
|
+
static void AddTransSIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2299
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
2300
|
+
{
|
|
2301
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2302
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2303
|
+
{
|
|
2304
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2305
|
+
feli.AddGradTrans (mir, y.Rows(i*DIM_SPC, (i+1)*DIM_SPC), x.Range(fel.GetRange(i)));
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
static shared_ptr<CoefficientFunction>
|
|
2310
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
2311
|
+
shared_ptr<CoefficientFunction> dir,
|
|
2312
|
+
bool Eulerian);
|
|
2313
|
+
};
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
template <int DIM_SPC>
|
|
2317
|
+
class DiffOpGradBoundaryVectorH1 : public DiffOp<DiffOpGradBoundaryVectorH1<DIM_SPC> >
|
|
2318
|
+
{
|
|
2319
|
+
public:
|
|
2320
|
+
enum { DIM = 1 };
|
|
2321
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
2322
|
+
enum { DIM_ELEMENT = DIM_SPC-1 };
|
|
2323
|
+
enum { DIM_DMAT = DIM_SPC*DIM_SPC };
|
|
2324
|
+
enum { DIFFORDER = 1 };
|
|
2325
|
+
|
|
2326
|
+
static IVec<2> GetDimensions() { return { DIM_SPC, DIM_SPC }; }
|
|
2327
|
+
static constexpr bool SUPPORT_PML = true;
|
|
2328
|
+
static string Name() { return "gradbnd"; }
|
|
2329
|
+
|
|
2330
|
+
typedef void DIFFOP_TRACE;
|
|
2331
|
+
|
|
2332
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
2333
|
+
static void GenerateMatrix (const FEL & bfel, const MIP & mip,
|
|
2334
|
+
MAT && mat, LocalHeap & lh)
|
|
2335
|
+
{
|
|
2336
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2337
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_ELEMENT>&> (fel[0]);
|
|
2338
|
+
|
|
2339
|
+
HeapReset hr(lh);
|
|
2340
|
+
FlatMatrix<> hmat(feli.GetNDof(), DIM_SPACE, lh);
|
|
2341
|
+
feli.CalcMappedDShape (mip, hmat);
|
|
2342
|
+
mat.AddSize(DIM_DMAT, fel.GetNDof()) = 0.0;
|
|
2343
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2344
|
+
mat.Rows(DIM_SPC*i, DIM_SPC*(i+1)).Cols(fel.GetRange(i)) = Trans(hmat);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
static int DimRef() { return DIM_SPC*DIM_ELEMENT; }
|
|
2348
|
+
|
|
2349
|
+
template <typename IP, typename MAT>
|
|
2350
|
+
static void GenerateMatrixRef (const FiniteElement & bfel, const IP & ip,
|
|
2351
|
+
MAT && mat, LocalHeap & lh)
|
|
2352
|
+
{
|
|
2353
|
+
HeapReset hr(lh);
|
|
2354
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2355
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_ELEMENT>&> (fel[0]);
|
|
2356
|
+
FlatMatrix<> hmat(feli.GetNDof(), DIM_ELEMENT, lh);
|
|
2357
|
+
feli.CalcDShape(ip, hmat);
|
|
2358
|
+
int ndof = feli.GetNDof();
|
|
2359
|
+
mat.Rows(DIM_SPACE*DIM_ELEMENT).Cols(DIM_SPC*ndof) = 0.0;
|
|
2360
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2361
|
+
mat.Rows(i*DIM_ELEMENT, (i+1)*DIM_ELEMENT).Cols(i*ndof,(i+1)*ndof)
|
|
2362
|
+
= Trans(hmat);
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
template <typename MIP, typename MAT>
|
|
2366
|
+
static void CalcTransformationMatrix (const MIP & mip,
|
|
2367
|
+
MAT & mat, LocalHeap & lh)
|
|
2368
|
+
{
|
|
2369
|
+
FlatMatrix<> hmat(DIM_SPC, DIM_ELEMENT, lh);
|
|
2370
|
+
hmat = Trans(static_cast<const MappedIntegrationPoint<DIM_ELEMENT,DIM_SPC>&>(mip).GetJacobianInverse());
|
|
2371
|
+
mat.Rows(DIM_DMAT).Cols(DIM_ELEMENT*DIM_SPC) = 0.0;
|
|
2372
|
+
for (int i = 0; i < DIM_SPACE; i++)
|
|
2373
|
+
mat.Rows(i*DIM_SPC, (i+1)*DIM_SPC).Cols(i*DIM_ELEMENT, (i+1)*DIM_ELEMENT) = hmat;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
|
|
2381
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
2382
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
2383
|
+
BareSliceMatrix<SIMD<double>> bmat)
|
|
2384
|
+
{
|
|
2385
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2386
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2387
|
+
auto mat = bmat.AddSize(DIM_SPC*DIM_SPC*bfel.GetNDof(), mir.Size());
|
|
2388
|
+
mat = 0.0;
|
|
2389
|
+
feli.CalcMappedDShape (mir, mat);
|
|
2390
|
+
for (int i = 1; i < DIM_SPC; i++)
|
|
2391
|
+
{
|
|
2392
|
+
auto mati = mat.Rows(DIM_SPC*DIM_SPC*fel.GetRange(i));
|
|
2393
|
+
for (int j = 0; j < feli.GetNDof(); j++)
|
|
2394
|
+
mati.Rows(j*DIM_SPC*DIM_SPC+i*DIM_SPC, j*DIM_SPC*DIM_SPC+(i+1)*DIM_SPC)
|
|
2395
|
+
= mat.Rows(j*DIM_SPC, (j+1)*DIM_SPC);
|
|
2396
|
+
}
|
|
2397
|
+
for (int j = feli.GetNDof()-1; j >= 0; j--)
|
|
2398
|
+
mat.Rows(j*DIM_SPC*DIM_SPC, j*DIM_SPC*DIM_SPC+DIM_SPC) = mat.Rows(j*DIM_SPC, (j+1)*DIM_SPC);
|
|
2399
|
+
for (int j = feli.GetNDof()-1; j >= 0; j--)
|
|
2400
|
+
mat.Rows(j*DIM_SPC*DIM_SPC+DIM_SPC, (j+1)*DIM_SPC*DIM_SPC) = 0.0;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
using DiffOp<DiffOpGradBoundaryVectorH1<DIM_SPC>>::ApplySIMDIR;
|
|
2404
|
+
static void ApplySIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2405
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
2406
|
+
{
|
|
2407
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2408
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2409
|
+
{
|
|
2410
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2411
|
+
feli.EvaluateGrad (mir, x.Range(fel.GetRange(i)), y.Rows(i*DIM_SPC, (i+1)*DIM_SPC));
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
using DiffOp<DiffOpGradBoundaryVectorH1<DIM_SPC>>::AddTransSIMDIR;
|
|
2416
|
+
static void AddTransSIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2417
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
2418
|
+
{
|
|
2419
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2420
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2421
|
+
{
|
|
2422
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[i]);
|
|
2423
|
+
feli.AddGradTrans (mir, y.Rows(i*DIM_SPC, (i+1)*DIM_SPC), x.Range(fel.GetRange(i)));
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
static shared_ptr<CoefficientFunction>
|
|
2429
|
+
DiffShape (shared_ptr<CoefficientFunction> proxy,
|
|
2430
|
+
shared_ptr<CoefficientFunction> dir,
|
|
2431
|
+
bool Eulerian);
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
template <int DIM_SPC> class DiffOpDivBoundaryVectorH1;
|
|
2436
|
+
|
|
2437
|
+
template <int DIM_SPC>
|
|
2438
|
+
class DiffOpDivVectorH1 : public DiffOp<DiffOpDivVectorH1<DIM_SPC> >
|
|
2439
|
+
{
|
|
2440
|
+
public:
|
|
2441
|
+
enum { DIM = 1 };
|
|
2442
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
2443
|
+
enum { DIM_ELEMENT = DIM_SPC };
|
|
2444
|
+
enum { DIM_DMAT = 1 };
|
|
2445
|
+
enum { DIFFORDER = 1 };
|
|
2446
|
+
|
|
2447
|
+
typedef DiffOpDivBoundaryVectorH1<DIM_SPC> DIFFOP_TRACE;
|
|
2448
|
+
static constexpr bool SUPPORT_PML = true;
|
|
2449
|
+
static string Name() { return "div"; }
|
|
2450
|
+
|
|
2451
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
2452
|
+
static void GenerateMatrix (const FEL & bfel, const MIP & mip,
|
|
2453
|
+
MAT && mat, LocalHeap & lh)
|
|
2454
|
+
{
|
|
2455
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2456
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_SPC>&> (fel[0]);
|
|
2457
|
+
|
|
2458
|
+
mat.AddSize(1, bfel.GetNDof()) = 0.0;
|
|
2459
|
+
size_t n1 = feli.GetNDof();
|
|
2460
|
+
HeapReset hr(lh);
|
|
2461
|
+
FlatMatrix<> tmp(n1, DIM_SPC, lh);
|
|
2462
|
+
feli.CalcMappedDShape (mip, tmp);
|
|
2463
|
+
|
|
2464
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2465
|
+
mat.Row(0).Range(i*n1, (i+1)*n1) = tmp.Col(i);
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
2469
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
2470
|
+
BareSliceMatrix<SIMD<double>> bmat)
|
|
2471
|
+
{
|
|
2472
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2473
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2474
|
+
|
|
2475
|
+
auto mat = bmat.AddSize(bfel.GetNDof(), mir.Size());
|
|
2476
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*feli.GetNDof()*mir.Size());
|
|
2477
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC*feli.GetNDof(), mir.Size(), &mem[0]);
|
|
2478
|
+
feli.CalcMappedDShape (mir, hmat);
|
|
2479
|
+
for (size_t i = 0; i < DIM_SPC; i++)
|
|
2480
|
+
for (size_t j = 0; j < feli.GetNDof(); j++)
|
|
2481
|
+
mat.Row(i*feli.GetNDof()+j) = hmat.Row(i+j*DIM_SPC);
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
using DiffOp<DiffOpDivVectorH1<DIM_SPC>>::ApplySIMDIR;
|
|
2485
|
+
static void ApplySIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2486
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
2487
|
+
{
|
|
2488
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2489
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2490
|
+
|
|
2491
|
+
y.AddSize(1, mir.Size()) = SIMD<double>(0.0);
|
|
2492
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*mir.Size());
|
|
2493
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC, mir.Size(), &mem[0]);
|
|
2494
|
+
|
|
2495
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2496
|
+
{
|
|
2497
|
+
feli.EvaluateGrad (mir, x.Range(fel.GetRange(i)), hmat);
|
|
2498
|
+
y.Row(0).Range(mir.Size()) += hmat.Row(i);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
using DiffOp<DiffOpDivVectorH1<DIM_SPC>>::AddTransSIMDIR;
|
|
2503
|
+
static void AddTransSIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2504
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
2505
|
+
{
|
|
2506
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2507
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2508
|
+
|
|
2509
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*mir.Size());
|
|
2510
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC,mir.Size(), &mem[0]);
|
|
2511
|
+
|
|
2512
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2513
|
+
{
|
|
2514
|
+
hmat = SIMD<double>(0.0);
|
|
2515
|
+
hmat.Row(i) = y.Row(0);
|
|
2516
|
+
feli.AddGradTrans (mir, hmat, x.Range(i*feli.GetNDof(), (i+1)*feli.GetNDof()));
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
template <int DIM_SPC>
|
|
2522
|
+
class DiffOpDivBoundaryVectorH1 : public DiffOp<DiffOpDivBoundaryVectorH1<DIM_SPC> >
|
|
2523
|
+
{
|
|
2524
|
+
public:
|
|
2525
|
+
enum { DIM = 1 };
|
|
2526
|
+
enum { DIM_SPACE = DIM_SPC };
|
|
2527
|
+
enum { DIM_ELEMENT = DIM_SPC-1 };
|
|
2528
|
+
enum { DIM_DMAT = 1 };
|
|
2529
|
+
enum { DIFFORDER = 1 };
|
|
2530
|
+
|
|
2531
|
+
static constexpr bool SUPPORT_PML = true;
|
|
2532
|
+
static string Name() { return "divbnd"; }
|
|
2533
|
+
|
|
2534
|
+
template <typename FEL, typename MIP, typename MAT>
|
|
2535
|
+
static void GenerateMatrix (const FEL & bfel, const MIP & mip,
|
|
2536
|
+
MAT && mat, LocalHeap & lh)
|
|
2537
|
+
{
|
|
2538
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2539
|
+
auto & feli = static_cast<const ScalarFiniteElement<DIM_ELEMENT>&> (fel[0]);
|
|
2540
|
+
|
|
2541
|
+
mat.AddSize(1, bfel.GetNDof()) = 0.0;
|
|
2542
|
+
size_t n1 = feli.GetNDof();
|
|
2543
|
+
HeapReset hr(lh);
|
|
2544
|
+
FlatMatrix<> tmp(n1, DIM_SPC, lh);
|
|
2545
|
+
feli.CalcMappedDShape (mip, tmp);
|
|
2546
|
+
|
|
2547
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2548
|
+
mat.Row(0).Range(i*n1, (i+1)*n1) = tmp.Col(i);
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
static void GenerateMatrixSIMDIR (const FiniteElement & bfel,
|
|
2552
|
+
const SIMD_BaseMappedIntegrationRule & mir,
|
|
2553
|
+
BareSliceMatrix<SIMD<double>> bmat)
|
|
2554
|
+
{
|
|
2555
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2556
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2557
|
+
|
|
2558
|
+
auto mat = bmat.AddSize(bfel.GetNDof(), mir.Size());
|
|
2559
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*feli.GetNDof()*mir.Size());
|
|
2560
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC*feli.GetNDof(), mir.Size(), &mem[0]);
|
|
2561
|
+
feli.CalcMappedDShape (mir, hmat);
|
|
2562
|
+
for (size_t i = 0; i < DIM_SPC; i++)
|
|
2563
|
+
for (size_t j = 0; j < feli.GetNDof(); j++)
|
|
2564
|
+
mat.Row(i*feli.GetNDof()+j) = hmat.Row(i+j*DIM_SPC);
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
using DiffOp<DiffOpDivBoundaryVectorH1<DIM_SPC>>::ApplySIMDIR;
|
|
2569
|
+
static void ApplySIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2570
|
+
BareSliceVector<double> x, BareSliceMatrix<SIMD<double>> y)
|
|
2571
|
+
{
|
|
2572
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2573
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2574
|
+
|
|
2575
|
+
y.AddSize(1, mir.Size()) = SIMD<double>(0.0);
|
|
2576
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*mir.Size());
|
|
2577
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC, mir.Size(), &mem[0]);
|
|
2578
|
+
|
|
2579
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2580
|
+
{
|
|
2581
|
+
feli.EvaluateGrad (mir, x.Range(fel.GetRange(i)), hmat);
|
|
2582
|
+
y.Row(0).Range(mir.Size()) += hmat.Row(i);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
using DiffOp<DiffOpDivBoundaryVectorH1<DIM_SPC>>::AddTransSIMDIR;
|
|
2587
|
+
static void AddTransSIMDIR (const FiniteElement & bfel, const SIMD_BaseMappedIntegrationRule & mir,
|
|
2588
|
+
BareSliceMatrix<SIMD<double>> y, BareSliceVector<double> x)
|
|
2589
|
+
{
|
|
2590
|
+
auto & fel = static_cast<const VectorFiniteElement&> (bfel);
|
|
2591
|
+
auto & feli = static_cast<const BaseScalarFiniteElement&> (fel[0]);
|
|
2592
|
+
|
|
2593
|
+
ArrayMem<SIMD<double>,100> mem(DIM_SPC*mir.Size());
|
|
2594
|
+
FlatMatrix<SIMD<double>> hmat(DIM_SPC,mir.Size(), &mem[0]);
|
|
2595
|
+
|
|
2596
|
+
for (int i = 0; i < DIM_SPC; i++)
|
|
2597
|
+
{
|
|
2598
|
+
hmat = SIMD<double>(0.0);
|
|
2599
|
+
hmat.Row(i) = y.Row(0);
|
|
2600
|
+
feli.AddGradTrans (mir, hmat, x.Range(i*feli.GetNDof(), (i+1)*feli.GetNDof()));
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
/* ************************** Linearform Integrators ************************* */
|
|
2608
|
+
|
|
2609
|
+
/// integrator for \f$\int_\Omega f v \f$
|
|
2610
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
2611
|
+
class NGS_DLL_HEADER SourceIntegrator
|
|
2612
|
+
: public T_BIntegrator<DiffOpId<D>, DVec<1>, FEL>
|
|
2613
|
+
{
|
|
2614
|
+
typedef T_BIntegrator<DiffOpId<D>, DVec<1>, FEL> BASE;
|
|
2615
|
+
public:
|
|
2616
|
+
using T_BIntegrator<DiffOpId<D>, DVec<1>, FEL>::T_BIntegrator;
|
|
2617
|
+
/*
|
|
2618
|
+
SourceIntegrator (shared_ptr<CoefficientFunction> coeff)
|
|
2619
|
+
: T_BIntegrator<DiffOpId<D>, DVec<1>, FEL> (DVec<1> (coeff))
|
|
2620
|
+
{ ; }
|
|
2621
|
+
*/
|
|
2622
|
+
virtual ~SourceIntegrator () { ; }
|
|
2623
|
+
virtual string Name () const { return "Source"; }
|
|
2624
|
+
};
|
|
2625
|
+
|
|
2626
|
+
|
|
2627
|
+
///
|
|
2628
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
2629
|
+
class NGS_DLL_HEADER NeumannIntegrator
|
|
2630
|
+
: public T_BIntegrator<DiffOpIdBoundary<D>, DVec<1>, FEL>
|
|
2631
|
+
{
|
|
2632
|
+
typedef T_BIntegrator<DiffOpIdBoundary<D>, DVec<1>, FEL> BASE;
|
|
2633
|
+
public:
|
|
2634
|
+
using T_BIntegrator<DiffOpIdBoundary<D>, DVec<1>, FEL>::T_BIntegrator;
|
|
2635
|
+
/*
|
|
2636
|
+
NeumannIntegrator (shared_ptr<CoefficientFunction> coeff)
|
|
2637
|
+
: T_BIntegrator<DiffOpIdBoundary<D>, DVec<1>, FEL> (DVec<1> (coeff))
|
|
2638
|
+
{ ; }
|
|
2639
|
+
*/
|
|
2640
|
+
virtual string Name () const { return "Neumann"; }
|
|
2641
|
+
};
|
|
2642
|
+
|
|
2643
|
+
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
/// integrator for \f$\int_\Gamma v_n \, ds\f$
|
|
2647
|
+
template <int D, typename FEL = ScalarFiniteElement<D-1> >
|
|
2648
|
+
class NormalNeumannIntegrator
|
|
2649
|
+
: public T_BIntegrator<DiffOpNormal<D>, DVec<1>, FEL>
|
|
2650
|
+
{
|
|
2651
|
+
typedef T_BIntegrator<DiffOpNormal<D>, DVec<1>, FEL> BASE;
|
|
2652
|
+
public:
|
|
2653
|
+
using T_BIntegrator<DiffOpNormal<D>, DVec<1>, FEL>::T_BIntegrator;
|
|
2654
|
+
virtual string Name () const { return "NormalNeumann"; }
|
|
2655
|
+
};
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
///
|
|
2661
|
+
template <int D, typename FEL = ScalarFiniteElement<D> >
|
|
2662
|
+
class GradSourceIntegrator
|
|
2663
|
+
: public T_BIntegrator<DiffOpGradient<D>, DVec<D>, FEL>
|
|
2664
|
+
{
|
|
2665
|
+
typedef T_BIntegrator<DiffOpGradient<D>, DVec<D>, FEL> BASE;
|
|
2666
|
+
public:
|
|
2667
|
+
using T_BIntegrator<DiffOpGradient<D>, DVec<D>, FEL>::T_BIntegrator;
|
|
2668
|
+
virtual string Name () const { return "GradSource"; }
|
|
2669
|
+
};
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
#ifdef FILE_BDBEQUATIONS_CPP
|
|
2677
|
+
#define BDBEQUATIONS_EXTERN
|
|
2678
|
+
#else
|
|
2679
|
+
#define BDBEQUATIONS_EXTERN extern
|
|
2680
|
+
#endif
|
|
2681
|
+
|
|
2682
|
+
/*
|
|
2683
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<1>,2,2>;
|
|
2684
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<1>,3,3>;
|
|
2685
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<1>,1,2>;
|
|
2686
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<1>,2,3>;
|
|
2687
|
+
|
|
2688
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<2>,2,2>;
|
|
2689
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<2>,1,2>;
|
|
2690
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<3>,3,3>;
|
|
2691
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<3>,2,3>;
|
|
2692
|
+
|
|
2693
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<SymDMat<3>,2,2>;
|
|
2694
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<SymDMat<3>,3,3>;
|
|
2695
|
+
*/
|
|
2696
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<1>>;
|
|
2697
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<2>>;
|
|
2698
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<DiagDMat<3>>;
|
|
2699
|
+
|
|
2700
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<SymDMat<2>>;
|
|
2701
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator_DMat<SymDMat<3>>;
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
BDBEQUATIONS_EXTERN template class MassIntegrator<1>;
|
|
2705
|
+
BDBEQUATIONS_EXTERN template class MassIntegrator<2>;
|
|
2706
|
+
BDBEQUATIONS_EXTERN template class MassIntegrator<3>;
|
|
2707
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpId<1>, DiagDMat<1>, ScalarFiniteElement<1>>;
|
|
2708
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpId<2>, DiagDMat<1>, ScalarFiniteElement<2>>;
|
|
2709
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpId<3>, DiagDMat<1>, ScalarFiniteElement<3>>;
|
|
2710
|
+
|
|
2711
|
+
BDBEQUATIONS_EXTERN template class LaplaceIntegrator<1>;
|
|
2712
|
+
BDBEQUATIONS_EXTERN template class LaplaceIntegrator<2>;
|
|
2713
|
+
BDBEQUATIONS_EXTERN template class LaplaceIntegrator<3>;
|
|
2714
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpGradient<1>, DiagDMat<1>, ScalarFiniteElement<1>>;
|
|
2715
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpGradient<2>, DiagDMat<2>, ScalarFiniteElement<2>>;
|
|
2716
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpGradient<3>, DiagDMat<3>, ScalarFiniteElement<3>>;
|
|
2717
|
+
|
|
2718
|
+
BDBEQUATIONS_EXTERN template class RotSymLaplaceIntegrator<2>;
|
|
2719
|
+
BDBEQUATIONS_EXTERN template class RotSymLaplaceIntegrator<3>;
|
|
2720
|
+
|
|
2721
|
+
BDBEQUATIONS_EXTERN template class LaplaceBoundaryIntegrator<2>;
|
|
2722
|
+
BDBEQUATIONS_EXTERN template class LaplaceBoundaryIntegrator<3>;
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
BDBEQUATIONS_EXTERN template class RobinIntegrator<1>;
|
|
2726
|
+
BDBEQUATIONS_EXTERN template class RobinIntegrator<2>;
|
|
2727
|
+
BDBEQUATIONS_EXTERN template class RobinIntegrator<3>;
|
|
2728
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpIdBoundary<1>, DiagDMat<1>, ScalarFiniteElement<0>>;
|
|
2729
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpIdBoundary<2>, DiagDMat<1>, ScalarFiniteElement<1>>;
|
|
2730
|
+
BDBEQUATIONS_EXTERN template class T_BDBIntegrator<DiffOpIdBoundary<3>, DiagDMat<1>, ScalarFiniteElement<2>>;
|
|
2731
|
+
|
|
2732
|
+
BDBEQUATIONS_EXTERN template class SourceIntegrator<1>;
|
|
2733
|
+
BDBEQUATIONS_EXTERN template class SourceIntegrator<2>;
|
|
2734
|
+
BDBEQUATIONS_EXTERN template class SourceIntegrator<3>;
|
|
2735
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpId<1>, DVec<1>, ScalarFiniteElement<1>>;
|
|
2736
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpId<2>, DVec<1>, ScalarFiniteElement<2>>;
|
|
2737
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpId<3>, DVec<1>, ScalarFiniteElement<3>>;
|
|
2738
|
+
|
|
2739
|
+
|
|
2740
|
+
BDBEQUATIONS_EXTERN template class NeumannIntegrator<1>;
|
|
2741
|
+
BDBEQUATIONS_EXTERN template class NeumannIntegrator<2>;
|
|
2742
|
+
BDBEQUATIONS_EXTERN template class NeumannIntegrator<3>;
|
|
2743
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpIdBoundary<1>, DVec<1>, ScalarFiniteElement<0>>;
|
|
2744
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpIdBoundary<2>, DVec<1>, ScalarFiniteElement<1>>;
|
|
2745
|
+
BDBEQUATIONS_EXTERN template class T_BIntegrator<DiffOpIdBoundary<3>, DVec<1>, ScalarFiniteElement<2>>;
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
extern template class NGS_DLL_HEADER DiffOpIdDual<1,2>;
|
|
2749
|
+
extern template class NGS_DLL_HEADER DiffOpIdDual<2,3>;
|
|
2750
|
+
extern template class NGS_DLL_HEADER DiffOpIdDual<1,1>;
|
|
2751
|
+
extern template class NGS_DLL_HEADER DiffOpIdDual<2,2>;
|
|
2752
|
+
extern template class NGS_DLL_HEADER DiffOpIdDual<3,3>;
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpId<1> >;
|
|
2756
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpId<2> >;
|
|
2757
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpId<3> >;
|
|
2758
|
+
|
|
2759
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdBoundary<1> >;
|
|
2760
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdBoundary<2> >;
|
|
2761
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdBoundary<3> >;
|
|
2762
|
+
|
|
2763
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<1,VOL> >;
|
|
2764
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<2,VOL> >;
|
|
2765
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<3,VOL> >;
|
|
2766
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<1,BND> >;
|
|
2767
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<2,BND> >;
|
|
2768
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<3,BND> >;
|
|
2769
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpIdVectorH1<3,BBND> >;
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
extern template class NGS_DLL_HEADER DiffOpGradient<1>;
|
|
2775
|
+
extern template class NGS_DLL_HEADER DiffOpGradient<2>;
|
|
2776
|
+
extern template class NGS_DLL_HEADER DiffOpGradient<3>;
|
|
2777
|
+
|
|
2778
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradient<1> >;
|
|
2779
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradient<2> >;
|
|
2780
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradient<3> >;
|
|
2781
|
+
|
|
2782
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradVectorH1<1> >;
|
|
2783
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradVectorH1<2> >;
|
|
2784
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradVectorH1<3> >;
|
|
2785
|
+
|
|
2786
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradientBoundary<1> >;
|
|
2787
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradientBoundary<2> >;
|
|
2788
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradientBoundary<3> >;
|
|
2789
|
+
|
|
2790
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradBoundaryVectorH1<1> >;
|
|
2791
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradBoundaryVectorH1<2> >;
|
|
2792
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpGradBoundaryVectorH1<3> >;
|
|
2793
|
+
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesse<1> >;
|
|
2799
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesse<2> >;
|
|
2800
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesse<3> >;
|
|
2801
|
+
|
|
2802
|
+
// extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesseBoundary<1> >;
|
|
2803
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesseBoundary<2> >;
|
|
2804
|
+
extern template class NGS_DLL_HEADER T_DifferentialOperator<DiffOpHesseBoundary<3> >;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
#endif
|