ngsolve 6.2.2506.post74.dev0__cp314-cp314-macosx_10_15_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ngsolve might be problematic. Click here for more details.
- netgen/include/analytic_integrals.hpp +10 -0
- netgen/include/arnoldi.hpp +55 -0
- netgen/include/bandmatrix.hpp +334 -0
- netgen/include/basematrix.hpp +957 -0
- netgen/include/basevector.hpp +1268 -0
- netgen/include/bdbequations.hpp +2805 -0
- netgen/include/bdbintegrator.hpp +1660 -0
- netgen/include/bem_diffops.hpp +475 -0
- netgen/include/bessel.hpp +1064 -0
- netgen/include/bilinearform.hpp +963 -0
- netgen/include/bla.hpp +29 -0
- netgen/include/blockalloc.hpp +95 -0
- netgen/include/blockjacobi.hpp +328 -0
- netgen/include/bspline.hpp +116 -0
- netgen/include/calcinverse.hpp +141 -0
- netgen/include/cg.hpp +368 -0
- netgen/include/chebyshev.hpp +44 -0
- netgen/include/cholesky.hpp +720 -0
- netgen/include/clapack.h +7254 -0
- netgen/include/code_generation.hpp +296 -0
- netgen/include/coefficient.hpp +2033 -0
- netgen/include/coefficient_impl.hpp +19 -0
- netgen/include/coefficient_stdmath.hpp +167 -0
- netgen/include/commutingAMG.hpp +106 -0
- netgen/include/comp.hpp +79 -0
- netgen/include/compatibility.hpp +41 -0
- netgen/include/complex_wrapper.hpp +73 -0
- netgen/include/compressedfespace.hpp +110 -0
- netgen/include/contact.hpp +235 -0
- netgen/include/diagonalmatrix.hpp +154 -0
- netgen/include/differentialoperator.hpp +276 -0
- netgen/include/diffop.hpp +1286 -0
- netgen/include/diffop_impl.hpp +328 -0
- netgen/include/diffopwithfactor.hpp +123 -0
- netgen/include/discontinuous.hpp +84 -0
- netgen/include/dump.hpp +949 -0
- netgen/include/ectypes.hpp +121 -0
- netgen/include/eigen.hpp +60 -0
- netgen/include/eigensystem.hpp +18 -0
- netgen/include/elasticity_equations.hpp +595 -0
- netgen/include/elementbyelement.hpp +195 -0
- netgen/include/elementtopology.hpp +1760 -0
- netgen/include/elementtransformation.hpp +339 -0
- netgen/include/evalfunc.hpp +405 -0
- netgen/include/expr.hpp +1686 -0
- netgen/include/facetfe.hpp +175 -0
- netgen/include/facetfespace.hpp +180 -0
- netgen/include/facethofe.hpp +111 -0
- netgen/include/facetsurffespace.hpp +112 -0
- netgen/include/fe_interfaces.hpp +32 -0
- netgen/include/fem.hpp +87 -0
- netgen/include/fesconvert.hpp +14 -0
- netgen/include/fespace.hpp +1449 -0
- netgen/include/finiteelement.hpp +286 -0
- netgen/include/globalinterfacespace.hpp +77 -0
- netgen/include/globalspace.hpp +115 -0
- netgen/include/gridfunction.hpp +525 -0
- netgen/include/h1amg.hpp +124 -0
- netgen/include/h1hofe.hpp +188 -0
- netgen/include/h1hofe_impl.hpp +1262 -0
- netgen/include/h1hofefo.hpp +148 -0
- netgen/include/h1hofefo_impl.hpp +185 -0
- netgen/include/h1hofespace.hpp +167 -0
- netgen/include/h1lofe.hpp +1240 -0
- netgen/include/h1lumping.hpp +41 -0
- netgen/include/hcurl_equations.hpp +1381 -0
- netgen/include/hcurlcurlfe.hpp +2241 -0
- netgen/include/hcurlcurlfespace.hpp +78 -0
- netgen/include/hcurlfe.hpp +259 -0
- netgen/include/hcurlfe_utils.hpp +107 -0
- netgen/include/hcurlhdiv_dshape.hpp +857 -0
- netgen/include/hcurlhdivfes.hpp +308 -0
- netgen/include/hcurlhofe.hpp +175 -0
- netgen/include/hcurlhofe_impl.hpp +1871 -0
- netgen/include/hcurlhofespace.hpp +193 -0
- netgen/include/hcurllofe.hpp +1146 -0
- netgen/include/hdiv_equations.hpp +880 -0
- netgen/include/hdivdivfe.hpp +2923 -0
- netgen/include/hdivdivsurfacespace.hpp +76 -0
- netgen/include/hdivfe.hpp +206 -0
- netgen/include/hdivfe_utils.hpp +717 -0
- netgen/include/hdivfes.hpp +75 -0
- netgen/include/hdivhofe.hpp +447 -0
- netgen/include/hdivhofe_impl.hpp +1107 -0
- netgen/include/hdivhofefo.hpp +229 -0
- netgen/include/hdivhofespace.hpp +177 -0
- netgen/include/hdivhosurfacefespace.hpp +106 -0
- netgen/include/hdivlofe.hpp +773 -0
- netgen/include/hidden.hpp +74 -0
- netgen/include/householder.hpp +181 -0
- netgen/include/hypre_ams_precond.hpp +123 -0
- netgen/include/hypre_precond.hpp +73 -0
- netgen/include/integrator.hpp +2012 -0
- netgen/include/integratorcf.hpp +253 -0
- netgen/include/interpolate.hpp +49 -0
- netgen/include/intrule.hpp +2542 -0
- netgen/include/intrules_SauterSchwab.hpp +25 -0
- netgen/include/irspace.hpp +49 -0
- netgen/include/jacobi.hpp +153 -0
- netgen/include/kernels.hpp +762 -0
- netgen/include/l2hofe.hpp +194 -0
- netgen/include/l2hofe_impl.hpp +564 -0
- netgen/include/l2hofefo.hpp +542 -0
- netgen/include/l2hofespace.hpp +344 -0
- netgen/include/la.hpp +38 -0
- netgen/include/linearform.hpp +266 -0
- netgen/include/matrix.hpp +2140 -0
- netgen/include/memusage.hpp +41 -0
- netgen/include/meshaccess.hpp +1359 -0
- netgen/include/mgpre.hpp +204 -0
- netgen/include/mp_coefficient.hpp +145 -0
- netgen/include/mptools.hpp +2281 -0
- netgen/include/multigrid.hpp +42 -0
- netgen/include/multivector.hpp +447 -0
- netgen/include/mumpsinverse.hpp +187 -0
- netgen/include/mycomplex.hpp +361 -0
- netgen/include/ng_lapack.hpp +1661 -0
- netgen/include/ngblas.hpp +1232 -0
- netgen/include/ngs_defines.hpp +30 -0
- netgen/include/ngs_stdcpp_include.hpp +106 -0
- netgen/include/ngs_utils.hpp +121 -0
- netgen/include/ngsobject.hpp +1019 -0
- netgen/include/ngsstream.hpp +113 -0
- netgen/include/ngstd.hpp +72 -0
- netgen/include/nodalhofe.hpp +96 -0
- netgen/include/nodalhofe_impl.hpp +141 -0
- netgen/include/normalfacetfe.hpp +223 -0
- netgen/include/normalfacetfespace.hpp +98 -0
- netgen/include/normalfacetsurfacefespace.hpp +84 -0
- netgen/include/order.hpp +251 -0
- netgen/include/parallel_matrices.hpp +222 -0
- netgen/include/paralleldofs.hpp +340 -0
- netgen/include/parallelngs.hpp +23 -0
- netgen/include/parallelvector.hpp +269 -0
- netgen/include/pardisoinverse.hpp +200 -0
- netgen/include/periodic.hpp +129 -0
- netgen/include/plateaufespace.hpp +25 -0
- netgen/include/pml.hpp +275 -0
- netgen/include/pmltrafo.hpp +631 -0
- netgen/include/postproc.hpp +142 -0
- netgen/include/potentialtools.hpp +22 -0
- netgen/include/precomp.hpp +60 -0
- netgen/include/preconditioner.hpp +602 -0
- netgen/include/prolongation.hpp +377 -0
- netgen/include/python_comp.hpp +107 -0
- netgen/include/python_fem.hpp +89 -0
- netgen/include/python_linalg.hpp +58 -0
- netgen/include/python_ngstd.hpp +386 -0
- netgen/include/recursive_pol.hpp +4896 -0
- netgen/include/recursive_pol_tet.hpp +395 -0
- netgen/include/recursive_pol_trig.hpp +492 -0
- netgen/include/reorderedfespace.hpp +81 -0
- netgen/include/sample_sort.hpp +105 -0
- netgen/include/scalarfe.hpp +335 -0
- netgen/include/shapefunction_utils.hpp +113 -0
- netgen/include/simd_complex.hpp +329 -0
- netgen/include/smoother.hpp +253 -0
- netgen/include/solve.hpp +89 -0
- netgen/include/sparsecholesky.hpp +313 -0
- netgen/include/sparsematrix.hpp +1038 -0
- netgen/include/sparsematrix_dyn.hpp +90 -0
- netgen/include/sparsematrix_impl.hpp +1013 -0
- netgen/include/special_matrix.hpp +463 -0
- netgen/include/specialelement.hpp +125 -0
- netgen/include/statushandler.hpp +33 -0
- netgen/include/stringops.hpp +12 -0
- netgen/include/superluinverse.hpp +136 -0
- netgen/include/symbolicintegrator.hpp +850 -0
- netgen/include/symmetricmatrix.hpp +144 -0
- netgen/include/tangentialfacetfe.hpp +224 -0
- netgen/include/tangentialfacetfespace.hpp +91 -0
- netgen/include/tensor.hpp +522 -0
- netgen/include/tensorcoefficient.hpp +446 -0
- netgen/include/tensorproductintegrator.hpp +113 -0
- netgen/include/thcurlfe.hpp +128 -0
- netgen/include/thcurlfe_impl.hpp +380 -0
- netgen/include/thdivfe.hpp +80 -0
- netgen/include/thdivfe_impl.hpp +492 -0
- netgen/include/tpdiffop.hpp +461 -0
- netgen/include/tpfes.hpp +133 -0
- netgen/include/tpintrule.hpp +224 -0
- netgen/include/triangular.hpp +465 -0
- netgen/include/tscalarfe.hpp +245 -0
- netgen/include/tscalarfe_impl.hpp +1029 -0
- netgen/include/umfpackinverse.hpp +148 -0
- netgen/include/vector.hpp +1273 -0
- netgen/include/voxelcoefficientfunction.hpp +41 -0
- netgen/include/vtkoutput.hpp +198 -0
- netgen/include/vvector.hpp +208 -0
- netgen/include/webgui.hpp +92 -0
- netgen/libngbla.dylib +0 -0
- netgen/libngcomp.dylib +0 -0
- netgen/libngfem.dylib +0 -0
- netgen/libngla.dylib +0 -0
- netgen/libngsbem.dylib +0 -0
- netgen/libngsolve.dylib +0 -0
- netgen/libngstd.dylib +0 -0
- ngsolve/TensorProductTools.py +210 -0
- ngsolve/__console.py +94 -0
- ngsolve/__expr.py +181 -0
- ngsolve/__init__.py +148 -0
- ngsolve/__init__.pyi +233 -0
- ngsolve/_scikit_build_core_dependencies.py +30 -0
- ngsolve/bla.pyi +1153 -0
- ngsolve/bvp.py +78 -0
- ngsolve/bvp.pyi +32 -0
- ngsolve/cmake/NGSolveConfig.cmake +102 -0
- ngsolve/cmake/ngsolve-targets-release.cmake +79 -0
- ngsolve/cmake/ngsolve-targets.cmake +163 -0
- ngsolve/comp/__init__.pyi +5449 -0
- ngsolve/comp/pml.pyi +89 -0
- ngsolve/config/__init__.py +1 -0
- ngsolve/config/__init__.pyi +43 -0
- ngsolve/config/__main__.py +4 -0
- ngsolve/config/config.py +60 -0
- ngsolve/config/config.pyi +45 -0
- ngsolve/demos/TensorProduct/__init__.py +0 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +80 -0
- ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +73 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +72 -0
- ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +66 -0
- ngsolve/demos/__init__.py +0 -0
- ngsolve/demos/howto/__init__.py +0 -0
- ngsolve/demos/howto/hhj.py +44 -0
- ngsolve/demos/howto/hybrid_dg.py +53 -0
- ngsolve/demos/howto/mixed.py +30 -0
- ngsolve/demos/howto/nonlin.py +29 -0
- ngsolve/demos/howto/pickling.py +26 -0
- ngsolve/demos/howto/pml.py +31 -0
- ngsolve/demos/howto/taskmanager.py +20 -0
- ngsolve/demos/howto/tdnns.py +47 -0
- ngsolve/demos/howto/timeDG-skeleton.py +45 -0
- ngsolve/demos/howto/timeDG.py +38 -0
- ngsolve/demos/howto/timeDGlap.py +42 -0
- ngsolve/demos/howto/timeDGwave.py +61 -0
- ngsolve/demos/intro/__init__.py +0 -0
- ngsolve/demos/intro/adaptive.py +123 -0
- ngsolve/demos/intro/cmagnet.py +59 -0
- ngsolve/demos/intro/elasticity.py +76 -0
- ngsolve/demos/intro/navierstokes.py +74 -0
- ngsolve/demos/intro/poisson.ipynb +170 -0
- ngsolve/demos/intro/poisson.py +41 -0
- ngsolve/demos/mpi/__init__.py +0 -0
- ngsolve/demos/mpi/mpi_cmagnet.py +87 -0
- ngsolve/demos/mpi/mpi_navierstokes.py +117 -0
- ngsolve/demos/mpi/mpi_poisson.py +89 -0
- ngsolve/demos/mpi/mpi_timeDG.py +82 -0
- ngsolve/directsolvers.py +26 -0
- ngsolve/directsolvers.pyi +15 -0
- ngsolve/eigenvalues.py +364 -0
- ngsolve/eigenvalues.pyi +30 -0
- ngsolve/fem.pyi +1647 -0
- ngsolve/internal.py +89 -0
- ngsolve/krylovspace.py +1013 -0
- ngsolve/krylovspace.pyi +298 -0
- ngsolve/la.pyi +1230 -0
- ngsolve/meshes.py +748 -0
- ngsolve/ngs2petsc.py +310 -0
- ngsolve/ngscxx.py +42 -0
- ngsolve/ngslib.so +0 -0
- ngsolve/ngstd.pyi +59 -0
- ngsolve/nonlinearsolvers.py +203 -0
- ngsolve/nonlinearsolvers.pyi +95 -0
- ngsolve/preconditioners.py +11 -0
- ngsolve/preconditioners.pyi +7 -0
- ngsolve/solve.pyi +109 -0
- ngsolve/solve_implementation.py +168 -0
- ngsolve/solve_implementation.pyi +42 -0
- ngsolve/solvers.py +7 -0
- ngsolve/solvers.pyi +14 -0
- ngsolve/timestepping.py +185 -0
- ngsolve/timestepping.pyi +28 -0
- ngsolve/timing.py +108 -0
- ngsolve/timing.pyi +54 -0
- ngsolve/utils.py +167 -0
- ngsolve/utils.pyi +273 -0
- ngsolve/webgui.py +670 -0
- ngsolve-6.2.2506.post74.dev0.data/data/Netgen.icns +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngscxx +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsld +13 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngsolve.tcl +648 -0
- ngsolve-6.2.2506.post74.dev0.data/data/bin/ngspy +2 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.geo +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/beam.vol +240 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.in2d +41 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/chip.vol +614 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.geo +12 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coil.vol +2560 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.geo +24 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/coilshield.vol +3179 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.geo +19 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/cube.vol +1832 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d10_DGdoubleglazing.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d11_chip_nitsche.pde +40 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d1_square.pde +43 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d2_chip.pde +35 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d3_helmholtz.pde +22 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d4_cube.pde +46 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d5_beam.pde +74 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d6_shaft.pde +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d7_coil.pde +50 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d8_coilshield.pde +49 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/d9_hybridDG.pde +72 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.in2d +27 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/doubleglazing.vol +737 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.geo +73 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/shaft.vol +4291 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.in2d +17 -0
- ngsolve-6.2.2506.post74.dev0.data/data/share/ngsolve/square.vol +149 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/METADATA +13 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/RECORD +315 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/WHEEL +5 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/licenses/LICENSE +504 -0
- ngsolve-6.2.2506.post74.dev0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
#ifndef FILE_BILINEARFORM
|
|
2
|
+
#define FILE_BILINEARFORM
|
|
3
|
+
|
|
4
|
+
/*********************************************************************/
|
|
5
|
+
/* File: bilinearform.hpp */
|
|
6
|
+
/* Author: Joachim Schoeberl */
|
|
7
|
+
/* Date: 25. Mar. 2000 */
|
|
8
|
+
/*********************************************************************/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#include "fespace.hpp"
|
|
12
|
+
#include <specialelement.hpp>
|
|
13
|
+
#include <sparsematrix.hpp>
|
|
14
|
+
#include <elementbyelement.hpp>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace ngcomp
|
|
18
|
+
{
|
|
19
|
+
class LinearForm;
|
|
20
|
+
class Preconditioner;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
A bilinear-form.
|
|
25
|
+
A bilinear-form provides the system matrix.
|
|
26
|
+
It knows about its definition in terms of integrators.
|
|
27
|
+
In most cases, it is defined on two copies of the same space V,
|
|
28
|
+
but it can also live on V x W.
|
|
29
|
+
*/
|
|
30
|
+
class NGS_DLL_HEADER BilinearForm : public NGS_Object
|
|
31
|
+
{
|
|
32
|
+
protected:
|
|
33
|
+
/// Finite element space
|
|
34
|
+
shared_ptr<FESpace> fespace;
|
|
35
|
+
/// Test-space if different from trial-space, otherwise NULL
|
|
36
|
+
shared_ptr<FESpace> fespace2;
|
|
37
|
+
|
|
38
|
+
/// don't assemble matrix
|
|
39
|
+
bool nonassemble;
|
|
40
|
+
/// store only diagonal of matrix
|
|
41
|
+
bool diagonal = false;
|
|
42
|
+
/// element-matrix for ref-elements
|
|
43
|
+
bool geom_free = false;
|
|
44
|
+
/// stores geom-free B factors, and D factors in integration points
|
|
45
|
+
bool matrix_free_bdb = false;
|
|
46
|
+
/// stores geom-free B factors, and D factors in integration points, and compiled CF
|
|
47
|
+
bool nonlinear_matrix_free_bdb = false;
|
|
48
|
+
/// store matrices on mesh hierarchy
|
|
49
|
+
bool multilevel;
|
|
50
|
+
/// galerkin projection of coarse grid matrices
|
|
51
|
+
bool galerkin;
|
|
52
|
+
/// complex forms are hermitean (non operational)
|
|
53
|
+
bool hermitean;
|
|
54
|
+
/// bilinear form is symmetric
|
|
55
|
+
bool symmetric;
|
|
56
|
+
/// bilinear form is symmetric and positive definite (experimental)
|
|
57
|
+
bool spd;
|
|
58
|
+
/// add epsilon for regularization
|
|
59
|
+
double eps_regularization;
|
|
60
|
+
/// diagonal value for unused dofs
|
|
61
|
+
double unuseddiag;
|
|
62
|
+
/// check if all dofs declared used are used in assemble
|
|
63
|
+
bool check_unused = true;
|
|
64
|
+
/// low order bilinear-form, 0 if not used
|
|
65
|
+
shared_ptr<BilinearForm> low_order_bilinear_form;
|
|
66
|
+
|
|
67
|
+
/// modify linear form due to static condensation
|
|
68
|
+
LinearForm * linearform;
|
|
69
|
+
|
|
70
|
+
/// some preconditioners need element matrices
|
|
71
|
+
Array<Preconditioner*> preconditioners;
|
|
72
|
+
|
|
73
|
+
/// matrices (sparse, application, diagonal, ...)
|
|
74
|
+
Array<shared_ptr<BaseMatrix>> mats;
|
|
75
|
+
size_t graph_timestamp = 0;
|
|
76
|
+
|
|
77
|
+
/// bilinearform-integrators
|
|
78
|
+
Array<shared_ptr<BilinearFormIntegrator>> parts;
|
|
79
|
+
Array<shared_ptr<BilinearFormIntegrator>> VB_parts[4];
|
|
80
|
+
|
|
81
|
+
// loop over facets, VB=0 .. inner facets, VB=1 .. boundary facets
|
|
82
|
+
Array<shared_ptr<FacetBilinearFormIntegrator>> facetwise_skeleton_parts[2];
|
|
83
|
+
|
|
84
|
+
// geometry-free parts (only for apply)
|
|
85
|
+
Array<shared_ptr<BilinearFormIntegrator>> geom_free_parts;
|
|
86
|
+
|
|
87
|
+
// loop over elements
|
|
88
|
+
Array<shared_ptr<FacetBilinearFormIntegrator>> elementwise_skeleton_parts;
|
|
89
|
+
|
|
90
|
+
// #ifdef PARALLEL
|
|
91
|
+
Array<shared_ptr<FacetBilinearFormIntegrator> > mpi_facet_parts;
|
|
92
|
+
// #endif
|
|
93
|
+
|
|
94
|
+
/// special elements for hacks (used for contact, periodic-boundary-penalty-constraints, ...
|
|
95
|
+
Array<unique_ptr<SpecialElement>> specialelements;
|
|
96
|
+
mutable unique_ptr<Table<int>> special_element_coloring;
|
|
97
|
+
|
|
98
|
+
size_t specialelements_timestamp = 0;
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
Array<BilinearFormIntegrator*> independent_parts;
|
|
103
|
+
Array<bool> independent_parts_deletable;
|
|
104
|
+
Array< Vec<2,int> > independent_meshindex;
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/// does some timing in assemble
|
|
108
|
+
bool timing;
|
|
109
|
+
/// prints assembled matrix to testout
|
|
110
|
+
bool print;
|
|
111
|
+
/// prints element matrices to testout
|
|
112
|
+
bool printelmat;
|
|
113
|
+
/// calculates eigenvalues of element matrices
|
|
114
|
+
bool elmat_ev;
|
|
115
|
+
/// does static condensation of internal dofs
|
|
116
|
+
bool eliminate_internal;
|
|
117
|
+
/// does static condensation of hidden dofs
|
|
118
|
+
bool eliminate_hidden;
|
|
119
|
+
/// keeps matrices for reconstruction of internal dofs
|
|
120
|
+
bool keep_internal;
|
|
121
|
+
/// should A_ii itself be stored?!
|
|
122
|
+
bool store_inner;
|
|
123
|
+
|
|
124
|
+
/// precomputes some data for each element
|
|
125
|
+
bool precompute;
|
|
126
|
+
/// precomputed element-wise data
|
|
127
|
+
Array<void*> precomputed_data;
|
|
128
|
+
/// output of norm of matrix entries
|
|
129
|
+
bool checksum;
|
|
130
|
+
///
|
|
131
|
+
optional<double> delete_zero_elements;
|
|
132
|
+
|
|
133
|
+
mutable std::map<size_t, Matrix<>> precomputed;
|
|
134
|
+
public:
|
|
135
|
+
/// generate a bilinear-form
|
|
136
|
+
BilinearForm (shared_ptr<FESpace> afespace,
|
|
137
|
+
const string & aname,
|
|
138
|
+
const Flags & flags);
|
|
139
|
+
|
|
140
|
+
/// generate a bilinear-form
|
|
141
|
+
BilinearForm (shared_ptr<FESpace> afespace,
|
|
142
|
+
shared_ptr<FESpace> afespace2,
|
|
143
|
+
const string & aname,
|
|
144
|
+
const Flags & flags);
|
|
145
|
+
BilinearForm (const BilinearForm&) = delete;
|
|
146
|
+
BilinearForm& operator= (const BilinearForm&) = delete;
|
|
147
|
+
virtual ~BilinearForm ();
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
///
|
|
151
|
+
virtual BilinearForm & AddIntegrator (shared_ptr<BilinearFormIntegrator> bfi);
|
|
152
|
+
|
|
153
|
+
BilinearForm & operator+= (shared_ptr<BilinearFormIntegrator> bfi)
|
|
154
|
+
{
|
|
155
|
+
return AddIntegrator(bfi);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/*
|
|
159
|
+
void AddIndependentIntegrator (BilinearFormIntegrator * bfi,
|
|
160
|
+
const int master_surface,
|
|
161
|
+
const int other)
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
const Array<shared_ptr<BilinearFormIntegrator>> & Integrators() const
|
|
165
|
+
{
|
|
166
|
+
return parts;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
///
|
|
170
|
+
int NumIntegrators () const
|
|
171
|
+
{
|
|
172
|
+
return parts.Size();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
int NumIndependentIntegrators(void) const {return independent_parts.Size();}
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
/// the i-th integrator
|
|
180
|
+
shared_ptr<BilinearFormIntegrator> GetIntegrator (int i) const { return parts[i]; }
|
|
181
|
+
|
|
182
|
+
// const BilinearFormIntegrator * GetIntegrator (int i) const { return parts[i]; }
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
/*
|
|
186
|
+
BilinearFormIntegrator * GetIndependentIntegrator (const int i)
|
|
187
|
+
{ return independent_parts[i]; }
|
|
188
|
+
|
|
189
|
+
const BilinearFormIntegrator * GetIndependentIntegrator (const int i) const
|
|
190
|
+
{ return independent_parts[i]; }
|
|
191
|
+
|
|
192
|
+
int GetIndependentMasterSurfaceIndex(const int i) const
|
|
193
|
+
{
|
|
194
|
+
return independent_meshindex[i](0);
|
|
195
|
+
}
|
|
196
|
+
int GetIndependentOtherIndex(const int i) const
|
|
197
|
+
{
|
|
198
|
+
return independent_meshindex[i](1);
|
|
199
|
+
}
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
void AddSpecialElement (unique_ptr<SpecialElement> spel);
|
|
203
|
+
auto & GetSpecialElements() const { return specialelements; }
|
|
204
|
+
void DeleteSpecialElement(size_t index);
|
|
205
|
+
void DeleteSpecialElements();
|
|
206
|
+
Table<int> & SpecialElementColoring() const;
|
|
207
|
+
|
|
208
|
+
/// for static condensation of internal bubbles
|
|
209
|
+
void SetLinearForm (LinearForm * alf) { linearform = alf; }
|
|
210
|
+
|
|
211
|
+
/// preconditioner gets element-matrix
|
|
212
|
+
void SetPreconditioner (Preconditioner * pre);
|
|
213
|
+
|
|
214
|
+
/// unregister preconditioner
|
|
215
|
+
void UnsetPreconditioner(Preconditioner* pre);
|
|
216
|
+
|
|
217
|
+
/// generates matrix graph
|
|
218
|
+
virtual MatrixGraph GetGraph (int level, bool symmetric);
|
|
219
|
+
|
|
220
|
+
/// assembles the matrix
|
|
221
|
+
void Assemble (LocalHeap & lh);
|
|
222
|
+
|
|
223
|
+
/// re-assembles the matrix.
|
|
224
|
+
/// if reallocate is false, the existing matrix is reused
|
|
225
|
+
void ReAssemble (LocalHeap & lh, bool reallocate = 0);
|
|
226
|
+
|
|
227
|
+
/// assembles matrix at linearization point given by lin
|
|
228
|
+
/// needed for Newton's method
|
|
229
|
+
virtual void AssembleLinearization (const BaseVector & lin,
|
|
230
|
+
LocalHeap & lh,
|
|
231
|
+
bool reallocate = 0) = 0;
|
|
232
|
+
|
|
233
|
+
/// applies the matrix without assembling
|
|
234
|
+
void ApplyMatrix (const BaseVector & x,
|
|
235
|
+
BaseVector & y, LocalHeap & lh) const
|
|
236
|
+
{
|
|
237
|
+
x.Cumulate();
|
|
238
|
+
y = 0;
|
|
239
|
+
AddMatrix (1, x, y, lh);
|
|
240
|
+
y.SetParallelStatus(DISTRIBUTED);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/// y += val * Mat * x
|
|
244
|
+
virtual void AddMatrix (double val, const BaseVector & x,
|
|
245
|
+
BaseVector & y, LocalHeap & lh) const = 0;
|
|
246
|
+
|
|
247
|
+
/// y += val * Mat * x
|
|
248
|
+
virtual void AddMatrix (Complex val, const BaseVector & x,
|
|
249
|
+
BaseVector & y, LocalHeap & lh) const = 0;
|
|
250
|
+
|
|
251
|
+
/// y += val * Mat^T * x
|
|
252
|
+
virtual void AddMatrixTrans (double val, const BaseVector & x,
|
|
253
|
+
BaseVector & y, LocalHeap & lh) const = 0;
|
|
254
|
+
|
|
255
|
+
/// y += val * lin.mat * x
|
|
256
|
+
virtual void ApplyLinearizedMatrixAdd (double val,
|
|
257
|
+
const BaseVector & lin,
|
|
258
|
+
const BaseVector & x,
|
|
259
|
+
BaseVector & y, LocalHeap & lh) const = 0;
|
|
260
|
+
/// y += val * lin.mat * x
|
|
261
|
+
virtual void ApplyLinearizedMatrixAdd (Complex val,
|
|
262
|
+
const BaseVector & lin,
|
|
263
|
+
const BaseVector & x,
|
|
264
|
+
BaseVector & y, LocalHeap & lh) const = 0;
|
|
265
|
+
|
|
266
|
+
/// evaulates internal energy (usually 1/2 x^T A x)
|
|
267
|
+
virtual double Energy (const BaseVector & x, LocalHeap & lh) const = 0;
|
|
268
|
+
|
|
269
|
+
/// returns the assembled matrix
|
|
270
|
+
const BaseMatrix & GetMatrix () const { return *mats.Last(); }
|
|
271
|
+
const BaseMatrix & GetMatrix (int level) const { return *mats[level]; }
|
|
272
|
+
void DeleteMatrix()
|
|
273
|
+
{
|
|
274
|
+
if(mats.Size())
|
|
275
|
+
mats.DeleteLast();
|
|
276
|
+
}
|
|
277
|
+
/// returns the assembled matrix
|
|
278
|
+
shared_ptr<BaseMatrix> GetMatrixPtr () const;
|
|
279
|
+
|
|
280
|
+
// operator const BaseMatrix& () const { return GetMatrix(); }
|
|
281
|
+
|
|
282
|
+
/// returns the assembled matrix on a given level
|
|
283
|
+
shared_ptr<BaseMatrix> GetMatrixPtr (int level) const { return mats[level]; }
|
|
284
|
+
|
|
285
|
+
BaseMatrix & GetMatrix () { return *mats.Last(); }
|
|
286
|
+
BaseMatrix & GetMatrix (int level) { return *mats[level]; }
|
|
287
|
+
|
|
288
|
+
/// reconstruct internal dofs from static condensation
|
|
289
|
+
/// -A_ii^{-1} A_ib
|
|
290
|
+
virtual shared_ptr<BaseMatrix> GetHarmonicExtension () const = 0;
|
|
291
|
+
|
|
292
|
+
/// modify rhs doue to static condensation.
|
|
293
|
+
/// -A_bi A_ii^{-1}
|
|
294
|
+
/// stored only for non-symmetric biforms
|
|
295
|
+
virtual shared_ptr<BaseMatrix> GetHarmonicExtensionTrans () const = 0;
|
|
296
|
+
|
|
297
|
+
/// returns inverse of A_ii
|
|
298
|
+
virtual shared_ptr<BaseMatrix> GetInnerSolve () const = 0;
|
|
299
|
+
|
|
300
|
+
/// returns A_ii
|
|
301
|
+
virtual shared_ptr<BaseMatrix> GetInnerMatrix () const = 0;
|
|
302
|
+
|
|
303
|
+
/// is there a low-order biform ?
|
|
304
|
+
bool HasLowOrderBilinearForm () const { return low_order_bilinear_form != NULL; }
|
|
305
|
+
|
|
306
|
+
/// returns the low-order biform, if we can provide it ...
|
|
307
|
+
virtual shared_ptr<BilinearForm> GetLowOrderBilinearForm()
|
|
308
|
+
{
|
|
309
|
+
return low_order_bilinear_form;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
/// use static condensation ?
|
|
314
|
+
bool UsesEliminateInternal () const { return eliminate_internal; }
|
|
315
|
+
|
|
316
|
+
/// use static condensation for hidden?
|
|
317
|
+
bool UsesEliminateHidden () const { return eliminate_hidden; }
|
|
318
|
+
|
|
319
|
+
/// stores the matrices for reconstructing internal dofs ?
|
|
320
|
+
bool UsesKeepInternal () const { return keep_internal; }
|
|
321
|
+
|
|
322
|
+
/// does it store Aii ?
|
|
323
|
+
bool UsesStoreInner () const { return store_inner; }
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
/// the finite element space
|
|
327
|
+
// const FESpace & GetFESpace() const { return *fespace; }
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
/// uses mixed spaces (non operational)
|
|
331
|
+
bool MixedSpaces () const { return fespace2 != NULL; }
|
|
332
|
+
|
|
333
|
+
/// returns the second space (form mixed spaces)
|
|
334
|
+
// const FESpace & GetFESpace2() const { return *fespace2; }
|
|
335
|
+
|
|
336
|
+
/// the finite element space
|
|
337
|
+
shared_ptr<FESpace> GetFESpace() const { return fespace; }
|
|
338
|
+
/// the finite element test space
|
|
339
|
+
shared_ptr<FESpace> GetFESpace2() const { return fespace2; }
|
|
340
|
+
|
|
341
|
+
shared_ptr<FESpace> GetTrialSpace() const { return fespace; }
|
|
342
|
+
shared_ptr<FESpace> GetTestSpace() const { return fespace2 ? fespace2 : fespace; }
|
|
343
|
+
///
|
|
344
|
+
int GetNLevels() const { return mats.Size(); }
|
|
345
|
+
|
|
346
|
+
/// is the form symmetric ?
|
|
347
|
+
bool IsSymmetric() const { return symmetric; }
|
|
348
|
+
|
|
349
|
+
/// is the form symmetric and positive definite ?
|
|
350
|
+
bool IsSPD() const { return spd; }
|
|
351
|
+
|
|
352
|
+
///
|
|
353
|
+
virtual bool SymmetricStorage() const { return false; }
|
|
354
|
+
|
|
355
|
+
/// don't assemble the matrix
|
|
356
|
+
void SetNonAssemble (bool na = true) { nonassemble = na; }
|
|
357
|
+
bool NonAssemble() const { return nonassemble; }
|
|
358
|
+
|
|
359
|
+
///
|
|
360
|
+
void SetGalerkin (bool agalerkin = true) { galerkin = agalerkin; }
|
|
361
|
+
|
|
362
|
+
///
|
|
363
|
+
void SetDiagonal (bool adiagonal = true) { diagonal = adiagonal; }
|
|
364
|
+
|
|
365
|
+
///
|
|
366
|
+
void SetSymmetric (bool asymmetric = true) { symmetric = asymmetric; }
|
|
367
|
+
|
|
368
|
+
///
|
|
369
|
+
void SetHermitean (bool ahermitean = true) { hermitean = ahermitean; }
|
|
370
|
+
|
|
371
|
+
///
|
|
372
|
+
void SetMultiLevel (bool amultilevel = 1) { multilevel = amultilevel; }
|
|
373
|
+
|
|
374
|
+
///
|
|
375
|
+
void SetTiming (bool at) { timing = at; }
|
|
376
|
+
|
|
377
|
+
void SetEliminateInternal (bool eliminate)
|
|
378
|
+
{ eliminate_internal = eliminate; }
|
|
379
|
+
|
|
380
|
+
void SetEliminateHidden (bool eliminate)
|
|
381
|
+
{ eliminate_hidden = eliminate; }
|
|
382
|
+
|
|
383
|
+
void SetKeepInternal (bool keep)
|
|
384
|
+
{ keep_internal = keep; }
|
|
385
|
+
|
|
386
|
+
void SetStoreInner (bool storei)
|
|
387
|
+
{ store_inner = storei; }
|
|
388
|
+
|
|
389
|
+
void SetPrint (bool ap);
|
|
390
|
+
void SetPrintElmat (bool ap);
|
|
391
|
+
void SetElmatEigenValues (bool ee);
|
|
392
|
+
void SetCheckUnused (bool b);
|
|
393
|
+
|
|
394
|
+
/// computes low-order matrices from fines matrix
|
|
395
|
+
void GalerkinProjection ();
|
|
396
|
+
|
|
397
|
+
/// reconstruct internal dofs
|
|
398
|
+
virtual void ComputeInternal (BaseVector & u, const BaseVector & f, LocalHeap & lh) const = 0;
|
|
399
|
+
|
|
400
|
+
/// modify rhs due to static condensation
|
|
401
|
+
virtual void ModifyRHS (BaseVector & f) const = 0;
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
/// add eps I to the assembled matrix
|
|
406
|
+
void SetEpsRegularization(double val) { eps_regularization = val; }
|
|
407
|
+
|
|
408
|
+
/// set matrix diagonal for unused dofs to this value
|
|
409
|
+
void SetUnusedDiag (double val) { unuseddiag = val; }
|
|
410
|
+
|
|
411
|
+
/// does it use Galerkin projection ?
|
|
412
|
+
bool UseGalerkin () const { return galerkin; }
|
|
413
|
+
|
|
414
|
+
/// biform object
|
|
415
|
+
virtual string GetClassName () const
|
|
416
|
+
{
|
|
417
|
+
return "BilinearForm";
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/// prints report to file
|
|
421
|
+
virtual void PrintReport (ostream & ost) const;
|
|
422
|
+
|
|
423
|
+
///
|
|
424
|
+
virtual Array<MemoryUsage> GetMemoryUsage () const;
|
|
425
|
+
|
|
426
|
+
/// creates a compatible vector
|
|
427
|
+
virtual AutoVector CreateRowVector() const;
|
|
428
|
+
virtual AutoVector CreateColVector() const;
|
|
429
|
+
|
|
430
|
+
/// frees matrix
|
|
431
|
+
virtual void CleanUpLevel() { ; }
|
|
432
|
+
|
|
433
|
+
protected:
|
|
434
|
+
/// assemble matrix
|
|
435
|
+
virtual void DoAssemble (LocalHeap & lh) = 0;
|
|
436
|
+
void AssembleGF (LocalHeap & lh);
|
|
437
|
+
void AssembleBDB (LocalHeap & lh, bool linear);
|
|
438
|
+
|
|
439
|
+
/// allocates (sparse) matrix data-structure
|
|
440
|
+
virtual void AllocateMatrix () = 0;
|
|
441
|
+
virtual void AllocateInternalMatrices () = 0;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
We specify the scalar (double or Complex) of the biform.
|
|
451
|
+
*/
|
|
452
|
+
template <class SCAL>
|
|
453
|
+
class NGS_DLL_HEADER S_BilinearForm : public BilinearForm
|
|
454
|
+
{
|
|
455
|
+
protected:
|
|
456
|
+
|
|
457
|
+
// have parallel wrapper for distributed meshes:
|
|
458
|
+
shared_ptr<BaseMatrix> harmonicext;
|
|
459
|
+
shared_ptr<BaseMatrix> harmonicexttrans;
|
|
460
|
+
shared_ptr<BaseMatrix> innersolve;
|
|
461
|
+
shared_ptr<BaseMatrix> innermatrix;
|
|
462
|
+
|
|
463
|
+
// local operators:
|
|
464
|
+
ElementByElementMatrix<SCAL> *harmonicext_ptr, *harmonicexttrans_ptr, *innersolve_ptr, *innermatrix_ptr;
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
//data for mpi-facets; only has data if there are relevant integrators in the BLF!
|
|
468
|
+
mutable bool have_mpi_facet_data = false;
|
|
469
|
+
mutable Array<int> os_per;
|
|
470
|
+
mutable Table<SCAL> send_table;
|
|
471
|
+
mutable Table<SCAL> recv_table;
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
public:
|
|
475
|
+
///
|
|
476
|
+
using BilinearForm::BilinearForm;
|
|
477
|
+
|
|
478
|
+
virtual ~S_BilinearForm();
|
|
479
|
+
|
|
480
|
+
///
|
|
481
|
+
void AddMatrix1 (SCAL val, const BaseVector & x,
|
|
482
|
+
BaseVector & y, LocalHeap & lh) const;
|
|
483
|
+
|
|
484
|
+
void AddMatrixGF (SCAL val, const BaseVector & x,
|
|
485
|
+
BaseVector & y, bool transpose, LocalHeap & lh) const;
|
|
486
|
+
|
|
487
|
+
virtual void AddMatrix (double val, const BaseVector & x,
|
|
488
|
+
BaseVector & y, LocalHeap & lh) const override
|
|
489
|
+
{
|
|
490
|
+
x.Cumulate();
|
|
491
|
+
y.Distribute();
|
|
492
|
+
|
|
493
|
+
AddMatrix1 (val, x, y, lh);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
virtual void AddMatrixTP (SCAL val, const BaseVector & x,
|
|
497
|
+
BaseVector & y, LocalHeap & lh) const;
|
|
498
|
+
|
|
499
|
+
virtual void AddMatrix (Complex val, const BaseVector & x,
|
|
500
|
+
BaseVector & y, LocalHeap & lh) const override
|
|
501
|
+
{
|
|
502
|
+
x.Cumulate();
|
|
503
|
+
y.Distribute();
|
|
504
|
+
|
|
505
|
+
// AddMatrix1 (ConvertTo<SCAL> (val), x, y, lh);
|
|
506
|
+
if constexpr (std::is_constructible<SCAL,Complex>())
|
|
507
|
+
AddMatrix1 (SCAL(val), x, y, lh);
|
|
508
|
+
else
|
|
509
|
+
throw Exception("BilinearForm::AddMatrix(complex) called for real BilinearForm");
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
virtual void AddMatrixTrans (double val, const BaseVector & x,
|
|
513
|
+
BaseVector & y, LocalHeap & lh) const override;
|
|
514
|
+
|
|
515
|
+
virtual void LapackEigenSystem(FlatMatrix<SCAL> & elmat, LocalHeap & lh) const;
|
|
516
|
+
// { ; }
|
|
517
|
+
|
|
518
|
+
void ApplyLinearizedMatrixAdd1 (SCAL val,
|
|
519
|
+
const BaseVector & lin,
|
|
520
|
+
const BaseVector & x,
|
|
521
|
+
BaseVector & y, LocalHeap & lh) const;
|
|
522
|
+
|
|
523
|
+
virtual void ApplyLinearizedMatrixAdd (double val,
|
|
524
|
+
const BaseVector & lin,
|
|
525
|
+
const BaseVector & x,
|
|
526
|
+
BaseVector & y, LocalHeap & lh) const override
|
|
527
|
+
{
|
|
528
|
+
lin.Cumulate();
|
|
529
|
+
x.Cumulate();
|
|
530
|
+
y.Distribute();
|
|
531
|
+
|
|
532
|
+
ApplyLinearizedMatrixAdd1 (val, lin, x, y, lh);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
virtual void ApplyLinearizedMatrixAdd (Complex val,
|
|
536
|
+
const BaseVector & lin,
|
|
537
|
+
const BaseVector & x,
|
|
538
|
+
BaseVector & y, LocalHeap & lh) const override
|
|
539
|
+
{
|
|
540
|
+
lin.Cumulate();
|
|
541
|
+
x.Cumulate();
|
|
542
|
+
y.Distribute();
|
|
543
|
+
|
|
544
|
+
if constexpr (std::is_constructible<SCAL,Complex>())
|
|
545
|
+
ApplyLinearizedMatrixAdd1 (SCAL(val), lin, x, y, lh);
|
|
546
|
+
else
|
|
547
|
+
throw Exception("BilinearForm::ApplyLinearizedMatrix(complex) called for real BilinearForm");
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
virtual double Energy (const BaseVector & x, LocalHeap & lh) const override;
|
|
552
|
+
|
|
553
|
+
virtual void ComputeInternal (BaseVector & u, const BaseVector & f, LocalHeap & lh) const override;
|
|
554
|
+
|
|
555
|
+
virtual void ModifyRHS (BaseVector & fd) const override;
|
|
556
|
+
|
|
557
|
+
///
|
|
558
|
+
virtual void DoAssemble (LocalHeap & lh) override;
|
|
559
|
+
virtual void Assemble_facetwise_skeleton_parts_VOL (Array<bool>& useddof, size_t & gcnt, LocalHeap & lh, const BaseVector * lin = nullptr);
|
|
560
|
+
///
|
|
561
|
+
// virtual void DoAssembleIndependent (BitArray & useddof, LocalHeap & lh);
|
|
562
|
+
///
|
|
563
|
+
virtual void AssembleLinearization (const BaseVector & lin,
|
|
564
|
+
LocalHeap & lh,
|
|
565
|
+
bool reallocate = 0) override;
|
|
566
|
+
///
|
|
567
|
+
virtual void AddElementMatrix (FlatArray<int> dnums1,
|
|
568
|
+
FlatArray<int> dnums2,
|
|
569
|
+
BareSliceMatrix<SCAL> elmat,
|
|
570
|
+
ElementId id, bool addatomic,
|
|
571
|
+
LocalHeap & lh) = 0;
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
virtual void AddDiagElementMatrix (FlatArray<int> dnums1,
|
|
575
|
+
FlatVector<SCAL> diag,
|
|
576
|
+
bool inner_element, int elnr,
|
|
577
|
+
LocalHeap & lh);
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
shared_ptr<BaseMatrix> GetHarmonicExtension () const override
|
|
581
|
+
{
|
|
582
|
+
return harmonicext;
|
|
583
|
+
}
|
|
584
|
+
///
|
|
585
|
+
shared_ptr<BaseMatrix> GetHarmonicExtensionTrans () const override
|
|
586
|
+
{
|
|
587
|
+
return harmonicexttrans;
|
|
588
|
+
}
|
|
589
|
+
///
|
|
590
|
+
shared_ptr<BaseMatrix> GetInnerSolve () const override
|
|
591
|
+
{
|
|
592
|
+
return innersolve;
|
|
593
|
+
}
|
|
594
|
+
///
|
|
595
|
+
shared_ptr<BaseMatrix> GetInnerMatrix () const override
|
|
596
|
+
{
|
|
597
|
+
return innermatrix;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
virtual void AllocateInternalMatrices () override;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
template <class TM, class TV = typename mat_traits<TM>::TV_COL>
|
|
606
|
+
class NGS_DLL_HEADER T_BilinearForm : public S_BilinearForm<typename mat_traits<TM>::TSCAL>
|
|
607
|
+
{
|
|
608
|
+
public:
|
|
609
|
+
typedef typename mat_traits<TM>::TSCAL TSCAL;
|
|
610
|
+
typedef TV TV_COL;
|
|
611
|
+
typedef SparseMatrix<TM,TV,TV> TMATRIX;
|
|
612
|
+
shared_ptr<TMATRIX> mymatrix;
|
|
613
|
+
protected:
|
|
614
|
+
|
|
615
|
+
public:
|
|
616
|
+
using S_BilinearForm<TSCAL> :: S_BilinearForm;
|
|
617
|
+
///
|
|
618
|
+
virtual ~T_BilinearForm () { };
|
|
619
|
+
|
|
620
|
+
///
|
|
621
|
+
virtual shared_ptr<BilinearForm> GetLowOrderBilinearForm() override;
|
|
622
|
+
|
|
623
|
+
virtual void AllocateMatrix () override;
|
|
624
|
+
|
|
625
|
+
///
|
|
626
|
+
virtual void CleanUpLevel() override;
|
|
627
|
+
|
|
628
|
+
///
|
|
629
|
+
virtual void AddElementMatrix (FlatArray<int> dnums1,
|
|
630
|
+
FlatArray<int> dnums2,
|
|
631
|
+
BareSliceMatrix<TSCAL> elmat,
|
|
632
|
+
ElementId id, bool addatomic,
|
|
633
|
+
LocalHeap & lh) override;
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
template <class TM, class TV = typename mat_traits<TM>::TV_COL>
|
|
642
|
+
class NGS_DLL_HEADER T_BilinearFormSymmetric : public S_BilinearForm<typename mat_traits<TM>::TSCAL>
|
|
643
|
+
{
|
|
644
|
+
|
|
645
|
+
public:
|
|
646
|
+
typedef typename mat_traits<TM>::TSCAL TSCAL;
|
|
647
|
+
typedef TV TV_COL;
|
|
648
|
+
typedef SparseMatrixSymmetric<TM,TV> TMATRIX;
|
|
649
|
+
shared_ptr<TMATRIX> mymatrix;
|
|
650
|
+
protected:
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
public:
|
|
654
|
+
T_BilinearFormSymmetric (shared_ptr<FESpace> afespace, const string & aname,
|
|
655
|
+
const Flags & flags);
|
|
656
|
+
virtual ~T_BilinearFormSymmetric () override;
|
|
657
|
+
|
|
658
|
+
virtual void AllocateMatrix () override;
|
|
659
|
+
virtual void CleanUpLevel() override;
|
|
660
|
+
virtual shared_ptr<BilinearForm> GetLowOrderBilinearForm() override;
|
|
661
|
+
|
|
662
|
+
virtual void AddElementMatrix (FlatArray<int> dnums1,
|
|
663
|
+
FlatArray<int> dnums2,
|
|
664
|
+
BareSliceMatrix<TSCAL> elmat,
|
|
665
|
+
ElementId id, bool addatomic,
|
|
666
|
+
LocalHeap & lh) override;
|
|
667
|
+
|
|
668
|
+
virtual bool SymmetricStorage() const override { return true; }
|
|
669
|
+
virtual void LapackEigenSystem(FlatMatrix<TSCAL> & elmat, LocalHeap & lh) const override;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
template <class TSCAL>
|
|
675
|
+
class NGS_DLL_HEADER T_BilinearFormDynBlocks : public S_BilinearForm<TSCAL>
|
|
676
|
+
{
|
|
677
|
+
public:
|
|
678
|
+
typedef SparseBlockMatrix<TSCAL> TMATRIX;
|
|
679
|
+
shared_ptr<TMATRIX> mymatrix;
|
|
680
|
+
size_t blockheight, blockwidth;
|
|
681
|
+
protected:
|
|
682
|
+
|
|
683
|
+
public:
|
|
684
|
+
T_BilinearFormDynBlocks (shared_ptr<FESpace> afespace,
|
|
685
|
+
const string & aname, const Flags & flags)
|
|
686
|
+
: S_BilinearForm<TSCAL> (afespace, aname, flags),
|
|
687
|
+
blockheight(afespace->GetDimension()),
|
|
688
|
+
blockwidth(afespace->GetDimension()) { }
|
|
689
|
+
|
|
690
|
+
T_BilinearFormDynBlocks (shared_ptr<FESpace> afespace,
|
|
691
|
+
shared_ptr<FESpace> afespace2,
|
|
692
|
+
const string & aname, const Flags & flags)
|
|
693
|
+
: S_BilinearForm<TSCAL> (afespace, afespace2, aname, flags),
|
|
694
|
+
blockheight(afespace2->GetDimension()),
|
|
695
|
+
blockwidth(afespace->GetDimension()) { }
|
|
696
|
+
|
|
697
|
+
virtual ~T_BilinearFormDynBlocks () { };
|
|
698
|
+
|
|
699
|
+
virtual shared_ptr<BilinearForm> GetLowOrderBilinearForm() override;
|
|
700
|
+
|
|
701
|
+
virtual void AllocateMatrix () override;
|
|
702
|
+
|
|
703
|
+
virtual void CleanUpLevel() override;
|
|
704
|
+
|
|
705
|
+
virtual void AddElementMatrix (FlatArray<int> dnums1,
|
|
706
|
+
FlatArray<int> dnums2,
|
|
707
|
+
BareSliceMatrix<TSCAL> elmat,
|
|
708
|
+
ElementId id, bool addatomic,
|
|
709
|
+
LocalHeap & lh) override;
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
template <class TSCAL>
|
|
720
|
+
class NGS_DLL_HEADER S_BilinearFormNonAssemble : public S_BilinearForm<TSCAL>
|
|
721
|
+
{
|
|
722
|
+
public:
|
|
723
|
+
S_BilinearFormNonAssemble (shared_ptr<FESpace> afespace, const string & aname,
|
|
724
|
+
const Flags & flags);
|
|
725
|
+
S_BilinearFormNonAssemble (shared_ptr<FESpace> afespace, shared_ptr<FESpace> afespace2,
|
|
726
|
+
const string & aname, const Flags & flags);
|
|
727
|
+
// virtual ~T_BilinearFormSymmetric ();
|
|
728
|
+
|
|
729
|
+
virtual void AllocateMatrix () { cout << "S_BilinearFormNonAssemble :: Allocate: nothing to do" << endl; }
|
|
730
|
+
virtual void CleanUpLevel() { ; }
|
|
731
|
+
|
|
732
|
+
virtual void AddElementMatrix (FlatArray<int> dnums1,
|
|
733
|
+
FlatArray<int> dnums2,
|
|
734
|
+
BareSliceMatrix<TSCAL> elmat,
|
|
735
|
+
ElementId id, bool addatomic,
|
|
736
|
+
LocalHeap & lh)
|
|
737
|
+
{
|
|
738
|
+
throw Exception ("AddElementMatrix for non-assemble biform called");
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
virtual bool SymmetricStorage() const { return true; }
|
|
742
|
+
|
|
743
|
+
virtual void LapackEigenSystem(FlatMatrix<TSCAL> & elmat, LocalHeap & lh) const
|
|
744
|
+
{ cout << "no eigensystem available" << endl; }
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
class ComponentBilinearForm : public BilinearForm
|
|
754
|
+
{
|
|
755
|
+
shared_ptr<BilinearForm> base_blf;
|
|
756
|
+
int comp; // , ncomp;
|
|
757
|
+
public:
|
|
758
|
+
ComponentBilinearForm (shared_ptr<BilinearForm> abase_blf, int acomp, int ancomp);
|
|
759
|
+
virtual BilinearForm & AddIntegrator (shared_ptr<BilinearFormIntegrator> bfi);
|
|
760
|
+
|
|
761
|
+
virtual void Assemble (LocalHeap & lh) { cerr << "comp - assemble is illegal" << endl; }
|
|
762
|
+
|
|
763
|
+
virtual void AssembleLinearization (const BaseVector & lin,
|
|
764
|
+
LocalHeap & lh,
|
|
765
|
+
bool reallocate = 0)
|
|
766
|
+
{ throw Exception ("comp-bf - AssembleLinearization is illegal"); }
|
|
767
|
+
|
|
768
|
+
virtual void AddMatrix (double val, const BaseVector & x,
|
|
769
|
+
BaseVector & y, LocalHeap & lh) const
|
|
770
|
+
{ throw Exception ("comp-bf - AddMatrix is illegal"); }
|
|
771
|
+
|
|
772
|
+
virtual void AddMatrix (Complex val, const BaseVector & x,
|
|
773
|
+
BaseVector & y, LocalHeap & lh) const
|
|
774
|
+
{ throw Exception ("comp-bf - AddMatrix is illegal"); }
|
|
775
|
+
|
|
776
|
+
virtual void AddMatrixTrans (double val, const BaseVector & x,
|
|
777
|
+
BaseVector & y, LocalHeap & lh) const
|
|
778
|
+
{ throw Exception ("comp-bf - AddMatrixTrans is illegal"); }
|
|
779
|
+
|
|
780
|
+
virtual void ApplyLinearizedMatrixAdd (double val,
|
|
781
|
+
const BaseVector & lin,
|
|
782
|
+
const BaseVector & x,
|
|
783
|
+
BaseVector & y, LocalHeap & lh) const
|
|
784
|
+
{ throw Exception ("comp-bf - AddMatrix is illegal"); }
|
|
785
|
+
|
|
786
|
+
virtual void ApplyLinearizedMatrixAdd (Complex val,
|
|
787
|
+
const BaseVector & lin,
|
|
788
|
+
const BaseVector & x,
|
|
789
|
+
BaseVector & y, LocalHeap & lh) const
|
|
790
|
+
{ throw Exception ("comp-bf - AddMatrix is illegal"); }
|
|
791
|
+
|
|
792
|
+
virtual shared_ptr<BaseMatrix> GetHarmonicExtension () const
|
|
793
|
+
{ throw Exception ("comp-bf - GetHarmonicExt is illegal"); }
|
|
794
|
+
|
|
795
|
+
virtual shared_ptr<BaseMatrix> GetHarmonicExtensionTrans () const
|
|
796
|
+
{ throw Exception ("comp-bf - GetHarmonicExtTrans is illegal"); }
|
|
797
|
+
virtual shared_ptr<BaseMatrix> GetInnerSolve () const
|
|
798
|
+
{ throw Exception ("comp-bf - GetInnerSolve is illegal"); }
|
|
799
|
+
virtual shared_ptr<BaseMatrix> GetInnerMatrix () const
|
|
800
|
+
{ throw Exception ("comp-bf - GetInnerMatrix is illegal"); }
|
|
801
|
+
virtual void ComputeInternal (BaseVector & u, const BaseVector & f, LocalHeap & lh) const
|
|
802
|
+
{ throw Exception ("comp-bf - ComputeInternal is illegal"); }
|
|
803
|
+
virtual void ModifyRHS (BaseVector & f) const
|
|
804
|
+
{ throw Exception ("comp-bf - ModifyRHS is illegal"); }
|
|
805
|
+
virtual AutoVector CreateRowVector() const
|
|
806
|
+
{ throw Exception ("comp-bf - CreateRowVector is illegal"); }
|
|
807
|
+
virtual AutoVector CreateColVector() const
|
|
808
|
+
{ throw Exception ("comp-bf - CreateColVector is illegal"); }
|
|
809
|
+
virtual void DoAssemble (LocalHeap & lh)
|
|
810
|
+
{ throw Exception ("comp-bf - DoAssemble is illegal"); }
|
|
811
|
+
virtual void AllocateMatrix ()
|
|
812
|
+
{ throw Exception ("comp-bf - AllocateMatrix is illegal"); }
|
|
813
|
+
virtual void AllocateInternalMatrices ()
|
|
814
|
+
{ throw Exception ("comp-bf - AllocateInternalMatrices is illegal"); }
|
|
815
|
+
virtual double Energy (const BaseVector & x, LocalHeap & lh) const
|
|
816
|
+
{ throw Exception ("comp-bf - Energy is illegal"); }
|
|
817
|
+
|
|
818
|
+
/*
|
|
819
|
+
virtual shared_ptr<BaseVector> GetVectorPtr() const
|
|
820
|
+
{ throw Exception ("comp - GetVectorPtr is illegal"); }
|
|
821
|
+
virtual BaseVector & GetVector () const
|
|
822
|
+
{ throw Exception ("comp - GetVector is illegal"); }
|
|
823
|
+
*/
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
Allocates a bilinearform.
|
|
833
|
+
Some flags are:
|
|
834
|
+
-symmetric ... assembles a symmetric matrix
|
|
835
|
+
*/
|
|
836
|
+
extern NGS_DLL_HEADER shared_ptr<BilinearForm> CreateBilinearForm (shared_ptr<FESpace> space,
|
|
837
|
+
const string & name,
|
|
838
|
+
const Flags & flags);
|
|
839
|
+
|
|
840
|
+
extern NGS_DLL_HEADER shared_ptr<BilinearForm> CreateBilinearForm (shared_ptr<FESpace> space,
|
|
841
|
+
shared_ptr<FESpace> space2,
|
|
842
|
+
const string & name,
|
|
843
|
+
const Flags & flags);
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
This objects provide the bilinear-form application as matrix vector product.
|
|
849
|
+
If the bilinearform is indeed non-linear in the first argumen, the operator*
|
|
850
|
+
will perform the non-linear operator application.
|
|
851
|
+
*/
|
|
852
|
+
class NGS_DLL_HEADER BilinearFormApplication : public BaseMatrix
|
|
853
|
+
{
|
|
854
|
+
protected:
|
|
855
|
+
///
|
|
856
|
+
shared_ptr<BilinearForm> bf;
|
|
857
|
+
LocalHeap & lh;
|
|
858
|
+
public:
|
|
859
|
+
///
|
|
860
|
+
BilinearFormApplication (shared_ptr<BilinearForm> abf, LocalHeap & alh);
|
|
861
|
+
|
|
862
|
+
virtual bool IsComplex() const override
|
|
863
|
+
{
|
|
864
|
+
return bf->GetFESpace()->IsComplex();
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
///
|
|
868
|
+
virtual void Mult (const BaseVector & v, BaseVector & prod) const override;
|
|
869
|
+
///
|
|
870
|
+
virtual void MultAdd (double val, const BaseVector & v, BaseVector & prod) const override;
|
|
871
|
+
///
|
|
872
|
+
virtual void MultAdd (Complex val, const BaseVector & v, BaseVector & prod) const override;
|
|
873
|
+
///
|
|
874
|
+
virtual void MultTransAdd (double val, const BaseVector & v, BaseVector & prod) const override;
|
|
875
|
+
|
|
876
|
+
virtual AutoVector CreateVector () const override;
|
|
877
|
+
virtual AutoVector CreateRowVector () const override;
|
|
878
|
+
virtual AutoVector CreateColVector () const override;
|
|
879
|
+
|
|
880
|
+
///
|
|
881
|
+
virtual int VHeight() const override
|
|
882
|
+
{
|
|
883
|
+
if (bf->GetFESpace2())
|
|
884
|
+
return bf->GetFESpace2()->GetNDof();
|
|
885
|
+
return bf->GetFESpace()->GetNDof();
|
|
886
|
+
}
|
|
887
|
+
///
|
|
888
|
+
virtual int VWidth() const override
|
|
889
|
+
{
|
|
890
|
+
return bf->GetFESpace()->GetNDof();
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
Applies the matrix-vector product of linearized matrix.
|
|
896
|
+
Linearization point is given in the constructor
|
|
897
|
+
*/
|
|
898
|
+
class NGS_DLL_HEADER LinearizedBilinearFormApplication : public BilinearFormApplication
|
|
899
|
+
{
|
|
900
|
+
protected:
|
|
901
|
+
const BaseVector * veclin;
|
|
902
|
+
|
|
903
|
+
public:
|
|
904
|
+
///
|
|
905
|
+
LinearizedBilinearFormApplication (shared_ptr<BilinearForm> abf,
|
|
906
|
+
const BaseVector * aveclin,
|
|
907
|
+
LocalHeap & alh);
|
|
908
|
+
|
|
909
|
+
///
|
|
910
|
+
virtual void Mult (const BaseVector & v, BaseVector & prod) const override;
|
|
911
|
+
///
|
|
912
|
+
virtual void MultAdd (double val, const BaseVector & v, BaseVector & prod) const override;
|
|
913
|
+
///
|
|
914
|
+
virtual void MultAdd (Complex val, const BaseVector & v, BaseVector & prod) const override;
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
// template <int DIM_ELEMENT, int DIM_SPACE>
|
|
919
|
+
class ApplyIntegrationPoints : public BaseMatrix
|
|
920
|
+
{
|
|
921
|
+
Array<shared_ptr<CoefficientFunction>> coefs;
|
|
922
|
+
Array<ProxyFunction*> trialproxies;
|
|
923
|
+
|
|
924
|
+
typedef void (*lib_function)(size_t nip, double * input, size_t dist_input,
|
|
925
|
+
double * output, size_t dist_output,
|
|
926
|
+
size_t dist, double * points, double * normals);
|
|
927
|
+
|
|
928
|
+
unique_ptr<SharedLibrary> library;
|
|
929
|
+
lib_function compiled_function = nullptr;
|
|
930
|
+
|
|
931
|
+
size_t dimx, dimy;
|
|
932
|
+
size_t nip;
|
|
933
|
+
Matrix<double> points;
|
|
934
|
+
Matrix<double> normals;
|
|
935
|
+
|
|
936
|
+
public:
|
|
937
|
+
ApplyIntegrationPoints (Array<shared_ptr<CoefficientFunction>> acoefs,
|
|
938
|
+
const Array<ProxyFunction*> & atrialproxies,
|
|
939
|
+
Matrix<double> apoints, Matrix<double> anormals,
|
|
940
|
+
size_t adimx, size_t adimy, size_t anip);
|
|
941
|
+
|
|
942
|
+
AutoVector CreateColVector() const override;
|
|
943
|
+
AutoVector CreateRowVector() const override;
|
|
944
|
+
|
|
945
|
+
virtual int VHeight() const override { return nip*dimy; }
|
|
946
|
+
virtual int VWidth() const override { return nip*dimx; }
|
|
947
|
+
|
|
948
|
+
virtual void Mult (const BaseVector & x, BaseVector & y) const override;
|
|
949
|
+
|
|
950
|
+
const Array<shared_ptr<CoefficientFunction>> & GetCFs() const { return coefs; }
|
|
951
|
+
const Array<ProxyFunction*> & GetTrialProxies() const { return trialproxies; }
|
|
952
|
+
size_t GetDimX() const { return dimx; }
|
|
953
|
+
size_t GetDimY() const { return dimy; }
|
|
954
|
+
size_t GetNIP() const { return nip; }
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
#endif
|