Skip to content

Commit

Permalink
act on Jonah comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Nov 27, 2024
1 parent 0d49d78 commit 95ed5b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions example/poisson_gmg/poisson_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ TaskCollection PoissonDriver::MakeTaskCollection(BlockList_t &blocks) {
if (use_exact_rhs) {
auto copy_exact = tl.AddTask(
copy_rhs, TF(solvers::utils::between_fields::CopyData<exact, u>), md);
copy_exact = tl.AddTask(
auto copy_u_between_stages = tl.AddTask(
copy_exact, TF(solvers::utils::CopyData<parthenon::TypeList<u>>), md, md_u);
auto comm = AddBoundaryExchangeTasks<BoundaryType::any>(copy_exact, tl, md_u, true);
auto comm = AddBoundaryExchangeTasks<BoundaryType::any>(copy_u_between_stages, tl,
md_u, true);
auto *eqs =
pkg->MutableParam<poisson_package::PoissonEquation<u, D>>("poisson_equation");
copy_rhs = eqs->Ax(tl, comm, md, md_u, md_rhs);
}

// Set initial solution guess to zero
auto zero_u = tl.AddTask(copy_rhs, TF(solvers::utils::SetToZero<u>), md);
zero_u = tl.AddTask(zero_u, TF(solvers::utils::SetToZero<u>), md_u);
auto zero_u = tl.AddTask(copy_rhs, TF(solvers::utils::SetToZero<u>), md_u);
auto setup = psolver->AddSetupTasks(tl, zero_u, i, pmesh);
auto solve = psolver->AddTasks(tl, setup, i, pmesh);

Expand Down
3 changes: 2 additions & 1 deletion src/interface/sparse_pack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class SparsePack : public SparsePackBase {

KOKKOS_INLINE_FUNCTION bool IsPhysicalBoundary(const int b, const int off3,
const int off2, const int off1) const {
return block_props_(b, (off1 + 1) + 3 * ((off2 + 1) + 3 * (off3 + 1))) == bnd_flag;
return block_props_(b, (off1 + 1) + 3 * ((off2 + 1) + 3 * (off3 + 1))) ==
physical_bnd_flag;
}

KOKKOS_INLINE_FUNCTION int GetGID(const int b) const { return block_props_(b, 27); }
Expand Down
18 changes: 12 additions & 6 deletions src/interface/sparse_pack_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,23 @@ SparsePackBase SparsePackBase::Build(T *pmd, const PackDescriptor &desc,
for (int oxb = -1; oxb <= 1; ++oxb) {
for (int oxa = -1; oxa <= 1; ++oxa) {
if (pmb->IsPhysicalBoundary(inner_x1))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, oxa, -1)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, oxa, -1)) =
physical_bnd_flag;
if (pmb->IsPhysicalBoundary(outer_x1))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, oxa, 1)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, oxa, 1)) =
physical_bnd_flag;
if (pmb->IsPhysicalBoundary(inner_x2))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, -1, oxa)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, -1, oxa)) =
physical_bnd_flag;
if (pmb->IsPhysicalBoundary(outer_x2))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, 1, oxa)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(oxb, 1, oxa)) =
physical_bnd_flag;
if (pmb->IsPhysicalBoundary(inner_x3))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(-1, oxb, oxa)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(-1, oxb, oxa)) =
physical_bnd_flag;
if (pmb->IsPhysicalBoundary(outer_x3))
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(1, oxb, oxa)) = bnd_flag;
pack.block_props_h_(blidx, bp_idxer.GetFlatIdx(1, oxb, oxa)) =
physical_bnd_flag;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/interface/sparse_pack_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SparsePackBase {
using block_props_h_t = typename block_props_t::HostMirror;
using coords_t = ParArray1DRaw<ParArray0D<Coordinates_t>>;

static constexpr int bnd_flag = -2000;
static constexpr int physical_bnd_flag = -2000;

// Returns a SparsePackBase object that is either newly created or taken
// from the cache in pmd. The cache itself handles the all of this logic
Expand Down

0 comments on commit 95ed5b2

Please sign in to comment.