Compare commits

...
203 Commits
Author SHA1 Message Date
Socratis Petrides c6f2f377d1 add aniso laplace problems 2024-09-26 16:08:21 -07:00
Tzanio Kolev 8ed11a5c9a Merge pull request #4356 from mfem/najlkin/mixed-form-elim-dofs
Elimination of essential DOFs/BCs in MixedBilinearForm
2024-09-25 18:43:03 -07:00
Tzanio Kolev 0739640110 Merge pull request #3138 from mfem/dispatch-map
Runtime dispatch for SMEM GPU kernels
2024-09-25 18:42:12 -07:00
Tzanio Kolev 96ac1d9444 Merge pull request #4500 from mfem/vector-move
Fix memory leak in Vector move assignment
2024-09-25 18:41:38 -07:00
Tzanio Kolev 1e29890736 Merge pull request #4399 from mfem/override
Override specifier in virtual functions
2024-09-21 16:57:22 -07:00
Tzanio Kolev 6c22a3a1ef Merge branch 'master' into override 2024-09-21 14:28:02 -07:00
Tzanio Kolev cfebb493c0 Merge pull request #4493 from mfem/stefanozampini/petsc-examples-init-device
Update petsc examples with missing device initializations
2024-09-19 07:41:53 -07:00
Tzanio Kolev af6cc43ad8 Merge pull request #4489 from mfem/print-mathematica-dev2
Adding PrintMathematica to dense linear algebra objects [print-mathematica-dev2]
2024-09-19 07:41:26 -07:00
Tzanio Kolev 3303e58921 Merge pull request #4448 from adam-sim-dev/remove-mesquitesmooth
Remove MesquiteSmooth which is not implemented
2024-09-19 07:41:03 -07:00
adam-sim-dev 192c4eeeea Merge branch 'master' into remove-mesquitesmooth 2024-09-16 20:25:31 +08:00
Tzanio Kolev 30bf4cae58 Merge pull request #4487 from mfem/cubit-reader-fix
Make reader comply with CUBIT output
2024-09-15 14:21:49 -07:00
Will Pazner 542a72402c Fix memory leak in Vector move assignment 2024-09-11 20:32:16 -07:00
adam-sim-dev 344c72ad98 Merge branch 'master' into remove-mesquitesmooth 2024-09-11 15:17:27 +08:00
Will Pazner fb1a587206 Update CHANGELOG 2024-09-10 11:59:39 -07:00
Chris Vogl bd11106166 Revert changes to CVODESSolver::StepB 2024-09-10 11:55:49 -07:00
Will Pazner b2c53715e9 Runtime enable or disable fallback kernel reporting 2024-09-10 11:54:10 -07:00
Tzanio Kolev 957ca0d500 Merge pull request #4416 from mfem/build-bdr-dof-arr-dev
Add `FiniteElementSpace::BuildDofToBdrArrays()` and Minor Doc Clarification
2024-09-10 11:53:35 -07:00
dylan-copeland 20d8f980a5 Merge branch 'master' of github.com:mfem/mfem into override 2024-09-09 20:49:17 -07:00
dylan-copeland aeeddcb11e Fix a function in sundials. 2024-09-09 20:48:53 -07:00
Tzanio Kolev 596b76cee2 Merge branch 'master' into cubit-reader-fix 2024-09-09 11:55:15 -07:00
adam-sim-dev f8f04c9328 Merge branch 'master' into remove-mesquitesmooth 2024-09-09 08:22:01 +08:00
Tzanio Kolev 8555207d7b Merge pull request #4474 from tsokar/fix_tmop_fitting_bug
Fix uninitialized variables in pmesh-fitting
2024-09-08 15:36:09 -07:00
Stefano Zampini df87b22266 PETSc: Initialize device in examples
otherwise there will be mismatches in HYPRE and PETSc default devices for CUDA installs of MFEM
2024-09-08 14:19:48 +03:00
Stefano Zampini f57aa5a808 PETSc: fix Operator type conversion for device matrices
Add MATGENERIC to the supported operators for some operations
2024-09-08 09:56:58 +03:00
Stowell, Mark L ed256ff9a3 Removing special character from suggested Mathematica code 2024-09-05 18:03:27 -07:00
Stowell, Mark L dd127b07b5 Adding PrintMathematica to dense linear algebra objects 2024-09-05 18:02:15 -07:00
Ketan Mittal 608ec13913 Merge branch 'master' into fix_tmop_fitting_bug 2024-09-05 12:29:00 -07:00
Julian Andrej b69059e79b fix sidesets too 2024-09-04 13:59:31 -07:00
Julian Andrej d6a4f0ae6c bug for bug implementation 2024-09-04 13:47:21 -07:00
adam-sim-dev c5e02ba0cc Merge branch 'master' into remove-mesquitesmooth 2024-09-03 08:55:21 +08:00
Tzanio Kolev 3d43371e9d Merge pull request #4442 from mfem/bowen/miniapp-port
feature: make GLVis socket user-configurable in miniapps
2024-09-01 11:27:56 -07:00
Joseph SignorelliandJan Nikl 9c13b53522 Remove bdr attribute unnecessary setting
Co-authored-by: Jan Nikl <nikl1@llnl.gov>
2024-08-30 16:10:15 -05:00
Joseph Signorelli 83bd5a2f6c Correctly call base class function 2024-08-30 16:08:16 -05:00
Will Pazner 47de3415cf Internal namespace for Occa PA functions 2024-08-30 10:36:37 -07:00
Joseph Signorelli a80d35b387 Explicitly call FiniteElementSpace::GetEssentialVDofs 2024-08-29 11:33:50 -05:00
Joseph Signorelli b21b24b4cf Revert "debug commit"
This reverts commit 7a9ccc5dad.
2024-08-29 11:33:03 -05:00
Tzanio Kolev 5574298f29 Reverted commit_max_files_changed back to 50 2024-08-28 11:46:11 -07:00
Tzanio Kolev 8c09d9109c Adjusted CHANGELOG 2024-08-28 11:45:08 -07:00
john bowen 9cbb59b742 Formatting 2024-08-28 11:10:08 -07:00
Tzanio Kolev e5bbc170d3 Merge branch 'master' into dispatch-map 2024-08-28 10:51:40 -07:00
Joseph Signorelli 47ddbc4f67 Merge branch 'build-bdr-dof-arr-dev' of github.com:mfem/mfem into build-bdr-dof-arr-dev 2024-08-28 08:55:58 -05:00
Joseph Signorelli 4044514851 style 2024-08-28 08:55:52 -05:00
Joseph Signorelli 7a9ccc5dad debug commit 2024-08-28 08:55:34 -05:00
adam-sim-dev 60fc13dcaf Merge branch 'master' into remove-mesquitesmooth 2024-08-28 10:07:15 +08:00
Tzanio Kolev 20cb653eb3 Merge branch 'master' into build-bdr-dof-arr-dev 2024-08-27 17:04:18 -07:00
john bowen da8b01bcf1 Merge branch 'master' into bowen/miniapp-port 2024-08-27 14:44:04 -07:00
john bowen e4cfbc56d7 Add visport to declarations 2024-08-27 14:43:20 -07:00
Tzanio Kolev e50e54e090 Merge pull request #4283 from mfem/trigger-pymfem-ci
Add workflow for triggering pymfem CI
2024-08-27 13:00:45 -07:00
dylan-copeland db7072a5c4 Merge branch 'master' of github.com:mfem/mfem into override 2024-08-27 11:28:27 -07:00
Tsokar 411ee5b1cf Update master 2024-08-27 17:29:16 +02:00
Tsokar fcc353b30c Initialize surf_fit_marker and surf_fit_mat_gf earlier 2024-08-27 17:25:44 +02:00
Tzanio Kolev b33a8d24ab Merge pull request #4453 from mfem/use-correct-bind
use ::bind instead of bind
2024-08-27 07:45:00 -07:00
Tsokar f1f98dd735 Fix uninitialized variables in pmesh-fitting 2024-08-27 08:46:37 +02:00
john bowen cc9885695b Merge branch 'master' into bowen/miniapp-port 2024-08-26 14:42:55 -07:00
john bowen d3a66a5887 Fix build issues 2024-08-26 14:39:23 -07:00
Tzanio Kolev e77d74aeef Merge branch 'master' into build-bdr-dof-arr-dev 2024-08-25 17:39:59 -07:00
Tzanio Kolev 723e8e656e Merge branch 'master' into remove-mesquitesmooth 2024-08-25 17:34:21 -07:00
Tzanio Kolev ac2a21516c Merge pull request #4447 from mfem/det-d1d-q1d-fix
Fix switched D1D and Q1D in determinant kernels
2024-08-25 15:22:05 -07:00
Tzanio Kolev 8ba104788f Merge pull request #4444 from mfem/small_doc_update
update the documentation of two methods in fespace
2024-08-25 15:21:49 -07:00
Tzanio Kolev a454a5407c Merge pull request #4464 from mfem/najlkin/fix-point-attr
Fixed Point default attribute.
2024-08-25 15:21:23 -07:00
Jan Nikl 689b46e3d6 Removed the workaround for 1D in the dof-to-arrays test. 2024-08-23 10:14:03 -07:00
Joseph Signorelli fb1d72e453 style 2024-08-22 17:24:46 -05:00
Joseph SignorelliandJan Nikl af1bc97a77 Fix forgotten reference
Co-authored-by: Jan Nikl <nikl1@llnl.gov>
2024-08-22 17:23:17 -05:00
Joseph Signorelli 4fac872989 style 2024-08-22 17:07:55 -05:00
Joseph Signorelli 76e7693235 Compare against boundary LDofs with associated BE on its own rank only 2024-08-22 17:06:50 -05:00
Joseph Signorelli 39fd1c5dee Loop over all the LDofs, not the TDofs! 2024-08-22 15:21:43 -05:00
Jan Nikl 85ccdf210a Fixed Point default attribute. 2024-08-22 12:53:33 -07:00
Joseph Signorelli fc802cbd6d Add continue to prevent segfaults. Separate element + bdr element checks. 2024-08-22 11:18:27 -05:00
Joseph Signorelli 61a49b8ca0 Fix MeshType::SEGMENT improperly setting bdr_attributes
Previous code used `Mesh::GenerateBoundaryElements()` followed by `Mesh::FinalizeTopology()`. This was preventing the ability to SetBdrAttributes for MeshType::SEGMENT
Fix is to instead just call `Mesh::FinalizeTopology(true)`.
2024-08-22 11:13:09 -05:00
Tzanio Kolev 0713dd34f0 Merge branch 'master' into build-bdr-dof-arr-dev 2024-08-21 08:28:51 -07:00
justinlaughlin 7d448fec3d undo change to bind on general/socketstream.cpp 2024-08-20 21:39:34 -07:00
justinlaughlin 88c0b0321c update isockstream.cpp to not use namespace std 2024-08-20 21:38:53 -07:00
Joseph Signorelli d303e35976 minor - fix failing test 2024-08-20 11:11:06 -05:00
Joseph Signorelli c34fc00644 style 2024-08-20 11:03:23 -05:00
Joseph Signorelli e71352e90e Implement parallel test 2024-08-20 11:03:01 -05:00
Joseph Signorelli 1d4f49acfb Include bdr dof check for serial. Renamed ldof variable to elemdof 2024-08-20 10:40:23 -05:00
john bowen ababf1aab3 Fix duplicated line 2024-08-19 10:53:41 -07:00
john bowen 0971513c89 Bump max number of files per branch 2024-08-19 10:45:28 -07:00
john bowen cef0828362 update changelog 2024-08-19 10:15:27 -07:00
john bowen 46cde14697 Merge branch 'master' into bowen/miniapp-port 2024-08-19 10:13:39 -07:00
justinlaughlin dd5963bd21 use ::bind instead of bind 2024-08-15 14:12:18 -07:00
Justin Laughlin e992d41a38 Merge branch 'master' into trigger-pymfem-ci 2024-08-14 15:27:22 -07:00
adam-sim-dev 2fad6d25b9 Remove MesquiteSmooth which is not implemented 2024-08-14 10:59:20 +08:00
dylan-copeland 898367b198 Merge branch 'master' of github.com:mfem/mfem into override 2024-08-13 19:24:59 -07:00
Will Pazner 0303669e9a Fix switched D1D and Q1D in determinant kernels 2024-08-13 16:03:36 -07:00
Joseph SignorelliandJan Nikl 104da453ed Update fem/fespace.hpp
Co-authored-by: Jan Nikl <nikl1@llnl.gov>
2024-08-13 13:22:52 -05:00
john bowen c82ce947d6 Reorder args 2024-08-12 16:14:48 -07:00
john bowen c8644c4b13 Reorder args 2024-08-12 15:56:29 -07:00
bslazarov fa10d89676 update the documentation of two methods in fesapce 2024-08-12 13:20:23 -07:00
john bowen e680558010 Add command line args for glvis 2024-08-12 13:04:12 -07:00
john bowen 0c12c9298b Make visport user configurable for miniapps 2024-08-12 13:01:37 -07:00
Justin Laughlin 16fc316ee6 Update trigger-pymfem-ci.yml - remove pull-request from triggers 2024-08-08 15:44:23 -07:00
Justin Laughlin fd195a0e8a Merge branch 'master' into trigger-pymfem-ci 2024-08-08 15:23:54 -07:00
Justin Laughlin 45f5d4bd72 Update trigger-pymfem-ci.yml
update target for POST, change input, and add trigger on push to master
2024-08-08 15:23:21 -07:00
Joseph SignorelliandWill Pazner 3c886d0c76 Update fem/fespace.hpp
Co-authored-by: Will Pazner <11493037+pazner@users.noreply.github.com>
2024-08-08 14:42:36 -05:00
Joseph Signorelli 4877bf12d1 Deprecate BuildDofToArrays, make build array fxns protected + automatic 2024-08-08 10:45:19 -05:00
Joseph Signorelli 70941f93f0 Automatically build arrays on Get calls
- `Build` array fxns made const
- arrays declared as mutable
2024-08-06 17:04:19 -05:00
Joseph Signorelli f49ffcb99b Merge branch 'build-bdr-dof-arr-dev' of github.com:mfem/mfem into build-bdr-dof-arr-dev 2024-08-06 15:37:50 -05:00
Joseph Signorelli a076bd04cb Delete bdr dof arrays 2024-08-06 15:33:06 -05:00
Joseph Signorelli 095893d224 Merge branch 'master' into build-bdr-dof-arr-dev 2024-08-06 15:31:37 -05:00
Will Pazner b023416c47 Use override specifier in more places
Identified using clang-tidy check 'modernize-use-override'
2024-08-05 09:45:46 -07:00
dylan-copeland 661e2d3d2b Fixing some mistakes. 2024-07-19 17:14:46 -07:00
dylan-copeland 1c71292d7c Merge branch 'master' of github.com:mfem/mfem into override 2024-07-19 16:44:39 -07:00
dylan-copeland 0e7dc57fe5 A couple more files. 2024-07-19 16:43:50 -07:00
dylan-copeland 337ab968e1 Override for more header files, miniapps, and examples. 2024-07-19 16:38:03 -07:00
Joseph Signorelli 88f731cf32 Update docs 2024-07-19 15:02:16 -05:00
Joseph Signorelli f89885905c style 2024-07-19 14:49:58 -05:00
dylan-copeland 3bf5c6adad Override for files in linalg. 2024-07-19 12:19:56 -07:00
Joseph Signorelli def84fdd86 Add doftobdr arrays + minor documentation rephrase 2024-07-19 13:57:06 -05:00
dylan-copeland 565c2b800d Override for the remaining files in fem. 2024-07-19 11:10:00 -07:00
Jan Nikl 0c91dba1bd Added verifies for SpMat(Elim)(). 2024-07-16 14:51:17 -07:00
dylan-copeland 5d6ca8b560 Fix for -Winconsistent-missing-override. 2024-07-12 21:10:43 -07:00
Dylan Copeland cc22712539 Override for some files in fem. 2024-07-12 19:49:00 -07:00
Dylan Copeland 6fbe2c2280 Override for remaining files in fem/fe. 2024-07-12 18:51:09 -07:00
Dylan Copeland 65b3cb157a Adding override specifier to virtual functions. 2024-07-12 12:05:29 -07:00
Will Pazner ffce41001e Suppress Doxygen warnings 2024-06-27 09:27:58 -07:00
Will Pazner 5724e4f274 Improve kernel dispatch mechanism and workaround MSVC issues
Introduce some workarounds for MSVC:

- Need to expand variadic macros explicitly
- Adjacent parameter packs in function templates not supported; use nested
  structs instead
- Can't use default parameters in template definition if not present in
  declaration

Some improvements to the kernel dispatch:

- Run is now a static member function (don't need to call Get)
- DIM is not treated differently from the other parameters
2024-06-27 09:27:58 -07:00
Will Pazner e189b0b0f0 Fix deprecated implicit cast warning 2024-06-26 16:12:42 -07:00
Will Pazner 11badb5d2f Workaround for gcc bug with variadic template parameter packs 2024-06-26 16:09:07 -07:00
Will Pazner 39e3854585 Remove extra semicolon, include <cstddef> 2024-06-26 15:57:55 -07:00
Will Pazner c271ac1eda Fix MFEM_REGISTER_KERNELS macro warnings
Fixes the warnings:

must specify at least one argument for '...' parameter of variadic macro
[-Werror,-Wgnu-zero-variadic-macro-arguments]

and

extra ';' inside a class [-Werror,-Wextra-semi]
2024-06-26 15:27:29 -07:00
Will Pazner ed8ce36e96 Use regular comments instead of Doxygen for MFEM_REGISTER_KERNELS macro 2024-06-26 15:26:46 -07:00
john bowen 66c71dd4f2 Merge branch 'dispatch-map-v2' into dispatch-map 2024-06-26 14:42:27 -07:00
Will Pazner 635c487665 Simplify kernel dispatch macro 2024-06-26 11:42:24 -07:00
Will Pazner 90c995f0e6 Add mechanism for reporting kernel fallbacks 2024-06-26 11:25:47 -07:00
Will Pazner 9d3ce2c394 Add headers to fem/CMakeLists.txt 2024-06-26 11:25:04 -07:00
Will Pazner 185b2bba58 Kernel dispatch for non-tensor eval kernels 2024-06-25 22:12:54 -07:00
Will Pazner 93e6be67d3 Doxygen documentation for dispatch map 2024-06-25 15:24:17 -07:00
Will Pazner 7a4ab004c2 Add Det kernel specializations 2024-06-25 15:11:11 -07:00
Will Pazner 467cc941f3 Fix to QuadratureInterpolator in H(div) linear solver 2024-06-25 15:06:22 -07:00
Will Pazner 5a5d9cfe77 Split QuadratureInterpolator kernel instantiations into multiple translation units 2024-06-25 15:05:48 -07:00
Will Pazner 998b531fe5 Rework NBZ kernel dispatch, add Det QuadratureInterpolator kernels 2024-06-25 14:39:00 -07:00
Will Pazner c33327f234 Bring back NBZ in QuadratureInterpolator 2024-06-25 13:29:56 -07:00
Will Pazner e60145110d QuadratureInterpolator kernel specializations 2024-06-25 13:03:04 -07:00
Will Pazner 5f04684f17 Bring back NBZ in mass and diffusion kernels 2024-06-25 12:48:48 -07:00
Will Pazner a3065a05dc Rename MFEM_DECLARE_KERNELS to MFEM_REGISTER_KERNELS 2024-06-25 11:06:21 -07:00
Will Pazner ede448d783 Unify kernel dispatch with and without fallback parameters 2024-06-25 11:05:36 -07:00
Will Pazner 2e0df87cd6 Use dispatch mechanism in QuadratureInterpolator 2024-06-24 21:57:07 -07:00
Will Pazner 5ec854e9e4 Rearrange parameters in kernel dispatch 2024-06-24 21:48:07 -07:00
Will Pazner 842c68b0b5 Proof of concept for dispatch with QuadratureInterpolator 2024-06-24 16:38:43 -07:00
Will Pazner c3806304d4 More simplifications 2024-06-24 15:50:12 -07:00
Will Pazner a092f9cad0 Small adjustments 2024-06-24 14:38:41 -07:00
Will Pazner 17eb65d619 Some suggestions for dispatch map 2024-06-24 13:47:01 -07:00
john bowen 75567ae1ef remove NBZ as a kernel parameter 2024-06-21 11:22:07 -07:00
john bowen c18e27aeac Merge branch 'master' into dispatch-map 2024-06-20 10:06:08 -07:00
john bowen 3d84777b69 Simplify kernel specialization class boilerplate using a macro. 2024-06-20 10:03:05 -07:00
john bowen cb6d48f499 Simplify Run method in kernel dispatch 2024-06-13 15:18:33 -07:00
Jan Nikl f135f662e7 Replaced depracated method MixedBilinearForm::EliminateTrialDofs(). 2024-06-13 11:40:41 -07:00
Jan Nikl 9ca87d3ecf Fixed shadowing in MixedBilinearForm. 2024-06-13 11:27:33 -07:00
Jan Nikl 10b9503528 Removed some extra spaces in MixedBilinearForm. 2024-06-13 11:03:10 -07:00
Jan Nikl 0572181086 Improved docstring in MixedBilinearForm. 2024-06-13 10:58:38 -07:00
Jan Nikl 8c58872ec8 Fixed math in bilinearform. 2024-06-13 10:39:28 -07:00
Jan Nikl df5b718f16 Added dof/bc elimination methods to MixedBilinearForm. 2024-06-13 10:39:15 -07:00
john bowen 01dfecd67e Fix unit test failures 2024-06-13 09:40:43 -07:00
john bowen f387244e57 Update kernel dispatch to support QuadratureInterpolator 2024-06-12 13:21:20 -07:00
john bowen 7b84f6ddc6 Merge branch 'master' into dispatch-map 2024-05-30 08:19:05 -07:00
Justin Laughlin badd444b9f add pull_request to triggers so it will show up 2024-05-07 17:55:33 -07:00
Justin Laughlin a3ce8974f6 add input to workflow_dispatch 2024-05-07 17:53:19 -07:00
Justin Laughlin f33a4ced53 Merge remote-tracking branch 'origin/master' into trigger-pymfem-ci 2024-05-07 17:48:16 -07:00
Justin Laughlin 78fff76695 change ref to master, and remove inputs for now (until pymfem workflow is updated) 2024-05-03 21:06:26 -07:00
Justin Laughlin 947310138e refresh action 2024-05-03 21:02:54 -07:00
Justin Laughlin 1d939a207a change target repo to pymfem 2024-05-03 20:27:45 -07:00
Justin Laughlin 3a5d89a6fb need to add pull_request to triggers so it will show up as an action 2024-05-03 20:19:16 -07:00
Justin Laughlin c0cc3eb976 add workflow for triggering pymfem CI 2024-05-03 18:45:19 -07:00
john bowen 5f083cea48 Remove ubuntu cmake build error 2024-03-27 16:56:25 -07:00
john bowen 80e29c8950 Delete use of sizeof... due to msvc incompatability. 2024-03-27 16:34:34 -07:00
john bowen 7264091c6f Fix mac build 2024-03-27 16:12:12 -07:00
john bowen 33c0df349d fix makefile build 2024-03-27 14:59:13 -07:00
john bowen d3015edb40 Delete double usage 2024-03-27 14:18:55 -07:00
john bowen 927c7f82be Merge branch 'master' into dispatch-map 2024-03-27 14:13:17 -07:00
john bowen 008dda250b Fix unit tests 2024-03-27 14:08:54 -07:00
john bowen a6b00aacbf Merge branch 'master' into dispatch-map 2024-03-21 12:23:59 -07:00
john bowen 504ae95915 fix ld error 2024-03-21 12:23:26 -07:00
john bowen 5d28b67295 copyright 2024-03-19 13:06:20 -07:00
john bowen b19800f1a7 Workaround for GCC limitation on class method non-type variadic pack deduction 2024-03-19 13:04:44 -07:00
john bowen e96dc7e4aa copyright 2024-03-07 10:59:20 -08:00
john bowen 3a113dcdd6 Merge branch 'master' into dispatch-map 2024-03-07 10:44:09 -08:00
john bowen 6a6d7eb83c Astyle 2024-03-07 10:43:50 -08:00
john bowen 8a0e295691 Delete occa merge artifact 2024-03-05 09:57:20 -08:00
john bowen 3386418737 Fixing build issues 2024-03-01 13:03:51 -08:00
john bowen 2f09777b17 tmp 2024-02-29 12:35:06 -08:00
john bowen 12842aa9e1 Tmp: Add non type parameter packs to generalize AddSpecialization API 2024-02-15 10:02:44 -08:00
john bowen b07ff3f5db Merge branch 'master' into dispatch-map 2024-02-08 09:34:15 -08:00
john bowen b86fdfb46c Add clangd files to gitignore 2024-01-30 10:56:05 -08:00
john bowen 50905e0dcb Copyright 2024-01-30 10:55:15 -08:00
john bowen 9702811d72 Fix linker errors 2024-01-16 17:28:47 -08:00
john bowen 955fe9f9df Merge branch 'master' into dispatch-map 2024-01-16 14:44:06 -08:00
john bowen 97e4f45be3 astyle format 2024-01-16 14:43:30 -08:00
john bowen 60242d41bd Fix makefile build error 2024-01-16 14:33:40 -08:00
john bowen 1fb47dab6b Cleanup following rebase 2024-01-16 13:35:46 -08:00
john bowen cd671cae3e tmp 2024-01-03 13:58:12 -08:00
john bowen c2154f95fe Merge branch 'master' into dispatch-map 2024-01-02 13:14:48 -08:00
Will Pazner f907191e58 Remove unneeded MassIntegrator member functions 2022-11-30 09:24:55 -08:00
Will Pazner 62a00562de Merge remote-tracking branch 'origin/master' into dispatch-map
# Conflicts:
#	fem/bilininteg_mass_pa.cpp
#	fem/bilininteg_mass_pa.hpp
2022-11-30 09:10:52 -08:00
Will Pazner 3316d89c63 Use 0 for default NBZ in kernel dispatch unless T::NBZ is defined 2022-11-30 09:00:28 -08:00
Will Pazner 6bf590c3ee Mass kernel dispatch 2022-11-29 21:05:43 -08:00
Will Pazner 78bf9951e3 Kernel dispatch WIP 2022-11-29 16:32:21 -08:00
Will Pazner 532060a646 Add generic dispatch table for PA kernels 2022-08-18 09:43:32 -07:00
Will Pazner 59f76ced6a Rename AddApplySpecialization to AddSpecialization 2022-08-10 21:40:56 -05:00
Will Pazner 0c2766ee76 Add dispatch table for DiffusionIntegrator::AssembleDiagonalPA 2022-08-10 16:40:19 -05:00
Will Pazner a90df38643 Calculate NBZ with constexpr pow 2022-08-10 14:15:50 -05:00
Will Pazner 407741b8e3 Add NBZ to DiffusionIntegrator kernel specialization 2022-08-10 12:32:32 -05:00
Will Pazner 3859678772 Runtime dispatch for specialized DiffusionIntegrator kernels 2022-08-10 12:10:04 -05:00
230 changed files with 5099 additions and 4593 deletions
+31
View File
@@ -0,0 +1,31 @@
# Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
# at the Lawrence Livermore National Laboratory. All Rights reserved. See files
# LICENSE and NOTICE for details. LLNL-CODE-806117.
#
# This file is part of the MFEM library. For more information and source code
# availability visit https://mfem.org.
#
# MFEM is free software; you can redistribute it and/or modify it under the
# terms of the BSD-3 license. We welcome feedback and contributions, see file
# CONTRIBUTING.md for details.
name: "Trigger PyMFEM CI"
on:
push:
branches:
- master
jobs:
trigger-pymfem:
runs-on: ubuntu-latest
steps:
- name: Send POST request to trigger PyMFEM CI
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PYMFEM_CI_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/mfem/pymfem/actions/workflows/build-and-test-dispatch.yml/dispatches \
-d '{"ref":"master", "inputs":{"test_options":"fast"}}'
+3
View File
@@ -15,6 +15,9 @@
CMakeCache.txt
CMakeFiles/
# Clangd server cache
*.cache*
# Backup files
*~
+15
View File
@@ -30,11 +30,26 @@ New and updated examples and miniapps
- Added an MFEM example for the eikonal equation. This new solver is based on
the proximal Galerkin method introduced by Keith and Surowiec.
- Added a command line option to all miniapps (`-p` or `--send-port`) for
specifying the GLVis server socket port (19916 by default).
GPU computing
-------------
- Added support for GPU-accelerated batched linear algebra (using cuBLAS,
hipBLAS, MAGMA, or native MFEM functionality) through the BatchedLinAlg class.
- A new GPU kernel dispatch mechanism was introduced. Users can instantiate
specialized kernels for specific combinations of (for example) polynomial
degree and number of quadrature points using
`DiffusionIntegrator::AddSpecialization` and
`MassIntegrator::AddSpecialization` (this functionality may be added to more
integrators in the future).
- Calls to slower fallback kernels can be reported to `mfem::err` by setting
the environment variable `MFEM_REPORT_KERNELS` to any value other than `NO`
or by explicitly calling `KernelReporter::Enable`. Users can then add
specializations for these kernels to achieve higher performance.
Miscellaneous
-------------
- Refactored the `ARKStepSolver` class (ARKODE interface) to use
+268
View File
@@ -0,0 +1,268 @@
#include "mfem.hpp"
#include <fstream>
#include <iostream>
using namespace std;
using namespace mfem;
enum problem
{
Lap2D, // Laplacian
ALap2D, // Anisotropic
Rlap2D, // Rotated Anisotropic
FRegLap2D // Four Region Domain
};
int main(int argc, char *argv[])
{
// 1. Initialize MPI and HYPRE.
Mpi::Init();
int num_procs = Mpi::WorldSize();
int myid = Mpi::WorldRank();
Hypre::Init();
// 2. Parse command-line options.
const char *mesh_file = "../data/ref-square.mesh";
int order = 1;
int ref = 1;
bool visualization = true;
int iprob = 0;
problem prob;
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
"Mesh file to use.");
args.AddOption(&order, "-o", "--order",
"Finite element order (polynomial degree)");
args.AddOption(&iprob, "-prob", "--problem", "Problem case"
" 0: Laplacian2D, 1: Anisotropic Laplacian 2D"
"2: Rotated anisotropic Laplacian 2D"
"4 region domain Laplacian 2D");
args.AddOption(&ref, "-r", "--refinements",
"Number of mesh refinements");
args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
"--no-visualization",
"Enable or disable GLVis visualization.");
args.Parse();
if (!args.Good())
{
if (myid == 0)
{
args.PrintUsage(cout);
}
return 1;
}
if (myid == 0)
{
args.PrintOptions(cout);
}
prob = (problem)iprob;
Mesh mesh(mesh_file, 1, 1);
int dim = mesh.Dimension();
for (int l = 0; l < ref; l++)
{
mesh.UniformRefinement();
}
// 3
// _______________
// | | |
// | 4 | 3 |
// 4 |_______|_______| 2
// | | |
// | 1 | 2 |
// |_______|_______|
// 1
// set attributes
// Element attributes
Vector center;
for (int i = 0; i < mesh.GetNE(); i++)
{
mesh.GetElementCenter(i,center);
if (center(0)<0.5 && center(1)<0.5)
{
mesh.SetAttribute(i,1);
}
else if (center(0)>0.5 && center(1)<0.5)
{
mesh.SetAttribute(i,2);
}
else if (center(0)<0.5 && center(1)>0.5)
{
mesh.SetAttribute(i,4);
}
else
{
mesh.SetAttribute(i,3);
}
}
mesh.SetAttributes();
// Boundary attributes;
for (int i = 0; i< mesh.GetNBE(); i++)
{
int geom = mesh.GetBdrElementBaseGeometry(i);
ElementTransformation * T = mesh.GetBdrElementTransformation(i);
T->Transform(Geometries.GetCenter(geom), center);
if (center(0) == 0.0)
{
mesh.SetBdrAttribute(i, 4);
}
else if (center(0) == 1.0)
{
mesh.SetBdrAttribute(i,2);
}
else if (center(1) == 0.0)
{
mesh.SetBdrAttribute(i,1);
}
else
{
mesh.SetBdrAttribute(i,3);
}
}
mesh.SetAttributes();
ParMesh pmesh(MPI_COMM_WORLD, mesh);
mesh.Clear();
PWMatrixCoefficient K(dim);
int nattr = pmesh.attributes.Max();
Vector dvalues(nattr);
Array<MatrixCoefficient*> Kcoeffs(nattr);
Array<DenseMatrix*> kmats(nattr);
Vector epsilons(nattr);
Vector thetas(nattr);
switch (prob)
{
case problem::Lap2D:
{
dvalues = 0.0;
epsilons = 1.0;
thetas = 0.0;
}
break;
case problem::ALap2D:
{
dvalues = 0.0;
epsilons = 0.01;
thetas = 0.0;
}
break;
case problem::Rlap2D:
{
dvalues = 0.0;
epsilons = 0.01;
thetas = M_PI/3.0;
}
break;
default:
{
dvalues = 0.0;
dvalues[0] = 1e4;
epsilons[0] = 1.0; thetas[0] = 0.0;
epsilons[1] = 1.0; thetas[1] = 0.0;
epsilons[2] = 0.01; thetas[2] = 0.0;
epsilons[3] = 0.01; thetas[3] = M_PI/2;
}
break;
}
PWConstCoefficient d(dvalues);
for (int i = 0; i<nattr; i++)
{
kmats[i] = new DenseMatrix(dim);
(*kmats[i])(0,0) = cos(thetas(i)) * cos(thetas(i))
+ epsilons(i) * sin(thetas(i)) * sin(thetas(i));
(*kmats[i])(1,1) = epsilons(i) * cos(thetas(i)) * cos(thetas(i))
+ sin(thetas(i)) * sin(thetas(i));
(*kmats[i])(0,1) = (1.0 - epsilons(i)) * cos(thetas(i)) * sin(thetas(i));
(*kmats[i])(1,0) = (*kmats[i])(0,1);
Kcoeffs[i] = new MatrixConstantCoefficient(*kmats[i]);
K.UpdateCoefficient(i+1,*Kcoeffs[i]);
}
H1_FECollection fec(order, dim);
ParFiniteElementSpace fespace(&pmesh, &fec);
HYPRE_BigInt size = fespace.GlobalTrueVSize();
if (myid == 0)
{
cout << "Number of finite element unknowns: " << size << endl;
}
Array<int> ess_tdof_list;
if (pmesh.bdr_attributes.Size())
{
Array<int> ess_bdr(pmesh.bdr_attributes.Max());
ess_bdr = 0;
switch (prob)
{
case problem::Lap2D:
case problem::ALap2D:
case problem::Rlap2D:
{
ess_bdr[1] = 1;
ess_bdr[3] = 1;
}
break;
default:
{
ess_bdr = 1;
}
break;
}
fespace.GetEssentialTrueDofs(ess_bdr, ess_tdof_list);
}
ParLinearForm b(&fespace);
ConstantCoefficient one(1.0);
b.AddDomainIntegrator(new DomainLFIntegrator(one));
b.Assemble();
ParGridFunction x(&fespace);
x = 0.0;
ParBilinearForm a(&fespace);
a.AddDomainIntegrator(new DiffusionIntegrator(K));
a.AddDomainIntegrator(new MassIntegrator(d));
a.Assemble();
for (int i = 0; i<nattr; i++)
{
delete kmats[i];
delete Kcoeffs[i];
}
OperatorPtr A;
Vector B, X;
a.FormLinearSystem(ess_tdof_list, x, b, A, X, B);
HypreBoomerAMG amg;
CGSolver cg(MPI_COMM_WORLD);
cg.SetRelTol(1e-12);
cg.SetMaxIter(2000);
cg.SetPrintLevel(1);
cg.SetPreconditioner(amg);
cg.SetOperator(*A);
cg.Mult(B, X);
a.RecoverFEMSolution(X, b, x);
if (visualization)
{
char vishost[] = "localhost";
int visport = 19916;
socketstream sol_sock(vishost, visport);
sol_sock << "parallel " << num_procs << " " << myid << "\n";
sol_sock.precision(8);
sol_sock << "solution\n" << pmesh << x << flush;
}
return 0;
}
+8 -8
View File
@@ -87,16 +87,16 @@ public:
real_t visc, real_t mu, real_t K);
/// Compute the right-hand side of the ODE system.
virtual void Mult(const Vector &vx, Vector &dvx_dt) const;
void Mult(const Vector &vx, Vector &dvx_dt) const override;
/** Solve the Backward-Euler equation: k = f(x + dt*k, t), for the unknown k.
This is the only requirement for high-order SDIRK implicit integration.*/
virtual void ImplicitSolve(const real_t dt, const Vector &x, Vector &k);
void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override;
real_t ElasticEnergy(const Vector &x) const;
real_t KineticEnergy(const Vector &v) const;
void GetElasticEnergyDensity(const GridFunction &x, GridFunction &w) const;
virtual ~HyperelasticOperator();
~HyperelasticOperator() override;
};
/** Nonlinear operator of the form:
@@ -120,12 +120,12 @@ public:
void SetParameters(real_t dt_, const Vector *v_, const Vector *x_);
/// Compute y = H(x + dt (v + dt k)) + M k + S (v + dt k).
virtual void Mult(const Vector &k, Vector &y) const;
void Mult(const Vector &k, Vector &y) const override;
/// Compute J = M + dt S + dt^2 grad_H(x + dt (v + dt k)).
virtual Operator &GetGradient(const Vector &k) const;
Operator &GetGradient(const Vector &k) const override;
virtual ~ReducedSystemOperator();
~ReducedSystemOperator() override;
};
@@ -141,8 +141,8 @@ private:
public:
ElasticEnergyCoefficient(HyperelasticModel &m, const GridFunction &x_)
: model(m), x(x_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
virtual ~ElasticEnergyCoefficient() { }
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
~ElasticEnergyCoefficient() override { }
};
void InitialDeformation(const Vector &x, Vector &y);
+8 -8
View File
@@ -89,17 +89,17 @@ public:
real_t visc, real_t mu, real_t K);
/// Compute the right-hand side of the ODE system.
virtual void Mult(const Vector &vx, Vector &dvx_dt) const;
void Mult(const Vector &vx, Vector &dvx_dt) const override;
/** Solve the Backward-Euler equation: k = f(x + dt*k, t), for the unknown k.
This is the only requirement for high-order SDIRK implicit integration.*/
virtual void ImplicitSolve(const real_t dt, const Vector &x, Vector &k);
void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override;
real_t ElasticEnergy(const ParGridFunction &x) const;
real_t KineticEnergy(const ParGridFunction &v) const;
void GetElasticEnergyDensity(const ParGridFunction &x,
ParGridFunction &w) const;
virtual ~HyperelasticOperator();
~HyperelasticOperator() override;
};
/** Nonlinear operator of the form:
@@ -125,12 +125,12 @@ public:
void SetParameters(real_t dt_, const Vector *v_, const Vector *x_);
/// Compute y = H(x + dt (v + dt k)) + M k + S (v + dt k).
virtual void Mult(const Vector &k, Vector &y) const;
void Mult(const Vector &k, Vector &y) const override;
/// Compute J = M + dt S + dt^2 grad_H(x + dt (v + dt k)).
virtual Operator &GetGradient(const Vector &k) const;
Operator &GetGradient(const Vector &k) const override;
virtual ~ReducedSystemOperator();
~ReducedSystemOperator() override;
};
@@ -146,8 +146,8 @@ private:
public:
ElasticEnergyCoefficient(HyperelasticModel &m, const ParGridFunction &x_)
: model(m), x(x_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
virtual ~ElasticEnergyCoefficient() { }
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
~ElasticEnergyCoefficient() override { }
};
void InitialDeformation(const Vector &x, Vector &y);
+1 -1
View File
@@ -53,7 +53,7 @@ public:
pmesh(pmesh_),
pgf(pgf_) {}
void MonitorSolution(int i, real_t norm, const Vector &x, bool final)
void MonitorSolution(int i, real_t norm, const Vector &x, bool final) override
{
char vishost[] = "localhost";
int visport = 19916;
+3 -3
View File
@@ -76,15 +76,15 @@ public:
ConductionOperator(FiniteElementSpace &f, real_t alpha, real_t kappa,
const Vector &u);
virtual void Mult(const Vector &u, Vector &du_dt) const;
void Mult(const Vector &u, Vector &du_dt) const override;
/** Solve the Backward-Euler equation: k = f(u + dt*k, t), for the unknown k.
This is the only requirement for high-order SDIRK implicit integration.*/
virtual void ImplicitSolve(const real_t dt, const Vector &u, Vector &k);
void ImplicitSolve(const real_t dt, const Vector &u, Vector &k) override;
/// Update the diffusion BilinearForm K using the given true-dof vector `u`.
void SetParameters(const Vector &u);
virtual ~ConductionOperator();
~ConductionOperator() override;
};
real_t InitialTemperature(const Vector &x);
+3 -3
View File
@@ -78,15 +78,15 @@ public:
ConductionOperator(ParFiniteElementSpace &f, real_t alpha, real_t kappa,
const Vector &u);
virtual void Mult(const Vector &u, Vector &du_dt) const;
void Mult(const Vector &u, Vector &du_dt) const override;
/** Solve the Backward-Euler equation: k = f(u + dt*k, t), for the unknown k.
This is the only requirement for high-order SDIRK implicit integration.*/
virtual void ImplicitSolve(const real_t dt, const Vector &u, Vector &k);
void ImplicitSolve(const real_t dt, const Vector &u, Vector &k) override;
/// Update the diffusion BilinearForm K using the given true-dof vector `u`.
void SetParameters(const Vector &u);
virtual ~ConductionOperator();
~ConductionOperator() override;
};
real_t InitialTemperature(const Vector &x);
+2 -2
View File
@@ -69,7 +69,7 @@ public:
void SetDisplacement(GridFunction &u_) { u = &u_; }
void SetComponent(int i, int j) { si = i; sj = j; }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
// Simple GLVis visualization manager.
@@ -89,7 +89,7 @@ public:
void NewWindow();
void CloseConnection();
void PositionWindow();
virtual ~VisMan();
~VisMan() override;
};
// Manipulators for the GLVis visualization manager.
+2 -2
View File
@@ -69,7 +69,7 @@ public:
void SetDisplacement(GridFunction &u_) { u = &u_; }
void SetComponent(int i, int j) { si = i; sj = j; }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
// Simple GLVis visualization manager.
@@ -89,7 +89,7 @@ public:
void NewWindow();
void CloseConnection();
void PositionWindow();
virtual ~VisMan();
~VisMan() override;
};
// Manipulators for the GLVis visualization manager.
+7 -7
View File
@@ -48,7 +48,7 @@ public:
print_level = print_lvl;
}
virtual void MonitorResidual(int it, real_t norm, const Vector &r, bool final);
void MonitorResidual(int it, real_t norm, const Vector &r, bool final) override;
private:
const std::string prefix;
@@ -116,10 +116,10 @@ public:
JacobianPreconditioner(Array<FiniteElementSpace *> &fes,
SparseMatrix &mass, Array<int> &offsets);
virtual void Mult(const Vector &k, Vector &y) const;
virtual void SetOperator(const Operator &op);
void Mult(const Vector &k, Vector &y) const override;
void SetOperator(const Operator &op) override;
virtual ~JacobianPreconditioner();
~JacobianPreconditioner() override;
};
// After spatial discretization, the rubber model can be written as:
@@ -161,13 +161,13 @@ public:
int iter, Coefficient &mu);
// Required to use the native newton solver
virtual Operator &GetGradient(const Vector &xp) const;
virtual void Mult(const Vector &k, Vector &y) const;
Operator &GetGradient(const Vector &xp) const override;
void Mult(const Vector &k, Vector &y) const override;
// Driver for the newton solver
void Solve(Vector &xp) const;
virtual ~RubberOperator();
~RubberOperator() override;
};
// Visualization driver
+7 -7
View File
@@ -62,7 +62,7 @@ public:
#endif
}
virtual void MonitorResidual(int it, real_t norm, const Vector &r, bool final);
void MonitorResidual(int it, real_t norm, const Vector &r, bool final) override;
private:
const std::string prefix;
@@ -130,10 +130,10 @@ public:
JacobianPreconditioner(Array<ParFiniteElementSpace *> &fes,
Operator &mass, Array<int> &offsets);
virtual void Mult(const Vector &k, Vector &y) const;
virtual void SetOperator(const Operator &op);
void Mult(const Vector &k, Vector &y) const override;
void SetOperator(const Operator &op) override;
virtual ~JacobianPreconditioner();
~JacobianPreconditioner() override;
};
// After spatial discretization, the rubber model can be written as:
@@ -175,13 +175,13 @@ public:
int iter, Coefficient &mu);
// Required to use the native newton solver
virtual Operator &GetGradient(const Vector &xp) const;
virtual void Mult(const Vector &k, Vector &y) const;
Operator &GetGradient(const Vector &xp) const override;
void Mult(const Vector &k, Vector &y) const override;
// Driver for the newton solver
void Solve(Vector &xp) const;
virtual ~RubberOperator();
~RubberOperator() override;
};
// Visualization driver
+2 -2
View File
@@ -79,14 +79,14 @@ class GradT : public Operator
{
public:
GradT() : Operator(1) {}
void Mult(const Vector &x, Vector &y) const { y.Set(1.0/m_, x); }
void Mult(const Vector &x, Vector &y) const override { y.Set(1.0/m_, x); }
};
class NegGradV : public TimeDependentOperator
{
public:
NegGradV() : TimeDependentOperator(1) {}
void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
};
int main(int argc, char *argv[])
+2 -2
View File
@@ -84,14 +84,14 @@ class GradT : public Operator
{
public:
GradT() : Operator(1) {}
void Mult(const Vector &x, Vector &y) const { y.Set(1.0/m_, x); }
void Mult(const Vector &x, Vector &y) const override { y.Set(1.0/m_, x); }
};
class NegGradV : public TimeDependentOperator
{
public:
NegGradV() : TimeDependentOperator(1) {}
void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
};
int main(int argc, char *argv[])
+5 -5
View File
@@ -61,20 +61,20 @@ public:
WaveOperator(FiniteElementSpace &f, Array<int> &ess_bdr, real_t speed);
using SecondOrderTimeDependentOperator::Mult;
virtual void Mult(const Vector &u, const Vector &du_dt,
Vector &d2udt2) const;
void Mult(const Vector &u, const Vector &du_dt,
Vector &d2udt2) const override;
/** Solve the Backward-Euler equation:
d2udt2 = f(u + fac0*d2udt2,dudt + fac1*d2udt2, t),
for the unknown d2udt2. */
using SecondOrderTimeDependentOperator::ImplicitSolve;
virtual void ImplicitSolve(const real_t fac0, const real_t fac1,
const Vector &u, const Vector &dudt, Vector &d2udt2);
void ImplicitSolve(const real_t fac0, const real_t fac1,
const Vector &u, const Vector &dudt, Vector &d2udt2) override;
///
void SetParameters(const Vector &u);
virtual ~WaveOperator();
~WaveOperator() override;
};
+2 -2
View File
@@ -103,8 +103,8 @@ public:
using VectorCoefficient::Eval;
virtual void Eval(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip) override
{
real_t x[3];
Vector transip(x, 3);
+2 -2
View File
@@ -102,8 +102,8 @@ public:
using VectorCoefficient::Eval;
virtual void Eval(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip) override
{
real_t x[3];
Vector transip(x, 3);
+1 -1
View File
@@ -58,7 +58,7 @@ public:
}
}
virtual ~DiffusionMultigrid()
~DiffusionMultigrid() override
{
delete amg;
}
+3 -3
View File
@@ -53,7 +53,7 @@ public:
real_t min_val_=-36)
: u(&u_), obstacle(&obst_), min_val(min_val_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
class ExponentialGridFunctionCoefficient : public Coefficient
@@ -69,7 +69,7 @@ public:
real_t min_val_=0.0, real_t max_val_=1e6)
: u(&u_), obstacle(&obst_), min_val(min_val_), max_val(max_val_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
int main(int argc, char *argv[])
@@ -258,7 +258,7 @@ int main(int argc, char *argv[])
MixedBilinearForm a10(&H1fes,&L2fes);
a10.AddDomainIntegrator(new MixedScalarMassIntegrator());
a10.Assemble();
a10.EliminateTrialDofs(ess_bdr, x.GetBlock(0), rhs.GetBlock(1));
a10.EliminateTrialEssentialBC(ess_bdr, x.GetBlock(0), rhs.GetBlock(1));
a10.Finalize();
SparseMatrix &A10 = a10.SpMat();
+2 -2
View File
@@ -53,7 +53,7 @@ public:
real_t min_val_=-36)
: u(&u_), obstacle(&obst_), min_val(min_val_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
class ExponentialGridFunctionCoefficient : public Coefficient
@@ -69,7 +69,7 @@ public:
real_t min_val_=0.0, real_t max_val_=1e6)
: u(&u_), obstacle(&obst_), min_val(min_val_), max_val(max_val_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
int main(int argc, char *argv[])
+8 -8
View File
@@ -52,8 +52,8 @@ public:
fun(fun_) {}
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{
return fun(GridFunctionCoefficient::Eval(T, ip));
}
@@ -83,8 +83,8 @@ public:
OtherGridF_cf(OtherGridF),
fun(fun_) {}
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{
const real_t value1 = fun(GridFunctionCoefficient::Eval(T, ip));
const real_t value2 = fun(OtherGridF_cf.Eval(T, ip));
@@ -108,7 +108,7 @@ public:
: rho_filter(rho_filter_), min_val(min_val_), max_val(max_val_),
exponent(exponent_) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
{
real_t val = rho_filter->GetValue(T, ip);
real_t coeff = min_val + pow(val,exponent)*(max_val-min_val);
@@ -142,7 +142,7 @@ public:
MFEM_ASSERT(rho_filter, "density field is not set");
}
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
{
real_t L = lambda->Eval(T, ip);
real_t M = mu->Eval(T, ip);
@@ -176,8 +176,8 @@ public:
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override
{
Vector xx; xx.SetSize(T.GetDimension());
T.Transform(ip,xx);
+6 -6
View File
@@ -408,9 +408,9 @@ public:
@param [in] Tr transformation of finite element
@param [out] elvect vector containing the
*/
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override
{
int dof = el.GetDof();
shape.SetSize(dof);
@@ -476,9 +476,9 @@ public:
@param [in] Tr transformation of finite element
@param [out] elvect vector containing the
*/
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override
{
int dof = el.GetDof();
shape.SetSize(dof);
+4 -4
View File
@@ -69,8 +69,8 @@ public:
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
void SetAlpha(real_t alpha_) { alpha = alpha_; }
};
@@ -84,8 +84,8 @@ public:
DZCoefficient(int height, GridFunction &psi_, real_t alpha_ = 1.0)
: MatrixCoefficient(height), psi(&psi_), alpha(alpha_) { }
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
void SetAlpha(real_t alpha_) { alpha = alpha_; }
};
+4 -4
View File
@@ -69,8 +69,8 @@ public:
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
void SetAlpha(real_t alpha_) { alpha = alpha_; }
};
@@ -84,8 +84,8 @@ public:
DZCoefficient(int height, ParGridFunction &psi_, real_t alpha_ = 1.0)
: MatrixCoefficient(height), psi(&psi_), alpha(alpha_) { }
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
void SetAlpha(real_t alpha_) { alpha = alpha_; }
};
+1 -1
View File
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
MixedBilinearForm *B0 = new MixedBilinearForm(x0_space,test_space);
B0->AddDomainIntegrator(new DiffusionIntegrator(one));
B0->Assemble();
B0->EliminateTrialDofs(ess_bdr, x.GetBlock(x0_var), F);
B0->EliminateTrialEssentialBC(ess_bdr, x.GetBlock(x0_var), F);
B0->Finalize();
MixedBilinearForm *Bhat = new MixedBilinearForm(xhat_space,test_space);
+5 -5
View File
@@ -104,12 +104,12 @@ public:
}
}
void SetOperator(const Operator &op)
void SetOperator(const Operator &op) override
{
linear_solver.SetOperator(op);
}
virtual void Mult(const Vector &x, Vector &y) const
void Mult(const Vector &x, Vector &y) const override
{
linear_solver.Mult(x, y);
}
@@ -134,10 +134,10 @@ private:
public:
FE_Evolution(BilinearForm &M_, BilinearForm &K_, const Vector &b_);
virtual void Mult(const Vector &x, Vector &y) const;
virtual void ImplicitSolve(const real_t dt, const Vector &x, Vector &k);
void Mult(const Vector &x, Vector &y) const override;
void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override;
virtual ~FE_Evolution();
~FE_Evolution() override;
};
+9 -9
View File
@@ -92,7 +92,7 @@ private:
public:
AIR_prec(int blocksize_) : AIR_solver(NULL), blocksize(blocksize_) { }
void SetOperator(const Operator &op)
void SetOperator(const Operator &op) override
{
width = op.Width();
height = op.Height();
@@ -110,7 +110,7 @@ public:
AIR_solver->SetMaxLevels(50);
}
virtual void Mult(const Vector &x, Vector &y) const
void Mult(const Vector &x, Vector &y) const override
{
// Scale the rhs by block inverse and solve system
HypreParVector z_s;
@@ -119,7 +119,7 @@ public:
AIR_solver->Mult(z_s, y);
}
~AIR_prec()
~AIR_prec() override
{
delete AIR_solver;
}
@@ -185,17 +185,17 @@ public:
}
}
void SetOperator(const Operator &op)
void SetOperator(const Operator &op) override
{
linear_solver.SetOperator(op);
}
virtual void Mult(const Vector &x, Vector &y) const
void Mult(const Vector &x, Vector &y) const override
{
linear_solver.Mult(x, y);
}
~DG_Solver()
~DG_Solver() override
{
delete prec;
delete A;
@@ -223,10 +223,10 @@ public:
FE_Evolution(ParBilinearForm &M_, ParBilinearForm &K_, const Vector &b_,
PrecType prec_type);
virtual void Mult(const Vector &x, Vector &y) const;
virtual void ImplicitSolve(const real_t dt, const Vector &x, Vector &k);
void Mult(const Vector &x, Vector &y) const override;
void ImplicitSolve(const real_t dt, const Vector &x, Vector &k) override;
virtual ~FE_Evolution();
~FE_Evolution() override;
};
+9 -1
View File
@@ -206,6 +206,7 @@ int main(int argc, char *argv[])
bool use_petsc = true;
const char *petscrc_file = "";
bool petsc_use_jfnk = false;
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
@@ -243,6 +244,8 @@ int main(int argc, char *argv[])
args.AddOption(&petsc_use_jfnk, "-jfnk", "--jfnk", "-no-jfnk",
"--no-jfnk",
"Use JFNK with user-defined preconditioner factory.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.Parse();
if (!args.Good())
{
@@ -257,7 +260,12 @@ int main(int argc, char *argv[])
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc)
{
MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL);
+9 -1
View File
@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
bool use_petsc = true;
const char *petscrc_file = "";
bool use_nonoverlapping = false;
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
@@ -95,6 +96,8 @@ int main(int argc, char *argv[])
"-no-nonoverlapping", "--no-nonoverlapping",
"Use or not the block diagonal PETSc's matrix format "
"for non-overlapping domain decomposition.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.Parse();
if (!args.Good())
{
@@ -109,7 +112,12 @@ int main(int argc, char *argv[])
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
// 3. Read the (serial) mesh from the given mesh file on all processors. We
+11 -2
View File
@@ -61,6 +61,7 @@ int main(int argc, char *argv[])
bool use_petsc = true;
const char *petscrc_file = "";
bool use_nonoverlapping = false;
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
@@ -87,6 +88,8 @@ int main(int argc, char *argv[])
"-no-nonoverlapping", "--no-nonoverlapping",
"Use or not the block diagonal PETSc's matrix format "
"for non-overlapping domain decomposition.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.Parse();
if (!args.Good())
{
@@ -100,10 +103,16 @@ int main(int argc, char *argv[])
{
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
kappa = freq * M_PI;
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
// 3. Read the (serial) mesh from the given mesh file on all processors. We
// can handle triangular, quadrilateral, tetrahedral, hexahedral, surface
// and volume meshes with the same code.
+11 -2
View File
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
bool use_petsc = true;
const char *petscrc_file = "";
bool use_nonoverlapping = false;
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
@@ -88,6 +89,8 @@ int main(int argc, char *argv[])
"-no-nonoverlapping", "--no-nonoverlapping",
"Use or not the block diagonal PETSc's matrix format "
"for non-overlapping domain decomposition.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.Parse();
if (!args.Good())
{
@@ -101,10 +104,16 @@ int main(int argc, char *argv[])
{
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
kappa = freq * M_PI;
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
// 3. Read the (serial) mesh from the given mesh file on all processors. We
// can handle triangular, quadrilateral, tetrahedral, hexahedral, surface
// and volume, as well as periodic meshes with the same code.
+28 -7
View File
@@ -59,6 +59,8 @@ int main(int argc, char *argv[])
// 2. Parse command-line options.
const char *mesh_file = "../../data/star.mesh";
int ser_ref_levels = -1;
int par_ref_levels = 2;
int order = 1;
bool par_format = false;
bool visualization = 1;
@@ -66,15 +68,22 @@ int main(int argc, char *argv[])
bool use_nonoverlapping = false;
bool local_bdr_spec = false;
const char *petscrc_file = "";
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
"Mesh file to use.");
args.AddOption(&ser_ref_levels, "-rs", "--refine-serial",
"Number of times to refine the mesh uniformly in serial.");
args.AddOption(&par_ref_levels, "-rp", "--refine-parallel",
"Number of times to refine the mesh uniformly in parallel.");
args.AddOption(&order, "-o", "--order",
"Finite element order (polynomial degree).");
args.AddOption(&par_format, "-pf", "--parallel-format", "-sf",
"--serial-format",
"Format to use when saving the results for VisIt.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
"--no-visualization",
"Enable or disable GLVis visualization.");
@@ -103,7 +112,13 @@ int main(int argc, char *argv[])
{
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
// 3. Read the (serial) mesh from the given mesh file on all processors. We
@@ -117,9 +132,11 @@ int main(int argc, char *argv[])
// 'ref_levels' to be the largest number that gives a final mesh with no
// more than 10,000 elements.
{
int ref_levels =
(int)floor(log(10000./mesh->GetNE())/log(2.)/dim);
for (int l = 0; l < ref_levels; l++)
if (ser_ref_levels < 0)
{
ser_ref_levels = (int)floor(log(10000./mesh->GetNE())/log(2.)/dim);
}
for (int l = 0; l < ser_ref_levels; l++)
{
mesh->UniformRefinement();
}
@@ -131,7 +148,6 @@ int main(int argc, char *argv[])
ParMesh *pmesh = new ParMesh(MPI_COMM_WORLD, *mesh);
delete mesh;
{
int par_ref_levels = 2;
for (int l = 0; l < par_ref_levels; l++)
{
pmesh->UniformRefinement();
@@ -187,21 +203,26 @@ int main(int argc, char *argv[])
// 9. Define the parallel grid function and parallel linear forms, solution
// vector and rhs.
BlockVector x(block_offsets), rhs(block_offsets);
BlockVector trueX(block_trueOffsets), trueRhs(block_trueOffsets);
MemoryType mt = device.GetMemoryType();
BlockVector x(block_offsets, mt), rhs(block_offsets, mt);
BlockVector trueX(block_trueOffsets, mt), trueRhs(block_trueOffsets, mt);
ParLinearForm *fform(new ParLinearForm);
fform->Update(R_space, rhs.GetBlock(0), 0);
fform->AddDomainIntegrator(new VectorFEDomainLFIntegrator(fcoeff));
fform->AddBoundaryIntegrator(new VectorFEBoundaryFluxLFIntegrator(fnatcoeff));
fform->Assemble();
fform->SyncAliasMemory(rhs);
fform->ParallelAssemble(trueRhs.GetBlock(0));
trueRhs.GetBlock(0).SyncAliasMemory(trueRhs);
ParLinearForm *gform(new ParLinearForm);
gform->Update(W_space, rhs.GetBlock(1), 0);
gform->AddDomainIntegrator(new DomainLFIntegrator(gcoeff));
gform->Assemble();
gform->SyncAliasMemory(rhs);
gform->ParallelAssemble(trueRhs.GetBlock(1));
trueRhs.GetBlock(1).SyncAliasMemory(trueRhs);
// 10. Assemble the finite element matrices for the Darcy operator
//
+10 -1
View File
@@ -53,6 +53,7 @@ int main(int argc, char *argv[])
bool use_petsc = true;
const char *petscrc_file = "";
bool use_nonoverlapping = false;
const char *device_config = "cpu";
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
@@ -73,6 +74,8 @@ int main(int argc, char *argv[])
"-no-nonoverlapping", "--no-nonoverlapping",
"Use or not the block diagonal PETSc's matrix format "
"for non-overlapping domain decomposition.");
args.AddOption(&device_config, "-d", "--device",
"Device configuration string, see Device::Configure().");
args.Parse();
if (!args.Good())
{
@@ -86,7 +89,13 @@ int main(int argc, char *argv[])
{
args.PrintOptions(cout);
}
// 2b. We initialize PETSc
// 2b. Enable hardware devices such as GPUs, and programming models such as
// CUDA, OCCA, RAJA and OpenMP based on command line options.
Device device(device_config);
if (myid == 0) { device.Print(); }
// 2c. We initialize PETSc
if (use_petsc) { MFEMInitializePetsc(NULL,NULL,petscrc_file,NULL); }
// 3. Read the (serial) mesh from the given mesh file on all processors. We
+3 -3
View File
@@ -112,8 +112,6 @@ set(SRCS
qinterp/eval_by_vdim.cpp
qinterp/grad_by_nodes.cpp
qinterp/grad_by_vdim.cpp
qinterp/grad_phys_by_nodes.cpp
qinterp/grad_phys_by_vdim.cpp
qspace.cpp
quadinterpolator.cpp
quadinterpolator_face.cpp
@@ -192,6 +190,9 @@ set(HDRS
hybridization.hpp
intrules.hpp
intrules_cut.hpp
kernel_dispatch.hpp
kernel_reporter.hpp
kernels.hpp
ceed/interface/basis.hpp
ceed/interface/integrator.hpp
ceed/interface/interface.hpp
@@ -223,7 +224,6 @@ set(HDRS
nonlinearform_ext.hpp
nonlininteg.hpp
qfunction.hpp
qinterp/dispatch.hpp
qinterp/eval.hpp
qinterp/grad.hpp
qspace.hpp
+56 -36
View File
@@ -1941,36 +1941,59 @@ void MixedBilinearForm::AssembleBdrElementMatrix(
mat->AddSubMatrix(test_vdofs_, trial_vdofs_, elmat, skip_zeros);
}
void MixedBilinearForm::EliminateTrialDofs (
void MixedBilinearForm::EliminateTrialEssentialBC(
const Array<int> &bdr_attr_is_ess, const Vector &sol, Vector &rhs )
{
int i, j, k;
Array<int> tr_vdofs, cols_marker (trial_fes -> GetVSize());
cols_marker = 0;
for (i = 0; i < trial_fes -> GetNBE(); i++)
if (bdr_attr_is_ess[trial_fes -> GetBdrAttribute (i)-1])
{
trial_fes -> GetBdrElementVDofs (i, tr_vdofs);
for (j = 0; j < tr_vdofs.Size(); j++)
{
if ( (k = tr_vdofs[j]) < 0 )
{
k = -1-k;
}
cols_marker[k] = 1;
}
}
mat -> EliminateCols (cols_marker, &sol, &rhs);
Array<int> trial_ess_dofs;
trial_fes->GetEssentialVDofs(bdr_attr_is_ess, trial_ess_dofs);
mat->EliminateCols(trial_ess_dofs, &sol, &rhs);
}
void MixedBilinearForm::EliminateEssentialBCFromTrialDofs (
void MixedBilinearForm::EliminateTrialEssentialBC(const Array<int>
&bdr_attr_is_ess)
{
Array<int> trial_ess_dofs;
trial_fes->GetEssentialVDofs(bdr_attr_is_ess, trial_ess_dofs);
mat->EliminateCols(trial_ess_dofs);
}
void MixedBilinearForm::EliminateTrialVDofs(const Array<int> &trial_vdofs_,
const Vector &sol, Vector &rhs)
{
Array<int> trial_vdofs_marker;
FiniteElementSpace::ListToMarker(trial_vdofs_, mat->Width(),
trial_vdofs_marker);
mat->EliminateCols(trial_vdofs_marker, &sol, &rhs);
}
void MixedBilinearForm::EliminateTrialVDofs(const Array<int> &trial_vdofs_)
{
if (mat_e == NULL)
{
mat_e = new SparseMatrix(mat->Height(), mat->Width());
}
Array<int> trial_vdofs_marker;
FiniteElementSpace::ListToMarker(trial_vdofs_, mat->Width(),
trial_vdofs_marker);
mat->EliminateCols(trial_vdofs_marker, *mat_e);
mat_e->Finalize();
}
void MixedBilinearForm::EliminateTrialVDofsInRHS(const Array<int> &trial_vdofs_,
const Vector &x, Vector &b)
{
mat_e->AddMult(x, b, -1.);
}
void MixedBilinearForm::EliminateEssentialBCFromTrialDofs(
const Array<int> &marked_vdofs, const Vector &sol, Vector &rhs)
{
mat -> EliminateCols (marked_vdofs, &sol, &rhs);
mat->EliminateCols(marked_vdofs, &sol, &rhs);
}
void MixedBilinearForm::EliminateTestDofs (const Array<int> &bdr_attr_is_ess)
void MixedBilinearForm::EliminateTestEssentialBC(const Array<int>
&bdr_attr_is_ess)
{
int i, j, k;
Array<int> te_vdofs;
@@ -1990,6 +2013,14 @@ void MixedBilinearForm::EliminateTestDofs (const Array<int> &bdr_attr_is_ess)
}
}
void MixedBilinearForm::EliminateTestVDofs(const Array<int> &test_vdofs_)
{
for (int i=0; i<test_vdofs_.Size(); ++i)
{
mat->EliminateRow(test_vdofs_[i]);
}
}
void MixedBilinearForm::FormRectangularSystemMatrix(
const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list,
@@ -2026,20 +2057,9 @@ void MixedBilinearForm::FormRectangularSystemMatrix(
mat = m;
}
Array<int> ess_trial_tdof_marker, ess_test_tdof_marker;
FiniteElementSpace::ListToMarker(trial_tdof_list, trial_fes->GetTrueVSize(),
ess_trial_tdof_marker);
FiniteElementSpace::ListToMarker(test_tdof_list, test_fes->GetTrueVSize(),
ess_test_tdof_marker);
EliminateTrialVDofs(trial_tdof_list);
EliminateTestVDofs(test_tdof_list);
mat_e = new SparseMatrix(mat->Height(), mat->Width());
mat->EliminateCols(ess_trial_tdof_marker, *mat_e);
for (int i=0; i<test_tdof_list.Size(); ++i)
{
mat->EliminateRow(test_tdof_list[i]);
}
mat_e->Finalize();
A.Reset(mat, false);
}
@@ -2068,7 +2088,7 @@ void MixedBilinearForm::FormRectangularLinearSystem(
A); // Set A = mat_e
}
// Eliminate essential BCs with B -= Ab xb
mat_e->AddMult(X, B, -1.0);
EliminateTrialVDofsInRHS(trial_tdof_list, X, B);
B.SetSubVector(test_tdof_list, 0.0);
}
+105 -45
View File
@@ -294,13 +294,13 @@ public:
const real_t &operator()(int i, int j) { return (*mat)(i,j); }
/// Returns a reference to: $ M_{ij} $
virtual real_t &Elem(int i, int j);
real_t &Elem(int i, int j) override;
/// Returns constant reference to: $ M_{ij} $
virtual const real_t &Elem(int i, int j) const;
const real_t &Elem(int i, int j) const override;
/// Matrix vector multiplication: $ y = M x $
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/** @brief Matrix vector multiplication with the original uneliminated
matrix. The original matrix is $ M + M_e $ so we have:
@@ -309,7 +309,7 @@ public:
{ mat->Mult(x, y); mat_e->AddMult(x, y); }
/// Add the matrix vector multiple to a vector: $ y += a M x $
virtual void AddMult(const Vector &x, Vector &y, const real_t a = 1.0) const
void AddMult(const Vector &x, Vector &y, const real_t a = 1.0) const override
{ mat -> AddMult (x, y, a); }
/** @brief Add the original uneliminated matrix vector multiple to a vector.
@@ -319,8 +319,8 @@ public:
{ mat->AddMult(x, y); mat_e->AddMult(x, y); }
/// Add the matrix transpose vector multiplication: $ y += a M^T x $
virtual void AddMultTranspose(const Vector & x, Vector & y,
const real_t a = 1.0) const
void AddMultTranspose(const Vector & x, Vector & y,
const real_t a = 1.0) const override
{ mat->AddMultTranspose(x, y, a); }
/** @brief Add the original uneliminated matrix transpose vector
@@ -330,7 +330,7 @@ public:
{ mat->AddMultTranspose(x, y); mat_e->AddMultTranspose(x, y); }
/// Matrix transpose vector multiplication: $ y = M^T x $
virtual void MultTranspose(const Vector & x, Vector & y) const;
void MultTranspose(const Vector & x, Vector & y) const override;
/// Compute $ y^T M x $
real_t InnerProduct(const Vector &x, const Vector &y) const
@@ -338,13 +338,13 @@ public:
/** @brief Returns a pointer to (approximation) of the matrix inverse:
$ M^{-1} $ (currently returns NULL) */
virtual MatrixInverse *Inverse() const;
MatrixInverse *Inverse() const override;
/** @brief Finalizes the matrix initialization if the ::AssemblyLevel is
AssemblyLevel::LEGACY.
The matrix that gets finalized is different if you are using static
condensation or hybridization.*/
virtual void Finalize(int skip_zeros = 1);
void Finalize(int skip_zeros = 1) override;
/** @brief Returns a const reference to the sparse matrix: $ M $
*
@@ -458,18 +458,18 @@ public:
conforming prolongation, and |.| denotes the entry-wise absolute value.
In general, this is just an approximation of the exact diagonal for this
case. */
virtual void AssembleDiagonal(Vector &diag) const;
void AssembleDiagonal(Vector &diag) const override;
/// Get the finite element space prolongation operator.
virtual const Operator *GetProlongation() const
const Operator *GetProlongation() const override
{ return fes->GetConformingProlongation(); }
/// Get the finite element space restriction operator
virtual const Operator *GetRestriction() const
const Operator *GetRestriction() const override
{ return fes->GetConformingRestriction(); }
/// Get the output finite element space prolongation matrix
virtual const Operator *GetOutputProlongation() const
const Operator *GetOutputProlongation() const override
{ return GetProlongation(); }
/** @brief Returns the output fe space restriction matrix, transposed
@@ -477,11 +477,11 @@ public:
Logically, this is the transpose of GetOutputRestriction, but in
practice it is convenient to have it in transposed form for
construction of RAP operators in matrix-free methods. */
virtual const Operator *GetOutputRestrictionTranspose() const
const Operator *GetOutputRestrictionTranspose() const override
{ return fes->GetRestrictionTransposeOperator(); }
/// Get the output finite element space restriction matrix
virtual const Operator *GetOutputRestriction() const
const Operator *GetOutputRestriction() const override
{ return GetRestriction(); }
/// Compute serial RAP operator and store it in @a A as a SparseMatrix.
@@ -566,7 +566,8 @@ public:
FormLinearSystem() method to recover the solution as a GridFunction-size
vector in @a x. Use the same arguments as in the FormLinearSystem() call.
*/
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
void RecoverFEMSolution(const Vector &X, const Vector &b,
Vector &x) override;
/// Compute and store internally all element matrices.
void ComputeElementMatrices();
@@ -811,32 +812,32 @@ public:
MixedBilinearForm *mbf);
/// Returns a reference to: $ M_{ij} $
virtual real_t &Elem(int i, int j);
real_t &Elem(int i, int j) override;
/// Returns a reference to: $ M_{ij} $
virtual const real_t &Elem(int i, int j) const;
const real_t &Elem(int i, int j) const override;
/// Matrix multiplication: $ y = M x $
virtual void Mult(const Vector & x, Vector & y) const;
void Mult(const Vector & x, Vector & y) const override;
/// Add the matrix vector multiple to a vector: $ y += a M x $
virtual void AddMult(const Vector & x, Vector & y,
const real_t a = 1.0) const;
void AddMult(const Vector & x, Vector & y,
const real_t a = 1.0) const override;
/// Matrix transpose vector multiplication: $ y = M^T x $
virtual void MultTranspose(const Vector & x, Vector & y) const;
void MultTranspose(const Vector & x, Vector & y) const override;
/// Add the matrix transpose vector multiplication: $ y += a M^T x $
virtual void AddMultTranspose(const Vector & x, Vector & y,
const real_t a = 1.0) const;
void AddMultTranspose(const Vector & x, Vector & y,
const real_t a = 1.0) const override;
/** @brief Returns a pointer to (approximation) of the matrix inverse:
$ M^{-1} $ (currently unimplemented and returns NULL)*/
virtual MatrixInverse *Inverse() const;
MatrixInverse *Inverse() const override;
/** @brief Finalizes the matrix initialization if the ::AssemblyLevel is
AssemblyLevel::LEGACY.*/
virtual void Finalize(int skip_zeros = 1);
void Finalize(int skip_zeros = 1) override;
/** @brief Extract the associated matrix as SparseMatrix blocks. The number
of block rows and columns is given by the vector dimensions (vdim) of the
@@ -847,15 +848,37 @@ public:
/** This will segfault if the usual sparse mat is not defined
like when static condensation is being used or AllocMat() has
not yet been called. */
const SparseMatrix &SpMat() const { return *mat; }
const SparseMatrix &SpMat() const
{
MFEM_VERIFY(mat, "mat is NULL and can't be dereferenced");
return *mat;
}
/// Returns a reference to the sparse matrix: $ M $
SparseMatrix &SpMat() { return *mat; }
SparseMatrix &SpMat()
{
MFEM_VERIFY(mat, "mat is NULL and can't be dereferenced");
return *mat;
}
/** @brief Nullifies the internal matrix $ M $ and returns a pointer
to it. Used for transferring ownership. */
SparseMatrix *LoseMat() { SparseMatrix *tmp = mat; mat = NULL; return tmp; }
/// Returns a const reference to the sparse matrix of eliminated b.c.: $ M_e $
const SparseMatrix &SpMatElim() const
{
MFEM_VERIFY(mat_e, "mat_e is NULL and can't be dereferenced");
return *mat_e;
}
/// Returns a reference to the sparse matrix of eliminated b.c.: $ M_e $
SparseMatrix &SpMatElim()
{
MFEM_VERIFY(mat_e, "mat_e is NULL and can't be dereferenced");
return *mat_e;
}
/// Adds a domain integrator. Assumes ownership of @a bfi.
void AddDomainIntegrator(BilinearFormIntegrator *bfi);
@@ -928,19 +951,19 @@ public:
void AssembleDiagonal_ADAt(const Vector &D, Vector &diag) const;
/// Get the input finite element space prolongation matrix
virtual const Operator *GetProlongation() const
const Operator *GetProlongation() const override
{ return trial_fes->GetProlongationMatrix(); }
/// Get the input finite element space restriction matrix
virtual const Operator *GetRestriction() const
const Operator *GetRestriction() const override
{ return trial_fes->GetRestrictionMatrix(); }
/// Get the test finite element space prolongation matrix
virtual const Operator *GetOutputProlongation() const
const Operator *GetOutputProlongation() const override
{ return test_fes->GetProlongationMatrix(); }
/// Get the test finite element space restriction matrix
virtual const Operator *GetOutputRestriction() const
const Operator *GetOutputRestriction() const override
{ return test_fes->GetRestrictionMatrix(); }
/** @brief For partially conforming trial and/or test FE spaces, complete the
@@ -1005,24 +1028,61 @@ public:
Array<int> &test_vdofs,
int skip_zeros = 1);
/// Eliminate essential boundary DOFs from the columns of the system.
/// Eliminate essential boundary trial DOFs from the system.
/** The array @a bdr_attr_is_ess marks boundary attributes that constitute
the essential part of the boundary. All entries in the columns will be
set to 0.0 through elimination.*/
void EliminateTrialDofs(const Array<int> &bdr_attr_is_ess,
const Vector &sol, Vector &rhs);
the essential part of the boundary. */
void EliminateTrialEssentialBC(const Array<int> &bdr_attr_is_ess,
const Vector &sol, Vector &rhs);
/// Eliminate the list of DOFs from the columns of the system.
/** @a marked_vdofs is the of colunm numbers that will be eliminated. All
entries in the columns will be set to 0.0 through elimination.*/
/// Eliminate essential boundary trial DOFs from the system matrix.
/** The array @a bdr_attr_is_ess marks boundary attributes that constitute
the essential part of the boundary. */
void EliminateTrialEssentialBC(const Array<int> &bdr_attr_is_ess);
/// (DEPRECATED) Eliminate essential boundary trial DOFs from the system.
/** @see EliminateTrialEssentialBC() */
MFEM_DEPRECATED void EliminateTrialDofs(const Array<int> &bdr_attr_is_ess,
const Vector &sol, Vector &rhs)
{ EliminateTrialEssentialBC(bdr_attr_is_ess, sol, rhs); }
/// Eliminate the given trial @a vdofs. NOTE: here, @a vdofs is a list of DOFs.
/** In this case the eliminations are applied to the internal $ M $
and @a rhs without storing the elimination matrix $ M_e $. */
void EliminateTrialVDofs(const Array<int> &vdofs, const Vector &sol,
Vector &rhs);
/// Eliminate the given trial @a vdofs, storing the eliminated part internally in $ M_e $.
/** This method works in conjunction with EliminateTrialVDofsInRHS() and allows
elimination of boundary conditions in multiple right-hand sides. In this
method, @a vdofs is a list of DOFs. */
void EliminateTrialVDofs(const Array<int> &vdofs);
/** @brief Use the stored eliminated part of the matrix (see
EliminateTrialVDofs(const Array<int> &)) to modify the r.h.s.
@a b; @a vdofs is a list of DOFs (non-directional, i.e. >= 0). */
void EliminateTrialVDofsInRHS(const Array<int> &vdofs, const Vector &x,
Vector &b);
/** @brief Similar to
EliminateTrialVDofs(const Array<int> &, const Vector &, Vector &)
but here @a ess_dofs is a marker (boolean) array on all vector-dofs
(@a ess_dofs[i] < 0 is true). */
void EliminateEssentialBCFromTrialDofs(const Array<int> &marked_vdofs,
const Vector &sol, Vector &rhs);
/// Eliminate essential boundary DOFs from the rows of the system.
/// Eliminate essential boundary test DOFs from the system matrix.
/** The array @a bdr_attr_is_ess marks boundary attributes that constitute
the essential part of the boundary. All entries in the rows will be
set to 0.0 through elimination.*/
virtual void EliminateTestDofs(const Array<int> &bdr_attr_is_ess);
the essential part of the boundary. */
void EliminateTestEssentialBC(const Array<int> &bdr_attr_is_ess);
/// (DEPRECATED) Eliminate essential boundary test DOFs from the system.
/** @see EliminateTestEssentialBC() */
MFEM_DEPRECATED virtual void EliminateTestDofs(const Array<int>
&bdr_attr_is_ess)
{ EliminateTestEssentialBC(bdr_attr_is_ess); }
/// Eliminate the given test @a vdofs. NOTE: here, @a vdofs is a list of DOFs.
void EliminateTestVDofs(const Array<int> &vdofs);
/** @brief Return in @a A that is column-constrained.
@@ -1178,7 +1238,7 @@ public:
/** @brief Get the output finite element space restriction matrix in
transposed form. */
virtual const Operator *GetOutputRestrictionTranspose() const
const Operator *GetOutputRestrictionTranspose() const override
{ return test_fes->GetRestrictionTransposeOperator(); }
};
+50 -45
View File
@@ -37,19 +37,19 @@ protected:
public:
BilinearFormExtension(BilinearForm *form);
virtual MemoryClass GetMemoryClass() const
MemoryClass GetMemoryClass() const override
{ return Device::GetDeviceMemoryClass(); }
/// Get the finite element space prolongation matrix
virtual const Operator *GetProlongation() const;
const Operator *GetProlongation() const override;
/// Get the finite element space restriction matrix
virtual const Operator *GetRestriction() const;
const Operator *GetRestriction() const override;
/// Assemble at the level given for the BilinearFormExtension subclass
virtual void Assemble() = 0;
virtual void AssembleDiagonal(Vector &diag) const
void AssembleDiagonal(Vector &diag) const override
{
MFEM_ABORT("AssembleDiagonal not implemented for this assembly level!");
}
@@ -83,16 +83,17 @@ protected:
public:
PABilinearFormExtension(BilinearForm*);
void Assemble();
void AssembleDiagonal(Vector &diag) const;
void FormSystemMatrix(const Array<int> &ess_tdof_list, OperatorHandle &A);
void Assemble() override;
void AssembleDiagonal(Vector &diag) const override;
void FormSystemMatrix(const Array<int> &ess_tdof_list,
OperatorHandle &A) override;
void FormLinearSystem(const Array<int> &ess_tdof_list,
Vector &x, Vector &b,
OperatorHandle &A, Vector &X, Vector &B,
int copy_interior = 0);
void Mult(const Vector &x, Vector &y) const;
void MultTranspose(const Vector &x, Vector &y) const;
void Update();
int copy_interior = 0) override;
void Mult(const Vector &x, Vector &y) const override;
void MultTranspose(const Vector &x, Vector &y) const override;
void Update() override;
protected:
void SetupRestrictionOperators(const L2FaceValues m);
@@ -150,9 +151,9 @@ protected:
public:
EABilinearFormExtension(BilinearForm *form);
void Assemble();
void Mult(const Vector &x, Vector &y) const;
void MultTranspose(const Vector &x, Vector &y) const;
void Assemble() override;
void Mult(const Vector &x, Vector &y) const override;
void MultTranspose(const Vector &x, Vector &y) const override;
};
/// Data and methods for fully-assembled bilinear forms
@@ -165,18 +166,19 @@ private:
public:
FABilinearFormExtension(BilinearForm *form);
void Assemble();
void Assemble() override;
void RAP(OperatorHandle &A);
/** @note Always does `DIAG_ONE` policy to be consistent with
`Operator::FormConstrainedSystemOperator`. */
void EliminateBC(const Array<int> &ess_dofs, OperatorHandle &A);
void FormSystemMatrix(const Array<int> &ess_tdof_list, OperatorHandle &A);
void FormSystemMatrix(const Array<int> &ess_tdof_list,
OperatorHandle &A) override;
void FormLinearSystem(const Array<int> &ess_tdof_list,
Vector &x, Vector &b,
OperatorHandle &A, Vector &X, Vector &B,
int copy_interior = 0);
void Mult(const Vector &x, Vector &y) const;
void MultTranspose(const Vector &x, Vector &y) const;
int copy_interior = 0) override;
void Mult(const Vector &x, Vector &y) const override;
void MultTranspose(const Vector &x, Vector &y) const override;
/** DGMult and DGMultTranspose use the extended L-vector to perform the
computation. */
@@ -199,16 +201,17 @@ protected:
public:
MFBilinearFormExtension(BilinearForm *form);
void Assemble();
void AssembleDiagonal(Vector &diag) const;
void FormSystemMatrix(const Array<int> &ess_tdof_list, OperatorHandle &A);
void Assemble() override;
void AssembleDiagonal(Vector &diag) const override;
void FormSystemMatrix(const Array<int> &ess_tdof_list,
OperatorHandle &A) override;
void FormLinearSystem(const Array<int> &ess_tdof_list,
Vector &x, Vector &b,
OperatorHandle &A, Vector &X, Vector &B,
int copy_interior = 0);
void Mult(const Vector &x, Vector &y) const;
void MultTranspose(const Vector &x, Vector &y) const;
void Update();
int copy_interior = 0) override;
void Mult(const Vector &x, Vector &y) const override;
void MultTranspose(const Vector &x, Vector &y) const override;
void Update() override;
};
/// Class extending the MixedBilinearForm class to support different AssemblyLevels.
@@ -225,20 +228,20 @@ protected:
public:
MixedBilinearFormExtension(MixedBilinearForm *form);
virtual MemoryClass GetMemoryClass() const
MemoryClass GetMemoryClass() const override
{ return Device::GetMemoryClass(); }
/// Get the finite element space prolongation matrix
virtual const Operator *GetProlongation() const;
const Operator *GetProlongation() const override;
/// Get the finite element space restriction matrix
virtual const Operator *GetRestriction() const;
const Operator *GetRestriction() const override;
/// Get the output finite element space restriction matrix
virtual const Operator *GetOutputProlongation() const;
const Operator *GetOutputProlongation() const override;
/// Get the output finite element space restriction matrix
virtual const Operator *GetOutputRestriction() const;
const Operator *GetOutputRestriction() const override;
virtual void Assemble() = 0;
virtual void FormRectangularSystemOperator(const Array<int> &trial_tdof_list,
@@ -273,7 +276,7 @@ public:
PAMixedBilinearFormExtension(MixedBilinearForm *form);
/// Partial assembly of all internal integrators
void Assemble();
void Assemble() override;
/**
@brief Setup OperatorHandle A to contain constrained linear operator
@@ -283,7 +286,7 @@ public:
*/
void FormRectangularSystemOperator(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list,
OperatorHandle &A);
OperatorHandle &A) override;
/**
Setup OperatorHandle A to contain constrained linear operator and
eliminate columns corresponding to essential dofs from system,
@@ -292,20 +295,21 @@ public:
void FormRectangularLinearSystem(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list,
Vector &x, Vector &b,
OperatorHandle &A, Vector &X, Vector &B);
OperatorHandle &A, Vector &X, Vector &B) override;
/// y = A*x
void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/// y += c*A*x
void AddMult(const Vector &x, Vector &y, const real_t c=1.0) const;
void AddMult(const Vector &x, Vector &y, const real_t c=1.0) const override;
/// y = A^T*x
void MultTranspose(const Vector &x, Vector &y) const;
void MultTranspose(const Vector &x, Vector &y) const override;
/// y += c*A^T*x
void AddMultTranspose(const Vector &x, Vector &y, const real_t c=1.0) const;
void AddMultTranspose(const Vector &x, Vector &y,
const real_t c=1.0) const override;
/// Assemble the diagonal of ADA^T for a diagonal vector D.
void AssembleDiagonal_ADAt(const Vector &D, Vector &diag) const;
void AssembleDiagonal_ADAt(const Vector &D, Vector &diag) const override;
/// Update internals for when a new MixedBilinearForm is given to this class
void Update();
void Update() override;
};
@@ -322,16 +326,17 @@ public:
PADiscreteLinearOperatorExtension(DiscreteLinearOperator *linop);
/// Partial assembly of all internal integrators
void Assemble();
void Assemble() override;
void AddMult(const Vector &x, Vector &y, const real_t c=1.0) const;
void AddMult(const Vector &x, Vector &y, const real_t c=1.0) const override;
void AddMultTranspose(const Vector &x, Vector &y, const real_t c=1.0) const;
void AddMultTranspose(const Vector &x, Vector &y,
const real_t c=1.0) const override;
void FormRectangularSystemOperator(const Array<int>&, const Array<int>&,
OperatorHandle& A);
OperatorHandle& A) override;
const Operator * GetOutputRestrictionTranspose() const;
const Operator * GetOutputRestrictionTranspose() const override;
private:
Vector test_multiplicity;
+12 -12
View File
@@ -4390,8 +4390,8 @@ struct ShapeCoefficient : public VectorCoefficient
: VectorCoefficient(fe_.GetDof()), Q(q), fe(fe_) { }
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override
{
V.SetSize(vdim);
fe.CalcPhysShape(T, V);
@@ -4433,8 +4433,8 @@ ScalarVectorProductInterpolator::AssembleElementMatrix2(
VShapeCoefficient(Coefficient &q, const FiniteElement &fe_, int sdim)
: MatrixCoefficient(fe_.GetDof(), sdim), Q(q), fe(fe_) { }
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override
{
M.SetSize(height, width);
fe.CalcPhysVShape(T, M);
@@ -4470,8 +4470,8 @@ VectorScalarProductInterpolator::AssembleElementMatrix2(
: MatrixCoefficient(fe_.GetDof(), vq.GetVDim()), VQ(vq), fe(fe_),
vc(width), shape(height) { }
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override
{
M.SetSize(height, width);
VQ.Eval(vc, T, ip);
@@ -4510,8 +4510,8 @@ ScalarCrossProductInterpolator::AssembleElementMatrix2(
vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override
{
V.SetSize(vdim);
VQ.Eval(vc, T, ip);
@@ -4554,8 +4554,8 @@ VectorCrossProductInterpolator::AssembleElementMatrix2(
MFEM_ASSERT(width == 3, "");
}
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override
{
M.SetSize(height, width);
VQ.Eval(vc, T, ip);
@@ -4603,8 +4603,8 @@ struct VDotVShapeCoefficient : public VectorCoefficient
vshape(vdim, vq.GetVDim()), vc(vq.GetVDim()) { }
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override
{
V.SetSize(vdim);
VQ.Eval(vc, T, ip);
+514 -469
View File
File diff suppressed because it is too large Load Diff
+156 -156
View File
@@ -90,12 +90,12 @@ public:
explicit ConstantCoefficient(real_t c = 1.0) { constant=c; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{ return (constant); }
/// Fill the QuadratureFunction @a qf with the constant value.
void Project(QuadratureFunction &qf);
void Project(QuadratureFunction &qf) override;
};
/** @brief A piecewise constant coefficient with the constants keyed
@@ -130,8 +130,8 @@ public:
int GetNConst() { return constants.Size(); }
/// Evaluate the coefficient.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/** @brief A piecewise coefficient with the pieces keyed off the element
@@ -195,7 +195,7 @@ public:
{ InitMap(attr, coefs); }
/// Set the time for time dependent coefficients
virtual void SetTime(real_t t);
void SetTime(real_t t) override;
/// Replace a set of coefficients
void UpdateCoefficients(const Array<int> & attr,
@@ -211,8 +211,8 @@ public:
{ pieces.erase(attr); }
/// Evaluate the coefficient.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// A general function coefficient
@@ -254,8 +254,8 @@ public:
}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// A common base class for returning individual components of the domain's
@@ -271,8 +271,8 @@ protected:
public:
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient which returns the x-component of the evaluation point
@@ -307,8 +307,8 @@ public:
CylindricalRadialCoefficient() : transip(3) {}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient which returns the angular position or azimuth (often
@@ -323,8 +323,8 @@ public:
CylindricalAzimuthalCoefficient() : transip(3) {}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient which returns the height or altitude of
@@ -342,8 +342,8 @@ public:
SphericalRadialCoefficient() : transip(3) {}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient which returns the azimuthal angle (often denoted by phi)
@@ -357,8 +357,8 @@ public:
SphericalAzimuthalCoefficient() : transip(3) {}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient which returns the polar angle (often denoted by theta)
@@ -372,8 +372,8 @@ public:
SphericalPolarCoefficient() : transip(3) {}
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
class GridFunction;
@@ -399,15 +399,15 @@ public:
const GridFunction * GetGridFunction() const { return GridF; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
/// @brief Fill the QuadratureFunction @a qf by evaluating the coefficient at
/// the quadrature points.
///
/// This function uses the efficient QuadratureFunction::ProjectGridFunction
/// to fill the QuadratureFunction.
virtual void Project(QuadratureFunction &qf);
void Project(QuadratureFunction &qf) override;
};
@@ -433,10 +433,10 @@ public:
: Q1(q1), Q2(q2), Transform2(std::move(F)) { Transform1 = 0; }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
};
/** @brief Delta function coefficient optionally multiplied by a weight
@@ -488,7 +488,7 @@ public:
}
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Set the center location of the delta function.
void SetDeltaCenter(const Vector& center);
@@ -534,7 +534,7 @@ public:
virtual real_t EvalDelta(ElementTransformation &T, const IntegrationPoint &ip);
/** @brief A DeltaFunction cannot be evaluated. Calling this method will
cause an MFEM error, terminating the application. */
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
{ mfem_error("DeltaCoefficient::Eval"); return 0.; }
virtual ~DeltaCoefficient() { delete weight; }
};
@@ -555,10 +555,10 @@ public:
{ c = &c_; attr.Copy(active_attr); }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
{ return active_attr[T.Attribute-1] ? c->Eval(T, ip, GetTime()) : 0.0; }
};
@@ -628,8 +628,8 @@ public:
using VectorCoefficient::Eval;
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) { V = vec; }
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override { V = vec; }
/// Return a reference to the constant vector in this class.
const Vector& GetVec() const { return vec; }
@@ -698,7 +698,7 @@ public:
: VectorCoefficient(vd) { InitMap(attr, coefs); }
/// Set the time for time dependent coefficients
virtual void SetTime(real_t t);
void SetTime(real_t t) override;
/// Replace a set of coefficients
void UpdateCoefficients(const Array<int> & attr,
@@ -713,8 +713,8 @@ public:
{ pieces.erase(attr); }
/// Evaluate the coefficient.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -728,8 +728,8 @@ public:
using VectorCoefficient::Eval;
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~PositionVectorCoefficient() { }
};
@@ -765,8 +765,8 @@ public:
using VectorCoefficient::Eval;
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~VectorFunctionCoefficient() { }
};
@@ -787,7 +787,7 @@ public:
explicit VectorArrayCoefficient(int dim);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Returns i'th coefficient.
Coefficient* GetCoeff(int i) { return Coeff[i]; }
@@ -806,8 +806,8 @@ public:
using VectorCoefficient::Eval;
/** @brief Evaluate the coefficient. Each element of vector V comes from the
associated array of scalar coefficients. */
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
/// Destroys vector coefficient.
virtual ~VectorArrayCoefficient();
@@ -836,21 +836,21 @@ public:
const GridFunction * GetGridFunction() const { return GridFunc; }
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
/** @brief Evaluate the vector coefficients at all of the locations in the
integration rule and write the vectors into the columns of matrix @a
M. */
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir) override;
/// @brief Fill the QuadratureFunction @a qf by evaluating the coefficient at
/// the quadrature points.
///
/// This function uses the efficient QuadratureFunction::ProjectGridFunction
/// to fill the QuadratureFunction.
virtual void Project(QuadratureFunction &qf);
void Project(QuadratureFunction &qf) override;
virtual ~VectorGridFunctionCoefficient() { }
};
@@ -874,14 +874,14 @@ public:
const GridFunction * GetGridFunction() const { return GridFunc; }
/// Evaluate the gradient vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
/** @brief Evaluate the gradient vector coefficient at all of the locations
in the integration rule and write the vectors into columns of matrix @a
M. */
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir) override;
virtual ~GradientGridFunctionCoefficient() { }
};
@@ -905,8 +905,8 @@ public:
using VectorCoefficient::Eval;
/// Evaluate the vector curl coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~CurlGridFunctionCoefficient() { }
};
@@ -929,8 +929,8 @@ public:
const GridFunction * GetGridFunction() const { return GridFunc; }
/// Evaluate the scalar divergence coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~DivergenceGridFunctionCoefficient() { }
};
@@ -973,7 +973,7 @@ public:
: VectorCoefficient(dir_.Size()), dir(dir_), d(x,y,z,s) { }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Replace the associated DeltaCoefficient with a new DeltaCoefficient.
/** The new DeltaCoefficient cannot have a specified weight Coefficient, i.e.
@@ -998,8 +998,8 @@ public:
using VectorCoefficient::Eval;
/** @brief A VectorDeltaFunction cannot be evaluated. Calling this method
will cause an MFEM error, terminating the application. */
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip)
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override
{ mfem_error("VectorDeltaCoefficient::Eval"); }
virtual ~VectorDeltaCoefficient() { }
};
@@ -1021,17 +1021,17 @@ public:
{ c = &vc; attr.Copy(active_attr); }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
/** @brief Evaluate the vector coefficient at all of the locations in the
integration rule and write the vectors into the columns of matrix @a
M. */
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationRule &ir) override;
};
typedef VectorCoefficient DiagonalMatrixCoefficient;
@@ -1113,8 +1113,8 @@ public:
: MatrixCoefficient(m.Height(), m.Width()), mat(m) { }
using MatrixCoefficient::Eval;
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) { M = mat; }
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override { M = mat; }
/// Return a reference to the constant matrix.
const DenseMatrix& GetMatrix() { return mat; }
};
@@ -1207,7 +1207,7 @@ public:
: MatrixCoefficient(h, w, symm) { InitMap(attr, coefs); }
/// Set the time for time dependent coefficients
virtual void SetTime(real_t t);
void SetTime(real_t t) override;
/// Replace a set of coefficients
void UpdateCoefficients(const Array<int> & attr,
@@ -1222,8 +1222,8 @@ public:
{ pieces.erase(attr); }
/// Evaluate the coefficient.
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/** @brief A matrix coefficient with an optional scalar coefficient multiplier
@@ -1280,16 +1280,16 @@ public:
{ }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
/// (DEPRECATED) Evaluate the symmetric matrix coefficient at @a ip.
/** @deprecated Use Eval() instead. */
virtual void EvalSymmetric(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip);
void EvalSymmetric(Vector &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~MatrixFunctionCoefficient() { }
};
@@ -1310,7 +1310,7 @@ public:
explicit MatrixArrayCoefficient (int dim);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Get the coefficient located at (i,j) in the matrix.
Coefficient* GetCoeff (int i, int j) { return Coeff[i*width+j]; }
@@ -1328,8 +1328,8 @@ public:
{ return Coeff[i*width+j] ? Coeff[i*width+j] -> Eval(T, ip, GetTime()) : 0.0; }
/// Evaluate the matrix coefficient @a ip.
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~MatrixArrayCoefficient();
};
@@ -1392,11 +1392,11 @@ public:
{ c = &mc; attr.Copy(active_attr); }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Coefficients based on sums, products, or other functions of coefficients.
@@ -1425,7 +1425,7 @@ public:
: aConst(0.0), a(&A), b(&B), alpha(alpha_), beta(beta_) { }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first term in the linear combination as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -1453,8 +1453,8 @@ public:
real_t GetBeta() const { return beta; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{
return alpha * ((a == NULL ) ? aConst : a->Eval(T, ip) )
+ beta * b->Eval(T, ip);
@@ -1502,8 +1502,8 @@ public:
@note When this method is called, the caller must make sure that the
IntegrationPoint associated with @a T is the same as @a ip. This can be
achieved by calling T.SetIntPoint(&ip). */
virtual void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
/// @deprecated Return a reference to the internal matrix used when evaluating this coefficient as a DenseMatrix.
@@ -1525,8 +1525,8 @@ public:
: SymmetricMatrixCoefficient(m.Height()), mat(m) { }
using SymmetricMatrixCoefficient::Eval;
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseSymmetricMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) { M = mat; }
void Eval(DenseSymmetricMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override { M = mat; }
/// Return a reference to the constant matrix.
const DenseSymmetricMatrix& GetMatrix() { return mat; }
@@ -1576,12 +1576,12 @@ public:
{ }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
using SymmetricMatrixCoefficient::Eval;
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseSymmetricMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseSymmetricMatrix &K, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual ~SymmetricMatrixFunctionCoefficient() { }
};
@@ -1606,7 +1606,7 @@ public:
: aConst(0.0), a(&A), b(&B) { }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first term in the product as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -1624,8 +1624,8 @@ public:
Coefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{ return ((a == NULL ) ? aConst : a->Eval(T, ip) ) * b->Eval(T, ip); }
};
@@ -1654,7 +1654,7 @@ public:
: aConst(0.0), bConst(B), a(&A), b(NULL) { }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the numerator in the ratio as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -1677,8 +1677,8 @@ public:
Coefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{
real_t den = (b == NULL ) ? bConst : b->Eval(T, ip);
MFEM_ASSERT(den != 0.0, "Division by zero in RatioCoefficient");
@@ -1700,7 +1700,7 @@ public:
: a(&A), p(p_) { }
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the base coefficient
void SetACoef(Coefficient &A) { a = &A; }
@@ -1713,8 +1713,8 @@ public:
real_t GetExponent() const { return p; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip)
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override
{ return pow(a->Eval(T, ip), p); }
};
@@ -1733,7 +1733,7 @@ public:
InnerProductCoefficient(VectorCoefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first vector in the inner product
void SetACoef(VectorCoefficient &A) { a = &A; }
@@ -1746,8 +1746,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient defined as a cross product of two vectors in the xy-plane.
@@ -1765,7 +1765,7 @@ public:
VectorRotProductCoefficient(VectorCoefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first vector in the product
void SetACoef(VectorCoefficient &A) { a = &A; }
@@ -1778,8 +1778,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient defined as the determinant of a matrix coefficient
@@ -1795,7 +1795,7 @@ public:
DeterminantCoefficient(MatrixCoefficient &A);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -1803,8 +1803,8 @@ public:
MatrixCoefficient * GetACoef() const { return a; }
/// Evaluate the determinant coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Scalar coefficient defined as the trace of a matrix coefficient
@@ -1820,7 +1820,7 @@ public:
TraceCoefficient(MatrixCoefficient &A);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -1828,8 +1828,8 @@ public:
MatrixCoefficient * GetACoef() const { return a; }
/// Evaluate the trace coefficient at @a ip.
virtual real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Vector coefficient defined as the linear combination of two vectors
@@ -1866,7 +1866,7 @@ public:
Coefficient &alpha_, Coefficient &beta_);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first vector coefficient
void SetACoef(VectorCoefficient &A_) { ACoef = &A_; }
@@ -1909,8 +1909,8 @@ public:
real_t GetBeta() const { return beta; }
/// Evaluate the coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -1930,7 +1930,7 @@ public:
ScalarVectorProductCoefficient(Coefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the scalar factor as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -1948,8 +1948,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -1971,7 +1971,7 @@ public:
NormalizedVectorCoefficient(VectorCoefficient &A, real_t tol = 1e-6);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the vector coefficient
void SetACoef(VectorCoefficient &A) { a = &A; }
@@ -1979,8 +1979,8 @@ public:
VectorCoefficient * GetACoef() const { return a; }
/// Evaluate the coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -1999,7 +1999,7 @@ public:
VectorCrossProductCoefficient(VectorCoefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first term in the product
void SetACoef(VectorCoefficient &A) { a = &A; }
@@ -2012,8 +2012,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -2033,7 +2033,7 @@ public:
MatrixVectorProductCoefficient(MatrixCoefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -2046,8 +2046,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the vector coefficient at @a ip.
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
using VectorCoefficient::Eval;
};
@@ -2066,8 +2066,8 @@ public:
: MatrixCoefficient(d, d), dim(d) { }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the linear combination of two matrices
@@ -2088,7 +2088,7 @@ public:
real_t alpha_ = 1.0, real_t beta_ = 1.0);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -2111,8 +2111,8 @@ public:
real_t GetBeta() const { return beta; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the product of two matrices
@@ -2140,8 +2140,8 @@ public:
MatrixCoefficient * GetBCoef() const { return b; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/** @brief Matrix coefficient defined as a product of a scalar coefficient and a
@@ -2161,7 +2161,7 @@ public:
ScalarMatrixProductCoefficient(Coefficient &A, MatrixCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the scalar factor as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -2179,8 +2179,8 @@ public:
MatrixCoefficient * GetBCoef() const { return b; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the transpose of a matrix coefficient
@@ -2194,7 +2194,7 @@ public:
TransposeMatrixCoefficient(MatrixCoefficient &A);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -2202,8 +2202,8 @@ public:
MatrixCoefficient * GetACoef() const { return a; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the inverse of a matrix coefficient.
@@ -2217,7 +2217,7 @@ public:
InverseMatrixCoefficient(MatrixCoefficient &A);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -2225,8 +2225,8 @@ public:
MatrixCoefficient * GetACoef() const { return a; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the exponential of a matrix coefficient.
@@ -2240,7 +2240,7 @@ public:
ExponentialMatrixCoefficient(MatrixCoefficient &A);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the matrix coefficient
void SetACoef(MatrixCoefficient &A) { a = &A; }
@@ -2248,8 +2248,8 @@ public:
MatrixCoefficient * GetACoef() const { return a; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/// Matrix coefficient defined as the outer product of two vector coefficients.
@@ -2267,7 +2267,7 @@ public:
OuterProductCoefficient(VectorCoefficient &A, VectorCoefficient &B);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the first vector in the outer product
void SetACoef(VectorCoefficient &A) { a = &A; }
@@ -2280,8 +2280,8 @@ public:
VectorCoefficient * GetBCoef() const { return b; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
/** @brief Matrix coefficient defined as -a k x k x, for a vector k and scalar a
@@ -2305,7 +2305,7 @@ public:
CrossCrossCoefficient(Coefficient &A, VectorCoefficient &K);
/// Set the time for internally stored coefficients
void SetTime(real_t t);
void SetTime(real_t t) override;
/// Reset the scalar factor as a constant
void SetAConst(real_t A) { a = NULL; aConst = A; }
@@ -2323,8 +2323,8 @@ public:
VectorCoefficient * GetKCoef() const { return k; }
/// Evaluate the matrix coefficient at @a ip.
virtual void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(DenseMatrix &M, ElementTransformation &T,
const IntegrationPoint &ip) override;
};
///@}
@@ -2349,10 +2349,10 @@ public:
const QuadratureFunction& GetQuadFunction() const { return QuadF; }
using VectorCoefficient::Eval;
virtual void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip);
void Eval(Vector &V, ElementTransformation &T,
const IntegrationPoint &ip) override;
virtual void Project(QuadratureFunction &qf);
void Project(QuadratureFunction &qf) override;
virtual ~VectorQuadratureFunctionCoefficient() { }
};
@@ -2371,9 +2371,9 @@ public:
const QuadratureFunction& GetQuadFunction() const { return QuadF; }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
virtual void Project(QuadratureFunction &qf);
void Project(QuadratureFunction &qf) override;
virtual ~QuadratureFunctionCoefficient() { }
};
+11 -11
View File
@@ -454,28 +454,28 @@ public:
#endif
/// Set/change the mesh associated with the collection
virtual void SetMesh(Mesh *new_mesh) override;
void SetMesh(Mesh *new_mesh) override;
#ifdef MFEM_USE_MPI
/// Set/change the mesh associated with the collection.
virtual void SetMesh(MPI_Comm comm, Mesh *new_mesh) override;
void SetMesh(MPI_Comm comm, Mesh *new_mesh) override;
#endif
/// Add a grid function to the collection and update the root file
virtual void RegisterField(const std::string& field_name,
GridFunction *gf) override;
void RegisterField(const std::string& field_name,
GridFunction *gf) override;
/// Add a quadrature function to the collection and update the root file.
/** Visualization of quadrature function is not supported in VisIt(3.12).
A patch has been sent to VisIt developers in June 2020. */
virtual void RegisterQField(const std::string& q_field_name,
QuadratureFunction *qf) override;
void RegisterQField(const std::string& q_field_name,
QuadratureFunction *qf) override;
/// Set the number of digits used for both the cycle and the MPI rank
/// @note VisIt seems to require 6 pad digits for the MPI rank. Therefore,
/// this function uses this default value. This behavior can be overridden
/// by calling SetPadDigitsCycle() and SetPadDigitsRank() instead.
virtual void SetPadDigits(int digits) override
void SetPadDigits(int digits) override
{ pad_digits_cycle=digits; pad_digits_rank=6; }
/// Set VisIt parameter: default levels of detail for the MultiresControl
@@ -489,13 +489,13 @@ public:
void DeleteAll();
/// Save the collection and a VisIt root file
virtual void Save() override;
void Save() override;
/// Save a VisIt root file for the collection
void SaveRootFile();
/// Load the collection based on its VisIt data (described in its root file)
virtual void Load(int cycle_ = 0) override;
void Load(int cycle_ = 0) override;
/// We will delete the mesh and fields if we own them
virtual ~VisItDataCollection() {}
@@ -546,7 +546,7 @@ public:
/// Save the collection - the directory name is constructed based on the
/// cycle value
virtual void Save() override;
void Save() override;
/// Set the data format for the ParaView output files. Possible options are
/// VTKFormat::ASCII, VTKFormat::BINARY, and VTKFormat::BINARY32.
@@ -590,7 +590,7 @@ public:
void UseRestartMode(bool restart_mode_);
/// Load the collection - not implemented in the ParaView writer
virtual void Load(int cycle_ = 0) override;
void Load(int cycle_ = 0) override;
};
}
+15 -15
View File
@@ -385,10 +385,10 @@ private:
/** @brief Evaluate the Jacobian of the transformation at the IntPoint and
store it in dFdx. */
virtual const DenseMatrix &EvalJacobian();
const DenseMatrix &EvalJacobian() override;
// Evaluate the Hessian of the transformation at the IntPoint and store it
// in d2Fdx2.
virtual const DenseMatrix &EvalHessian();
const DenseMatrix &EvalHessian() override;
public:
IsoparametricTransformation() : FElem(NULL) {}
@@ -430,32 +430,32 @@ public:
/** @brief Transform integration point from reference coordinates to
physical coordinates and store them in the vector. */
virtual void Transform(const IntegrationPoint &, Vector &);
void Transform(const IntegrationPoint &, Vector &) override;
/** @brief Transform all the integration points from the integration rule
from reference coordinates to physical
coordinates and store them as column vectors in the matrix. */
virtual void Transform(const IntegrationRule &, DenseMatrix &);
void Transform(const IntegrationRule &, DenseMatrix &) override;
/** @brief Transform all the integration points from the column vectors
of @a matrix from reference coordinates to physical
coordinates and store them as column vectors in @a result. */
virtual void Transform(const DenseMatrix &matrix, DenseMatrix &result);
void Transform(const DenseMatrix &matrix, DenseMatrix &result) override;
/// Return the order of the current element we are using for the transformation.
virtual int Order() const { return FElem->GetOrder(); }
int Order() const override { return FElem->GetOrder(); }
/// Return the order of the elements of the Jacobian of the transformation.
virtual int OrderJ() const;
int OrderJ() const override;
/** @brief Return the order of the determinant of the Jacobian (weight)
of the transformation. */
virtual int OrderW() const;
int OrderW() const override;
/// Return the order of $ adj(J)^T \nabla fi $
virtual int OrderGrad(const FiniteElement *fe) const;
int OrderGrad(const FiniteElement *fe) const override;
virtual int GetSpaceDim() const { return PointMat.Height(); }
int GetSpaceDim() const override { return PointMat.Height(); }
/** @brief Transform a point @a pt from physical space to a point @a ip in
reference space and optionally can set a solver tolerance using @a phys_tol. */
@@ -463,8 +463,8 @@ public:
point in physical space. If the inversion fails a non-zero value is
returned. This method is not 100 percent reliable for non-linear
transformations. */
virtual int TransformBack(const Vector & v, IntegrationPoint & ip,
const real_t phys_rel_tol = tol_0)
int TransformBack (const Vector & v, IntegrationPoint & ip,
const real_t phys_rel_tol = tol_0) override
{
InverseElementTransformation inv_tr(this);
inv_tr.SetPhysicalRelTol(phys_rel_tol);
@@ -604,9 +604,9 @@ public:
has been configured. */
const IntegrationPoint &GetElement2IntPoint() { return eip2; }
virtual void Transform(const IntegrationPoint &, Vector &);
virtual void Transform(const IntegrationRule &, DenseMatrix &);
virtual void Transform(const DenseMatrix &matrix, DenseMatrix &result);
void Transform(const IntegrationPoint &, Vector &) override;
void Transform(const IntegrationRule &, DenseMatrix &) override;
void Transform(const DenseMatrix &matrix, DenseMatrix &result) override;
ElementTransformation & GetElement1Transformation();
ElementTransformation & GetElement2Transformation();
+13 -13
View File
@@ -172,10 +172,10 @@ public:
void SetFluxAveraging(int fa) { flux_averaging = fa; }
/// Return the total error from the last error estimate.
virtual real_t GetTotalError() const override { return total_error; }
real_t GetTotalError() const override { return total_error; }
/// Get a Vector with all element errors.
virtual const Vector &GetLocalErrors() override
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
@@ -184,14 +184,14 @@ public:
/** @brief Get an Array<int> with anisotropic flags for all mesh elements.
Return an empty array when anisotropic estimates are not available or
enabled. */
virtual const Array<int> &GetAnisotropicFlags() override
const Array<int> &GetAnisotropicFlags() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return aniso_flags;
}
/// Reset the error estimator.
virtual void Reset() override { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
/** @brief Destroy a ZienkiewiczZhuEstimator object. Destroys, if owned, the
FiniteElementSpace, flux_space. */
@@ -298,17 +298,17 @@ public:
}
/// Return the total error from the last error estimate.
virtual real_t GetTotalError() const override { return total_error; }
real_t GetTotalError() const override { return total_error; }
/// Get a Vector with all element errors.
virtual const Vector &GetLocalErrors() override
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
}
/// Reset the error estimator.
virtual void Reset() override { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
virtual ~LSZienkiewiczZhuEstimator() { }
};
@@ -411,17 +411,17 @@ public:
void SetLocalErrorNormP(int p) { local_norm_p = p; }
/// Return the total error from the last error estimate.
virtual real_t GetTotalError() const override { return total_error; }
real_t GetTotalError() const override { return total_error; }
/// Get a Vector with all element errors.
virtual const Vector &GetLocalErrors() override
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
}
/// Reset the error estimator.
virtual void Reset() override { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
/** @brief Destroy a L2ZienkiewiczZhuEstimator object. Destroys, if owned,
the FiniteElementSpace, flux_space. */
@@ -505,10 +505,10 @@ public:
void SetCoef(VectorCoefficient &A) { vcoef = &A; }
/// Reset the error estimator.
virtual void Reset() override { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
/// Get a Vector with all element errors.
virtual const Vector &GetLocalErrors() override
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
@@ -661,7 +661,7 @@ public:
/// Reset the error estimator.
void Reset() override { current_sequence = -1; };
virtual real_t GetTotalError() const override { return total_error; }
real_t GetTotalError() const override { return total_error; }
/** @brief Change the method to compute hₑ on a per-element basis.
@param compute_element_coefficient_
+324 -324
View File
File diff suppressed because it is too large Load Diff
+31 -31
View File
@@ -28,12 +28,12 @@ private:
public:
/// Construct the H1_SegmentElement of order @a p and BasisType @a btype
H1_SegmentElement(const int p, const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -49,12 +49,12 @@ public:
/// Construct the H1_QuadrilateralElement of order @a p and BasisType @a btype
H1_QuadrilateralElement(const int p,
const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -70,12 +70,12 @@ private:
public:
/// Construct the H1_HexahedronElement of order @a p and BasisType @a btype
H1_HexahedronElement(const int p, const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &Hessian) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -93,11 +93,11 @@ private:
public:
/// Construct the H1_TriangleElement of order @a p and BasisType @a btype
H1_TriangleElement(const int p, const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &ddshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &ddshape) const override;
};
@@ -117,11 +117,11 @@ public:
/// Construct the H1_TetrahedronElement of order @a p and BasisType @a btype
H1_TetrahedronElement(const int p,
const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &ddshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian(const IntegrationPoint &ip,
DenseMatrix &ddshape) const override;
};
@@ -143,9 +143,9 @@ public:
/// Construct the H1_WedgeElement of order @a p and BasisType @a btype
H1_WedgeElement(const int p,
const int btype = BasisType::GaussLobatto);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
} // namespace mfem
+49 -49
View File
@@ -28,13 +28,13 @@ private:
public:
/// Construct the L2_SegmentElement of order @a p and BasisType @a btype
L2_SegmentElement(const int p, const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
};
@@ -52,25 +52,25 @@ public:
/// Construct the L2_QuadrilateralElement of order @a p and BasisType @a btype
L2_QuadrilateralElement(const int p,
const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_2D(fe, Trans, curl); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
using FiniteElement::Project;
virtual void ProjectDiv(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &div) const;
virtual void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const;
void ProjectDiv(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &div) const override;
void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const override;
};
@@ -86,21 +86,21 @@ public:
/// Construct the L2_HexahedronElement of order @a p and BasisType @a btype
L2_HexahedronElement(const int p,
const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
using FiniteElement::Project;
virtual void ProjectDiv(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &div) const;
virtual void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const;
void ProjectDiv(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &div) const override;
void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const override;
};
@@ -118,17 +118,17 @@ public:
/// Construct the L2_TriangleElement of order @a p and BasisType @a btype
L2_TriangleElement(const int p,
const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_2D(fe, Trans, curl); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
};
@@ -149,13 +149,13 @@ public:
/// Construct the L2_TetrahedronElement of order @a p and BasisType @a btype
L2_TetrahedronElement(const int p,
const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
};
@@ -178,9 +178,9 @@ public:
/// Construct the L2_WedgeElement of order @a p and BasisType @a btype
L2_WedgeElement(const int p,
const int btype = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
} // namespace mfem
+242 -235
View File
@@ -36,62 +36,63 @@ public:
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{
if (obasis1d.IsIntegratedType()) { ProjectIntegrated(vc, Trans, dofs); }
else { Project_ND(tk, dof2tk, vc, Trans, dofs); }
}
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
virtual void GetFaceMap(const int face_id, Array<int> &face_map) const;
void GetFaceMap(const int face_id, Array<int> &face_map) const override;
protected:
void ProjectIntegrated(VectorCoefficient &vc,
@@ -118,46 +119,47 @@ public:
ND_QuadrilateralElement(const int p,
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{
if (obasis1d.IsIntegratedType()) { ProjectIntegrated(vc, Trans, dofs); }
else { Project_ND(tk, dof2tk, vc, Trans, dofs); }
}
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
virtual void GetFaceMap(const int face_id, Array<int> &face_map) const;
void GetFaceMap(const int face_id, Array<int> &face_map) const override;
protected:
void ProjectIntegrated(VectorCoefficient &vc,
@@ -184,47 +186,48 @@ class ND_TetrahedronElement : public VectorFiniteElement
public:
/// Construct the ND_TetrahedronElement of order @a p
ND_TetrahedronElement(const int p);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
virtual const StatelessDofTransformation *GetDofTransformation() const
const StatelessDofTransformation *GetDofTransformation() const override
{ return &doftrans; }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
};
@@ -247,42 +250,43 @@ class ND_TriangleElement : public VectorFiniteElement
public:
/// Construct the ND_TriangleElement of order @a p
ND_TriangleElement(const int p);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
virtual const StatelessDofTransformation *GetDofTransformation() const
const StatelessDofTransformation *GetDofTransformation() const override
{ return &doftrans; }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
};
@@ -298,39 +302,40 @@ public:
/** @brief Construct the ND_SegmentElement of order @a p and open
BasisType @a ob_type */
ND_SegmentElement(const int p, const int ob_type = BasisType::GaussLegendre);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override
{ obasis1d.Eval(ip.x, shape); }
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
// virtual void CalcCurlShape(const IntegrationPoint &ip,
// void CalcCurlShape(const IntegrationPoint &ip,
// DenseMatrix &curl_shape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
};
@@ -358,53 +363,54 @@ public:
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_ND(Trans, shape); }
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
virtual const StatelessDofTransformation *GetDofTransformation() const
const StatelessDofTransformation *GetDofTransformation() const override
{ return &doftrans; }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_ND(tk, dof2tk, fe, Trans, I); }
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
};
@@ -423,11 +429,11 @@ public:
using FiniteElement::CalcVShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
};
/// Arbitrary order, three component, Nedelec elements in 1D on a segment
@@ -455,56 +461,57 @@ public:
using FiniteElement::CalcVShape;
using FiniteElement::CalcPhysCurlShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
virtual void CalcPhysCurlShape(ElementTransformation &Trans,
DenseMatrix &curl_shape) const;
void CalcPhysCurlShape(ElementTransformation &Trans,
DenseMatrix &curl_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(*this, tk, dof2tk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_ND(tk, dof2tk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_ND(CheckVectorFE(fe), tk, dof2tk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_ND(tk, dof2tk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_ND(tk, dof2tk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const;
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override;
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_ND(tk, dof2tk, fe, Trans, grad); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_ND(tk, dof2tk, fe, Trans, curl); }
};
@@ -535,32 +542,32 @@ public:
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(*this, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ MFEM_ABORT("method is not overloaded"); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(CheckVectorFE(fe), Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
};
class ND_R2D_FiniteElement : public VectorFiniteElement
@@ -580,35 +587,35 @@ public:
using FiniteElement::CalcVShape;
using FiniteElement::CalcPhysCurlShape;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void CalcPhysCurlShape(ElementTransformation &Trans,
DenseMatrix &curl_shape) const;
void CalcPhysCurlShape(ElementTransformation &Trans,
DenseMatrix &curl_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(*this, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const;
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override;
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(CheckVectorFE(fe), Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const;
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override;
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const;
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override;
};
/// Arbitrary order Nedelec 3D elements in 2D on a triangle
@@ -635,10 +642,10 @@ public:
using ND_R2D_FiniteElement::CalcVShape;
using ND_R2D_FiniteElement::CalcPhysCurlShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
};
@@ -664,10 +671,10 @@ public:
using ND_R2D_FiniteElement::CalcVShape;
using ND_R2D_FiniteElement::CalcPhysCurlShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
};
+46 -46
View File
@@ -80,12 +80,12 @@ public:
NURBSFiniteElement(1),
shape_x(p + 1) { }
virtual void SetOrder() const;
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const;
void SetOrder() const override;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const override;
};
/// An arbitrary order 2D NURBS element on a square
@@ -115,12 +115,12 @@ public:
dshape_y(py + 1), d2shape_x(px + 1), d2shape_y(py + 1), du(dof,2)
{ orders[0] = px; orders[1] = py; }
virtual void SetOrder() const;
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const;
void SetOrder() const override;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const override;
};
/// An arbitrary order 3D NURBS element on a cube
@@ -155,12 +155,12 @@ public:
d2shape_x(px + 1), d2shape_y(py + 1), d2shape_z(pz + 1), du(dof,3)
{ orders[0] = px; orders[1] = py; orders[2] = pz; }
virtual void SetOrder() const;
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const;
void SetOrder() const override;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void CalcHessian (const IntegrationPoint &ip,
DenseMatrix &hessian) const override;
};
@@ -221,10 +221,10 @@ public:
kv1[1] = nullptr;
}
virtual void SetOrder() const;
void SetOrder() const override;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
/** @brief Evaluate the values of all shape functions of a *vector* finite
element in physical space at the point described by @a Trans. */
@@ -232,15 +232,15 @@ public:
one vector shape function. The size (#dof x SDim) of @a shape must be set
in advance, where SDim >= #dim is the physical space dimension as
described by @a Trans. */
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
/** @brief Evaluate the divergence of all shape functions of a *vector*
finite element in reference space at the given point @a ip. */
/** The size (#dof) of the result Vector @a divshape must be set in advance.
*/
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
~NURBS_HDiv2DFiniteElement();
};
@@ -315,10 +315,10 @@ public:
kv1[2] = nullptr;
}
virtual void SetOrder() const;
void SetOrder() const override;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
/** @brief Evaluate the values of all shape functions of a *vector* finite
element in physical space at the point described by @a Trans. */
@@ -326,15 +326,15 @@ public:
one vector shape function. The size (#dof x SDim) of @a shape must be set
in advance, where SDim >= #dim is the physical space dimension as
described by @a Trans. */
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
/** @brief Evaluate the divergence of all shape functions of a *vector*
finite element in reference space at the given point @a ip. */
/** The size (#dof) of the result Vector @a divshape must be set in advance.
*/
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
~NURBS_HDiv3DFiniteElement();
};
@@ -392,10 +392,10 @@ public:
kv1[1] = nullptr;
}
virtual void SetOrder() const;
void SetOrder() const override;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
/** @brief Evaluate the values of all shape functions of a *vector* finite
element in physical space at the point described by @a Trans. */
@@ -403,8 +403,8 @@ public:
one vector shape function. The size (#dof x SDim) of @a shape must be set
in advance, where SDim >= #dim is the physical space dimension as
described by @a Trans. */
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
/** @brief Evaluate the curl of all shape functions of a *vector* finite
element in reference space at the given point @a ip. */
@@ -412,8 +412,8 @@ public:
of the curl of one vector shape function. The size (#dof x CDim) of
@a curl_shape must be set in advance, where CDim = 3 for #dim = 3 and
CDim = 1 for #dim = 2. */
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
~NURBS_HCurl2DFiniteElement();
};
@@ -483,10 +483,10 @@ public:
kv1[2] = nullptr;
}
virtual void SetOrder() const;
void SetOrder() const override;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
/** @brief Evaluate the values of all shape functions of a *vector* finite
element in physical space at the point described by @a Trans. */
@@ -494,8 +494,8 @@ public:
one vector shape function. The size (#dof x SDim) of @a shape must be set
in advance, where SDim >= #dim is the physical space dimension as
described by @a Trans. */
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
/** @brief Evaluate the curl of all shape functions of a *vector* finite
element in reference space at the given point @a ip. */
@@ -503,8 +503,8 @@ public:
of the curl of one vector shape function. The size (#dof x CDim) of
@a curl_shape must be set in advance, where CDim = 3 for #dim = 3 and
CDim = 1 for #dim = 2. */
virtual void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const;
void CalcCurlShape(const IntegrationPoint &ip,
DenseMatrix &curl_shape) const override;
~NURBS_HCurl3DFiniteElement();
};
+70 -70
View File
@@ -34,31 +34,31 @@ public:
ScalarFiniteElement(D, G, Do, O, F)
{ }
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ ScalarLocalInterpolation(Trans, I, *this); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ ScalarLocalL2Restriction(Trans, R, *this); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ CheckScalarFE(fe).ScalarLocalInterpolation(Trans, I, *this); }
using FiniteElement::Project;
// Low-order monotone "projection" (actually it is not a projection): the
// dofs are set to be the Coefficient values at the nodes.
virtual void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const;
void Project(Coefficient &coeff,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void Project (VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project (VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const;
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override;
};
@@ -88,17 +88,17 @@ class BiQuadPos2DFiniteElement : public PositiveFiniteElement
public:
/// Construct the BiQuadPos2DFiniteElement
BiQuadPos2DFiniteElement();
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override;
using FiniteElement::Project;
virtual void Project(Coefficient &coeff, ElementTransformation &Trans,
Vector &dofs) const;
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans,
Vector &dofs) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const
void Project(Coefficient &coeff, ElementTransformation &Trans,
Vector &dofs) const override;
void Project(VectorCoefficient &vc, ElementTransformation &Trans,
Vector &dofs) const override;
void ProjectDelta(int vertex, Vector &dofs) const override
{ dofs = 0.; dofs(vertex) = 1.; }
};
@@ -109,9 +109,9 @@ class QuadPos1DFiniteElement : public PositiveFiniteElement
public:
/// Construct the QuadPos1DFiniteElement
QuadPos1DFiniteElement();
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
@@ -131,10 +131,10 @@ private:
public:
/// Construct the H1Pos_SegmentElement of order @a p
H1Pos_SegmentElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -150,10 +150,10 @@ private:
public:
/// Construct the H1Pos_QuadrilateralElement of order @a p
H1Pos_QuadrilateralElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -169,10 +169,10 @@ private:
public:
/// Construct the H1Pos_HexahedronElement of order @a p
H1Pos_HexahedronElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -198,9 +198,9 @@ public:
static void CalcDShape(const int p, const real_t x, const real_t y,
real_t *dshape_1d, real_t *dshape);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
@@ -227,9 +227,9 @@ public:
static void CalcDShape(const int p, const real_t x, const real_t y,
const real_t z, real_t *dshape_1d, real_t *dshape);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
@@ -250,9 +250,9 @@ public:
/// Construct the H1Pos_WedgeElement of order @a p
H1Pos_WedgeElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
@@ -267,10 +267,10 @@ private:
public:
/// Construct the L2Pos_SegmentElement of order @a p
L2Pos_SegmentElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -285,10 +285,10 @@ private:
public:
/// Construct the L2Pos_QuadrilateralElement of order @a p
L2Pos_QuadrilateralElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -303,10 +303,10 @@ private:
public:
/// Construct the L2Pos_HexahedronElement of order @a p
L2Pos_HexahedronElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -321,10 +321,10 @@ private:
public:
/// Construct the L2Pos_TriangleElement of order @a p
L2Pos_TriangleElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -340,10 +340,10 @@ private:
public:
/// Construct the L2Pos_TetrahedronElement of order @a p
L2Pos_TetrahedronElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void ProjectDelta(int vertex, Vector &dofs) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void ProjectDelta(int vertex, Vector &dofs) const override;
};
@@ -364,9 +364,9 @@ public:
/// Construct the L2Pos_WedgeElement of order @a p
L2Pos_WedgeElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
};
} // namespace mfem
+182 -177
View File
@@ -38,51 +38,52 @@ public:
RT_QuadrilateralElement(const int p,
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_RT(Trans, shape); }
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_RT(nk, dof2nk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{
if (obasis1d.IsIntegratedType()) { ProjectIntegrated(vc, Trans, dofs); }
else { Project_RT(nk, dof2nk, vc, Trans, dofs); }
}
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_RT(nk, dof2nk, fe, Trans, I); }
// Gradient + rotation = Curl: H1 -> H(div)
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_RT(nk, dof2nk, fe, Trans, grad); }
// Curl = Gradient + rotation: H1 -> H(div)
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectGrad_RT(nk, dof2nk, fe, Trans, curl); }
virtual void GetFaceMap(const int face_id, Array<int> &face_map) const;
void GetFaceMap(const int face_id, Array<int> &face_map) const override;
protected:
void ProjectIntegrated(VectorCoefficient &vc, ElementTransformation &Trans,
@@ -109,48 +110,49 @@ public:
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_RT(Trans, shape); }
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_RT(nk, dof2nk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{
if (obasis1d.IsIntegratedType()) { ProjectIntegrated(vc, Trans, dofs); }
else { Project_RT(nk, dof2nk, vc, Trans, dofs); }
}
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_RT(nk, dof2nk, fe, Trans, I); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_RT(nk, dof2nk, fe, Trans, curl); }
/// @brief Return the mapping from lexicographically ordered face DOFs to
/// lexicographically ordered element DOFs corresponding to local face
/// @a face_id.
virtual void GetFaceMap(const int face_id, Array<int> &face_map) const;
void GetFaceMap(const int face_id, Array<int> &face_map) const override;
protected:
void ProjectIntegrated(VectorCoefficient &vc,
@@ -176,45 +178,46 @@ class RT_TriangleElement : public VectorFiniteElement
public:
/// Construct the RT_TriangleElement of order @a p
RT_TriangleElement(const int p);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_RT(Trans, shape); }
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_RT(nk, dof2nk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_RT(nk, dof2nk, fe, Trans, I); }
// Gradient + rotation = Curl: H1 -> H(div)
virtual void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const
void ProjectGrad(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &grad) const override
{ ProjectGrad_RT(nk, dof2nk, fe, Trans, grad); }
// Curl = Gradient + rotation: H1 -> H(div)
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectGrad_RT(nk, dof2nk, fe, Trans, curl); }
};
@@ -236,39 +239,40 @@ class RT_TetrahedronElement : public VectorFiniteElement
public:
/// Construct the RT_TetrahedronElement of order @a p
RT_TetrahedronElement(const int p);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_RT(Trans, shape); }
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_RT(nk, dof2nk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const
void ProjectFromNodes(Vector &vc, ElementTransformation &Trans,
Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_RT(nk, dof2nk, fe, Trans, I); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_RT(nk, dof2nk, fe, Trans, curl); }
};
@@ -296,36 +300,37 @@ class RT_WedgeElement : public VectorFiniteElement
public:
RT_WedgeElement(const int p);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override
{ CalcVShape_RT(Trans, shape); }
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(*this, nk, dof2nk, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ LocalRestriction_RT(nk, dof2nk, Trans, R); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation_RT(CheckVectorFE(fe), nk, dof2nk, Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override
{ Project_RT(nk, dof2nk, vc, Trans, dofs); }
virtual void ProjectMatrixCoefficient(
MatrixCoefficient &mc, ElementTransformation &T, Vector &dofs) const
void ProjectMatrixCoefficient(MatrixCoefficient &mc,
ElementTransformation &T,
Vector &dofs) const override
{ ProjectMatrixCoefficient_RT(nk, dof2nk, mc, T, dofs); }
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override
{ Project_RT(nk, dof2nk, fe, Trans, I); }
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override
{ ProjectCurl_RT(nk, dof2nk, fe, Trans, curl); }
};
@@ -353,27 +358,27 @@ public:
const int cb_type = BasisType::GaussLobatto,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const;
void Project(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override;
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const;
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override;
};
@@ -401,26 +406,26 @@ public:
RT_R2D_SegmentElement(const int p,
const int ob_type = BasisType::GaussLegendre);
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &div_shape) const;
void CalcDivShape(const IntegrationPoint &ip,
Vector &div_shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(*this, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override
{ MFEM_ABORT("method is not overloaded"); }
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(CheckVectorFE(fe), Trans, I); }
};
@@ -440,32 +445,32 @@ private:
public:
using FiniteElement::CalcVShape;
virtual void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const;
void CalcVShape(ElementTransformation &Trans,
DenseMatrix &shape) const override;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(*this, Trans, I); }
virtual void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const;
void GetLocalRestriction(ElementTransformation &Trans,
DenseMatrix &R) const override;
virtual void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const
void GetTransferMatrix(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &I) const override
{ LocalInterpolation(CheckVectorFE(fe), Trans, I); }
using FiniteElement::Project;
virtual void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const;
void Project(VectorCoefficient &vc,
ElementTransformation &Trans, Vector &dofs) const override;
virtual void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const;
void Project(const FiniteElement &fe, ElementTransformation &Trans,
DenseMatrix &I) const override;
virtual void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const;
void ProjectCurl(const FiniteElement &fe,
ElementTransformation &Trans,
DenseMatrix &curl) const override;
};
/// Arbitrary order Raviart-Thomas 3D elements in 2D on a triangle
@@ -489,11 +494,11 @@ public:
using RT_R2D_FiniteElement::CalcVShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
};
/// Arbitrary order Raviart-Thomas 3D elements in 2D on a square
@@ -518,10 +523,10 @@ public:
using RT_R2D_FiniteElement::CalcVShape;
virtual void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const;
virtual void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const;
void CalcVShape(const IntegrationPoint &ip,
DenseMatrix &shape) const override;
void CalcDivShape(const IntegrationPoint &ip,
Vector &divshape) const override;
};
+5 -5
View File
@@ -23,11 +23,11 @@ class H1Ser_QuadrilateralElement : public ScalarFiniteElement
public:
/// Construct the H1Ser_QuadrilateralElement of order @a p
H1Ser_QuadrilateralElement(const int p);
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
virtual void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const;
virtual void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const;
void CalcShape(const IntegrationPoint &ip, Vector &shape) const override;
void CalcDShape(const IntegrationPoint &ip,
DenseMatrix &dshape) const override;
void GetLocalInterpolation(ElementTransformation &Trans,
DenseMatrix &I) const override;
using FiniteElement::Project;
};
+6 -6
View File
@@ -757,7 +757,7 @@ public:
order, or VariableOrder (default). */
explicit NURBS_HDivFECollection(int Order = VariableOrder, const int vdim = -1);
virtual void Reset() const override
void Reset() const override
{
SegmentFE->Reset();
QuadrilateralFE->Reset();
@@ -765,11 +765,11 @@ public:
ParallelepipedVFE->Reset();
}
virtual void SetDim(const int dim) override;
void SetDim(const int dim) override;
/** @brief Set the order and the name, based on the given @a Order: either a
positive number for fixed order, or VariableOrder. */
virtual void SetOrder(int Order) const override;
void SetOrder(int Order) const override;
const FiniteElement *
FiniteElementForGeometry(Geometry::Type GeomType) const override;
@@ -808,7 +808,7 @@ public:
explicit NURBS_HCurlFECollection(int Order = VariableOrder,
const int vdim = -1);
virtual void Reset() const override
void Reset() const override
{
SegmentFE->Reset();
QuadrilateralFE->Reset();
@@ -816,11 +816,11 @@ public:
ParallelepipedVFE->Reset();
}
virtual void SetDim(const int dim) override;
void SetDim(const int dim) override;
/** @brief Set the order and the name, based on the given @a Order: either a
positive number for fixed order, or VariableOrder. */
virtual void SetOrder(int Order) const override;
void SetOrder(int Order) const override;
const FiniteElement *
FiniteElementForGeometry(Geometry::Type GeomType) const override;
+28 -1
View File
@@ -478,7 +478,7 @@ void FiniteElementSpace::ReorderElementToDofTable()
}
}
void FiniteElementSpace::BuildDofToArrays()
void FiniteElementSpace::BuildDofToArrays_() const
{
if (dof_elem_array.Size()) { return; }
@@ -503,6 +503,31 @@ void FiniteElementSpace::BuildDofToArrays()
}
}
void FiniteElementSpace::BuildDofToBdrArrays() const
{
if (dof_bdr_elem_array.Size()) { return; }
BuildBdrElementToDofTable();
dof_bdr_elem_array.SetSize (ndofs);
dof_bdr_ldof_array.SetSize (ndofs);
dof_bdr_elem_array = -1;
for (int i = 0; i < mesh -> GetNBE(); i++)
{
const int *dofs = bdr_elem_dof -> GetRow(i);
const int n = bdr_elem_dof -> RowSize(i);
for (int j = 0; j < n; j++)
{
int dof = DecodeDof(dofs[j]);
if (dof_bdr_elem_array[dof] < 0)
{
dof_bdr_elem_array[dof] = i;
dof_bdr_ldof_array[dof] = j;
}
}
}
}
void MarkDofs(const Array<int> &dofs, Array<int> &mark_array)
{
for (auto d : dofs)
@@ -3496,6 +3521,8 @@ void FiniteElementSpace::Destroy()
dof_elem_array.DeleteAll();
dof_ldof_array.DeleteAll();
dof_bdr_elem_array.DeleteAll();
dof_bdr_ldof_array.DeleteAll();
for (int i = 0; i < VNURBSext.Size(); i++)
{
+31 -15
View File
@@ -265,7 +265,10 @@ protected:
mutable Table *bdr_elem_fos; // bdr face orientations by bdr element index
mutable Table *face_dof; // owned; in var-order space contains variant 0 DOFs
Array<int> dof_elem_array, dof_ldof_array;
mutable Array<int> dof_elem_array;
mutable Array<int> dof_ldof_array;
mutable Array<int> dof_bdr_elem_array;
mutable Array<int> dof_bdr_ldof_array;
NURBSExtension *NURBSext;
/** array of NURBS extension for H(div) and H(curl) vector elements.
@@ -339,6 +342,14 @@ protected:
void BuildBdrElementToDofTable() const;
void BuildFaceToDofTable() const;
/** @brief Initialize internal data that enables the use of the methods
GetElementForDof() and GetLocalDofForDof(). */
void BuildDofToArrays_() const;
/** @brief Initialize internal data that enables the use of the methods
GetBdrElementForDof() and GetBdrLocalDofForDof(). */
void BuildDofToBdrArrays() const;
/** @brief Generates partial face_dof table for a NURBS space.
The table is only defined for exterior faces that coincide with a
@@ -458,7 +469,7 @@ protected:
DerefinementOperator(const FiniteElementSpace *f_fes,
const FiniteElementSpace *c_fes,
BilinearFormIntegrator *mass_integ);
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
virtual ~DerefinementOperator();
};
@@ -591,7 +602,8 @@ public:
/// Returns true if the space contains elements of varying polynomial orders.
bool IsVariableOrder() const { return elem_order.Size(); }
/// The returned SparseMatrix is owned by the FiniteElementSpace.
/// The returned SparseMatrix is owned by the FiniteElementSpace. The method
/// returns nullptr if the matrix is identity.
const SparseMatrix *GetConformingProlongation() const;
/// The returned SparseMatrix is owned by the FiniteElementSpace.
@@ -604,7 +616,8 @@ public:
/// The returned SparseMatrix is owned by the FiniteElementSpace.
const SparseMatrix *GetHpConformingRestriction() const;
/// The returned Operator is owned by the FiniteElementSpace.
/// The returned Operator is owned by the FiniteElementSpace. The method
/// returns nullptr if the prolongation matrix is identity.
virtual const Operator *GetProlongationMatrix() const
{ return GetConformingProlongation(); }
@@ -1163,18 +1176,21 @@ public:
const Table &GetFaceToDofTable() const
{ if (!face_dof) { BuildFaceToDofTable(); } return *face_dof; }
/** @brief Initialize internal data that enables the use of the methods
GetElementForDof() and GetLocalDofForDof(). */
void BuildDofToArrays();
/// Deprecated. This function is not required to be called by the user.
MFEM_DEPRECATED void BuildDofToArrays() const { BuildDofToArrays_(); }
/// Return the index of the first element that contains ldof index @a i.
int GetElementForDof(int i) const { BuildDofToArrays_(); return dof_elem_array[i]; }
/// Return the dof index within the element from GetElementForDof() for ldof index @a i.
int GetLocalDofForDof(int i) const { BuildDofToArrays_(); return dof_ldof_array[i]; }
/// Return the index of the first boundary element that contains ldof index @a i.
int GetBdrElementForDof(int i) const { BuildDofToBdrArrays(); return dof_bdr_elem_array[i]; }
/// Return the dof index within the boundary element from GetBdrElementForDof() for ldof index @a i.
int GetBdrLocalDofForDof(int i) const { BuildDofToBdrArrays(); return dof_bdr_ldof_array[i]; }
/// Return the index of the first element that contains dof @a i.
/** This method can be called only after setup is performed using the method
BuildDofToArrays(). */
int GetElementForDof(int i) const { return dof_elem_array[i]; }
/// Return the local dof index in the first element that contains dof @a i.
/** This method can be called only after setup is performed using the method
BuildDofToArrays(). */
int GetLocalDofForDof(int i) const { return dof_ldof_array[i]; }
/** @brief Returns pointer to the FiniteElement in the FiniteElementCollection
associated with i'th element in the mesh object.
+2 -2
View File
@@ -61,10 +61,10 @@ public:
void SetProtocol(const std::string &protocol);
/// Save the collection and a FMS blueprint root file
virtual void Save();
void Save() override;
/// Load the collection based blueprint data
virtual void Load(int cycle = 0);
void Load(int cycle = 0) override;
};
} // namespace mfem
-4
View File
@@ -2435,8 +2435,6 @@ void GridFunction::ProjectCoefficient(
ElementTransformation *T = NULL;
const FiniteElement *fe = NULL;
fes->BuildDofToArrays(); // ensures GetElementForDof(), GetLocalDofForDof() initialized.
for (int i = 0; i < dofs.Size(); i++)
{
int dof = dofs[i], j = fes->GetElementForDof(dof);
@@ -2516,8 +2514,6 @@ void GridFunction::ProjectCoefficient(
Vector val;
fes->BuildDofToArrays(); // ensures GetElementForDof(), GetLocalDofForDof() initialized.
for (int i = 0; i < dofs.Size(); i++)
{
int dof = dofs[i], j = fes->GetElementForDof(dof);
+1 -1
View File
@@ -876,7 +876,7 @@ private:
public:
ExtrudeCoefficient(Mesh *m, Coefficient &s, int n_)
: n(n_), mesh_in(m), sol_in(s) { }
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip);
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override;
virtual ~ExtrudeCoefficient() { }
};
+27 -114
View File
@@ -14,6 +14,33 @@
namespace mfem
{
// PA Diffusion Integrator
DiffusionIntegrator::Kernels DiffusionIntegrator::kernels;
DiffusionIntegrator::Kernels::Kernels()
{
// 2D
DiffusionIntegrator::AddSpecialization<2,2,2>();
DiffusionIntegrator::AddSpecialization<2,3,3>();
DiffusionIntegrator::AddSpecialization<2,4,4>();
DiffusionIntegrator::AddSpecialization<2,5,5>();
DiffusionIntegrator::AddSpecialization<2,6,6>();
DiffusionIntegrator::AddSpecialization<2,7,7>();
DiffusionIntegrator::AddSpecialization<2,8,8>();
DiffusionIntegrator::AddSpecialization<2,9,9>();
// 3D
DiffusionIntegrator::AddSpecialization<3,2,2>();
DiffusionIntegrator::AddSpecialization<3,2,3>();
DiffusionIntegrator::AddSpecialization<3,3,4>();
DiffusionIntegrator::AddSpecialization<3,4,5>();
DiffusionIntegrator::AddSpecialization<3,4,6>();
DiffusionIntegrator::AddSpecialization<3,5,6>();
DiffusionIntegrator::AddSpecialization<3,5,8>();
DiffusionIntegrator::AddSpecialization<3,6,7>();
DiffusionIntegrator::AddSpecialization<3,7,8>();
DiffusionIntegrator::AddSpecialization<3,8,9>();
}
namespace internal
{
@@ -361,121 +388,7 @@ void OccaPADiffusionSetup3D(const int D1D,
}
OccaDiffSetup3D_ker.at(id)(NE, o_W, o_J, o_C, o_op, const_c);
}
#endif // MFEM_USE_OCCA
void PADiffusionAssembleDiagonal(const int dim,
const int D1D,
const int Q1D,
const int NE,
const bool symm,
const Array<real_t> &B,
const Array<real_t> &G,
const Vector &D,
Vector &Y)
{
if (dim == 2)
{
switch ((D1D << 4 ) | Q1D)
{
case 0x22: return SmemPADiffusionDiagonal2D<2,2,8>(NE,symm,B,G,D,Y);
case 0x33: return SmemPADiffusionDiagonal2D<3,3,8>(NE,symm,B,G,D,Y);
case 0x44: return SmemPADiffusionDiagonal2D<4,4,4>(NE,symm,B,G,D,Y);
case 0x55: return SmemPADiffusionDiagonal2D<5,5,4>(NE,symm,B,G,D,Y);
case 0x66: return SmemPADiffusionDiagonal2D<6,6,2>(NE,symm,B,G,D,Y);
case 0x77: return SmemPADiffusionDiagonal2D<7,7,2>(NE,symm,B,G,D,Y);
case 0x88: return SmemPADiffusionDiagonal2D<8,8,1>(NE,symm,B,G,D,Y);
case 0x99: return SmemPADiffusionDiagonal2D<9,9,1>(NE,symm,B,G,D,Y);
default: return PADiffusionDiagonal2D(NE,symm,B,G,D,Y,D1D,Q1D);
}
}
else if (dim == 3)
{
switch ((D1D << 4 ) | Q1D)
{
case 0x22: return SmemPADiffusionDiagonal3D<2,2>(NE,symm,B,G,D,Y);
case 0x23: return SmemPADiffusionDiagonal3D<2,3>(NE,symm,B,G,D,Y);
case 0x34: return SmemPADiffusionDiagonal3D<3,4>(NE,symm,B,G,D,Y);
case 0x45: return SmemPADiffusionDiagonal3D<4,5>(NE,symm,B,G,D,Y);
case 0x46: return SmemPADiffusionDiagonal3D<4,6>(NE,symm,B,G,D,Y);
case 0x56: return SmemPADiffusionDiagonal3D<5,6>(NE,symm,B,G,D,Y);
case 0x67: return SmemPADiffusionDiagonal3D<6,7>(NE,symm,B,G,D,Y);
case 0x78: return SmemPADiffusionDiagonal3D<7,8>(NE,symm,B,G,D,Y);
case 0x89: return SmemPADiffusionDiagonal3D<8,9>(NE,symm,B,G,D,Y);
case 0x9A: return SmemPADiffusionDiagonal3D<9,10>(NE,symm,B,G,D,Y);
default: return PADiffusionDiagonal3D(NE,symm,B,G,D,Y,D1D,Q1D);
}
}
MFEM_ABORT("Unknown kernel.");
}
void PADiffusionApply(const int dim,
const int D1D,
const int Q1D,
const int NE,
const bool symm,
const Array<real_t> &B,
const Array<real_t> &G,
const Array<real_t> &Bt,
const Array<real_t> &Gt,
const Vector &D,
const Vector &X,
Vector &Y)
{
#ifdef MFEM_USE_OCCA
if (DeviceCanUseOcca())
{
if (dim == 2)
{
OccaPADiffusionApply2D(D1D,Q1D,NE,B,G,Bt,Gt,D,X,Y);
return;
}
if (dim == 3)
{
OccaPADiffusionApply3D(D1D,Q1D,NE,B,G,Bt,Gt,D,X,Y);
return;
}
MFEM_ABORT("OCCA PADiffusionApply unknown kernel!");
}
#endif // MFEM_USE_OCCA
const int id = (D1D << 4) | Q1D;
if (dim == 2)
{
switch (id)
{
case 0x22: return SmemPADiffusionApply2D<2,2,16>(NE,symm,B,G,D,X,Y);
case 0x33: return SmemPADiffusionApply2D<3,3,16>(NE,symm,B,G,D,X,Y);
case 0x44: return SmemPADiffusionApply2D<4,4,8>(NE,symm,B,G,D,X,Y);
case 0x55: return SmemPADiffusionApply2D<5,5,8>(NE,symm,B,G,D,X,Y);
case 0x66: return SmemPADiffusionApply2D<6,6,4>(NE,symm,B,G,D,X,Y);
case 0x77: return SmemPADiffusionApply2D<7,7,4>(NE,symm,B,G,D,X,Y);
case 0x88: return SmemPADiffusionApply2D<8,8,2>(NE,symm,B,G,D,X,Y);
case 0x99: return SmemPADiffusionApply2D<9,9,2>(NE,symm,B,G,D,X,Y);
default: return PADiffusionApply2D(NE,symm,B,G,Bt,Gt,D,X,Y,D1D,Q1D);
}
}
if (dim == 3)
{
switch (id)
{
case 0x22: return SmemPADiffusionApply3D<2,2>(NE,symm,B,G,D,X,Y);
case 0x23: return SmemPADiffusionApply3D<2,3>(NE,symm,B,G,D,X,Y);
case 0x34: return SmemPADiffusionApply3D<3,4>(NE,symm,B,G,D,X,Y);
case 0x45: return SmemPADiffusionApply3D<4,5>(NE,symm,B,G,D,X,Y);
case 0x46: return SmemPADiffusionApply3D<4,6>(NE,symm,B,G,D,X,Y);
case 0x56: return SmemPADiffusionApply3D<5,6>(NE,symm,B,G,D,X,Y);
case 0x58: return SmemPADiffusionApply3D<5,8>(NE,symm,B,G,D,X,Y);
case 0x67: return SmemPADiffusionApply3D<6,7>(NE,symm,B,G,D,X,Y);
case 0x78: return SmemPADiffusionApply3D<7,8>(NE,symm,B,G,D,X,Y);
case 0x89: return SmemPADiffusionApply3D<8,9>(NE,symm,B,G,D,X,Y);
default: return PADiffusionApply3D(NE,symm,B,G,Bt,Gt,D,X,Y,D1D,Q1D);
}
}
MFEM_ABORT("Unknown kernel: 0x"<<std::hex << id << std::dec);
}
#ifdef MFEM_USE_OCCA
void OccaPADiffusionApply2D(const int D1D,
const int Q1D,
const int NE,
+65 -7
View File
@@ -12,6 +12,7 @@
#ifndef MFEM_BILININTEG_DIFFUSION_KERNELS_HPP
#define MFEM_BILININTEG_DIFFUSION_KERNELS_HPP
#include "../kernel_dispatch.hpp"
#include "../../config/config.hpp"
#include "../../general/array.hpp"
#include "../../general/forall.hpp"
@@ -36,7 +37,7 @@ void PADiffusionSetup(const int dim,
const Vector &C,
Vector &D);
// PA Diffusion Assemble 2D kernel
// PA Diffusion Assemble 2D f
template<int T_SDIM>
void PADiffusionSetup2D(const int Q1D,
const int coeffDim,
@@ -151,8 +152,23 @@ inline void PADiffusionDiagonal2D(const int NE,
});
}
namespace diffusion
{
constexpr int ipow(int x, int p) { return p == 0 ? 1 : x*ipow(x, p-1); }
constexpr int D11(int x) { return (11 - x)/2; }
constexpr int D10(int x) { return (10 - x)/2; }
constexpr int NBZApply(int D1D)
{
return ipow(2, D11(D1D) >= 0 ? D11(D1D) : 0);
}
constexpr int NBZDiagonal(int D1D)
{
return ipow(2, D10(D1D) >= 0 ? D10(D1D) : 0);
}
}
// Shared memory PA Diffusion Diagonal 2D kernel
template<int T_D1D = 0, int T_Q1D = 0, int T_NBZ = 0>
template<int T_D1D = 0, int T_Q1D = 0>
inline void SmemPADiffusionDiagonal2D(const int NE,
const bool symmetric,
const Array<real_t> &b_,
@@ -162,9 +178,10 @@ inline void SmemPADiffusionDiagonal2D(const int NE,
const int d1d = 0,
const int q1d = 0)
{
static constexpr int T_NBZ = diffusion::NBZDiagonal(T_D1D);
static constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int max_q1d = T_Q1D ? T_Q1D : DeviceDofQuadLimits::Get().MAX_Q1D;
const int max_d1d = T_D1D ? T_D1D : DeviceDofQuadLimits::Get().MAX_D1D;
MFEM_VERIFY(D1D <= max_d1d, "");
@@ -178,7 +195,6 @@ inline void SmemPADiffusionDiagonal2D(const int NE,
const int tidz = MFEM_THREAD_ID(z);
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
constexpr int MQ1 = T_Q1D ? T_Q1D : DofQuadLimits::MAX_Q1D;
constexpr int MD1 = T_D1D ? T_D1D : DofQuadLimits::MAX_D1D;
MFEM_SHARED real_t BG[2][MQ1*MD1];
@@ -628,20 +644,23 @@ inline void PADiffusionApply2D(const int NE,
}
// Shared memory PA Diffusion Apply 2D kernel
template<int T_D1D = 0, int T_Q1D = 0, int T_NBZ = 0>
template<int T_D1D = 0, int T_Q1D = 0>
inline void SmemPADiffusionApply2D(const int NE,
const bool symmetric,
const Array<real_t> &b_,
const Array<real_t> &g_,
const Array<real_t> &bt_,
const Array<real_t> &gt_,
const Vector &d_,
const Vector &x_,
Vector &y_,
const int d1d = 0,
const int q1d = 0)
{
static constexpr int T_NBZ = diffusion::NBZApply(T_D1D);
static constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int max_q1d = T_Q1D ? T_Q1D : DeviceDofQuadLimits::Get().MAX_Q1D;
const int max_d1d = T_D1D ? T_D1D : DeviceDofQuadLimits::Get().MAX_D1D;
MFEM_VERIFY(D1D <= max_d1d, "");
@@ -656,7 +675,6 @@ inline void SmemPADiffusionApply2D(const int NE,
const int tidz = MFEM_THREAD_ID(z);
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
constexpr int MQ1 = T_Q1D ? T_Q1D : DofQuadLimits::MAX_Q1D;
constexpr int MD1 = T_D1D ? T_D1D : DofQuadLimits::MAX_D1D;
MFEM_SHARED real_t sBG[2][MQ1*MD1];
@@ -984,6 +1002,8 @@ inline void SmemPADiffusionApply3D(const int NE,
const bool symmetric,
const Array<real_t> &b_,
const Array<real_t> &g_,
const Array<real_t> &,
const Array<real_t> &,
const Vector &d_,
const Vector &x_,
Vector &y_,
@@ -1203,6 +1223,44 @@ inline void SmemPADiffusionApply3D(const int NE,
} // namespace internal
namespace
{
using ApplyKernelType = DiffusionIntegrator::ApplyKernelType;
using DiagonalKernelType = DiffusionIntegrator::DiagonalKernelType;
}
template<int DIM, int T_D1D, int T_Q1D>
ApplyKernelType DiffusionIntegrator::ApplyPAKernels::Kernel()
{
if (DIM == 2) { return internal::SmemPADiffusionApply2D<T_D1D,T_Q1D>; }
else if (DIM == 3) { return internal::SmemPADiffusionApply3D<T_D1D, T_Q1D>; }
else { MFEM_ABORT(""); }
}
inline
ApplyKernelType DiffusionIntegrator::ApplyPAKernels::Fallback(int DIM, int, int)
{
if (DIM == 2) { return internal::PADiffusionApply2D; }
else if (DIM == 3) { return internal::PADiffusionApply3D; }
else { MFEM_ABORT(""); }
}
template<int DIM, int D1D, int Q1D>
DiagonalKernelType DiffusionIntegrator::DiagonalPAKernels::Kernel()
{
if (DIM == 2) { return internal::SmemPADiffusionDiagonal2D<D1D,Q1D>; }
else if (DIM == 3) { return internal::SmemPADiffusionDiagonal3D<D1D, Q1D>; }
else { MFEM_ABORT(""); }
}
inline DiagonalKernelType
DiffusionIntegrator::DiagonalPAKernels::Fallback(int DIM, int, int)
{
if (DIM == 2) { return internal::PADiffusionDiagonal2D; }
else if (DIM == 3) { return internal::PADiffusionDiagonal3D; }
else { MFEM_ABORT(""); }
}
} // namespace mfem
#endif
+67 -41
View File
@@ -19,6 +19,73 @@
namespace mfem
{
void DiffusionIntegrator::AssembleDiagonalPA(Vector &diag)
{
if (DeviceCanUseCeed())
{
ceedOp->GetDiagonal(diag);
}
else
{
if (pa_data.Size() == 0) { AssemblePA(*fespace); }
const Array<real_t> &B = maps->B;
const Array<real_t> &G = maps->G;
const Vector &Dv = pa_data;
DiagonalPAKernels::Run(dim, dofs1D, quad1D, ne, symmetric, B, G, Dv,
diag, dofs1D, quad1D);
}
}
// PA Diffusion Apply kernel
void DiffusionIntegrator::AddMultPA(const Vector &x, Vector &y) const
{
if (DeviceCanUseCeed())
{
ceedOp->AddMult(x, y);
}
else
{
const Array<real_t> &B = maps->B;
const Array<real_t> &G = maps->G;
const Array<real_t> &Bt = maps->Bt;
const Array<real_t> &Gt = maps->Gt;
const Vector &Dv = pa_data;
#ifdef MFEM_USE_OCCA
if (DeviceCanUseOcca())
{
if (dim == 2)
{
internal::OccaPADiffusionApply2D(dofs1D,quad1D,ne,B,G,Bt,Gt,Dv,x,y);
return;
}
if (dim == 3)
{
internal::OccaPADiffusionApply3D(dofs1D,quad1D,ne,B,G,Bt,Gt,Dv,x,y);
return;
}
MFEM_ABORT("OCCA PADiffusionApply unknown kernel!");
}
#endif // MFEM_USE_OCCA
ApplyPAKernels::Run(dim, dofs1D, quad1D, ne, symmetric, B, G, Bt,
Gt, Dv, x, y, dofs1D, quad1D);
}
}
void DiffusionIntegrator::AddMultTransposePA(const Vector &x, Vector &y) const
{
if (symmetric)
{
AddMultPA(x, y);
}
else
{
MFEM_ABORT("DiffusionIntegrator::AddMultTransposePA only implemented in "
"the symmetric case.")
}
}
void DiffusionIntegrator::AssemblePA(const FiniteElementSpace &fes)
{
const MemoryType mt = (pa_mt == MemoryType::DEFAULT) ?
@@ -98,47 +165,6 @@ void DiffusionIntegrator::AssemblePatchPA(const int patch,
SetupPatchPA(patch, mesh); // For full quadrature, unitWeights = false
}
void DiffusionIntegrator::AssembleDiagonalPA(Vector &diag)
{
if (DeviceCanUseCeed())
{
ceedOp->GetDiagonal(diag);
}
else
{
if (pa_data.Size()==0) { AssemblePA(*fespace); }
internal::PADiffusionAssembleDiagonal(dim, dofs1D, quad1D, ne, symmetric,
maps->B, maps->G, pa_data, diag);
}
}
void DiffusionIntegrator::AddMultPA(const Vector &x, Vector &y) const
{
if (DeviceCanUseCeed())
{
ceedOp->AddMult(x, y);
}
else
{
internal::PADiffusionApply(dim, dofs1D, quad1D, ne, symmetric,
maps->B, maps->G, maps->Bt, maps->Gt,
pa_data, x, y);
}
}
void DiffusionIntegrator::AddMultTransposePA(const Vector &x, Vector &y) const
{
if (symmetric)
{
AddMultPA(x, y);
}
else
{
MFEM_ABORT("DiffusionIntegrator::AddMultTransposePA only implemented in "
"the symmetric case.")
}
}
// This version uses full 1D quadrature rules, taking into account the
// minimum interaction between basis functions and integration points.
void DiffusionIntegrator::AddMultPatchPA(const int patch, const Vector &x,
+25 -217
View File
@@ -14,78 +14,34 @@
namespace mfem
{
MassIntegrator::Kernels MassIntegrator::kernels;
MassIntegrator::Kernels::Kernels()
{
// 2D
MassIntegrator::AddSpecialization<2,2,2>();
MassIntegrator::AddSpecialization<2,3,3>();
MassIntegrator::AddSpecialization<2,4,4>();
MassIntegrator::AddSpecialization<2,5,5>();
MassIntegrator::AddSpecialization<2,6,6>();
MassIntegrator::AddSpecialization<2,7,7>();
MassIntegrator::AddSpecialization<2,8,8>();
MassIntegrator::AddSpecialization<2,9,9>();
// 3D
MassIntegrator::AddSpecialization<3,2,2>();
MassIntegrator::AddSpecialization<3,2,3>();
MassIntegrator::AddSpecialization<3,3,4>();
MassIntegrator::AddSpecialization<3,4,5>();
MassIntegrator::AddSpecialization<3,4,6>();
MassIntegrator::AddSpecialization<3,5,6>();
MassIntegrator::AddSpecialization<3,5,8>();
MassIntegrator::AddSpecialization<3,6,7>();
MassIntegrator::AddSpecialization<3,7,8>();
MassIntegrator::AddSpecialization<3,8,9>();
}
namespace internal
{
// PA Mass Diagonal 1D kernel
static void PAMassAssembleDiagonal1D(const int NE,
const Array<real_t> &b,
const Vector &d,
Vector &y,
const int D1D,
const int Q1D)
{
auto B = Reshape(b.Read(), Q1D, D1D);
auto D = Reshape(d.Read(), Q1D, NE);
auto Y = Reshape(y.ReadWrite(), D1D, NE);
mfem::forall(NE, [=] MFEM_HOST_DEVICE (int e)
{
for (int dx = 0; dx < D1D; ++dx)
{
for (int qx = 0; qx < Q1D; ++qx)
{
Y(dx, e) += B(qx, dx) * B(qx, dx) * D(qx, e);
}
}
});
}
void PAMassAssembleDiagonal(const int dim, const int D1D,
const int Q1D, const int NE,
const Array<real_t> &B,
const Vector &D,
Vector &Y)
{
if (dim == 1)
{
return PAMassAssembleDiagonal1D(NE,B,D,Y,D1D,Q1D);
}
else if (dim == 2)
{
switch ((D1D << 4 ) | Q1D)
{
case 0x22: return SmemPAMassAssembleDiagonal2D<2,2,16>(NE,B,D,Y);
case 0x33: return SmemPAMassAssembleDiagonal2D<3,3,16>(NE,B,D,Y);
case 0x44: return SmemPAMassAssembleDiagonal2D<4,4,8>(NE,B,D,Y);
case 0x55: return SmemPAMassAssembleDiagonal2D<5,5,8>(NE,B,D,Y);
case 0x66: return SmemPAMassAssembleDiagonal2D<6,6,4>(NE,B,D,Y);
case 0x77: return SmemPAMassAssembleDiagonal2D<7,7,4>(NE,B,D,Y);
case 0x88: return SmemPAMassAssembleDiagonal2D<8,8,2>(NE,B,D,Y);
case 0x99: return SmemPAMassAssembleDiagonal2D<9,9,2>(NE,B,D,Y);
default: return PAMassAssembleDiagonal2D(NE,B,D,Y,D1D,Q1D);
}
}
else if (dim == 3)
{
switch ((D1D << 4 ) | Q1D)
{
case 0x23: return SmemPAMassAssembleDiagonal3D<2,3>(NE,B,D,Y);
case 0x24: return SmemPAMassAssembleDiagonal3D<2,4>(NE,B,D,Y);
case 0x26: return SmemPAMassAssembleDiagonal3D<2,6>(NE,B,D,Y);
case 0x34: return SmemPAMassAssembleDiagonal3D<3,4>(NE,B,D,Y);
case 0x35: return SmemPAMassAssembleDiagonal3D<3,5>(NE,B,D,Y);
case 0x45: return SmemPAMassAssembleDiagonal3D<4,5>(NE,B,D,Y);
case 0x48: return SmemPAMassAssembleDiagonal3D<4,8>(NE,B,D,Y);
case 0x56: return SmemPAMassAssembleDiagonal3D<5,6>(NE,B,D,Y);
case 0x67: return SmemPAMassAssembleDiagonal3D<6,7>(NE,B,D,Y);
case 0x78: return SmemPAMassAssembleDiagonal3D<7,8>(NE,B,D,Y);
case 0x89: return SmemPAMassAssembleDiagonal3D<8,9>(NE,B,D,Y);
default: return PAMassAssembleDiagonal3D(NE,B,D,Y,D1D,Q1D);
}
}
MFEM_ABORT("Unknown kernel.");
}
#ifdef MFEM_USE_OCCA
void OccaPAMassApply2D(const int D1D,
const int Q1D,
@@ -176,154 +132,6 @@ void OccaPAMassApply3D(const int D1D,
}
#endif // MFEM_USE_OCCA
MFEM_HOST_DEVICE inline
void PAMassApply1D_Element(const int e,
const int NE,
const real_t *b_,
const real_t *bt_,
const real_t *d_,
const real_t *x_,
real_t *y_,
const int d1d = 0,
const int q1d = 0)
{
const int D1D = d1d;
const int Q1D = q1d;
auto B = ConstDeviceMatrix(b_, Q1D, D1D);
auto Bt = ConstDeviceMatrix(bt_, D1D, Q1D);
auto D = ConstDeviceMatrix(d_, Q1D, NE);
auto X = ConstDeviceMatrix(x_, D1D, NE);
auto Y = DeviceMatrix(y_, D1D, NE);
real_t XQ[DofQuadLimits::MAX_Q1D];
for (int qx = 0; qx < Q1D; ++qx)
{
XQ[qx] = 0.0;
}
for (int dx = 0; dx < D1D; ++dx)
{
const real_t s = X(dx,e);
for (int qx = 0; qx < Q1D; ++qx)
{
XQ[qx] += B(qx,dx)*s;
}
}
for (int qx = 0; qx < Q1D; ++qx)
{
const real_t q = XQ[qx]*D(qx,e);
for (int dx = 0; dx < D1D; ++dx)
{
Y(dx,e) += Bt(dx,qx) * q;
}
}
}
// PA Mass Apply 1D kernel
static void PAMassApply1D(const int NE,
const Array<real_t> &b_,
const Array<real_t> &bt_,
const Vector &d_,
const Vector &x_,
Vector &y_,
const int d1d = 0,
const int q1d = 0)
{
MFEM_VERIFY(d1d <= DeviceDofQuadLimits::Get().MAX_D1D, "");
MFEM_VERIFY(q1d <= DeviceDofQuadLimits::Get().MAX_Q1D, "");
const auto B = b_.Read();
const auto Bt = bt_.Read();
const auto D = d_.Read();
const auto X = x_.Read();
auto Y = y_.ReadWrite();
mfem::forall(NE, [=] MFEM_HOST_DEVICE (int e)
{
internal::PAMassApply1D_Element(e, NE, B, Bt, D, X, Y, d1d, q1d);
});
}
void PAMassApply(const int dim,
const int D1D,
const int Q1D,
const int NE,
const Array<real_t> &B,
const Array<real_t> &Bt,
const Vector &D,
const Vector &X,
Vector &Y)
{
#ifdef MFEM_USE_OCCA
if (DeviceCanUseOcca())
{
if (dim == 2)
{
return OccaPAMassApply2D(D1D,Q1D,NE,B,Bt,D,X,Y);
}
if (dim == 3)
{
return OccaPAMassApply3D(D1D,Q1D,NE,B,Bt,D,X,Y);
}
MFEM_ABORT("OCCA PA Mass Apply unknown kernel!");
}
#endif // MFEM_USE_OCCA
const int id = (D1D << 4) | Q1D;
if (dim == 1)
{
return PAMassApply1D(NE,B,Bt,D,X,Y,D1D,Q1D);
}
else if (dim == 2)
{
switch (id)
{
case 0x22: return SmemPAMassApply2D<2,2,16>(NE,B,Bt,D,X,Y);
case 0x24: return SmemPAMassApply2D<2,4,16>(NE,B,Bt,D,X,Y);
case 0x33: return SmemPAMassApply2D<3,3,16>(NE,B,Bt,D,X,Y);
case 0x34: return SmemPAMassApply2D<3,4,16>(NE,B,Bt,D,X,Y);
case 0x35: return SmemPAMassApply2D<3,5,16>(NE,B,Bt,D,X,Y);
case 0x36: return SmemPAMassApply2D<3,6,16>(NE,B,Bt,D,X,Y);
case 0x44: return SmemPAMassApply2D<4,4,8>(NE,B,Bt,D,X,Y);
case 0x46: return SmemPAMassApply2D<4,6,8>(NE,B,Bt,D,X,Y);
case 0x48: return SmemPAMassApply2D<4,8,4>(NE,B,Bt,D,X,Y);
case 0x55: return SmemPAMassApply2D<5,5,8>(NE,B,Bt,D,X,Y);
case 0x57: return SmemPAMassApply2D<5,7,8>(NE,B,Bt,D,X,Y);
case 0x58: return SmemPAMassApply2D<5,8,2>(NE,B,Bt,D,X,Y);
case 0x66: return SmemPAMassApply2D<6,6,4>(NE,B,Bt,D,X,Y);
case 0x77: return SmemPAMassApply2D<7,7,4>(NE,B,Bt,D,X,Y);
case 0x88: return SmemPAMassApply2D<8,8,2>(NE,B,Bt,D,X,Y);
case 0x99: return SmemPAMassApply2D<9,9,2>(NE,B,Bt,D,X,Y);
default: return PAMassApply2D(NE,B,Bt,D,X,Y,D1D,Q1D);
}
}
else if (dim == 3)
{
switch (id)
{
case 0x22: return SmemPAMassApply3D<2,2>(NE,B,Bt,D,X,Y);
case 0x23: return SmemPAMassApply3D<2,3>(NE,B,Bt,D,X,Y);
case 0x24: return SmemPAMassApply3D<2,4>(NE,B,Bt,D,X,Y);
case 0x26: return SmemPAMassApply3D<2,6>(NE,B,Bt,D,X,Y);
case 0x34: return SmemPAMassApply3D<3,4>(NE,B,Bt,D,X,Y);
case 0x35: return SmemPAMassApply3D<3,5>(NE,B,Bt,D,X,Y);
case 0x36: return SmemPAMassApply3D<3,6>(NE,B,Bt,D,X,Y);
case 0x37: return SmemPAMassApply3D<3,7>(NE,B,Bt,D,X,Y);
case 0x45: return SmemPAMassApply3D<4,5>(NE,B,Bt,D,X,Y);
case 0x46: return SmemPAMassApply3D<4,6>(NE,B,Bt,D,X,Y);
case 0x48: return SmemPAMassApply3D<4,8>(NE,B,Bt,D,X,Y);
case 0x56: return SmemPAMassApply3D<5,6>(NE,B,Bt,D,X,Y);
case 0x58: return SmemPAMassApply3D<5,8>(NE,B,Bt,D,X,Y);
case 0x67: return SmemPAMassApply3D<6,7>(NE,B,Bt,D,X,Y);
case 0x78: return SmemPAMassApply3D<7,8>(NE,B,Bt,D,X,Y);
case 0x89: return SmemPAMassApply3D<8,9>(NE,B,Bt,D,X,Y);
case 0x9A: return SmemPAMassApply3D<9,10>(NE,B,Bt,D,X,Y);
default: return PAMassApply3D(NE,B,Bt,D,X,Y,D1D,Q1D);
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Unknown kernel.");
}
} // namespace internal
} // namespace mfem
+149 -22
View File
@@ -25,11 +25,95 @@ namespace mfem
namespace internal
{
void PAMassAssembleDiagonal(const int dim, const int D1D,
const int Q1D, const int NE,
const Array<real_t> &B,
const Vector &D,
Vector &Y);
// PA Mass Diagonal 1D kernel
static void PAMassAssembleDiagonal1D(const int NE,
const Array<real_t> &b,
const Vector &d,
Vector &y,
const int D1D,
const int Q1D)
{
auto B = Reshape(b.Read(), Q1D, D1D);
auto D = Reshape(d.Read(), Q1D, NE);
auto Y = Reshape(y.ReadWrite(), D1D, NE);
mfem::forall(NE, [=] MFEM_HOST_DEVICE (int e)
{
for (int dx = 0; dx < D1D; ++dx)
{
for (int qx = 0; qx < Q1D; ++qx)
{
Y(dx, e) += B(qx, dx) * B(qx, dx) * D(qx, e);
}
}
});
}
MFEM_HOST_DEVICE inline
void PAMassApply1D_Element(const int e,
const int NE,
const real_t *b_,
const real_t *bt_,
const real_t *d_,
const real_t *x_,
real_t *y_,
const int d1d = 0,
const int q1d = 0)
{
const int D1D = d1d;
const int Q1D = q1d;
auto B = ConstDeviceMatrix(b_, Q1D, D1D);
auto Bt = ConstDeviceMatrix(bt_, D1D, Q1D);
auto D = ConstDeviceMatrix(d_, Q1D, NE);
auto X = ConstDeviceMatrix(x_, D1D, NE);
auto Y = DeviceMatrix(y_, D1D, NE);
real_t XQ[DofQuadLimits::MAX_Q1D];
for (int qx = 0; qx < Q1D; ++qx)
{
XQ[qx] = 0.0;
}
for (int dx = 0; dx < D1D; ++dx)
{
const real_t s = X(dx,e);
for (int qx = 0; qx < Q1D; ++qx)
{
XQ[qx] += B(qx,dx)*s;
}
}
for (int qx = 0; qx < Q1D; ++qx)
{
const double q = XQ[qx]*D(qx,e);
for (int dx = 0; dx < D1D; ++dx)
{
Y(dx,e) += Bt(dx,qx) * q;
}
}
}
// PA Mass Apply 1D kernel
static void PAMassApply1D(const int NE,
const Array<real_t> &b_,
const Array<real_t> &bt_,
const Vector &d_,
const Vector &x_,
Vector &y_,
const int d1d = 0,
const int q1d = 0)
{
MFEM_VERIFY(d1d <= DeviceDofQuadLimits::Get().MAX_D1D, "");
MFEM_VERIFY(q1d <= DeviceDofQuadLimits::Get().MAX_Q1D, "");
const auto B = b_.Read();
const auto Bt = bt_.Read();
const auto D = d_.Read();
const auto X = x_.Read();
auto Y = y_.ReadWrite();
mfem::forall(NE, [=] MFEM_HOST_DEVICE (int e)
{
internal::PAMassApply1D_Element(e, NE, B, Bt, D, X, Y, d1d, q1d);
});
}
// PA Mass Diagonal 2D kernel
template<int T_D1D = 0, int T_Q1D = 0>
@@ -78,8 +162,18 @@ inline void PAMassAssembleDiagonal2D(const int NE,
});
}
namespace mass
{
constexpr int ipow(int x, int p) { return p == 0 ? 1 : x*ipow(x, p-1); }
constexpr int D(int D1D) { return (11 - D1D) / 2; }
constexpr int NBZ(int D1D)
{
return ipow(2, D(D1D) >= 0 ? D(D1D) : 0);
}
}
// Shared memory PA Mass Diagonal 2D kernel
template<int T_D1D = 0, int T_Q1D = 0, int T_NBZ = 0>
template<int T_D1D = 0, int T_Q1D = 0>
inline void SmemPAMassAssembleDiagonal2D(const int NE,
const Array<real_t> &b_,
const Vector &d_,
@@ -87,9 +181,10 @@ inline void SmemPAMassAssembleDiagonal2D(const int NE,
const int d1d = 0,
const int q1d = 0)
{
static constexpr int T_NBZ = mass::NBZ(T_D1D);
static constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int max_q1d = T_Q1D ? T_Q1D : DeviceDofQuadLimits::Get().MAX_Q1D;
const int max_d1d = T_D1D ? T_D1D : DeviceDofQuadLimits::Get().MAX_D1D;
MFEM_VERIFY(D1D <= max_d1d, "");
@@ -102,7 +197,6 @@ inline void SmemPAMassAssembleDiagonal2D(const int NE,
const int tidz = MFEM_THREAD_ID(z);
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
constexpr int MQ1 = T_Q1D ? T_Q1D : DofQuadLimits::MAX_Q1D;
constexpr int MD1 = T_D1D ? T_D1D : DofQuadLimits::MAX_D1D;
MFEM_SHARED real_t B[MQ1][MD1];
@@ -302,16 +396,6 @@ inline void SmemPAMassAssembleDiagonal3D(const int NE,
});
}
void PAMassApply(const int dim,
const int D1D,
const int Q1D,
const int NE,
const Array<real_t> &B,
const Array<real_t> &Bt,
const Vector &D,
const Vector &X,
Vector &Y);
#ifdef MFEM_USE_OCCA
// OCCA PA Mass Apply 2D kernel
void OccaPAMassApply2D(const int D1D,
@@ -964,7 +1048,7 @@ inline void PAMassApply2D(const int NE,
}
// Shared memory PA Mass Apply 2D kernel
template<int T_D1D = 0, int T_Q1D = 0, int T_NBZ = 0>
template<int T_D1D = 0, int T_Q1D = 0>
inline void SmemPAMassApply2D(const int NE,
const Array<real_t> &b_,
const Array<real_t> &bt_,
@@ -975,9 +1059,10 @@ inline void SmemPAMassApply2D(const int NE,
const int q1d = 0)
{
MFEM_CONTRACT_VAR(bt_);
static constexpr int T_NBZ = mass::NBZ(T_D1D);
static constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int D1D = T_D1D ? T_D1D : d1d;
const int Q1D = T_Q1D ? T_Q1D : q1d;
constexpr int NBZ = T_NBZ ? T_NBZ : 1;
const int max_q1d = T_Q1D ? T_Q1D : DeviceDofQuadLimits::Get().MAX_Q1D;
const int max_d1d = T_D1D ? T_D1D : DeviceDofQuadLimits::Get().MAX_D1D;
MFEM_VERIFY(D1D <= max_d1d, "");
@@ -988,8 +1073,8 @@ inline void SmemPAMassApply2D(const int NE,
auto Y = y_.ReadWrite();
mfem::forall_2D_batch(NE, Q1D, Q1D, NBZ, [=] MFEM_HOST_DEVICE (int e)
{
internal::SmemPAMassApply2D_Element<T_D1D,T_Q1D,T_NBZ>(e, NE, b, D, x, Y, d1d,
q1d);
internal::SmemPAMassApply2D_Element<T_D1D,T_Q1D,T_NBZ>(
e, NE, b, D, x, Y, d1d, q1d);
});
}
@@ -1049,6 +1134,48 @@ inline void SmemPAMassApply3D(const int NE,
} // namespace internal
namespace
{
using ApplyKernelType = MassIntegrator::ApplyKernelType;
using DiagonalKernelType = MassIntegrator::DiagonalKernelType;
}
template<int DIM, int T_D1D, int T_Q1D>
ApplyKernelType MassIntegrator::ApplyPAKernels::Kernel()
{
if (DIM == 1) { return internal::PAMassApply1D; }
else if (DIM == 2) { return internal::SmemPAMassApply2D<T_D1D,T_Q1D>; }
else if (DIM == 3) { return internal::SmemPAMassApply3D<T_D1D, T_Q1D>; }
else { MFEM_ABORT(""); }
}
inline ApplyKernelType MassIntegrator::ApplyPAKernels::Fallback(
int DIM, int, int)
{
if (DIM == 1) { return internal::PAMassApply1D; }
else if (DIM == 2) { return internal::PAMassApply2D; }
else if (DIM == 3) { return internal::PAMassApply3D; }
else { MFEM_ABORT(""); }
}
template<int DIM, int T_D1D, int T_Q1D>
DiagonalKernelType MassIntegrator::DiagonalPAKernels::Kernel()
{
if (DIM == 1) { return internal::PAMassAssembleDiagonal1D; }
else if (DIM == 2) { return internal::SmemPAMassAssembleDiagonal2D<T_D1D,T_Q1D>; }
else if (DIM == 3) { return internal::SmemPAMassAssembleDiagonal3D<T_D1D, T_Q1D>; }
else { MFEM_ABORT(""); }
}
inline DiagonalKernelType MassIntegrator::DiagonalPAKernels::Fallback(
int DIM, int, int)
{
if (DIM == 1) { return internal::PAMassAssembleDiagonal1D; }
else if (DIM == 2) { return internal::PAMassAssembleDiagonal2D; }
else if (DIM == 3) { return internal::PAMassAssembleDiagonal3D; }
else { MFEM_ABORT(""); }
}
} // namespace mfem
#endif
+24 -4
View File
@@ -19,6 +19,8 @@
namespace mfem
{
// PA Mass Integrator
void MassIntegrator::AssemblePA(const FiniteElementSpace &fes)
{
const MemoryType mt = (pa_mt == MemoryType::DEFAULT) ?
@@ -195,8 +197,8 @@ void MassIntegrator::AssembleDiagonalPA(Vector &diag)
}
else
{
internal::PAMassAssembleDiagonal(dim, dofs1D, quad1D, ne, maps->B, pa_data,
diag);
DiagonalPAKernels::Run(dim, dofs1D, quad1D, ne, maps->B, pa_data,
diag, dofs1D, quad1D);
}
}
@@ -208,8 +210,26 @@ void MassIntegrator::AddMultPA(const Vector &x, Vector &y) const
}
else
{
internal::PAMassApply(dim, dofs1D, quad1D, ne, maps->B, maps->Bt, pa_data, x,
y);
const int D1D = dofs1D;
const int Q1D = quad1D;
const Array<real_t> &B = maps->B;
const Array<real_t> &Bt = maps->Bt;
const Vector &D = pa_data;
#ifdef MFEM_USE_OCCA
if (DeviceCanUseOcca())
{
if (dim == 2)
{
return internal::OccaPAMassApply2D(D1D,Q1D,ne,B,Bt,D,x,y);
}
if (dim == 3)
{
return internal::OccaPAMassApply3D(D1D,Q1D,ne,B,Bt,D,x,y);
}
MFEM_ABORT("OCCA PA Mass Apply unknown kernel!");
}
#endif // MFEM_USE_OCCA
ApplyPAKernels::Run(dim, D1D, Q1D, ne, B, Bt, D, x, y, D1D, Q1D);
}
}
+2 -4
View File
@@ -160,16 +160,14 @@ public:
/// bigger value. A node in the target grid function is matching
/// a point with coordinates specified in the vector coords if the
/// distance between them is smaller than lerr.
virtual
void Project(const Vector& coords,const Vector& src,
int ordering=Ordering::byNODES, real_t lerr=1e-8);
int ordering=Ordering::byNODES, real_t lerr=1e-8) override;
/// The project method can be called as many times as necessary with
/// different grid functions gf. A node in the target grid function is
/// matching a node from the source grid function if the distance
/// between them is smaller than lerr.
virtual
void Project(const GridFunction& gf, real_t lerr=1e-8);
void Project(const GridFunction& gf, real_t lerr=1e-8) override;
};
} // namespace mfem
+183
View File
@@ -0,0 +1,183 @@
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#ifndef MFEM_KERNEL_DISPATCH_HPP
#define MFEM_KERNEL_DISPATCH_HPP
#include "../config/config.hpp"
#include "kernel_reporter.hpp"
#include <unordered_map>
#include <tuple>
#include <cstddef>
namespace mfem
{
// The MFEM_REGISTER_KERNELS macro registers kernels for runtime dispatch using
// a dispatch map.
//
// This creates a dispatch table (a static member variable) named @a KernelName
// containing function points of type @a KernelType. These are followed by one
// or two sets of parenthesized argument types.
//
// The first set of argument types contains the types that are used to dispatch
// to either specialized or fallback kernels. The second set of argument types
// can be used to further specialize the kernel without participating in
// dispatch (a canonical example is NBZ, determining the size of the thread
// blocks; this is required to specialize kernels for optimal performance, but
// is not relevant for dispatch).
//
// After calling this macro, the user must implement the Kernel and Fallback
// static member functions, which return pointers to the appropriate kernel
// functions depending on the parameters.
//
// Specialized functions can be registered using the static AddSpecialization
// member function.
#define MFEM_EXPAND(X) X // Workaround needed for MSVC compiler
#define MFEM_REGISTER_KERNELS(KernelName, KernelType, ...) \
MFEM_EXPAND(MFEM_EXPAND(MFEM_REGISTER_KERNELS_N(__VA_ARGS__,2,1,)) \
(KernelName,KernelType,__VA_ARGS__))
#define MFEM_REGISTER_KERNELS_N(_1, _2, N, ...) MFEM_REGISTER_KERNELS_##N
// Expands a variable length macro parameter so that multiple variable length
// parameters can be passed to the same macro.
#define MFEM_PARAM_LIST(...) __VA_ARGS__
// Version of MFEM_REGISTER_KERNELS without any "optional" (non-dispatch)
// parameters.
#define MFEM_REGISTER_KERNELS_1(KernelName, KernelType, Params) \
MFEM_REGISTER_KERNELS_(KernelName, KernelType, Params, (), Params)
// Version of MFEM_REGISTER_KERNELS without any optional (non-dispatch)
// parameters (e.g. NBZ).
#define MFEM_REGISTER_KERNELS_2(KernelName, KernelType, Params, OptParams) \
MFEM_REGISTER_KERNELS_(KernelName, KernelType, Params, OptParams, \
(MFEM_PARAM_LIST Params, MFEM_PARAM_LIST OptParams))
// P1 are the parameters, P2 are the optional (non-dispatch parameters), and P3
// is the concatenation of P1 and P2. We need to pass it as a separate argument
// to avoid a trailing comma in the case that P2 is empty.
#define MFEM_REGISTER_KERNELS_(KernelName, KernelType, P1, P2, P3) \
class KernelName : public \
KernelDispatchTable<KernelName, KernelType, \
internal::KernelTypeList<MFEM_PARAM_LIST P1>, \
internal::KernelTypeList<MFEM_PARAM_LIST P2>> \
{ \
public: \
const char *kernel_name = MFEM_KERNEL_NAME(KernelName); \
using KernelSignature = KernelType; \
template <MFEM_PARAM_LIST P3> \
static KernelSignature Kernel(); \
static KernelSignature Fallback(MFEM_PARAM_LIST P1); \
static KernelName &Get() \
{ static KernelName table; return table;} \
}
/// @brief Hashes variadic packs for which each type contained in the variadic
/// pack has a specialization of `std::hash` available.
///
/// For example, packs containing int, bool, enum values, etc.
template<typename ...KernelParameters>
struct KernelDispatchKeyHash
{
private:
template<int N>
size_t operator()(std::tuple<KernelParameters...> value) const { return 0; }
// The hashing formula here is taken directly from the Boost library, with
// the magic number 0x9e3779b9 chosen to minimize hashing collisions.
template<std::size_t N, typename THead, typename... TTail>
size_t operator()(std::tuple<KernelParameters...> value) const
{
constexpr int Index = N - sizeof...(TTail) - 1;
auto lhs_hash = std::hash<THead>()(std::get<Index>(value));
auto rhs_hash = operator()<N, TTail...>(value);
return lhs_hash^(rhs_hash + 0x9e3779b9 + (lhs_hash<<6) + (lhs_hash>>2));
}
public:
/// Returns the hash of the given @a value.
size_t operator()(std::tuple<KernelParameters...> value) const
{
return operator()<sizeof...(KernelParameters),KernelParameters...>(value);
}
};
namespace internal { template<typename... Types> struct KernelTypeList { }; }
template<typename... T> class KernelDispatchTable { };
template <typename Kernels,
typename Signature,
typename... Params,
typename... OptParams>
class KernelDispatchTable<Kernels,
Signature,
internal::KernelTypeList<Params...>,
internal::KernelTypeList<OptParams...>>
{
std::unordered_map<std::tuple<Params...>,
Signature,
KernelDispatchKeyHash<Params...>> table;
public:
/// @brief Run the kernel with the given dispatch parameters and arguments.
///
/// If a compile-time specialized version of the kernel with the given
/// parameters has been registered, it will be called. Otherwise, the
/// fallback kernel will be called.
template<typename... Args>
static void Run(Params... params, Args&&... args)
{
const auto &table = Kernels::Get().table;
const std::tuple<Params...> key = std::make_tuple(params...);
const auto it = table.find(key);
if (it != table.end())
{
it->second(std::forward<Args>(args)...);
}
else
{
KernelReporter::ReportFallback(Kernels::Get().kernel_name, params...);
Kernels::Fallback(params...)(std::forward<Args>(args)...);
}
}
/// Register a specialized kernel for dispatch.
template <Params... PARAMS>
struct Specialization
{
// Version without optional parameters
static void Add()
{
std::tuple<Params...> param_tuple(PARAMS...);
Kernels::Get().table[param_tuple] =
Kernels:: template Kernel<PARAMS...>();
};
// Version with optional parameters
template <OptParams... OPT_PARAMS>
struct Opt
{
static void Add()
{
std::tuple<Params...> param_tuple(PARAMS...);
Kernels::Get().table[param_tuple] =
Kernels:: template Kernel<PARAMS..., OPT_PARAMS...>();
}
};
};
};
}
#endif
+102
View File
@@ -0,0 +1,102 @@
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#ifndef MFEM_KERNEL_REPORTER_HPP
#define MFEM_KERNEL_REPORTER_HPP
#include "../general/globals.hpp"
#include <set>
#include <sstream>
#include <string>
#define MFEM_STR_(X) #X
#define MFEM_STR(X) MFEM_STR_(X)
#define MFEM_KERNEL_NAME(KernelName) \
__FILE__ ":" MFEM_STR(__LINE__) " : " #KernelName
namespace mfem
{
namespace internal
{
template <typename Last>
static void Stringify_(std::ostream &o, Last &&arg)
{
o << arg;
}
template <typename T1, typename T2, typename... Rest>
static void Stringify_(std::ostream &o, T1 &&a1, T2 &&a2, Rest&&... rest)
{
o << int(a1) << ",";
Stringify_(o, a2, rest...);
}
template <typename... Args>
static std::string Stringify(Args&&... args)
{
std::stringstream o;
Stringify_(o, args...);
return o.str();
}
} // namespace
/// @brief Singleton class to report fallback kernels.
///
/// Writes the first call to a fallback kernel to mfem::err
///
/// @note This class is only enabled when the environment variable
/// MFEM_REPORT_KERNELS is set to a value other than 'NO' or if
/// KernelReporter::Enable() is called.
class KernelReporter
{
bool enabled = false;
std::set<std::string> reported_fallbacks;
KernelReporter()
{
const char *env = getenv("MFEM_REPORT_KERNELS");
if (env)
{
if (std::string(env) != "NO") { enabled = true; }
}
}
static KernelReporter &Instance()
{
static KernelReporter instance;
return instance;
}
public:
/// Enable reporting of fallback kernels.
static void Enable() { Instance().enabled = true; }
/// Disable reporting of fallback kernels.
static void Disable() { Instance().enabled = false; }
/// Report the fallback kernel with given parameters.
template <typename... Params>
static void ReportFallback(const std::string &kernel_name, Params&&... params)
{
if (!Instance().enabled) { return; }
auto &reported_fallbacks = Instance().reported_fallbacks;
const std::string requested_kernel =
kernel_name + "<" + internal::Stringify(params...) + ">";
if (reported_fallbacks.find(requested_kernel) == reported_fallbacks.end())
{
reported_fallbacks.insert(requested_kernel);
mfem::err << "Fallback kernel. Requested "
<< requested_kernel << std::endl;
}
}
};
} // namespace mfem
#endif
+130 -130
View File
@@ -121,22 +121,22 @@ public:
DomainLFIntegrator(Coefficient &QF, const IntegrationRule *ir)
: DeltaLFIntegrator(QF, ir), Q(QF), oa(1), ob(1) { }
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
/** Given a particular Finite Element and a transformation (Tr)
computes the element right hand side element vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -154,22 +154,22 @@ public:
DomainLFGradIntegrator(VectorCoefficient &QF)
: DeltaLFIntegrator(QF), Q(QF) { }
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
/** Given a particular Finite Element and a transformation (Tr)
computes the element right hand side element vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -187,21 +187,21 @@ public:
BoundaryLFIntegrator(Coefficient &QG, int a = 1, int b = 1)
: Q(QG), oa(a), ob(b) { }
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
/** Given a particular boundary Finite Element and a transformation (Tr)
computes the element boundary vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
virtual void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -217,16 +217,16 @@ public:
BoundaryNormalLFIntegrator(VectorCoefficient &QG, int a = 1, int b = 1)
: Q(QG), oa(a), ob(b) { }
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -242,9 +242,9 @@ public:
BoundaryTangentialLFIntegrator(VectorCoefficient &QG, int a = 1, int b = 1)
: Q(QG), oa(a), ob(b) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -262,22 +262,22 @@ public:
VectorDomainLFIntegrator(VectorCoefficient &QF)
: DeltaLFIntegrator(QF), Q(QF) { }
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
/** Given a particular Finite Element and a transformation (Tr)
computes the element right hand side element vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -296,22 +296,22 @@ public:
VectorDomainLFGradIntegrator(VectorCoefficient &QF)
: DeltaLFIntegrator(QF), Q(QF) { }
virtual bool SupportsDevice() const override { return true; }
bool SupportsDevice() const override { return true; }
/// Method defining assembly on device
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
/** Given a particular Finite Element and a transformation (Tr)
computes the element right hand side element vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -330,14 +330,14 @@ public:
/** Given a particular boundary Finite Element and a transformation (Tr)
computes the element boundary vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
// For DG spaces
virtual void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -354,19 +354,19 @@ public:
VectorFEDomainLFIntegrator(VectorCoefficient &F)
: DeltaLFIntegrator(F), QF(F) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -384,13 +384,13 @@ public:
VectorFEDomainLFCurlIntegrator(VectorCoefficient &F)
: DeltaLFIntegrator(F), QF(&F) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -408,13 +408,13 @@ public:
/** Given a particular Finite Element and a transformation (Tr)
computes the element right hand side element vector, elvect. */
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect);
void AssembleDeltaElementVect(const FiniteElement &fe,
ElementTransformation &Trans,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -434,9 +434,9 @@ public:
const IntegrationRule *ir = NULL)
: LinearFormIntegrator(ir), Sign(s), F(&f) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -457,17 +457,17 @@ public:
VectorFEBoundaryFluxLFIntegrator(Coefficient &f, int a = 2, int b = 0)
: F(&f), oa(a), ob(b) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
virtual bool SupportsDevice() const { return true; }
bool SupportsDevice() const override { return true; }
virtual void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b);
void AssembleDevice(const FiniteElementSpace &fes,
const Array<int> &markers,
Vector &b) override;
};
/** Class for boundary integration of (f.n, v.n) for vector coefficient f and
@@ -501,9 +501,9 @@ public:
int a = 2, int b = 0)
: f(QG), oa(a), ob(b) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -531,12 +531,12 @@ public:
real_t a, real_t b)
{ f = &f_; u = &u_; alpha = a; beta = b; }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
virtual void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -573,12 +573,12 @@ public:
const real_t s, const real_t k)
: uD(&u), Q(NULL), MQ(&q), sigma(s), kappa(k) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
virtual void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -618,12 +618,12 @@ public:
real_t alpha_, real_t kappa_)
: uD(uD_), lambda(&lambda_), mu(&mu_), alpha(alpha_), kappa(kappa_) { }
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
virtual void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
void AssembleRHSElementVect(const FiniteElement &el,
FaceElementTransformations &Tr,
Vector &elvect) override;
using LinearFormIntegrator::AssembleRHSElementVect;
};
@@ -695,9 +695,9 @@ public:
}
using LinearFormIntegrator::AssembleRHSElementVect;
virtual void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &el,
ElementTransformation &Tr,
Vector &elvect) override;
/** @brief Saves the lower triangular matrices in the element-wise Cholesky
decomposition. The parameter @a NE should be the number of elements in
@@ -758,11 +758,11 @@ public:
}
using LinearFormIntegrator::AssembleRHSElementVect;
virtual void AssembleRHSElementVect(const FiniteElement &fe,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &fe,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void SetIntRule(const IntegrationRule *ir)
void SetIntRule(const IntegrationRule *ir) override
{
MFEM_WARNING("Integration rule not used in this class. "
"The QuadratureFunction integration rules are used instead");
@@ -790,11 +790,11 @@ public:
}
using LinearFormIntegrator::AssembleRHSElementVect;
virtual void AssembleRHSElementVect(const FiniteElement &fe,
ElementTransformation &Tr,
Vector &elvect);
void AssembleRHSElementVect(const FiniteElement &fe,
ElementTransformation &Tr,
Vector &elvect) override;
virtual void SetIntRule(const IntegrationRule *ir)
void SetIntRule(const IntegrationRule *ir) override
{
MFEM_WARNING("Integration rule not used in this class. "
"The QuadratureFunction integration rules are used instead");
+5 -5
View File
@@ -106,12 +106,12 @@ public:
int postSmoothingSteps_);
/// Application of the multigrid as a preconditioner
virtual void Mult(const Vector& x, Vector& y) const override;
virtual void ArrayMult(const Array<const Vector*>& X_,
Array<Vector*>& Y_) const override;
void Mult(const Vector& x, Vector& y) const override;
void ArrayMult(const Array<const Vector*>& X_,
Array<Vector*>& Y_) const override;
/// Not supported for multigrid
virtual void SetOperator(const Operator& op) override
void SetOperator(const Operator& op) override
{
MFEM_ABORT("SetOperator is not supported in Multigrid!");
}
@@ -155,7 +155,7 @@ public:
private:
/// Returns prolongation operator at given level
virtual const Operator* GetProlongationAtLevel(int level) const override
const Operator* GetProlongationAtLevel(int level) const override
{
return prolongations[level];
}
+6 -6
View File
@@ -204,7 +204,7 @@ public:
Both the input and the output vectors, @a x and @a y, must be true-dof
vectors, i.e. their size must be fes->GetTrueVSize(). */
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/** @brief Compute the gradient Operator of the NonlinearForm corresponding
to the state @a x. */
@@ -217,7 +217,7 @@ public:
In general, @a x may have non-homogeneous essential boundary values.
The state @a x must be a true-dof vector. */
virtual Operator &GetGradient(const Vector &x) const;
Operator &GetGradient(const Vector &x) const override;
/// Update the NonlinearForm to propagate updates of the associated FE space.
/** After calling this method, the essential boundary conditions need to be
@@ -233,9 +233,9 @@ public:
virtual void Setup();
/// Get the finite element space prolongation matrix
virtual const Operator *GetProlongation() const { return P; }
const Operator *GetProlongation() const override { return P; }
/// Get the finite element space restriction matrix
virtual const Operator *GetRestriction() const
const Operator *GetRestriction() const override
{ return fes->GetRestrictionMatrix(); }
/// Indicate that integrators are not owned by the NonlinearForm
@@ -370,11 +370,11 @@ public:
/// Method is only called in serial, the parallel version calls MultBlocked
/// directly.
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/// Method is only called in serial, the parallel version calls
/// GetGradientBlocked directly.
virtual Operator &GetGradient(const Vector &x) const;
Operator &GetGradient(const Vector &x) const override;
/// Destructor.
virtual ~BlockNonlinearForm();
+3 -3
View File
@@ -68,17 +68,17 @@ private:
Gradient(const PANonlinearFormExtension &ext);
/// Assumes that @a x and @a y are ldof Vector%s.
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/// Assumes that @a g is an ldof Vector.
void AssembleGrad(const Vector &g);
/// Assemble the diagonal of the gradient into the ldof Vector @a diag.
virtual void AssembleDiagonal(Vector &diag) const;
void AssembleDiagonal(Vector &diag) const override;
/** @brief Define the prolongation Operator for use with methods like
FormSystemOperator. */
virtual const Operator *GetProlongation() const
const Operator *GetProlongation() const override
{
return ext.fes.GetProlongationMatrix();
}
+48 -48
View File
@@ -267,12 +267,12 @@ protected:
mutable DenseMatrix G, C; // dof x dim
public:
virtual real_t EvalW(const DenseMatrix &J) const;
real_t EvalW(const DenseMatrix &J) const override;
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const;
void EvalP(const DenseMatrix &J, DenseMatrix &P) const override;
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
const real_t weight, DenseMatrix &A) const;
void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
const real_t weight, DenseMatrix &A) const override;
};
@@ -301,12 +301,12 @@ public:
: mu(0.0), K(0.0), g(1.0), c_mu(&mu_), c_K(&K_), c_g(g_),
have_coeffs(true) { }
virtual real_t EvalW(const DenseMatrix &J) const;
real_t EvalW(const DenseMatrix &J) const override;
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const;
void EvalP(const DenseMatrix &J, DenseMatrix &P) const override;
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
const real_t weight, DenseMatrix &A) const;
void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
const real_t weight, DenseMatrix &A) const override;
};
@@ -342,17 +342,17 @@ public:
@param[in] el Type of FiniteElement.
@param[in] Ttr Represents ref->target coordinates transformation.
@param[in] elfun Physical coordinates of the zone. */
virtual real_t GetElementEnergy(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun);
real_t GetElementEnergy(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun) override;
virtual void AssembleElementVector(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun, Vector &elvect);
void AssembleElementVector(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun, Vector &elvect) override;
virtual void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun, DenseMatrix &elmat);
void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &Ttr,
const Vector &elfun, DenseMatrix &elmat) override;
};
/** Hyperelastic incompressible Neo-Hookean integrator with the PK1 stress
@@ -369,21 +369,21 @@ private:
public:
IncompressibleNeoHookeanIntegrator(Coefficient &mu_) : c_mu(&mu_) { }
virtual real_t GetElementEnergy(const Array<const FiniteElement *>&el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun);
real_t GetElementEnergy(const Array<const FiniteElement *>&el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun) override;
/// Perform the local action of the NonlinearFormIntegrator
virtual void AssembleElementVector(const Array<const FiniteElement *> &el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun,
const Array<Vector *> &elvec);
void AssembleElementVector(const Array<const FiniteElement *> &el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun,
const Array<Vector *> &elvec) override;
/// Assemble the local gradient matrix
virtual void AssembleElementGrad(const Array<const FiniteElement*> &el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun,
const Array2D<DenseMatrix *> &elmats);
void AssembleElementGrad(const Array<const FiniteElement*> &el,
ElementTransformation &Tr,
const Array<const Vector *> &elfun,
const Array2D<DenseMatrix *> &elmats) override;
};
@@ -407,25 +407,25 @@ public:
static const IntegrationRule &GetRule(const FiniteElement &fe,
ElementTransformation &T);
virtual void AssembleElementVector(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
Vector &elvect);
void AssembleElementVector(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
Vector &elvect) override;
virtual void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat);
void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat) override;
using NonlinearFormIntegrator::AssemblePA;
virtual void AssemblePA(const FiniteElementSpace &fes);
void AssemblePA(const FiniteElementSpace &fes) override;
virtual void AssembleMF(const FiniteElementSpace &fes);
void AssembleMF(const FiniteElementSpace &fes) override;
virtual void AddMultPA(const Vector &x, Vector &y) const;
void AddMultPA(const Vector &x, Vector &y) const override;
virtual void AddMultMF(const Vector &x, Vector &y) const;
void AddMultMF(const Vector &x, Vector &y) const override;
};
@@ -444,10 +444,10 @@ public:
ConvectiveVectorConvectionNLFIntegrator() = default;
virtual void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat);
void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat) override;
};
@@ -467,10 +467,10 @@ public:
SkewSymmetricVectorConvectionNLFIntegrator() = default;
virtual void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat);
void AssembleElementGrad(const FiniteElement &el,
ElementTransformation &trans,
const Vector &elfun,
DenseMatrix &elmat) override;
};
}
+17 -17
View File
@@ -99,7 +99,7 @@ public:
of the parallel/conforming prolongation, and |.| denotes the entry-wise
absolute value. In general, this is just an approximation of the exact
diagonal for this case. */
virtual void AssembleDiagonal(Vector &diag) const;
void AssembleDiagonal(Vector &diag) const override;
/// Returns the matrix assembled on the true dofs, i.e. P^t A P.
/** The returned matrix has to be deleted by the caller. */
@@ -212,31 +212,31 @@ public:
{ return static_cond ? static_cond->GetParTraceFESpace() : NULL; }
/// Get the parallel finite element space prolongation matrix
virtual const Operator *GetProlongation() const
const Operator *GetProlongation() const override
{ return pfes->GetProlongationMatrix(); }
/// Get the transpose of GetRestriction, useful for matrix-free RAP
virtual const Operator *GetRestrictionTranspose() const
{ return pfes->GetRestrictionTransposeOperator(); }
/// Get the parallel finite element space restriction matrix
virtual const Operator *GetRestriction() const
const Operator *GetRestriction() const override
{ return pfes->GetRestrictionMatrix(); }
using BilinearForm::FormLinearSystem;
using BilinearForm::FormSystemMatrix;
virtual void FormLinearSystem(const Array<int> &ess_tdof_list, Vector &x,
Vector &b, OperatorHandle &A, Vector &X,
Vector &B, int copy_interior = 0);
void FormLinearSystem(const Array<int> &ess_tdof_list, Vector &x,
Vector &b, OperatorHandle &A, Vector &X,
Vector &B, int copy_interior = 0) override;
virtual void FormSystemMatrix(const Array<int> &ess_tdof_list,
OperatorHandle &A);
void FormSystemMatrix(const Array<int> &ess_tdof_list,
OperatorHandle &A) override;
/** Call this method after solving a linear system constructed using the
FormLinearSystem method to recover the solution as a ParGridFunction-size
vector in x. Use the same arguments as in the FormLinearSystem call. */
virtual void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x);
void RecoverFEMSolution(const Vector &X, const Vector &b, Vector &x) override;
virtual void Update(FiniteElementSpace *nfes = NULL);
void Update(FiniteElementSpace *nfes = NULL) override;
void EliminateVDofsInRHS(const Array<int> &vdofs, const Vector &x, Vector &b);
@@ -312,9 +312,9 @@ public:
This returns the same operator as FormRectangularLinearSystem(), but does
without the transformations of the right-hand side. */
virtual void FormRectangularSystemMatrix(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list,
OperatorHandle &A);
void FormRectangularSystemMatrix(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list,
OperatorHandle &A) override;
/** @brief Form the parallel linear system A X = B, corresponding to this mixed
bilinear form and the linear form @a b(.).
@@ -322,10 +322,10 @@ public:
Return in @a A a *reference* to the system matrix that is column-constrained.
The reference will be invalidated when SetOperatorType(), Update(), or the
destructor is called. */
virtual void FormRectangularLinearSystem(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list, Vector &x,
Vector &b, OperatorHandle &A, Vector &X,
Vector &B);
void FormRectangularLinearSystem(const Array<int> &trial_tdof_list,
const Array<int> &test_tdof_list, Vector &x,
Vector &b, OperatorHandle &A, Vector &X,
Vector &B) override;
/// Compute y += a (P^t A P) x, where x and y are vectors on the true dofs
void TrueAddMult(const Vector &x, Vector &y, const real_t a = 1.0) const;
+2 -2
View File
@@ -101,7 +101,7 @@ public:
@note This version of the method will also perform bounds checks when the
build option MFEM_DEBUG is enabled. */
virtual void MakeRef(FiniteElementSpace *f, Vector &v, int v_offset);
void MakeRef(FiniteElementSpace *f, Vector &v, int v_offset) override;
/** @brief Make the ParLinearForm reference external data on a new
ParFiniteElementSpace. */
@@ -120,7 +120,7 @@ public:
void Assemble();
/// Return true if assembly on device is supported, false otherwise.
virtual bool SupportsDevice() const;
bool SupportsDevice() const override;
void AssembleSharedFaces();
+9 -9
View File
@@ -46,16 +46,16 @@ public:
real_t GetEnergy(const ParGridFunction &x) const
{ return GetParGridFunctionEnergy(x); }
virtual real_t GetEnergy(const Vector &x) const
real_t GetEnergy(const Vector &x) const override
{ return GetParGridFunctionEnergy(Prolongate(x)); }
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/// Return the local gradient matrix for the given true-dof vector x.
/** The returned matrix does NOT have any boundary conditions imposed. */
const SparseMatrix &GetLocalGradient(const Vector &x) const;
virtual Operator &GetGradient(const Vector &x) const;
Operator &GetGradient(const Vector &x) const override;
/// Set the operator type id for the parallel gradient matrix/operator.
void SetGradientType(Operator::Type tid) { pGrad.SetType(tid); }
@@ -64,7 +64,7 @@ public:
parallel FE space. */
/** After calling this method, the essential boundary conditions need to be
set again. */
virtual void Update();
void Update() override;
virtual ~ParNonlinearForm() { }
};
@@ -83,7 +83,7 @@ protected:
public:
/// Computes the energy of the system
virtual real_t GetEnergy(const Vector &x) const;
real_t GetEnergy(const Vector &x) const override;
/// Construct an empty ParBlockNonlinearForm. Initialize with SetParSpaces().
ParBlockNonlinearForm() : pBlockGrad(NULL) { }
@@ -103,16 +103,16 @@ public:
void SetParSpaces(Array<ParFiniteElementSpace *> &pf);
// Here, rhs is a true dof vector
virtual void SetEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
Array<Vector *> &rhs);
void SetEssentialBC(const Array<Array<int> *>&bdr_attr_is_ess,
Array<Vector *> &rhs) override;
/// Block T-Vector to Block T-Vector
virtual void Mult(const Vector &x, Vector &y) const;
void Mult(const Vector &x, Vector &y) const override;
/// Return the local block gradient matrix for the given true-dof vector x
const BlockOperator &GetLocalGradient(const Vector &x) const;
virtual BlockOperator &GetGradient(const Vector &x) const;
BlockOperator &GetGradient(const Vector &x) const override;
/** @brief Set the operator type id for the blocks of the parallel gradient
matrix/operator. The default type is Operator::Hypre_ParCSR. */
+68 -87
View File
@@ -27,12 +27,16 @@ namespace quadrature_interpolator
{
static void Det1D(const int NE,
const real_t *b,
const real_t *g,
const real_t *x,
real_t *y,
const int d1d,
const int q1d)
const int q1d,
Vector *d_buff = nullptr)
{
MFEM_CONTRACT_VAR(b);
MFEM_CONTRACT_VAR(d_buff);
const auto G = Reshape(g, q1d, d1d);
const auto X = Reshape(x, d1d, NE);
@@ -59,8 +63,10 @@ static void Det2D(const int NE,
const real_t *x,
real_t *y,
const int d1d = 0,
const int q1d = 0)
const int q1d = 0,
Vector *d_buff = nullptr)
{
MFEM_CONTRACT_VAR(d_buff);
static constexpr int SDIM = 2;
static constexpr int NBZ = 1;
@@ -109,8 +115,11 @@ static void Det2DSurface(const int NE,
const real_t *x,
real_t *y,
const int d1d = 0,
const int q1d = 0)
const int q1d = 0,
Vector *d_buff = nullptr)
{
MFEM_CONTRACT_VAR(d_buff);
static constexpr int SDIM = 3;
static constexpr int NBZ = 1;
@@ -222,8 +231,8 @@ static void Det3D(const int NE,
if (!SMEM)
{
const DeviceDofQuadLimits &limits = DeviceDofQuadLimits::Get();
const int max_q1d = T_Q1D ? T_Q1D : limits.MAX_D1D;
const int max_d1d = T_D1D ? T_D1D : limits.MAX_Q1D;
const int max_q1d = T_Q1D ? T_Q1D : limits.MAX_Q1D;
const int max_d1d = T_D1D ? T_D1D : limits.MAX_D1D;
const int max_qd = std::max(max_q1d, max_d1d);
const int mem_size = max_qd * max_qd * max_qd * 9;
d_buff->SetSize(2*mem_size*GRID);
@@ -233,9 +242,9 @@ static void Det3D(const int NE,
mfem::forall_3D_grid(NE, Q1D, Q1D, Q1D, GRID, [=] MFEM_HOST_DEVICE (int e)
{
static constexpr int MQ1 = T_Q1D ? T_Q1D :
(SMEM ? DofQuadLimits::MAX_DET_1D : DofQuadLimits::MAX_D1D);
static constexpr int MD1 = T_D1D ? T_D1D :
(SMEM ? DofQuadLimits::MAX_DET_1D : DofQuadLimits::MAX_Q1D);
static constexpr int MD1 = T_D1D ? T_D1D :
(SMEM ? DofQuadLimits::MAX_DET_1D : DofQuadLimits::MAX_D1D);
static constexpr int MDQ = MQ1 > MD1 ? MQ1 : MD1;
static constexpr int MSZ = MDQ * MDQ * MDQ * 9;
@@ -272,91 +281,63 @@ static void Det3D(const int NE,
});
}
// Tensor-product evaluation of quadrature point determinants: dispatch
// function.
void TensorDeterminants(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_det,
Vector &d_buff)
void InitDetKernels()
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const real_t *B = maps.B.Read();
const real_t *G = maps.G.Read();
const real_t *X = e_vec.Read();
real_t *Y = q_det.Write();
const int id = (vdim<<8) | (D1D<<4) | Q1D;
if (dim == 1)
{
MFEM_VERIFY(D1D <= DeviceDofQuadLimits::Get().MAX_D1D,
"Orders higher than " << DeviceDofQuadLimits::Get().MAX_D1D-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= DeviceDofQuadLimits::Get().MAX_Q1D,
"Quadrature rules with more than "
<< DeviceDofQuadLimits::Get().MAX_Q1D << " 1D points are not supported!");
Det1D(NE, G, X, Y, D1D, Q1D);
return;
}
if (dim == 2)
{
switch (id)
{
case 0x222: return Det2D<2,2>(NE,B,G,X,Y);
case 0x223: return Det2D<2,3>(NE,B,G,X,Y);
case 0x224: return Det2D<2,4>(NE,B,G,X,Y);
case 0x226: return Det2D<2,6>(NE,B,G,X,Y);
case 0x234: return Det2D<3,4>(NE,B,G,X,Y);
case 0x236: return Det2D<3,6>(NE,B,G,X,Y);
case 0x244: return Det2D<4,4>(NE,B,G,X,Y);
case 0x246: return Det2D<4,6>(NE,B,G,X,Y);
case 0x256: return Det2D<5,6>(NE,B,G,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
if (vdim == 2) { Det2D(NE,B,G,X,Y,D1D,Q1D); }
else if (vdim == 3) { Det2DSurface(NE,B,G,X,Y,D1D,Q1D); }
else { MFEM_ABORT("Invalid space dimension."); }
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x324: return Det3D<2,4>(NE,B,G,X,Y);
case 0x333: return Det3D<3,3>(NE,B,G,X,Y);
case 0x335: return Det3D<3,5>(NE,B,G,X,Y);
case 0x336: return Det3D<3,6>(NE,B,G,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_DET_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_DET_1D;
// Highest orders that fit in shared memory
if (D1D <= MD && Q1D <= MQ)
{ return Det3D<0,0,true>(NE,B,G,X,Y,D1D,Q1D); }
// Last fall-back will use global memory
return Det3D<0,0,false>(
NE,B,G,X,Y,D1D,Q1D,&d_buff);
}
}
}
MFEM_ABORT("Kernel " << std::hex << id << std::dec << " not supported yet");
using k = QuadratureInterpolator::DetKernels;
// 2D
k::Specialization<2,2,2,2>::Add();
k::Specialization<2,2,2,3>::Add();
k::Specialization<2,2,2,4>::Add();
k::Specialization<2,2,2,6>::Add();
k::Specialization<2,2,3,4>::Add();
k::Specialization<2,2,3,6>::Add();
k::Specialization<2,2,4,4>::Add();
k::Specialization<2,2,4,6>::Add();
k::Specialization<2,2,5,6>::Add();
// 3D
k::Specialization<3,3,2,4>::Add();
k::Specialization<3,3,3,3>::Add();
k::Specialization<3,3,3,5>::Add();
k::Specialization<3,3,3,6>::Add();
}
} // namespace quadrature_interpolator
} // namespace internal
/// @cond Suppress_Doxygen_warnings
namespace
{
using DetKernel = QuadratureInterpolator::DetKernelType;
}
template<int DIM, int SDIM, int D1D, int Q1D>
DetKernel QuadratureInterpolator::DetKernels::Kernel()
{
if (DIM == 1) { return internal::quadrature_interpolator::Det1D; }
else if (DIM == 2 && SDIM == 2) { return internal::quadrature_interpolator::Det2D<D1D, Q1D>; }
else if (DIM == 2 && SDIM == 3) { return internal::quadrature_interpolator::Det2DSurface<D1D, Q1D>; }
else if (DIM == 3) { return internal::quadrature_interpolator::Det3D<D1D, Q1D>; }
else { MFEM_ABORT(""); }
}
DetKernel QuadratureInterpolator::DetKernels::Fallback(
int DIM, int SDIM, int D1D, int Q1D)
{
if (DIM == 1) { return internal::quadrature_interpolator::Det1D; }
else if (DIM == 2 && SDIM == 2) { return internal::quadrature_interpolator::Det2D; }
else if (DIM == 2 && SDIM == 3) { return internal::quadrature_interpolator::Det2DSurface; }
else if (DIM == 3)
{
const int MD = DeviceDofQuadLimits::Get().MAX_DET_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_DET_1D;
if (D1D <= MD && Q1D <= MQ) { return internal::quadrature_interpolator::Det3D<0,0,true>; }
else { return internal::quadrature_interpolator::Det3D<0,0,false>; }
}
else { MFEM_ABORT(""); }
}
/// @endcond
} // namespace mfem
-64
View File
@@ -1,64 +0,0 @@
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
// Internal header, included only by .cpp files
#include "../quadinterpolator.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point values: dispatch function.
template<QVectorLayout VL>
void TensorValues(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_val);
// Tensor-product evaluation of quadrature point derivatives: dispatch function.
template<QVectorLayout VL>
void TensorDerivatives(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_der);
// Tensor-product evaluation of quadrature point physical derivatives: dispatch
// function.
template<QVectorLayout VL>
void TensorPhysDerivatives(const int NE,
const int vdim,
const DofToQuad &maps,
const GeometricFactors &geom,
const Vector &e_vec,
Vector &q_der);
// Tensor-product evaluation of quadrature point determinants: dispatch
// function.
void TensorDeterminants(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_det,
Vector &d_buff);
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
+21 -1
View File
@@ -12,6 +12,9 @@
// Internal header, included only by .cpp files.
// Template function implementations.
#ifndef MFEM_QUADINTERP_EVAL
#define MFEM_QUADINTERP_EVAL
#include "../quadinterpolator.hpp"
#include "../../general/forall.hpp"
#include "../../linalg/dtensor.hpp"
@@ -63,7 +66,7 @@ static void Values1D(const int NE,
// Template compute kernel for Values in 2D: tensor product version.
template<QVectorLayout Q_LAYOUT,
int T_VDIM = 0, int T_D1D = 0, int T_Q1D = 0,
int T_NBZ = 1, int MAX_D1D = 0, int MAX_Q1D = 0>
int T_NBZ = 1>
static void Values2D(const int NE,
const real_t *b_,
const real_t *x_,
@@ -193,4 +196,21 @@ static void Values3D(const int NE,
} // namespace internal
/// @cond Suppress_Doxygen_warnings
template<int DIM, QVectorLayout Q_LAYOUT,
int VDIM, int D1D, int Q1D, int NBZ>
QuadratureInterpolator::TensorEvalKernelType
QuadratureInterpolator::TensorEvalKernels::Kernel()
{
if (DIM == 1) { return internal::quadrature_interpolator::Values1D<Q_LAYOUT>; }
else if (DIM == 2) { return internal::quadrature_interpolator::Values2D<Q_LAYOUT, VDIM, D1D, Q1D, NBZ>; }
else if (DIM == 3) { return internal::quadrature_interpolator::Values3D<Q_LAYOUT, VDIM, D1D, Q1D>; }
else { MFEM_ABORT(""); }
}
/// @endcond
} // namespace mfem
#endif
+47 -115
View File
@@ -10,143 +10,75 @@
// CONTRIBUTING.md for details.
#include "../quadinterpolator.hpp"
#include "dispatch.hpp"
#include "eval.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point values: dispatch function.
// Instantiation for the case QVectorLayout::byNODES.
template<>
void TensorValues<QVectorLayout::byNODES>(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_val)
void InitEvalByNodesKernels()
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const real_t *B = maps.B.Read();
const real_t *X = e_vec.Read();
real_t *Y = q_val.Write();
using k = QuadratureInterpolator::TensorEvalKernels;
constexpr QVectorLayout L = QVectorLayout::byNODES;
// 2D
k::Specialization<2,QVectorLayout::byNODES,1,3,3>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,1,2,4>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,1,3,2>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,1,3,4>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,1,4,3>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,1,4,4>::Opt<1>::Add();
const int id = (vdim<<8) | (D1D<<4) | Q1D;
k::Specialization<2,QVectorLayout::byNODES,2,2,2>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,2,3>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,2,4>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,2,5>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,2,6>::Opt<1>::Add();
if (dim == 1)
{
MFEM_VERIFY(D1D <= DeviceDofQuadLimits::Get().MAX_D1D,
"Orders higher than " << DeviceDofQuadLimits::Get().MAX_D1D-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= DeviceDofQuadLimits::Get().MAX_Q1D,
"Quadrature rules with more than "
<< DeviceDofQuadLimits::Get().MAX_Q1D << " 1D points are not supported!");
Values1D<L>(NE, B, X, Y, vdim, D1D, Q1D);
return;
}
if (dim == 2)
{
switch (id)
{
case 0x133: return Values2D<L,1,3,3>(NE,B,X,Y);
case 0x124: return Values2D<L,1,2,4>(NE,B,X,Y);
case 0x132: return Values2D<L,1,3,2>(NE,B,X,Y);
case 0x134: return Values2D<L,1,3,4>(NE,B,X,Y);
case 0x143: return Values2D<L,1,4,3>(NE,B,X,Y);
case 0x144: return Values2D<L,1,4,4>(NE,B,X,Y);
k::Specialization<2,QVectorLayout::byNODES,2,3,3>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,3,4>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,3,6>::Opt<1>::Add();
case 0x222: return Values2D<L,2,2,2>(NE,B,X,Y);
case 0x223: return Values2D<L,2,2,3>(NE,B,X,Y);
case 0x224: return Values2D<L,2,2,4>(NE,B,X,Y);
case 0x225: return Values2D<L,2,2,5>(NE,B,X,Y);
case 0x226: return Values2D<L,2,2,6>(NE,B,X,Y);
k::Specialization<2,QVectorLayout::byNODES,2,4,3>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,4,4>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,4,5>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,4,6>::Opt<1>::Add();
k::Specialization<2,QVectorLayout::byNODES,2,4,7>::Opt<1>::Add();
case 0x233: return Values2D<L,2,3,3>(NE,B,X,Y);
case 0x234: return Values2D<L,2,3,4>(NE,B,X,Y);
case 0x236: return Values2D<L,2,3,6>(NE,B,X,Y);
k::Specialization<2,QVectorLayout::byNODES,2,5,6>::Opt<1>::Add();
case 0x243: return Values2D<L,2,4,3>(NE,B,X,Y);
case 0x244: return Values2D<L,2,4,4>(NE,B,X,Y);
case 0x245: return Values2D<L,2,4,5>(NE,B,X,Y);
case 0x246: return Values2D<L,2,4,6>(NE,B,X,Y);
case 0x247: return Values2D<L,2,4,7>(NE,B,X,Y);
// 3D
k::Specialization<3,QVectorLayout::byNODES,1,2,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,3,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,3,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,3,6>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,4,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,4,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,1,4,8>::Opt<1>::Add();
case 0x256: return Values2D<L,2,5,6>(NE,B,X,Y);
k::Specialization<3,QVectorLayout::byNODES,2,2,2>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,2,2,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,2,3,4>::Opt<1>::Add();
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Values2D<L>(NE,B,X,Y,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x124: return Values3D<L,1,2,4>(NE,B,X,Y);
case 0x133: return Values3D<L,1,3,3>(NE,B,X,Y);
case 0x134: return Values3D<L,1,3,4>(NE,B,X,Y);
case 0x136: return Values3D<L,1,3,6>(NE,B,X,Y);
case 0x143: return Values3D<L,1,4,3>(NE,B,X,Y);
case 0x144: return Values3D<L,1,4,4>(NE,B,X,Y);
case 0x148: return Values3D<L,1,4,8>(NE,B,X,Y);
k::Specialization<3,QVectorLayout::byNODES,3,2,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,2,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,2,5>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,2,6>::Opt<1>::Add();
case 0x222: return Values3D<L,2,2,2>(NE,B,X,Y);
case 0x223: return Values3D<L,2,2,3>(NE,B,X,Y);
case 0x234: return Values3D<L,2,3,4>(NE,B,X,Y);
k::Specialization<3,QVectorLayout::byNODES,3,3,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,3,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,3,5>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,3,6>::Opt<1>::Add();
case 0x323: return Values3D<L,3,2,3>(NE,B,X,Y);
case 0x324: return Values3D<L,3,2,4>(NE,B,X,Y);
case 0x325: return Values3D<L,3,2,5>(NE,B,X,Y);
case 0x326: return Values3D<L,3,2,6>(NE,B,X,Y);
case 0x333: return Values3D<L,3,3,3>(NE,B,X,Y);
case 0x334: return Values3D<L,3,3,4>(NE,B,X,Y);
case 0x335: return Values3D<L,3,3,5>(NE,B,X,Y);
case 0x336: return Values3D<L,3,3,6>(NE,B,X,Y);
case 0x343: return Values3D<L,3,4,3>(NE,B,X,Y);
case 0x344: return Values3D<L,3,4,4>(NE,B,X,Y);
case 0x346: return Values3D<L,3,4,6>(NE,B,X,Y);
case 0x347: return Values3D<L,3,4,7>(NE,B,X,Y);
case 0x348: return Values3D<L,3,4,8>(NE,B,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Values3D<L>(NE,B,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Kernel not supported yet");
k::Specialization<3,QVectorLayout::byNODES,3,4,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,4,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,4,6>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,4,7>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,3,4,8>::Opt<1>::Add();
}
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
+25 -97
View File
@@ -10,117 +10,45 @@
// CONTRIBUTING.md for details.
#include "../quadinterpolator.hpp"
#include "dispatch.hpp"
#include "eval.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point values: dispatch function.
// Instantiation for the case QVectorLayout::byVDIM.
template<>
void TensorValues<QVectorLayout::byVDIM>(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_val)
void InitEvalByVDimKernels()
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const real_t *B = maps.B.Read();
const real_t *X = e_vec.Read();
real_t *Y = q_val.Write();
using k = QuadratureInterpolator::TensorEvalKernels;
// 2D
k::Specialization<2,QVectorLayout::byVDIM,1,2,4>::Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,1,3,6>::Opt<4>::Add();
k::Specialization<2,QVectorLayout::byVDIM,1,4,8>::Opt<2>::Add();
constexpr QVectorLayout L = QVectorLayout::byVDIM;
k::Specialization<2,QVectorLayout::byVDIM,2,2,4>::Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,2,3,4>::Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,2,3,6>::Opt<4>::Add();
k::Specialization<2,QVectorLayout::byVDIM,2,4,8>::Opt<2>::Add();
// 3D
k::Specialization<3,QVectorLayout::byVDIM,1,2,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,1,3,6>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,1,4,8>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,2,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,3,6>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,4,8>::Opt<1>::Add();
const int id = (vdim<<8) | (D1D<<4) | Q1D;
if (dim == 1)
{
MFEM_VERIFY(D1D <= DeviceDofQuadLimits::Get().MAX_D1D,
"Orders higher than " << DeviceDofQuadLimits::Get().MAX_D1D-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= DeviceDofQuadLimits::Get().MAX_Q1D,
"Quadrature rules with more than "
<< DeviceDofQuadLimits::Get().MAX_Q1D << " 1D points are not supported!");
Values1D<L>(NE, B, X, Y, vdim, D1D, Q1D);
return;
}
if (dim == 2)
{
switch (id)
{
case 0x124: return Values2D<L,1,2,4,8>(NE,B,X,Y);
case 0x136: return Values2D<L,1,3,6,4>(NE,B,X,Y);
case 0x148: return Values2D<L,1,4,8,2>(NE,B,X,Y);
case 0x224: return Values2D<L,2,2,4,8>(NE,B,X,Y);
case 0x234: return Values2D<L,2,3,4,8>(NE,B,X,Y);
case 0x236: return Values2D<L,2,3,6,4>(NE,B,X,Y);
case 0x248: return Values2D<L,2,4,8,2>(NE,B,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Values2D<L>(NE,B,X,Y,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x124: return Values3D<L,1,2,4>(NE,B,X,Y);
case 0x136: return Values3D<L,1,3,6>(NE,B,X,Y);
case 0x148: return Values3D<L,1,4,8>(NE,B,X,Y);
case 0x324: return Values3D<L,3,2,4>(NE,B,X,Y);
case 0x336: return Values3D<L,3,3,6>(NE,B,X,Y);
case 0x348: return Values3D<L,3,4,8>(NE,B,X,Y);
// Used for LOR batched assembly
case 0x322: return Values3D<L,3,2,2>(NE,B,X,Y);
case 0x333: return Values3D<L,3,3,3>(NE,B,X,Y);
case 0x344: return Values3D<L,3,4,4>(NE,B,X,Y);
case 0x355: return Values3D<L,3,5,5>(NE,B,X,Y);
case 0x366: return Values3D<L,3,6,6>(NE,B,X,Y);
case 0x377: return Values3D<L,3,7,7>(NE,B,X,Y);
case 0x388: return Values3D<L,3,8,8>(NE,B,X,Y);
case 0x399: return Values3D<L,3,9,9>(NE,B,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Values3D<L>(NE,B,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Kernel not supported yet");
k::Specialization<3,QVectorLayout::byVDIM,3,2,2>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,3,3>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,4,4>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,5,5>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,6,6>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,7,7>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,8,8>::Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,3,9,9>::Opt<1>::Add();
}
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
+23
View File
@@ -12,6 +12,9 @@
// Internal header, included only by .cpp files.
// Template function implementations.
#ifndef MFEM_QUADINTERP_GRAD
#define MFEM_QUADINTERP_GRAD
#include "../quadinterpolator.hpp"
#include "../../general/forall.hpp"
#include "../../linalg/dtensor.hpp"
@@ -29,6 +32,7 @@ namespace quadrature_interpolator
template<QVectorLayout Q_LAYOUT, bool GRAD_PHYS>
static void Derivatives1D(const int NE,
const real_t *b_,
const real_t *g_,
const real_t *j_,
const real_t *x_,
@@ -38,6 +42,7 @@ static void Derivatives1D(const int NE,
const int d1d,
const int q1d)
{
MFEM_CONTRACT_VAR(b_);
const auto g = Reshape(g_, q1d, d1d);
const auto j = Reshape(j_, q1d, sdim, NE);
const auto x = Reshape(x_, d1d, vdim, NE);
@@ -232,6 +237,7 @@ static void Derivatives3D(const int NE,
const real_t *j_,
const real_t *x_,
real_t *y_,
const int sdim = 3,
const int vdim = 0,
const int d1d = 0,
const int q1d = 0)
@@ -370,4 +376,21 @@ static void Derivatives3D(const int NE,
} // namespace internal
/// @cond Suppress_Doxygen_warnings
template<int DIM, QVectorLayout Q_LAYOUT, bool GRAD_PHYS,
int VDIM, int D1D, int Q1D, int NBZ>
QuadratureInterpolator::GradKernelType
QuadratureInterpolator::GradKernels::Kernel()
{
if (DIM == 1) { return internal::quadrature_interpolator::Derivatives1D<Q_LAYOUT, GRAD_PHYS>; }
else if (DIM == 2) { return internal::quadrature_interpolator::Derivatives2D<Q_LAYOUT, GRAD_PHYS, VDIM, D1D, Q1D, NBZ>; }
else if (DIM == 3) { return internal::quadrature_interpolator::Derivatives3D<Q_LAYOUT, GRAD_PHYS, VDIM, D1D, Q1D>; }
else { MFEM_ABORT(""); }
}
/// @endcond
} // namespace mfem
#endif
+45 -104
View File
@@ -9,128 +9,69 @@
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#include "dispatch.hpp"
#include "../quadinterpolator.hpp"
#include "grad.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point derivatives: dispatch function.
// Instantiation for the case QVectorLayout::byNODES.
template<>
void TensorDerivatives<QVectorLayout::byNODES>(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_der)
template <bool P>
void InitGradByNodesKernels()
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const real_t *B = maps.B.Read();
const real_t *G = maps.G.Read();
const real_t *J = nullptr; // not used in DERIVATIVES (non-GRAD_PHYS) mode
const real_t *X = e_vec.Read();
real_t *Y = q_der.Write();
using k = QuadratureInterpolator::GradKernels;
// 2D
k::Specialization<2,QVectorLayout::byNODES,P,1,3,3>::template Opt<16>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,1,3,4>::template Opt<16>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,1,4,3>::template Opt<16>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,1,4,4>::template Opt<16>::Add();
constexpr QVectorLayout L = QVectorLayout::byNODES;
constexpr bool P = false; // GRAD_PHYS
k::Specialization<2,QVectorLayout::byNODES,P,2,2,2>::template Opt<16>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,2,3>::template Opt<8>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,2,4>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,2,5>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,2,6>::template Opt<2>::Add();
const int id = (vdim<<8) | (D1D<<4) | Q1D;
k::Specialization<2,QVectorLayout::byNODES,P,2,3,3>::template Opt<2>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,3,4>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,4,3>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,3,6>::template Opt<2>::Add();
if (dim == 1)
{
return Derivatives1D<L,P>(NE,G,J,X,Y,dim,vdim,D1D,Q1D);
}
if (dim == 2)
{
switch (id)
{
case 0x133: return Derivatives2D<L,P,1,3,3,16>(NE,B,G,J,X,Y);
case 0x134: return Derivatives2D<L,P,1,3,4,16>(NE,B,G,J,X,Y);
case 0x143: return Derivatives2D<L,P,1,4,3,16>(NE,B,G,J,X,Y);
case 0x144: return Derivatives2D<L,P,1,4,4,16>(NE,B,G,J,X,Y);
k::Specialization<2,QVectorLayout::byNODES,P,2,4,4>::template Opt<2>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,4,5>::template Opt<2>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,4,6>::template Opt<2>::Add();
k::Specialization<2,QVectorLayout::byNODES,P,2,4,7>::template Opt<2>::Add();
case 0x222: return Derivatives2D<L,P,2,2,2,16>(NE,B,G,J,X,Y);
case 0x223: return Derivatives2D<L,P,2,2,3,8>(NE,B,G,J,X,Y);
case 0x224: return Derivatives2D<L,P,2,2,4,4>(NE,B,G,J,X,Y);
case 0x225: return Derivatives2D<L,P,2,2,5,4>(NE,B,G,J,X,Y);
case 0x226: return Derivatives2D<L,P,2,2,6,2>(NE,B,G,J,X,Y);
k::Specialization<2,QVectorLayout::byNODES,P,2,5,6>::template Opt<2>::Add();
// 3D
k::Specialization<3,QVectorLayout::byNODES,P,1,2,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,1,3,3>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,1,3,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,1,3,6>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,1,4,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,1,4,8>::template Opt<1>::Add();
case 0x233: return Derivatives2D<L,P,2,3,3,2>(NE,B,G,J,X,Y);
case 0x234: return Derivatives2D<L,P,2,3,4,4>(NE,B,G,J,X,Y);
case 0x243: return Derivatives2D<L,P,2,4,3,4>(NE,B,G,J,X,Y);
case 0x236: return Derivatives2D<L,P,2,3,6,2>(NE,B,G,J,X,Y);
k::Specialization<3,QVectorLayout::byNODES,P,3,2,3>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,2,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,2,5>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,2,6>::template Opt<1>::Add();
case 0x244: return Derivatives2D<L,P,2,4,4,2>(NE,B,G,J,X,Y);
case 0x245: return Derivatives2D<L,P,2,4,5,2>(NE,B,G,J,X,Y);
case 0x246: return Derivatives2D<L,P,2,4,6,2>(NE,B,G,J,X,Y);
case 0x247: return Derivatives2D<L,P,2,4,7,2>(NE,B,G,J,X,Y);
case 0x256: return Derivatives2D<L,P,2,5,6,2>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
if (D1D > MD || Q1D > MQ)
{
MFEM_ABORT("");
}
Derivatives2D<L,P>(NE,B,G,J,X,Y,dim,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x124: return Derivatives3D<L,P,1,2,4>(NE,B,G,J,X,Y);
case 0x133: return Derivatives3D<L,P,1,3,3>(NE,B,G,J,X,Y);
case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
case 0x136: return Derivatives3D<L,P,1,3,6>(NE,B,G,J,X,Y);
case 0x144: return Derivatives3D<L,P,1,4,4>(NE,B,G,J,X,Y);
case 0x148: return Derivatives3D<L,P,1,4,8>(NE,B,G,J,X,Y);
case 0x323: return Derivatives3D<L,P,3,2,3>(NE,B,G,J,X,Y);
case 0x324: return Derivatives3D<L,P,3,2,4>(NE,B,G,J,X,Y);
case 0x325: return Derivatives3D<L,P,3,2,5>(NE,B,G,J,X,Y);
case 0x326: return Derivatives3D<L,P,3,2,6>(NE,B,G,J,X,Y);
case 0x333: return Derivatives3D<L,P,3,3,3>(NE,B,G,J,X,Y);
case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
case 0x335: return Derivatives3D<L,P,3,3,5>(NE,B,G,J,X,Y);
case 0x336: return Derivatives3D<L,P,3,3,6>(NE,B,G,J,X,Y);
case 0x344: return Derivatives3D<L,P,3,4,4>(NE,B,G,J,X,Y);
case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
case 0x347: return Derivatives3D<L,P,3,4,7>(NE,B,G,J,X,Y);
case 0x348: return Derivatives3D<L,P,3,4,8>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives3D<L,P>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Kernel not supported yet");
k::Specialization<3,QVectorLayout::byNODES,P,3,3,3>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,3,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,3,5>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,3,6>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,4,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,4,6>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,4,7>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byNODES,P,3,4,8>::template Opt<1>::Add();
}
template void InitGradByNodesKernels<true>();
template void InitGradByNodesKernels<false>();
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
+22 -81
View File
@@ -9,100 +9,41 @@
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#include "dispatch.hpp"
#include "../quadinterpolator.hpp"
#include "grad.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point derivatives: dispatch function.
// Instantiation for the case QVectorLayout::byVDIM.
template<>
void TensorDerivatives<QVectorLayout::byVDIM>(const int NE,
const int vdim,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_der)
template <bool P>
void InitGradByVDimKernels()
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const real_t *B = maps.B.Read();
const real_t *G = maps.G.Read();
const real_t *J = nullptr; // not used in DERIVATIVES (non-GRAD_PHYS) mode
const real_t *X = e_vec.Read();
real_t *Y = q_der.Write();
using k = QuadratureInterpolator::GradKernels;
// 2D
k::Specialization<2,QVectorLayout::byVDIM,P,1,3,4>::template Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,P,1,4,6>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byVDIM,P,1,5,8>::template Opt<2>::Add();
constexpr QVectorLayout L = QVectorLayout::byVDIM;
constexpr bool P = false; // GRAD_PHYS
const int id = (vdim<<8) | (D1D<<4) | Q1D;
if (dim == 1)
{
return Derivatives1D<L,P>(NE,G,J,X,Y,dim,vdim,D1D,Q1D);
}
if (dim == 2)
{
switch (id)
{
case 0x134: return Derivatives2D<L,P,1,3,4,8>(NE,B,G,J,X,Y);
case 0x146: return Derivatives2D<L,P,1,4,6,4>(NE,B,G,J,X,Y);
case 0x158: return Derivatives2D<L,P,1,5,8,2>(NE,B,G,J,X,Y);
case 0x234: return Derivatives2D<L,P,2,3,4,8>(NE,B,G,J,X,Y);
case 0x246: return Derivatives2D<L,P,2,4,6,4>(NE,B,G,J,X,Y);
case 0x258: return Derivatives2D<L,P,2,5,8,2>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives2D<L,P>(NE,B,G,J,X,Y,dim,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
case 0x146: return Derivatives3D<L,P,1,4,6>(NE,B,G,J,X,Y);
case 0x158: return Derivatives3D<L,P,1,5,8>(NE,B,G,J,X,Y);
case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
case 0x358: return Derivatives3D<L,P,3,5,8>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives3D<L,P>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Kernel not supported yet");
k::Specialization<2,QVectorLayout::byVDIM,P,2,3,3>::template Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,P,2,3,4>::template Opt<8>::Add();
k::Specialization<2,QVectorLayout::byVDIM,P,2,4,6>::template Opt<4>::Add();
k::Specialization<2,QVectorLayout::byVDIM,P,2,5,8>::template Opt<2>::Add();
// 3D
k::Specialization<3,QVectorLayout::byVDIM,P,1,3,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,P,1,4,6>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,P,1,5,8>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,P,3,3,4>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,P,3,4,6>::template Opt<1>::Add();
k::Specialization<3,QVectorLayout::byVDIM,P,3,5,8>::template Opt<1>::Add();
}
template void InitGradByVDimKernels<true>();
template void InitGradByVDimKernels<false>();
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
-123
View File
@@ -1,123 +0,0 @@
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#include "dispatch.hpp"
#include "grad.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point physical derivatives: dispatch
// function.
// Instantiation for the case QVectorLayout::byNODES.
template<>
void TensorPhysDerivatives<QVectorLayout::byNODES>(const int NE,
const int vdim,
const DofToQuad &maps,
const GeometricFactors &geom,
const Vector &e_vec,
Vector &q_der)
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const int sdim = geom.mesh->SpaceDimension();
const real_t *B = maps.B.Read();
const real_t *G = maps.G.Read();
const real_t *J = geom.J.Read();
const real_t *X = e_vec.Read();
real_t *Y = q_der.Write();
constexpr QVectorLayout L = QVectorLayout::byNODES;
constexpr bool P = true; // GRAD_PHYS
const int id = (vdim<<8) | (D1D<<4) | Q1D;
if (dim == 1)
{
return Derivatives1D<L,P>(NE,G,J,X,Y,sdim,vdim,D1D,Q1D);
}
if (dim == 2)
{
switch (id)
{
case 0x133: return Derivatives2D<L,P,1,3,3,8>(NE,B,G,J,X,Y,sdim);
case 0x134: return Derivatives2D<L,P,1,3,4,8>(NE,B,G,J,X,Y,sdim);
case 0x143: return Derivatives2D<L,P,1,4,3,4>(NE,B,G,J,X,Y,sdim);
case 0x144: return Derivatives2D<L,P,1,4,4,4>(NE,B,G,J,X,Y,sdim);
case 0x146: return Derivatives2D<L,P,1,4,6,4>(NE,B,G,J,X,Y,sdim);
case 0x158: return Derivatives2D<L,P,1,5,8,2>(NE,B,G,J,X,Y,sdim);
case 0x233: return Derivatives2D<L,P,2,3,3,8>(NE,B,G,J,X,Y,sdim);
case 0x234: return Derivatives2D<L,P,2,3,4,8>(NE,B,G,J,X,Y,sdim);
case 0x243: return Derivatives2D<L,P,2,4,3,4>(NE,B,G,J,X,Y,sdim);
case 0x244: return Derivatives2D<L,P,2,4,4,4>(NE,B,G,J,X,Y,sdim);
case 0x246: return Derivatives2D<L,P,2,4,6,4>(NE,B,G,J,X,Y,sdim);
case 0x258: return Derivatives2D<L,P,2,5,8,2>(NE,B,G,J,X,Y,sdim);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives2D<L,P>(NE,B,G,J,X,Y,sdim,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x133: return Derivatives3D<L,P,1,3,3>(NE,B,G,J,X,Y);
case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
case 0x144: return Derivatives3D<L,P,1,4,4>(NE,B,G,J,X,Y);
case 0x146: return Derivatives3D<L,P,1,4,6>(NE,B,G,J,X,Y);
case 0x158: return Derivatives3D<L,P,1,5,8>(NE,B,G,J,X,Y);
case 0x333: return Derivatives3D<L,P,3,3,3>(NE,B,G,J,X,Y);
case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
case 0x344: return Derivatives3D<L,P,3,4,4>(NE,B,G,J,X,Y);
case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
case 0x358: return Derivatives3D<L,P,3,5,8>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives3D<L,P>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Unknown kernel");
}
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
-114
View File
@@ -1,114 +0,0 @@
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#include "dispatch.hpp"
#include "grad.hpp"
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
// Tensor-product evaluation of quadrature point physical derivatives: dispatch
// function.
// Instantiation for the case QVectorLayout::byVDIM.
template<>
void TensorPhysDerivatives<QVectorLayout::byVDIM>(const int NE,
const int vdim,
const DofToQuad &maps,
const GeometricFactors &geom,
const Vector &e_vec,
Vector &q_der)
{
if (NE == 0) { return; }
const int dim = maps.FE->GetDim();
const int D1D = maps.ndof;
const int Q1D = maps.nqpt;
const int sdim = geom.mesh->SpaceDimension();
const real_t *B = maps.B.Read();
const real_t *G = maps.G.Read();
const real_t *J = geom.J.Read();
const real_t *X = e_vec.Read();
real_t *Y = q_der.Write();
constexpr QVectorLayout L = QVectorLayout::byVDIM;
constexpr bool P = true; // GRAD_PHYS
const int id = (vdim<<8) | (D1D<<4) | Q1D;
if (dim == 1)
{
return Derivatives1D<L,P>(NE,G,J,X,Y,sdim,vdim,D1D,Q1D);
}
if (dim == 2)
{
switch (id)
{
case 0x134: return Derivatives2D<L,P,1,3,4,8>(NE,B,G,J,X,Y,sdim);
case 0x146: return Derivatives2D<L,P,1,4,6,4>(NE,B,G,J,X,Y,sdim);
case 0x158: return Derivatives2D<L,P,1,5,8,2>(NE,B,G,J,X,Y,sdim);
case 0x233: return Derivatives2D<L,P,2,3,3,8>(NE,B,G,J,X,Y,sdim);
case 0x234: return Derivatives2D<L,P,2,3,4,8>(NE,B,G,J,X,Y,sdim);
case 0x246: return Derivatives2D<L,P,2,4,6,4>(NE,B,G,J,X,Y,sdim);
case 0x258: return Derivatives2D<L,P,2,5,8,2>(NE,B,G,J,X,Y,sdim);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives2D<L,P>(NE,B,G,J,X,Y,sdim,vdim,D1D,Q1D);
return;
}
}
}
if (dim == 3)
{
switch (id)
{
case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
case 0x146: return Derivatives3D<L,P,1,4,6>(NE,B,G,J,X,Y);
case 0x158: return Derivatives3D<L,P,1,5,8>(NE,B,G,J,X,Y);
case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
case 0x358: return Derivatives3D<L,P,3,5,8>(NE,B,G,J,X,Y);
default:
{
const int MD = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
const int MQ = DeviceDofQuadLimits::Get().MAX_INTERP_1D;
MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
<< " are not supported!");
MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
<< MQ << " 1D points are not supported!");
Derivatives3D<L,P>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
return;
}
}
}
mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
MFEM_ABORT("Unknown kernel");
}
} // namespace quadrature_interpolator
} // namespace internal
} // namespace mfem
+234 -187
View File
@@ -10,7 +10,8 @@
// CONTRIBUTING.md for details.
#include "quadinterpolator.hpp"
#include "qinterp/dispatch.hpp"
#include "qinterp/grad.hpp"
#include "qinterp/eval.hpp"
#include "qspace.hpp"
#include "../general/forall.hpp"
#include "../linalg/dtensor.hpp"
@@ -19,6 +20,38 @@
namespace mfem
{
namespace internal
{
namespace quadrature_interpolator
{
void InitEvalByNodesKernels();
void InitEvalByVDimKernels();
void InitEvalKernels();
void InitDetKernels();
template <bool P> void InitGradByNodesKernels();
template <bool P> void InitGradByVDimKernels();
}
}
QuadratureInterpolator::Kernels QuadratureInterpolator::kernels;
QuadratureInterpolator::Kernels::Kernels()
{
using namespace internal::quadrature_interpolator;
InitEvalByNodesKernels();
InitEvalByVDimKernels();
// Non-phys grad kernels
InitGradByNodesKernels<false>();
InitGradByVDimKernels<false>();
// Phys grad kernels
InitGradByNodesKernels<true>();
InitGradByVDimKernels<true>();
// Determinants
InitDetKernels();
// Non-tensor
InitEvalKernels();
}
QuadratureInterpolator::QuadratureInterpolator(const FiniteElementSpace &fes,
const IntegrationRule &ir):
@@ -467,6 +500,7 @@ void QuadratureInterpolator::Mult(const Vector &e_vec,
const int ne = fespace->GetNE();
if (ne == 0) { return; }
const int vdim = fespace->GetVDim();
const int sdim = fespace->GetMesh()->SpaceDimension();
const FiniteElement *fe = fespace->GetFE(0);
const bool use_tensor_eval =
use_tensor_products &&
@@ -477,6 +511,8 @@ void QuadratureInterpolator::Mult(const Vector &e_vec,
use_tensor_eval ? DofToQuad::TENSOR : DofToQuad::FULL;
const DofToQuad &maps = fe->GetDofToQuad(*ir, mode);
const int dim = maps.FE->GetDim();
const int nd = maps.ndof;
const int nq = maps.nqpt;
const GeometricFactors *geom = nullptr;
if (eval_flags & PHYSICAL_DERIVATIVES)
{
@@ -492,202 +528,31 @@ void QuadratureInterpolator::Mult(const Vector &e_vec,
if (use_tensor_eval)
{
// TODO: use fused kernels
if (q_layout == QVectorLayout::byNODES)
if (eval_flags & VALUES)
{
if (eval_flags & VALUES)
{
TensorValues<QVectorLayout::byNODES>(ne, vdim, maps, e_vec, q_val);
}
if (eval_flags & DERIVATIVES)
{
TensorDerivatives<QVectorLayout::byNODES>(
ne, vdim, maps, e_vec, q_der);
}
if (eval_flags & PHYSICAL_DERIVATIVES)
{
TensorPhysDerivatives<QVectorLayout::byNODES>(
ne, vdim, maps, *geom, e_vec, q_der);
}
TensorEvalKernels::Run(dim, q_layout, vdim, nd, nq, ne, maps.B.Read(),
e_vec.Read(), q_val.Write(), vdim, nd, nq);
}
if (q_layout == QVectorLayout::byVDIM)
if (eval_flags & (DERIVATIVES | PHYSICAL_DERIVATIVES))
{
if (eval_flags & VALUES)
{
TensorValues<QVectorLayout::byVDIM>(ne, vdim, maps, e_vec, q_val);
}
if (eval_flags & DERIVATIVES)
{
TensorDerivatives<QVectorLayout::byVDIM>(
ne, vdim, maps, e_vec, q_der);
}
if (eval_flags & PHYSICAL_DERIVATIVES)
{
TensorPhysDerivatives<QVectorLayout::byVDIM>(
ne, vdim, maps, *geom, e_vec, q_der);
}
const bool phys = (eval_flags & PHYSICAL_DERIVATIVES);
const real_t *J = phys ? geom->J.Read() : nullptr;
const int s_dim = phys ? sdim : dim;
GradKernels::Run(dim, q_layout, phys, vdim, nd, nq, ne,
maps.B.Read(), maps.G.Read(), J, e_vec.Read(),
q_der.Write(), s_dim, vdim, nd, nq);
}
if (eval_flags & DETERMINANTS)
{
TensorDeterminants(ne, vdim, maps, e_vec, q_det, d_buffer);
DetKernels::Run(dim, vdim, nd, nq, ne, maps.B.Read(),
maps.G.Read(), e_vec.Read(), q_det.Write(), nd,
nq, &d_buffer);
}
}
else // use_tensor_eval == false
{
const int nd = maps.ndof;
const int nq = maps.nqpt;
void (*mult)(const int NE,
const int vdim,
const QVectorLayout q_layout,
const GeometricFactors *geom,
const DofToQuad &maps,
const Vector &e_vec,
Vector &q_val,
Vector &q_der,
Vector &q_det,
const int eval_flags) = NULL;
if (dim == 1)
{
mult = &Eval1D;
}
else if (vdim == 1) // dim == 2 || dim == 3
{
if (dim == 2)
{
switch (100*nd + nq)
{
// Q0
case 101: mult = &Eval2D<1,1,1>; break;
case 104: mult = &Eval2D<1,1,4>; break;
// Q1
case 404: mult = &Eval2D<1,4,4>; break;
case 409: mult = &Eval2D<1,4,9>; break;
// Q2
case 909: mult = &Eval2D<1,9,9>; break;
case 916: mult = &Eval2D<1,9,16>; break;
// Q3
case 1616: mult = &Eval2D<1,16,16>; break;
case 1625: mult = &Eval2D<1,16,25>; break;
case 1636: mult = &Eval2D<1,16,36>; break;
// Q4
case 2525: mult = &Eval2D<1,25,25>; break;
case 2536: mult = &Eval2D<1,25,36>; break;
case 2549: mult = &Eval2D<1,25,49>; break;
case 2564: mult = &Eval2D<1,25,64>; break;
}
if (nq >= 100 || !mult)
{
mult = &Eval2D<1,0,0>;
}
}
else if (dim == 3)
{
switch (1000*nd + nq)
{
// Q0
case 1001: mult = &Eval3D<1,1,1>; break;
case 1008: mult = &Eval3D<1,1,8>; break;
// Q1
case 8008: mult = &Eval3D<1,8,8>; break;
case 8027: mult = &Eval3D<1,8,27>; break;
// Q2
case 27027: mult = &Eval3D<1,27,27>; break;
case 27064: mult = &Eval3D<1,27,64>; break;
// Q3
case 64064: mult = &Eval3D<1,64,64>; break;
case 64125: mult = &Eval3D<1,64,125>; break;
case 64216: mult = &Eval3D<1,64,216>; break;
// Q4
case 125125: mult = &Eval3D<1,125,125>; break;
case 125216: mult = &Eval3D<1,125,216>; break;
}
if (nq >= 1000 || !mult)
{
mult = &Eval3D<1,0,0>;
}
}
}
else if (vdim == 3 && dim == 2)
{
switch (100*nd + nq)
{
// Q0
case 101: mult = &Eval2D<3,1,1>; break;
case 104: mult = &Eval2D<3,1,4>; break;
// Q1
case 404: mult = &Eval2D<3,4,4>; break;
case 409: mult = &Eval2D<3,4,9>; break;
// Q2
case 904: mult = &Eval2D<3,9,4>; break;
case 909: mult = &Eval2D<3,9,9>; break;
case 916: mult = &Eval2D<3,9,16>; break;
case 925: mult = &Eval2D<3,9,25>; break;
// Q3
case 1616: mult = &Eval2D<3,16,16>; break;
case 1625: mult = &Eval2D<3,16,25>; break;
case 1636: mult = &Eval2D<3,16,36>; break;
// Q4
case 2525: mult = &Eval2D<3,25,25>; break;
case 2536: mult = &Eval2D<3,25,36>; break;
case 2549: mult = &Eval2D<3,25,49>; break;
case 2564: mult = &Eval2D<3,25,64>; break;
default: mult = &Eval2D<3,0,0>;
}
}
else if (vdim == dim)
{
if (dim == 2)
{
switch (100*nd + nq)
{
// Q1
case 404: mult = &Eval2D<2,4,4>; break;
case 409: mult = &Eval2D<2,4,9>; break;
// Q2
case 909: mult = &Eval2D<2,9,9>; break;
case 916: mult = &Eval2D<2,9,16>; break;
// Q3
case 1616: mult = &Eval2D<2,16,16>; break;
case 1625: mult = &Eval2D<2,16,25>; break;
case 1636: mult = &Eval2D<2,16,36>; break;
// Q4
case 2525: mult = &Eval2D<2,25,25>; break;
case 2536: mult = &Eval2D<2,25,36>; break;
case 2549: mult = &Eval2D<2,25,49>; break;
case 2564: mult = &Eval2D<2,25,64>; break;
}
if (nq >= 100 || !mult) { mult = &Eval2D<2,0,0>; }
}
else if (dim == 3)
{
switch (1000*nd + nq)
{
// Q1
case 8008: mult = &Eval3D<3,8,8>; break;
case 8027: mult = &Eval3D<3,8,27>; break;
// Q2
case 27027: mult = &Eval3D<3,27,27>; break;
case 27064: mult = &Eval3D<3,27,64>; break;
case 27125: mult = &Eval3D<3,27,125>; break;
// Q3
case 64064: mult = &Eval3D<3,64,64>; break;
case 64125: mult = &Eval3D<3,64,125>; break;
case 64216: mult = &Eval3D<3,64,216>; break;
// Q4
case 125125: mult = &Eval3D<3,125,125>; break;
case 125216: mult = &Eval3D<3,125,216>; break;
}
if (nq >= 1000 || !mult) { mult = &Eval3D<3,0,0>; }
}
}
if (mult)
{
mult(ne,vdim,q_layout,geom,maps,e_vec,q_val,q_der,q_det,eval_flags);
}
else { MFEM_ABORT("case not supported yet"); }
EvalKernels::Run(dim, vdim, maps.ndof, maps.nqpt, ne,vdim,q_layout,
geom, maps,e_vec, q_val,q_der,q_det,eval_flags);
}
}
@@ -731,4 +596,186 @@ void QuadratureInterpolator::Determinants(const Vector &e_vec,
Mult(e_vec, DETERMINANTS, empty, empty, q_det);
}
/// @cond Suppress_Doxygen_warnings
namespace
{
using EvalKernel = QuadratureInterpolator::EvalKernelType;
using TensorEvalKernel = QuadratureInterpolator::TensorEvalKernelType;
using GradKernel = QuadratureInterpolator::GradKernelType;
template <QVectorLayout Q_LAYOUT>
TensorEvalKernel FallbackTensorEvalKernel(int DIM)
{
if (DIM == 1) { return internal::quadrature_interpolator::Values1D<Q_LAYOUT>; }
else if (DIM == 2) { return internal::quadrature_interpolator::Values2D<Q_LAYOUT>; }
else if (DIM == 3) { return internal::quadrature_interpolator::Values3D<Q_LAYOUT>; }
else { MFEM_ABORT(""); }
}
template<QVectorLayout Q_LAYOUT, bool GRAD_PHYS>
GradKernel GetGradKernel(int DIM)
{
if (DIM == 1) { return internal::quadrature_interpolator::Derivatives1D<Q_LAYOUT, GRAD_PHYS>; }
else if (DIM == 2) { return internal::quadrature_interpolator::Derivatives2D<Q_LAYOUT, GRAD_PHYS>; }
else if (DIM == 3) { return internal::quadrature_interpolator::Derivatives3D<Q_LAYOUT, GRAD_PHYS>; }
else { MFEM_ABORT(""); }
}
template<QVectorLayout Q_LAYOUT>
GradKernel GetGradKernel(int DIM, bool GRAD_PHYS)
{
if (GRAD_PHYS) { return GetGradKernel<Q_LAYOUT, true>(DIM); }
else { return GetGradKernel<Q_LAYOUT, false>(DIM); }
}
} // namespace
template <int DIM, int VDIM, int ND, int NQ>
EvalKernel QuadratureInterpolator::EvalKernels::Kernel()
{
using namespace internal::quadrature_interpolator;
if (DIM == 1) { return Eval1D; }
else if (DIM == 2) { return Eval2D<VDIM,ND,NQ>; }
else if (DIM == 3) { return Eval3D<VDIM,ND,NQ>; }
else { MFEM_ABORT(""); }
}
template <int DIM>
EvalKernel GetEvalKernelVDimFallback(int VDIM)
{
using EvalKernels = QuadratureInterpolator::EvalKernels;
if (VDIM == 1) { return EvalKernels::Kernel<DIM,1,0,0>(); }
else if (VDIM == 2) { return EvalKernels::Kernel<DIM,2,0,0>(); }
else if (VDIM == 3) { return EvalKernels::Kernel<DIM,3,0,0>(); }
else { MFEM_ABORT(""); }
}
EvalKernel QuadratureInterpolator::EvalKernels::Fallback(
int DIM, int VDIM, int ND, int NQ)
{
if (DIM == 1) { return GetEvalKernelVDimFallback<1>(VDIM); }
else if (DIM == 2) { return GetEvalKernelVDimFallback<2>(VDIM); }
else if (DIM == 3) { return GetEvalKernelVDimFallback<3>(VDIM); }
else { MFEM_ABORT(""); }
}
TensorEvalKernel QuadratureInterpolator::TensorEvalKernels::Fallback(
int DIM, QVectorLayout Q_LAYOUT, int, int, int)
{
if (Q_LAYOUT == QVectorLayout::byNODES) { return FallbackTensorEvalKernel<QVectorLayout::byNODES>(DIM); }
else { return FallbackTensorEvalKernel<QVectorLayout::byVDIM>(DIM); }
}
GradKernel QuadratureInterpolator::GradKernels::Fallback(
int DIM, QVectorLayout Q_LAYOUT, bool GRAD_PHYS, int, int, int)
{
if (Q_LAYOUT == QVectorLayout::byNODES) { return GetGradKernel<QVectorLayout::byNODES>(DIM, GRAD_PHYS); }
else { return GetGradKernel<QVectorLayout::byVDIM>(DIM, GRAD_PHYS); }
}
/// @endcond
namespace internal
{
namespace quadrature_interpolator
{
void InitEvalKernels()
{
using k = QuadratureInterpolator::EvalKernels;
// 2D, VDIM = 1
k::Specialization<2,1,1,1>::Add();
k::Specialization<2,1,1,4>::Add();
// Q1
k::Specialization<2,1,4,4>::Add();
k::Specialization<2,1,4,9>::Add();
// Q2
k::Specialization<2,1,9,9>::Add();
k::Specialization<2,1,9,16>::Add();
// Q3
k::Specialization<2,1,16,16>::Add();
k::Specialization<2,1,16,25>::Add();
k::Specialization<2,1,16,36>::Add();
// Q4
k::Specialization<2,1,25,25>::Add();
k::Specialization<2,1,25,36>::Add();
k::Specialization<2,1,25,49>::Add();
k::Specialization<2,1,25,64>::Add();
// 3D, VDIM = 1
// Q0
k::Specialization<3,1,1,1>::Add();
k::Specialization<3,1,1,8>::Add();
// Q1
k::Specialization<3,1,8,8>::Add();
k::Specialization<3,1,8,27>::Add();
// Q2
k::Specialization<3,1,27,27>::Add();
k::Specialization<3,1,27,64>::Add();
// Q3
k::Specialization<3,1,64,64>::Add();
k::Specialization<3,1,64,125>::Add();
k::Specialization<3,1,64,216>::Add();
// Q4
k::Specialization<3,1,125,125>::Add();
k::Specialization<3,1,125,216>::Add();
// 2D, VDIM = 3
// Q0
k::Specialization<2,3,1,1>::Add();
k::Specialization<2,3,1,4>::Add();
// Q1
k::Specialization<2,3,4,4>::Add();
k::Specialization<2,3,4,9>::Add();
// Q2
k::Specialization<2,3,9,4>::Add();
k::Specialization<2,3,9,9>::Add();
k::Specialization<2,3,9,16>::Add();
k::Specialization<2,3,9,25>::Add();
// Q3
k::Specialization<2,3,16,16>::Add();
k::Specialization<2,3,16,25>::Add();
k::Specialization<2,3,16,36>::Add();
// Q4
k::Specialization<2,3,25,25>::Add();
k::Specialization<2,3,25,36>::Add();
k::Specialization<2,3,25,49>::Add();
k::Specialization<2,3,25,64>::Add();
// 2D, VDIM = 2
// Q1
k::Specialization<2,2,4,4>::Add();
k::Specialization<2,2,4,9>::Add();
// Q2
k::Specialization<2,2,9,9>::Add();
k::Specialization<2,2,9,16>::Add();
// Q3
k::Specialization<2,2,16,16>::Add();
k::Specialization<2,2,16,25>::Add();
k::Specialization<2,2,16,36>::Add();
// Q4
k::Specialization<2,2,25,25>::Add();
k::Specialization<2,2,25,36>::Add();
k::Specialization<2,2,25,49>::Add();
k::Specialization<2,2,25,64>::Add();
// 3D, VDIM = 3
// Q1
k::Specialization<3,3,8,8>::Add();
k::Specialization<3,3,8,27>::Add();
// Q2
k::Specialization<3,3,27,27>::Add();
k::Specialization<3,3,27,64>::Add();
k::Specialization<3,3,27,125>::Add();
// Q3
k::Specialization<3,3,64,64>::Add();
k::Specialization<3,3,64,125>::Add();
k::Specialization<3,3,64,216>::Add();
// Q4
k::Specialization<3,3,125,125>::Add();
k::Specialization<3,3,125,216>::Add();
}
} // namespace quadrature_Interpolator
} // namespace internal
} // namespace mfem
+24
View File
@@ -13,6 +13,7 @@
#define MFEM_QUADINTERP
#include "fespace.hpp"
#include "kernel_dispatch.hpp"
namespace mfem
{
@@ -130,6 +131,29 @@ public:
/// Perform the transpose operation of Mult(). (TODO)
void MultTranspose(unsigned eval_flags, const Vector &q_val,
const Vector &q_der, Vector &e_vec) const;
using TensorEvalKernelType = void(*)(const int, const real_t *, const real_t *,
real_t *, const int, const int, const int);
using GradKernelType = void(*)(const int, const real_t *, const real_t *,
const real_t *, const real_t *, real_t *,
const int, const int, const int, const int);
using DetKernelType = void(*)(const int NE, const real_t *, const real_t *,
const real_t *, real_t *, const int, const int,
Vector *);
using EvalKernelType = void(*)(const int, const int, const QVectorLayout,
const GeometricFactors *, const DofToQuad &,
const Vector &, Vector &, Vector &, Vector &,
const int);
MFEM_REGISTER_KERNELS(TensorEvalKernels, TensorEvalKernelType,
(int, QVectorLayout, int, int, int), (int));
MFEM_REGISTER_KERNELS(GradKernels, GradKernelType,
(int, QVectorLayout, bool, int, int, int), (int));
MFEM_REGISTER_KERNELS(DetKernels, DetKernelType, (int, int, int, int));
MFEM_REGISTER_KERNELS(EvalKernels, EvalKernelType, (int, int, int, int));
static struct Kernels { Kernels(); } kernels;
};
}
+2 -2
View File
@@ -184,8 +184,8 @@ public:
face degrees of freedom.
@param[in] a Scalar coefficient for addition.
*/
virtual void AddMultTranspose(const Vector &x, Vector &y,
const real_t a = 1.0) const override = 0;
void AddMultTranspose(const Vector &x, Vector &y,
const real_t a = 1.0) const override = 0;
/** @brief Add the face degrees of freedom @a x to the element degrees of
freedom @a y ignoring the signs from DOF orientation. */
+3 -3
View File
@@ -151,13 +151,13 @@ public:
}
/// Get the input finite element space prolongation matrix
virtual const Operator *GetProlongation() const
const Operator *GetProlongation() const override
{ return ((FiniteElementSpace &)in_fes).GetProlongationMatrix(); }
/// Get the input finite element space restriction matrix
virtual const Operator *GetRestriction() const
const Operator *GetRestriction() const override
{ return ((FiniteElementSpace &)in_fes).GetRestrictionMatrix(); }
virtual void Mult(const Vector &x, Vector &y) const
void Mult(const Vector &x, Vector &y) const override
{
if (!assembled_data.Empty())
{
+268 -268
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -99,13 +99,13 @@ public:
/// Get TMOP-based errors for each element in the mesh computed based on the
/// refinement types being considered.
virtual const Vector &GetLocalErrors()
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
}
/// For anisotropic refinements, get the refinement type (e.g., x or y)
virtual const Array<int> &GetAnisotropicFlags()
const Array<int> &GetAnisotropicFlags() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return aniso_flags;
@@ -124,7 +124,7 @@ public:
void SetSpatialIndicatorCritical(real_t val_) { spat_gf_critical = val_; }
/// Reset the error estimator.
virtual void Reset() { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
};
class TMOPDeRefinerEstimator : public ErrorEstimator
@@ -174,14 +174,14 @@ public:
~TMOPDeRefinerEstimator() { }
virtual const Vector &GetLocalErrors()
const Vector &GetLocalErrors() override
{
if (MeshIsModified()) { ComputeEstimates(); }
return error_estimates;
}
/// Reset the error estimator.
virtual void Reset() { current_sequence = -1; }
void Reset() override { current_sequence = -1; }
};
// hr-adaptivity using TMOP.
+17 -17
View File
@@ -38,12 +38,12 @@ public:
: AdaptivityEvaluator(),
ode_solver(), nodes0(), field0(), dt_scale(timestep_scale), al(al) { }
virtual void SetInitialField(const Vector &init_nodes,
const Vector &init_field);
void SetInitialField(const Vector &init_nodes,
const Vector &init_field) override;
virtual void ComputeAtNewPosition(const Vector &new_nodes,
Vector &new_field,
int new_nodes_ordering = Ordering::byNODES);
void ComputeAtNewPosition(const Vector &new_nodes,
Vector &new_field,
int new_nodes_ordering = Ordering::byNODES) override;
/// Set the memory type used for large memory allocations. This memory type
/// is used when constructing the AdvectorCGOper but currently only for the
@@ -61,12 +61,12 @@ private:
public:
InterpolatorFP() : finder(NULL) { }
virtual void SetInitialField(const Vector &init_nodes,
const Vector &init_field);
void SetInitialField(const Vector &init_nodes,
const Vector &init_field) override;
virtual void ComputeAtNewPosition(const Vector &new_nodes,
Vector &new_field,
int new_nodes_ordering = Ordering::byNODES);
void ComputeAtNewPosition(const Vector &new_nodes,
Vector &new_field,
int new_nodes_ordering = Ordering::byNODES) override;
const FindPointsGSLIB *GetFindPointsGSLIB() const
{
@@ -99,7 +99,7 @@ public:
FiniteElementSpace &fes,
AssemblyLevel al = AssemblyLevel::LEGACY);
virtual void Mult(const Vector &ind, Vector &di_dt) const;
void Mult(const Vector &ind, Vector &di_dt) const override;
};
#ifdef MFEM_USE_MPI
@@ -123,7 +123,7 @@ public:
AssemblyLevel al = AssemblyLevel::LEGACY,
MemoryType mt = MemoryType::DEFAULT);
virtual void Mult(const Vector &ind, Vector &di_dt) const;
void Mult(const Vector &ind, Vector &di_dt) const override;
};
#endif
@@ -223,11 +223,11 @@ public:
/// Compute scaling factor for the node movement direction using line-search.
/// We impose constraints on TMOP energy, gradient, minimum Jacobian of
/// the mesh, and (optionally) on the surface fitting error.
virtual real_t ComputeScalingFactor(const Vector &x, const Vector &b) const;
real_t ComputeScalingFactor(const Vector &x, const Vector &b) const override;
/// Update (i) discrete functions at new nodal positions, and
/// (ii) surface fitting weight.
virtual void ProcessNewState(const Vector &x) const;
void ProcessNewState(const Vector &x) const override;
/** @name Methods for adaptive surface fitting.
\brief These methods control the behavior of the weight and the
@@ -319,7 +319,7 @@ public:
min_detJ_limit = threshold;
}
virtual void Mult(const Vector &b, Vector &x) const
void Mult(const Vector &b, Vector &x) const override
{
if (solver_type == 0)
{
@@ -332,7 +332,7 @@ public:
else { MFEM_ABORT("Invalid type"); }
}
virtual void SetSolver(Solver &solver)
void SetSolver(Solver &solver) override
{
if (solver_type == 0)
{
@@ -344,7 +344,7 @@ public:
}
else { MFEM_ABORT("Invalid type"); }
}
virtual void SetPreconditioner(Solver &pr) { SetSolver(pr); }
void SetPreconditioner(Solver &pr) override { SetSolver(pr); }
};
void vis_tmop_metric_s(int order, TMOP_QualityMetric &qm,
+25 -25
View File
@@ -143,9 +143,9 @@ public:
void SetMassIntegrator(BilinearFormIntegrator *mass_integ_,
bool own_mass_integ_ = true);
virtual const Operator &ForwardOperator();
const Operator &ForwardOperator() override;
virtual const Operator &BackwardOperator();
const Operator &BackwardOperator() override;
};
@@ -231,7 +231,7 @@ protected:
/// finite element space. Refined mesh should be a uniform refinement of
/// the coarse mesh. Coefficients are computed through minimization of L2
/// error between the fields.
virtual void Mult(const Vector& x, Vector& y) const;
void Mult(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, dual field coefficients defined on a refined mesh
/// with a low order L2 finite element space, to <tt>y</tt>, dual field
/// coefficients defined on a coarse mesh with a higher order L2 finite
@@ -239,7 +239,7 @@ protected:
/// coarse mesh. Coefficients are computed through minimization of L2
/// error between the primal fields. Note, if the <tt>x</tt>-coefficients
/// come from ProlongateTranspose, then mass is conserved.
virtual void MultTranspose(const Vector& x, Vector& y) const;
void MultTranspose(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, primal field coefficients defined on a refined mesh
/// with a low order L2 finite element space, to <tt>y</tt>, primal field
/// coefficients defined on a coarse mesh with a higher order L2 finite
@@ -247,7 +247,7 @@ protected:
/// coarse mesh. Coefficients are computed from the mass conservative
/// left-inverse prolongation operation. This functionality is also
/// provided as an Operator by L2Prolongation.
virtual void Prolongate(const Vector& x, Vector& y) const;
void Prolongate(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, dual field coefficients defined on a coarse mesh with
/// a higher order L2 finite element space, to <tt>y</tt>, dual field
/// coefficients defined on a refined mesh with a low order L2 finite
@@ -255,9 +255,9 @@ protected:
/// coarse mesh. Coefficients are computed from the transpose of the mass
/// conservative left-inverse prolongation operation. This functionality
/// is also provided as an Operator by L2Prolongation.
virtual void ProlongateTranspose(const Vector& x, Vector& y) const;
virtual void SetRelTol(real_t p_rtol_) { } ///< No-op.
virtual void SetAbsTol(real_t p_atol_) { } ///< No-op.
void ProlongateTranspose(const Vector& x, Vector& y) const override;
void SetRelTol(real_t p_rtol_) override { } ///< No-op.
void SetAbsTol(real_t p_atol_) override { } ///< No-op.
};
/** Projection operator between a H1 high-order finite element space on a
@@ -278,7 +278,7 @@ protected:
/// finite element space. Refined mesh should be a uniform refinement of
/// the coarse mesh. Coefficients are computed through minimization of L2
/// error between the fields.
virtual void Mult(const Vector& x, Vector& y) const;
void Mult(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, dual field coefficients defined on a refined mesh
/// with a low order H1 finite element space, to <tt>y</tt>, dual field
/// coefficients defined on a coarse mesh with a higher order H1 finite
@@ -286,7 +286,7 @@ protected:
/// coarse mesh. Coefficients are computed through minimization of L2
/// error between the primal fields. Note, if the <tt>x</tt>-coefficients
/// come from ProlongateTranspose, then mass is conserved.
virtual void MultTranspose(const Vector& x, Vector& y) const;
void MultTranspose(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, primal field coefficients defined on a refined mesh
/// with a low order H1 finite element space, to <tt>y</tt>, primal field
/// coefficients defined on a coarse mesh with a higher order H1 finite
@@ -294,7 +294,7 @@ protected:
/// coarse mesh. Coefficients are computed from the mass conservative
/// left-inverse prolongation operation. This functionality is also
/// provided as an Operator by L2Prolongation.
virtual void Prolongate(const Vector& x, Vector& y) const;
void Prolongate(const Vector& x, Vector& y) const override;
/// Maps <tt>x</tt>, dual field coefficients defined on a coarse mesh with
/// a higher order H1 finite element space, to <tt>y</tt>, dual field
/// coefficients defined on a refined mesh with a low order H1 finite
@@ -302,9 +302,9 @@ protected:
/// coarse mesh. Coefficients are computed from the transpose of the mass
/// conservative left-inverse prolongation operation. This functionality
/// is also provided as an Operator by L2Prolongation.
virtual void ProlongateTranspose(const Vector& x, Vector& y) const;
virtual void SetRelTol(real_t p_rtol_);
virtual void SetAbsTol(real_t p_atol_);
void ProlongateTranspose(const Vector& x, Vector& y) const override;
void SetRelTol(real_t p_rtol_) override;
void SetAbsTol(real_t p_atol_) override;
protected:
/// Sets up the PCG solver (sets parameters, operator, and preconditioner)
void SetupPCG();
@@ -385,11 +385,11 @@ public:
{ }
virtual ~L2ProjectionGridTransfer();
virtual const Operator &ForwardOperator();
const Operator &ForwardOperator() override;
virtual const Operator &BackwardOperator();
const Operator &BackwardOperator() override;
virtual bool SupportsBackwardsOperator() const;
bool SupportsBackwardsOperator() const override;
private:
void BuildF();
};
@@ -417,12 +417,12 @@ public:
/// @brief Interpolation or prolongation of a vector \p x corresponding to
/// the coarse space to the vector \p y corresponding to the fine space.
virtual void Mult(const Vector& x, Vector& y) const override;
void Mult(const Vector& x, Vector& y) const override;
/// Restriction by applying the transpose of the Mult method.
/** The vector \p x corresponding to the fine space is restricted to the
vector \p y corresponding to the coarse space. */
virtual void MultTranspose(const Vector& x, Vector& y) const override;
void MultTranspose(const Vector& x, Vector& y) const override;
};
/// Matrix-free transfer operator between finite element spaces on the same mesh
@@ -447,12 +447,12 @@ public:
/// @brief Interpolation or prolongation of a vector \p x corresponding to
/// the coarse space to the vector \p y corresponding to the fine space.
virtual void Mult(const Vector& x, Vector& y) const override;
void Mult(const Vector& x, Vector& y) const override;
/// Restriction by applying the transpose of the Mult method.
/** The vector \p x corresponding to the fine space is restricted to the
vector \p y corresponding to the coarse space. */
virtual void MultTranspose(const Vector& x, Vector& y) const override;
void MultTranspose(const Vector& x, Vector& y) const override;
};
/// @brief Matrix-free transfer operator between finite element spaces on the
@@ -489,12 +489,12 @@ public:
/// @brief Interpolation or prolongation of a vector \p x corresponding to
/// the coarse space to the vector \p y corresponding to the fine space.
virtual void Mult(const Vector& x, Vector& y) const override;
void Mult(const Vector& x, Vector& y) const override;
/// Restriction by applying the transpose of the Mult method.
/** The vector \p x corresponding to the fine space is restricted to the
vector \p y corresponding to the coarse space. */
virtual void MultTranspose(const Vector& x, Vector& y) const override;
void MultTranspose(const Vector& x, Vector& y) const override;
};
/// @brief Matrix-free transfer operator between finite element spaces working
@@ -523,12 +523,12 @@ public:
/// dof vector \p y.
/** The true dof vector \p x corresponding to the coarse space is restricted
to the true dof vector \p y corresponding to the fine space. */
virtual void Mult(const Vector& x, Vector& y) const override;
void Mult(const Vector& x, Vector& y) const override;
/// Restriction by applying the transpose of the Mult method.
/** The true dof vector \p x corresponding to the fine space is restricted to
the true dof vector \p y corresponding to the coarse space. */
virtual void MultTranspose(const Vector& x, Vector& y) const override;
void MultTranspose(const Vector& x, Vector& y) const override;
};
} // namespace mfem
+9 -11
View File
@@ -32,8 +32,6 @@ typedef int socklen_t;
#define close closesocket
#endif
using namespace std;
namespace mfem
{
@@ -43,7 +41,7 @@ isockstream::isockstream(int port)
if ( (portID = establish()) < 0)
mfem::out << "Server couldn't be established on port "
<< portnum << endl;
<< portnum << std::endl;
Buf = NULL;
}
@@ -64,7 +62,7 @@ int isockstream::establish()
{
mfem::err << "isockstream::establish(): getaddrinfo() failed!\n"
<< "isockstream::establish(): getaddrinfo() returned: '"
<< myname << "'" << endl;
<< myname << "'" << std::endl;
error = 1;
return (-1);
}
@@ -74,7 +72,7 @@ int isockstream::establish()
{
if ((sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol)) < 0)
{
mfem::err << "isockstream::establish(): socket() failed!" << endl;
mfem::err << "isockstream::establish(): socket() failed!" << std::endl;
error = 2;
return (-1);
}
@@ -82,7 +80,7 @@ int isockstream::establish()
int on = 1;
if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
{
mfem::err << "isockstream::establish(): setsockopt() failed!" << endl;
mfem::err << "isockstream::establish(): setsockopt() failed!" << std::endl;
return (-1);
}
@@ -92,7 +90,7 @@ int isockstream::establish()
if (bind(sfd, rp->ai_addr, rp->ai_addrlen) < 0)
#endif
{
mfem::err << "isockstream::establish(): bind() failed!" << endl;
mfem::err << "isockstream::establish(): bind() failed!" << std::endl;
close(sfd);
error = 3;
continue;
@@ -152,7 +150,7 @@ void isockstream::receive(std::istringstream **in)
if ((socketID = accept(portID, NULL, NULL)) < 0)
{
mfem::out << "Server failed to accept connection." << endl;
mfem::out << "Server failed to accept connection." << std::endl;
error = 5;
return;
}
@@ -171,18 +169,18 @@ void isockstream::receive(std::istringstream **in)
Buf = new char[size+1];
if (size != read_data(socketID, Buf, size))
{
mfem::out << "Not all the data has been read" << endl;
mfem::out << "Not all the data has been read" << std::endl;
}
#ifdef DEBUG
else
{
mfem::out << "Reading " << size << " bytes is successful" << endl;
mfem::out << "Reading " << size << " bytes is successful" << std::endl;
}
#endif
Buf[size] = '\0';
close(socketID);
(*in) = new istringstream(Buf);
(*in) = new std::istringstream(Buf);
}
isockstream::~isockstream()
+42 -42
View File
@@ -240,7 +240,7 @@ class StdHostMemorySpace : public HostMemorySpace { };
/// The No host memory space
struct NoHostMemorySpace : public HostMemorySpace
{
void Alloc(void**, const size_t) { mfem_error("! Host Alloc error"); }
void Alloc(void**, const size_t) override { mfem_error("! Host Alloc error"); }
};
/// The aligned 32 host memory space
@@ -248,9 +248,9 @@ class Aligned32HostMemorySpace : public HostMemorySpace
{
public:
Aligned32HostMemorySpace(): HostMemorySpace() { }
void Alloc(void **ptr, size_t bytes)
void Alloc(void **ptr, size_t bytes) override
{ if (mfem_memalign(ptr, 32, bytes) != 0) { throw ::std::bad_alloc(); } }
void Dealloc(void *ptr) { mfem_aligned_free(ptr); }
void Dealloc(void *ptr) override { mfem_aligned_free(ptr); }
};
/// The aligned 64 host memory space
@@ -258,9 +258,9 @@ class Aligned64HostMemorySpace : public HostMemorySpace
{
public:
Aligned64HostMemorySpace(): HostMemorySpace() { }
void Alloc(void **ptr, size_t bytes)
void Alloc(void **ptr, size_t bytes) override
{ if (mfem_memalign(ptr, 64, bytes) != 0) { throw ::std::bad_alloc(); } }
void Dealloc(void *ptr) { mfem_aligned_free(ptr); }
void Dealloc(void *ptr) override { mfem_aligned_free(ptr); }
};
#ifndef _WIN32
@@ -389,17 +389,17 @@ class MmuHostMemorySpace : public HostMemorySpace
{
public:
MmuHostMemorySpace(): HostMemorySpace() { MmuInit(); }
void Alloc(void **ptr, size_t bytes) { MmuAlloc(ptr, bytes); }
void Dealloc(void *ptr) { MmuDealloc(ptr, maps->memories.at(ptr).bytes); }
void Protect(const Memory& mem, size_t bytes)
void Alloc(void **ptr, size_t bytes) override { MmuAlloc(ptr, bytes); }
void Dealloc(void *ptr) override { MmuDealloc(ptr, maps->memories.at(ptr).bytes); }
void Protect(const Memory& mem, size_t bytes) override
{ if (mem.h_rw) { mem.h_rw = false; MmuProtect(mem.h_ptr, bytes); } }
void Unprotect(const Memory &mem, size_t bytes)
void Unprotect(const Memory &mem, size_t bytes) override
{ if (!mem.h_rw) { mem.h_rw = true; MmuAllow(mem.h_ptr, bytes); } }
/// Aliases need to be restricted during protection
void AliasProtect(const void *ptr, size_t bytes)
void AliasProtect(const void *ptr, size_t bytes) override
{ MmuProtect(MmuAddrR(ptr), MmuLengthR(ptr, bytes)); }
/// Aliases need to be prolongated for un-protection
void AliasUnprotect(const void *ptr, size_t bytes)
void AliasUnprotect(const void *ptr, size_t bytes) override
{ MmuAllow(MmuAddrP(ptr), MmuLengthP(ptr, bytes)); }
};
@@ -408,19 +408,19 @@ class UvmHostMemorySpace : public HostMemorySpace
{
public:
UvmHostMemorySpace(): HostMemorySpace() { }
void Alloc(void **ptr, size_t bytes) { CuMallocManaged(ptr, bytes == 0 ? 8 : bytes); }
void Dealloc(void *ptr) { CuMemFree(ptr); }
void Alloc(void **ptr, size_t bytes) override { CuMallocManaged(ptr, bytes == 0 ? 8 : bytes); }
void Dealloc(void *ptr) override { CuMemFree(ptr); }
};
/// The 'No' device memory space
class NoDeviceMemorySpace: public DeviceMemorySpace
{
public:
void Alloc(internal::Memory&) { mfem_error("! Device Alloc"); }
void Dealloc(Memory&) { mfem_error("! Device Dealloc"); }
void *HtoD(void*, const void*, size_t) { mfem_error("!HtoD"); return nullptr; }
void *DtoD(void*, const void*, size_t) { mfem_error("!DtoD"); return nullptr; }
void *DtoH(void*, const void*, size_t) { mfem_error("!DtoH"); return nullptr; }
void Alloc(internal::Memory&) override { mfem_error("! Device Alloc"); }
void Dealloc(Memory&) override { mfem_error("! Device Dealloc"); }
void *HtoD(void*, const void*, size_t) override { mfem_error("!HtoD"); return nullptr; }
void *DtoD(void*, const void*, size_t) override { mfem_error("!DtoD"); return nullptr; }
void *DtoH(void*, const void*, size_t) override { mfem_error("!DtoH"); return nullptr; }
};
/// The std:: device memory space, used with the 'debug' device
@@ -431,13 +431,13 @@ class CudaDeviceMemorySpace: public DeviceMemorySpace
{
public:
CudaDeviceMemorySpace(): DeviceMemorySpace() { }
void Alloc(Memory &base) { CuMemAlloc(&base.d_ptr, base.bytes); }
void Dealloc(Memory &base) { CuMemFree(base.d_ptr); }
void *HtoD(void *dst, const void *src, size_t bytes)
void Alloc(Memory &base) override { CuMemAlloc(&base.d_ptr, base.bytes); }
void Dealloc(Memory &base) override { CuMemFree(base.d_ptr); }
void *HtoD(void *dst, const void *src, size_t bytes) override
{ return CuMemcpyHtoD(dst, src, bytes); }
void *DtoD(void* dst, const void* src, size_t bytes)
void *DtoD(void* dst, const void* src, size_t bytes) override
{ return CuMemcpyDtoD(dst, src, bytes); }
void *DtoH(void *dst, const void *src, size_t bytes)
void *DtoH(void *dst, const void *src, size_t bytes) override
{ return CuMemcpyDtoH(dst, src, bytes); }
};
@@ -471,16 +471,16 @@ class HipDeviceMemorySpace: public DeviceMemorySpace
{
public:
HipDeviceMemorySpace(): DeviceMemorySpace() { }
void Alloc(Memory &base) { HipMemAlloc(&base.d_ptr, base.bytes); }
void Dealloc(Memory &base) { HipMemFree(base.d_ptr); }
void *HtoD(void *dst, const void *src, size_t bytes)
void Alloc(Memory &base) override { HipMemAlloc(&base.d_ptr, base.bytes); }
void Dealloc(Memory &base) override { HipMemFree(base.d_ptr); }
void *HtoD(void *dst, const void *src, size_t bytes) override
{ return HipMemcpyHtoD(dst, src, bytes); }
void *DtoD(void* dst, const void* src, size_t bytes)
void *DtoD(void* dst, const void* src, size_t bytes) override
// Unlike cudaMemcpy(DtoD), hipMemcpy(DtoD) causes a host-side synchronization so
// instead we use hipMemcpyAsync to get similar behavior.
// for more info see: https://github.com/mfem/mfem/pull/2780
{ return HipMemcpyDtoDAsync(dst, src, bytes); }
void *DtoH(void *dst, const void *src, size_t bytes)
void *DtoH(void *dst, const void *src, size_t bytes) override
{ return HipMemcpyDtoH(dst, src, bytes); }
};
@@ -488,16 +488,16 @@ public:
class UvmCudaMemorySpace : public DeviceMemorySpace
{
public:
void Alloc(Memory &base) { base.d_ptr = base.h_ptr; }
void Dealloc(Memory&) { }
void *HtoD(void *dst, const void *src, size_t bytes)
void Alloc(Memory &base) override { base.d_ptr = base.h_ptr; }
void Dealloc(Memory&) override { }
void *HtoD(void *dst, const void *src, size_t bytes) override
{
if (dst == src) { MFEM_STREAM_SYNC; return dst; }
return CuMemcpyHtoD(dst, src, bytes);
}
void *DtoD(void* dst, const void* src, size_t bytes)
void *DtoD(void* dst, const void* src, size_t bytes) override
{ return CuMemcpyDtoD(dst, src, bytes); }
void *DtoH(void *dst, const void *src, size_t bytes)
void *DtoH(void *dst, const void *src, size_t bytes) override
{
if (dst == src) { MFEM_STREAM_SYNC; return dst; }
return CuMemcpyDtoH(dst, src, bytes);
@@ -509,23 +509,23 @@ class MmuDeviceMemorySpace : public DeviceMemorySpace
{
public:
MmuDeviceMemorySpace(): DeviceMemorySpace() { }
void Alloc(Memory &m) { MmuAlloc(&m.d_ptr, m.bytes); }
void Dealloc(Memory &m) { MmuDealloc(m.d_ptr, m.bytes); }
void Protect(const Memory &m)
void Alloc(Memory &m) override { MmuAlloc(&m.d_ptr, m.bytes); }
void Dealloc(Memory &m) override { MmuDealloc(m.d_ptr, m.bytes); }
void Protect(const Memory &m) override
{ if (m.d_rw) { m.d_rw = false; MmuProtect(m.d_ptr, m.bytes); } }
void Unprotect(const Memory &m)
void Unprotect(const Memory &m) override
{ if (!m.d_rw) { m.d_rw = true; MmuAllow(m.d_ptr, m.bytes); } }
/// Aliases need to be restricted during protection
void AliasProtect(const void *ptr, size_t bytes)
void AliasProtect(const void *ptr, size_t bytes) override
{ MmuProtect(MmuAddrR(ptr), MmuLengthR(ptr, bytes)); }
/// Aliases need to be prolongated for un-protection
void AliasUnprotect(const void *ptr, size_t bytes)
void AliasUnprotect(const void *ptr, size_t bytes) override
{ MmuAllow(MmuAddrP(ptr), MmuLengthP(ptr, bytes)); }
void *HtoD(void *dst, const void *src, size_t bytes)
void *HtoD(void *dst, const void *src, size_t bytes) override
{ return std::memcpy(dst, src, bytes); }
void *DtoD(void *dst, const void *src, size_t bytes)
void *DtoD(void *dst, const void *src, size_t bytes) override
{ return std::memcpy(dst, src, bytes); }
void *DtoH(void *dst, const void *src, size_t bytes)
void *DtoH(void *dst, const void *src, size_t bytes) override
{ return std::memcpy(dst, src, bytes); }
};
+7 -7
View File
@@ -186,23 +186,23 @@ public:
/** Attach a new socket descriptor to the socketbuf. Returns the old socket
descriptor which is NOT closed. */
virtual int attach(int sd);
int attach(int sd) override;
virtual int open(const char hostname[], int port);
int open(const char hostname[], int port) override;
virtual int close();
int close() override;
protected:
virtual int sync();
int sync() override;
virtual int_type underflow();
int_type underflow() override;
// Same as in the base class:
// virtual int_type overflow(int_type c = traits_type::eof());
virtual std::streamsize xsgetn(char_type *s__, std::streamsize n__);
std::streamsize xsgetn(char_type *s__, std::streamsize n__) override;
virtual std::streamsize xsputn(const char_type *s__, std::streamsize n__);
std::streamsize xsputn(const char_type *s__, std::streamsize n__) override;
};
#endif // MFEM_USE_GNUTLS
+2 -2
View File
@@ -157,7 +157,7 @@ public:
Supports operators based on either an MFEM SparseMatrix or
HypreParMatrix.
*/
virtual void SetOperator(const Operator &op);
void SetOperator(const Operator &op) override;
/** @brief Change the input operator that is being solved via AmgX.
Supports operators based on either an MFEM SparseMatrix or
@@ -172,7 +172,7 @@ public:
@a x vector will be set to zero, otherwise the value of @a x passed
in will be used.
*/
virtual void Mult(const Vector& b, Vector& x) const;
void Mult(const Vector& b, Vector& x) const override;
/** @brief Return the number of iterations that were executed during the
last solve phase. */
+3 -3
View File
@@ -338,7 +338,7 @@ public:
}
}
void Mult(const Vector& x, Vector& y) const
void Mult(const Vector& x, Vector& y) const override
{
amg_->Mult(x, y);
@@ -349,9 +349,9 @@ public:
}
}
void SetOperator(const Operator&) { }
void SetOperator(const Operator&) override { }
~ZeroWrapAMG()
~ZeroWrapAMG() override
{
delete amg_;
}
+2 -2
View File
@@ -137,9 +137,9 @@ public:
virtual ~GeneralAMS();
/// in principle this should set A_ = op;
void SetOperator(const Operator &op) {}
void SetOperator(const Operator &op) override {}
virtual void Mult(const Vector& x, Vector& y) const;
void Mult(const Vector& x, Vector& y) const override;
private:
const Operator& curlcurl_op;
+14 -13
View File
@@ -88,24 +88,24 @@ public:
void EliminateRowCol(Array<int> & ess_bc_dofs, Vector & sol, Vector & rhs);
/// Finalize all the submatrices
virtual void Finalize(int skip_zeros = 1) { Finalize(skip_zeros, false); }
void Finalize(int skip_zeros = 1) override { Finalize(skip_zeros, false); }
/// A slightly more general version of the Finalize(int) method.
void Finalize(int skip_zeros, bool fix_empty_rows);
//! Returns a monolithic CSR matrix that represents this operator.
SparseMatrix * CreateMonolithic() const;
//! Export the monolithic matrix to file.
virtual void PrintMatlab(std::ostream & os = mfem::out) const;
void PrintMatlab(std::ostream & os = mfem::out) const override;
/// @name Matrix interface
///@{
/// Returns reference to a_{ij}.
virtual real_t& Elem (int i, int j);
real_t& Elem (int i, int j) override;
/// Returns constant reference to a_{ij}.
virtual const real_t& Elem (int i, int j) const;
const real_t& Elem (int i, int j) const override;
/// Returns a pointer to (approximation) of the matrix inverse.
virtual MatrixInverse * Inverse() const
MatrixInverse * Inverse() const override
{
mfem_error("BlockMatrix::Inverse not implemented \n");
return static_cast<MatrixInverse*>(NULL);
@@ -116,27 +116,28 @@ public:
///@{
//! Returns the total number of non zeros in the matrix.
virtual int NumNonZeroElems() const;
int NumNonZeroElems() const override;
/// Gets the columns indexes and values for row *row*.
/** The return value is always 0 since @a cols and @a srow are copies of the
values in the matrix. */
virtual int GetRow(const int row, Array<int> &cols, Vector &srow) const;
int GetRow(const int row, Array<int> &cols, Vector &srow) const override;
/** @brief If the matrix is square, this method will place 1 on the diagonal
(i,i) if row i has "almost" zero l1-norm.
If entry (i,i) does not belong to the sparsity pattern of A, then a error
will occur. */
virtual void EliminateZeroRows(const real_t threshold = 1e-12);
void EliminateZeroRows(const real_t threshold = 1e-12) override;
/// Matrix-Vector Multiplication y = A*x
virtual void Mult(const Vector & x, Vector & y) const;
void Mult(const Vector & x, Vector & y) const override;
/// Matrix-Vector Multiplication y = y + val*A*x
virtual void AddMult(const Vector & x, Vector & y, const real_t val = 1.) const;
void AddMult(const Vector & x, Vector & y,
const real_t val = 1.) const override;
/// MatrixTranspose-Vector Multiplication y = A'*x
virtual void MultTranspose(const Vector & x, Vector & y) const;
void MultTranspose(const Vector & x, Vector & y) const override;
/// MatrixTranspose-Vector Multiplication y = y + val*A'*x
virtual void AddMultTranspose(const Vector & x, Vector & y,
const real_t val = 1.) const;
void AddMultTranspose(const Vector & x, Vector & y,
const real_t val = 1.) const override;
///@}
/** @brief Partial matrix vector multiplication of (*this) with @a x

Some files were not shown because too many files have changed in this diff Show More