MLMG: Specialize for fMultiFab#5484
Draft
ax3l wants to merge 3 commits into
Draft
Conversation
If we want to develop applications that can use double and single precision switches at runtime, then we need to be able to generate both in the same binary. This adds the corresponding templates (that default to the current status quo) in particle containers.
Specialize the MLMG Solvers for fMultiFab, too.
ax3l
commented
Jun 9, 2026
Comment on lines
+19
to
+22
| // Single-precision instantiations needed by the float nodal solve | ||
| // (MLNodeTensorLaplacianT<fMultiFab> via MLMGT<fMultiFab>). | ||
| template class MLMGT<fMultiFab>; | ||
| template class MLLinOpT<fMultiFab>; |
Member
Author
There was a problem hiding this comment.
Probably compiles 2x as long now, so might be worth a separate .cpp file
ax3l
commented
Jun 9, 2026
Comment on lines
+723
to
+724
| template class MLNodeLinOpT<MultiFab>; | ||
| template class MLNodeLinOpT<fMultiFab>; |
Member
Author
There was a problem hiding this comment.
Potentially worth a 2nd cpp file for double/float
ax3l
commented
Jun 9, 2026
Comment on lines
+365
to
+366
| template class MLNodeTensorLaplacianT<MultiFab>; | ||
| template class MLNodeTensorLaplacianT<fMultiFab>; |
Member
Author
There was a problem hiding this comment.
Potentially worth a 2nd .cpp file for float.
Two fixes for the HYPRE CI builds of the templated nodal MLMG operator (MLNodeLinOp is now the alias MLNodeLinOpT<>): - AMReX_HypreNodeLap.H forward-declared `class MLNodeLinOp;`, which conflicts with the alias (this header is included by AMReX_MLNodeLinOp.H). Forward-declare the template + alias instead. - MLNodeLinOpT<MF>::makeHypreNodeLap is a regular member, so the explicit `template class MLNodeLinOpT<fMultiFab>;` instantiates it; it passes `this` to HypreNodeLap's `MLNodeLinOp const*` (== MLNodeLinOpT<MultiFab> const*) param. Guard it with `if constexpr (std::is_same_v<MF, MultiFab>)` (the HYPRE IJ interface is double-only, matching the requires(same_as<TMF,MultiFab>) constraint already on bottomSolveWithHypre/PETSc). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Specialize the MLMG Solvers for fMultiFab, too.
Additional background
#5482
Checklist
The proposed changes: