diff options
Diffstat (limited to '')
-rw-r--r-- | Source/WarpXComm.cpp | 137 |
1 files changed, 96 insertions, 41 deletions
diff --git a/Source/WarpXComm.cpp b/Source/WarpXComm.cpp index 23ce0ce0b..46d3a0af7 100644 --- a/Source/WarpXComm.cpp +++ b/Source/WarpXComm.cpp @@ -238,67 +238,122 @@ WarpX::FillBoundaryF () void WarpX::FillBoundaryE(int lev) { - const auto& period = Geom(lev).periodicity(); - - if (do_pml && pml[lev]->ok()) { - ExchangeWithPmlE(lev); - pml[lev]->FillBoundaryE(); - } - - (*Efield_fp[lev][0]).FillBoundary( period ); - (*Efield_fp[lev][1]).FillBoundary( period ); - (*Efield_fp[lev][2]).FillBoundary( period ); + FillBoundaryE(lev, PatchType::fine); + if (lev > 0) FillBoundaryE(lev, PatchType::coarse); +} - if (lev > 0) +void +WarpX::FillBoundaryE (int lev, PatchType patch_type) +{ + if (patch_type == PatchType::fine) { - const auto& cperiod = Geom(lev-1).periodicity(); - (*Efield_cp[lev][0]).FillBoundary(cperiod); - (*Efield_cp[lev][1]).FillBoundary(cperiod); - (*Efield_cp[lev][2]).FillBoundary(cperiod); + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeE(patch_type, + { Efield_fp[lev][0].get(), + Efield_fp[lev][1].get(), + Efield_fp[lev][2].get() }); + pml[lev]->FillBoundaryE(patch_type); + } + + const auto& period = Geom(lev).periodicity(); + (*Efield_fp[lev][0]).FillBoundary(period); + (*Efield_fp[lev][1]).FillBoundary(period); + (*Efield_fp[lev][2]).FillBoundary(period); } + else if (patch_type == PatchType::coarse) + { + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeE(patch_type, + { Efield_cp[lev][0].get(), + Efield_cp[lev][1].get(), + Efield_cp[lev][2].get() }); + pml[lev]->FillBoundaryE(patch_type); + } + + const auto& cperiod = Geom(lev-1).periodicity(); + (*Efield_cp[lev][0]).FillBoundary(cperiod); + (*Efield_cp[lev][1]).FillBoundary(cperiod); + (*Efield_cp[lev][2]).FillBoundary(cperiod); + } } void -WarpX::FillBoundaryB(int lev) +WarpX::FillBoundaryB (int lev) { - const auto& period = Geom(lev).periodicity(); + FillBoundaryB(lev, PatchType::fine); + if (lev > 0) FillBoundaryB(lev, PatchType::coarse); +} - if (do_pml && pml[lev]->ok()) +void +WarpX::FillBoundaryB (int lev, PatchType patch_type) +{ + if (patch_type == PatchType::fine) { - ExchangeWithPmlB(lev); - pml[lev]->FillBoundaryB(); - } - - (*Bfield_fp[lev][0]).FillBoundary(period); - (*Bfield_fp[lev][1]).FillBoundary(period); - (*Bfield_fp[lev][2]).FillBoundary(period); + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeB(patch_type, + { Bfield_fp[lev][0].get(), + Bfield_fp[lev][1].get(), + Bfield_fp[lev][2].get() }); + pml[lev]->FillBoundaryB(patch_type); + } - if (lev > 0) + const auto& period = Geom(lev).periodicity(); + (*Bfield_fp[lev][0]).FillBoundary(period); + (*Bfield_fp[lev][1]).FillBoundary(period); + (*Bfield_fp[lev][2]).FillBoundary(period); + } + else if (patch_type == PatchType::coarse) { - const auto& cperiod = Geom(lev-1).periodicity(); - (*Bfield_cp[lev][0]).FillBoundary(cperiod); - (*Bfield_cp[lev][1]).FillBoundary(cperiod); - (*Bfield_cp[lev][2]).FillBoundary(cperiod); + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeB(patch_type, + { Bfield_cp[lev][0].get(), + Bfield_cp[lev][1].get(), + Bfield_cp[lev][2].get() }); + pml[lev]->FillBoundaryB(patch_type); + } + + const auto& cperiod = Geom(lev-1).periodicity(); + (*Bfield_cp[lev][0]).FillBoundary(cperiod); + (*Bfield_cp[lev][1]).FillBoundary(cperiod); + (*Bfield_cp[lev][2]).FillBoundary(cperiod); } } void -WarpX::FillBoundaryF(int lev) +WarpX::FillBoundaryF (int lev) { - const auto& period = Geom(lev).periodicity(); + FillBoundaryF(lev, PatchType::fine); + if (lev > 0) FillBoundaryF(lev, PatchType::coarse); +} - if (do_pml && pml[lev]->ok()) +void +WarpX::FillBoundaryF (int lev, PatchType patch_type) +{ + if (patch_type == PatchType::fine && F_fp[lev]) { - ExchangeWithPmlF(lev); - pml[lev]->FillBoundaryF(); - } - - if (F_fp[lev]) F_fp[lev]->FillBoundary(period); + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeF(patch_type, F_fp[lev].get()); + pml[lev]->FillBoundaryF(patch_type); + } - if (lev > 0) + const auto& period = Geom(lev).periodicity(); + F_fp[lev]->FillBoundary(period); + } + else if (patch_type == PatchType::coarse && F_cp[lev]) { - const auto& cperiod = Geom(lev-1).periodicity(); - if (F_cp[lev]) F_cp[lev]->FillBoundary(cperiod); + if (do_pml && pml[lev]->ok()) + { + pml[lev]->ExchangeF(patch_type, F_cp[lev].get()); + pml[lev]->FillBoundaryF(patch_type); + } + + const auto& cperiod = Geom(lev-1).periodicity(); + F_cp[lev]->FillBoundary(cperiod); } } |