-
Notifications
You must be signed in to change notification settings - Fork 32
Fix master #1075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix master #1075
Changes from all commits
9fdbff4
0ad214f
2ef11e1
6d46539
ac41469
9f42f65
287a68b
b9912f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,14 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| #ifndef PHARE_MAGNETIC_FIELD_COARSENER | ||||||||||||||||||||||||||||||||||||||||||||
| #define PHARE_MAGNETIC_FIELD_COARSENER | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| #include "core/def/phare_mpi.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
| #ifndef PHARE_ELECTRIC_FIELD_COARSENER | ||||||||||||||||||||||||||||||||||||||||||||
| #define PHARE_ELECTRIC_FIELD_COARSENER | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| #include "amr/amr_constants.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
| #include "core/data/grid/gridlayoutdefs.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
| #include "core/hybrid/hybrid_quantities.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
| #include "core/utilities/constants.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
| #include "amr/resources_manager/amr_utils.hpp" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| #include <SAMRAI/hier/Box.h> | ||||||||||||||||||||||||||||||||||||||||||||
| #include <cstddef> | ||||||||||||||||||||||||||||||||||||||||||||
| #include <stdexcept> | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| namespace PHARE::amr | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -32,13 +31,13 @@ using core::dirZ; | |||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||
| template<std::size_t dimension> | ||||||||||||||||||||||||||||||||||||||||||||
| class MagneticFieldCoarsener | ||||||||||||||||||||||||||||||||||||||||||||
| class ElectricFieldCoarsener | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| public: | ||||||||||||||||||||||||||||||||||||||||||||
| MagneticFieldCoarsener(std::array<core::QtyCentering, dimension> const centering, | ||||||||||||||||||||||||||||||||||||||||||||
| ElectricFieldCoarsener(std::array<core::QtyCentering, dimension> const centering, | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::Box const& sourceBox, | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::Box const& destinationBox, | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::IntVector const& ratio) | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::IntVector const& /*ratio*/) | ||||||||||||||||||||||||||||||||||||||||||||
| : centering_{centering} | ||||||||||||||||||||||||||||||||||||||||||||
| , sourceBox_{sourceBox} | ||||||||||||||||||||||||||||||||||||||||||||
| , destinationBox_{destinationBox} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -55,86 +54,101 @@ class MagneticFieldCoarsener | |||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| core::Point<int, dimension> fineStartIndex; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirX] = coarseIndex[dirX] * this->ratio_; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if constexpr (dimension > 1) | ||||||||||||||||||||||||||||||||||||||||||||
| for (auto i = std::size_t{0}; i < dimension; ++i) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirY] = coarseIndex[dirY] * this->ratio_; | ||||||||||||||||||||||||||||||||||||||||||||
| if constexpr (dimension > 2) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirZ] = coarseIndex[dirZ] * this->ratio_; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[i] = coarseIndex[i] * refinementRatio; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex = AMRToLocal(fineStartIndex, sourceBox_); | ||||||||||||||||||||||||||||||||||||||||||||
| coarseIndex = AMRToLocal(coarseIndex, destinationBox_); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // the following kinda assumes where B is, i.e. Yee layout centering | ||||||||||||||||||||||||||||||||||||||||||||
| // as it only does faces pirmal-dual, dual-primal and dual-dual | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if constexpr (dimension == 1) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| // in 1D div(B) is automatically satisfied so using this coarsening | ||||||||||||||||||||||||||||||||||||||||||||
| // opertor is probably not better than the default one, but we do that | ||||||||||||||||||||||||||||||||||||||||||||
| // for a kind of consistency... | ||||||||||||||||||||||||||||||||||||||||||||
| // coarse flux is equal to fine flux and we're 1D so there is flux partitioned | ||||||||||||||||||||||||||||||||||||||||||||
| // only for By and Bz, Bx is equal to the fine value | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (centering_[dirX] == core::QtyCentering::primal) // bx | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX]) = fineField(fineStartIndex[dirX]); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::dual) // by and bz | ||||||||||||||||||||||||||||||||||||||||||||
| if (centering_[dirX] == core::QtyCentering::dual) // ex | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 * (fineField(fineStartIndex[dirX] + 1) + fineField(fineStartIndex[dirX])); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::primal) // ey, ez | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX]) = fineField(fineStartIndex[dirX]); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if constexpr (dimension == 2) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| if (centering_[dirX] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::dual) | ||||||||||||||||||||||||||||||||||||||||||||
| if (centering_[dirX] == core::QtyCentering::dual | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::primal) // ex | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1)); | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY])); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+80
to
87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2D Ex: average across X over ratio_(X), not a hardcoded 0.5 of two points. - if (centering_[dirX] == core::QtyCentering::dual
- and centering_[dirY] == core::QtyCentering::primal) // ex
+ if (centering_[dirX] == core::QtyCentering::dual
+ and centering_[dirY] == core::QtyCentering::primal) // Ex
{
- coarseField(coarseIndex[dirX], coarseIndex[dirY])
- = 0.5
- * (fineField(fineStartIndex[dirX], fineStartIndex[dirY])
- + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY]));
+ auto const rx = ratio_(dirX);
+ double acc = 0.;
+ for (int sx = 0; sx < rx; ++sx)
+ acc += fineField(fineStartIndex[dirX] + sx, fineStartIndex[dirY]);
+ coarseField(coarseIndex[dirX], coarseIndex[dirY]) = acc / rx;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::dual | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::primal) | ||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::dual) // ey | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY])); | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+88
to
95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2D Ey: average across Y over ratio_(Y). - else if (centering_[dirX] == core::QtyCentering::primal
- and centering_[dirY] == core::QtyCentering::dual) // ey
+ else if (centering_[dirX] == core::QtyCentering::primal
+ and centering_[dirY] == core::QtyCentering::dual) // Ey
{
- coarseField(coarseIndex[dirX], coarseIndex[dirY])
- = 0.5
- * (fineField(fineStartIndex[dirX], fineStartIndex[dirY])
- + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1));
+ auto const ry = ratio_(dirY);
+ double acc = 0.;
+ for (int sy = 0; sy < ry; ++sy)
+ acc += fineField(fineStartIndex[dirX], fineStartIndex[dirY] + sy);
+ coarseField(coarseIndex[dirX], coarseIndex[dirY]) = acc / ry;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::dual | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::dual) | ||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::primal) // ez | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.25 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY] + 1)); | ||||||||||||||||||||||||||||||||||||||||||||
| = fineField(fineStartIndex[dirX], fineStartIndex[dirY]); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| throw std::runtime_error("no magnetic field should end up here"); | ||||||||||||||||||||||||||||||||||||||||||||
| throw std::runtime_error("no electric field should end up here"); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| else if constexpr (dimension == 3) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| throw std::runtime_error("Not Implemented yet"); | ||||||||||||||||||||||||||||||||||||||||||||
| if (centering_[dirX] == core::QtyCentering::dual | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirZ] == core::QtyCentering::primal) // ex | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY], | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirZ])); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+109
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3D Ex: average across X over ratio_(X). - if (centering_[dirX] == core::QtyCentering::dual
+ if (centering_[dirX] == core::QtyCentering::dual
and centering_[dirY] == core::QtyCentering::primal
and centering_[dirZ] == core::QtyCentering::primal) // ex
{
- coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ])
- = 0.5
- * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ])
- + fineField(fineStartIndex[dirX] + 1, fineStartIndex[dirY],
- fineStartIndex[dirZ]));
+ auto const rx = ratio_(dirX);
+ double acc = 0.;
+ for (int sx = 0; sx < rx; ++sx)
+ acc += fineField(fineStartIndex[dirX] + sx, fineStartIndex[dirY],
+ fineStartIndex[dirZ]);
+ coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) = acc / rx;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::dual | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirZ] == core::QtyCentering::primal) // ey | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1, | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirZ])); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+119
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3D Ey: average across Y over ratio_(Y). - else if (centering_[dirX] == core::QtyCentering::primal
+ else if (centering_[dirX] == core::QtyCentering::primal
and centering_[dirY] == core::QtyCentering::dual
and centering_[dirZ] == core::QtyCentering::primal) // ey
{
- coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ])
- = 0.5
- * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ])
- + fineField(fineStartIndex[dirX], fineStartIndex[dirY] + 1,
- fineStartIndex[dirZ]));
+ auto const ry = ratio_(dirY);
+ double acc = 0.;
+ for (int sy = 0; sy < ry; ++sy)
+ acc += fineField(fineStartIndex[dirX], fineStartIndex[dirY] + sy,
+ fineStartIndex[dirZ]);
+ coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) = acc / ry;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| else if (centering_[dirX] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirY] == core::QtyCentering::primal | ||||||||||||||||||||||||||||||||||||||||||||
| and centering_[dirZ] == core::QtyCentering::dual) // ez | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| = 0.5 | ||||||||||||||||||||||||||||||||||||||||||||
| * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ]) | ||||||||||||||||||||||||||||||||||||||||||||
| + fineField(fineStartIndex[dirX], fineStartIndex[dirY], | ||||||||||||||||||||||||||||||||||||||||||||
| fineStartIndex[dirZ] + 1)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+129
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3D Ez: average across Z over ratio_(Z). - else if (centering_[dirX] == core::QtyCentering::primal
+ else if (centering_[dirX] == core::QtyCentering::primal
and centering_[dirY] == core::QtyCentering::primal
and centering_[dirZ] == core::QtyCentering::dual) // ez
{
- coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ])
- = 0.5
- * (fineField(fineStartIndex[dirX], fineStartIndex[dirY], fineStartIndex[dirZ])
- + fineField(fineStartIndex[dirX], fineStartIndex[dirY],
- fineStartIndex[dirZ] + 1));
+ auto const rz = ratio_(dirZ);
+ double acc = 0.;
+ for (int sz = 0; sz < rz; ++sz)
+ acc += fineField(fineStartIndex[dirX], fineStartIndex[dirY],
+ fineStartIndex[dirZ] + sz);
+ coarseField(coarseIndex[dirX], coarseIndex[dirY], coarseIndex[dirZ]) = acc / rz;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| throw std::runtime_error("no electric field should end up here"); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| private: | ||||||||||||||||||||||||||||||||||||||||||||
| std::array<core::QtyCentering, dimension> const centering_; | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::Box const sourceBox_; | ||||||||||||||||||||||||||||||||||||||||||||
| SAMRAI::hier::Box const destinationBox_; | ||||||||||||||||||||||||||||||||||||||||||||
| static int constexpr ratio_ = 2; | ||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| } // namespace PHARE::amr | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,11 @@ | |
| #include "core/def/phare_mpi.hpp" | ||
|
|
||
| #include "core/def.hpp" | ||
| #include "coarsen_weighter.hpp" | ||
| #include "core/data/grid/gridlayoutdefs.hpp" | ||
| #include "core/hybrid/hybrid_quantities.hpp" | ||
| #include "core/data/field/field.hpp" | ||
| #include "core/utilities/constants.hpp" | ||
|
|
||
| #include "amr/resources_manager/amr_utils.hpp" | ||
|
|
||
| #include "coarsen_weighter.hpp" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential missing import of dirX/dirY/dirZ after include reordering. This file uses dirX/dirY/dirZ unqualified, but no namespace PHARE
{
namespace amr
{
+ using core::dirX;
+ using core::dirY;
+ using core::dirZ;Alternatively, qualify all occurrences (
🤖 Prompt for AI Agents |
||
|
|
||
| #include <SAMRAI/hier/Box.h> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coarsening assumes ratio==2 via 0.5 average; generalize to any refinement ratio along the dual axis.
Average over ratio_(X) fine edges for Ex in 1D; inject for primal. Current code is incorrect for ratios ≠ 2.
📝 Committable suggestion