From 916f1e0e513d863411c436b48f9a1a5753d99ff8 Mon Sep 17 00:00:00 2001 From: Nathaniel Morgan Date: Fri, 12 Jun 2026 14:13:52 -0600 Subject: [PATCH 1/3] moved FOR_ALL in driver to a function --- apps/multiphysics/src/driver.cpp | 30 ++++++++++++++++++++++++------ apps/multiphysics/src/driver.hpp | 6 ++++-- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/apps/multiphysics/src/driver.cpp b/apps/multiphysics/src/driver.cpp index 4f3d23bf9..f416074e8 100644 --- a/apps/multiphysics/src/driver.cpp +++ b/apps/multiphysics/src/driver.cpp @@ -222,12 +222,15 @@ void Driver::initialize() std::vector required_node_state = { node_state::coords }; State.node.initialize(mesh.num_nodes, mesh.num_dims, required_node_state, node_communication_plan); - // Copy the partitioned node coordinates to the state - FOR_ALL(node_gid, 0, mesh.num_nodes, { - for (size_t dim = 0; dim < mesh.num_dims; dim++) { - State.node.coords(node_gid, dim) = final_node_coords(node_gid, dim); - } - }); + + setting_nodes(State.node.coords, final_node_coords, mesh.num_nodes, mesh.num_dims); + + // // Copy the partitioned node coordinates to the state + // FOR_ALL(node_gid, 0, mesh.num_nodes, { + // for (size_t dim = 0; dim < mesh.num_dims; dim++) { + // State.node.coords(node_gid, dim) = final_node_coords(node_gid, dim); + // } + // }); // --- calculate bdy sets ---// mesh.init_bdy_sets(num_bcs); @@ -575,3 +578,18 @@ void Driver::setup_solver_vars(T& a_solver, return; } // end setup solver vars function + + +inline void setting_nodes(MPICArrayKokkos &node_coords, + const MPICArrayKokkos &final_node_coords, + const size_t num_nodes, + const size_t num_dims){ + + // Copy the partitioned node coordinates to the state + FOR_ALL(node_gid, 0, num_nodes, { + for (size_t dim = 0; dim < num_dims; dim++) { + node_coords(node_gid, dim) = final_node_coords(node_gid, dim); + } + }); + return; +}; \ No newline at end of file diff --git a/apps/multiphysics/src/driver.hpp b/apps/multiphysics/src/driver.hpp index 09164f7b8..de39ddb46 100644 --- a/apps/multiphysics/src/driver.hpp +++ b/apps/multiphysics/src/driver.hpp @@ -160,6 +160,8 @@ class Driver }; // end driver class - - +inline void setting_nodes(MPICArrayKokkos &node_coords, + const MPICArrayKokkos &final_node_coords, + const size_t num_nodes, + const size_t num_dims); From a28ca9b7a42179e8fa623f01ec9cd1d09487f1c4 Mon Sep 17 00:00:00 2001 From: Nathaniel Morgan Date: Fri, 12 Jun 2026 15:54:59 -0600 Subject: [PATCH 2/3] added messages and cleaned up comments --- apps/multiphysics/src/driver.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/multiphysics/src/driver.cpp b/apps/multiphysics/src/driver.cpp index f416074e8..a74ab2df2 100644 --- a/apps/multiphysics/src/driver.cpp +++ b/apps/multiphysics/src/driver.cpp @@ -222,16 +222,11 @@ void Driver::initialize() std::vector required_node_state = { node_state::coords }; State.node.initialize(mesh.num_nodes, mesh.num_dims, required_node_state, node_communication_plan); - + // a function is used to set the node coords, ensuring the compiler doesn't change the FOR_ALL + // to be a FOR_ALL_CLASS. Be careful with using FOR_ALL (etc) in classes as some compilers will + // change the coding, adding a *this to the lambda function, which creates a bug on a GPU. setting_nodes(State.node.coords, final_node_coords, mesh.num_nodes, mesh.num_dims); - // // Copy the partitioned node coordinates to the state - // FOR_ALL(node_gid, 0, mesh.num_nodes, { - // for (size_t dim = 0; dim < mesh.num_dims; dim++) { - // State.node.coords(node_gid, dim) = final_node_coords(node_gid, dim); - // } - // }); - // --- calculate bdy sets ---// mesh.init_bdy_sets(num_bcs); tag_bdys(BoundaryConditions, mesh, State.node.coords); @@ -580,6 +575,7 @@ void Driver::setup_solver_vars(T& a_solver, } // end setup solver vars function +// setting node coords inline void setting_nodes(MPICArrayKokkos &node_coords, const MPICArrayKokkos &final_node_coords, const size_t num_nodes, @@ -592,4 +588,4 @@ inline void setting_nodes(MPICArrayKokkos &node_coords, } }); return; -}; \ No newline at end of file +}; // end function \ No newline at end of file From 939bebe0ccd50e49caf6ca3c4a0a757adc4ba68e Mon Sep 17 00:00:00 2001 From: Nathaniel Morgan Date: Fri, 12 Jun 2026 15:55:20 -0600 Subject: [PATCH 3/3] added messages and cleaned up comments --- apps/multiphysics/src/driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/multiphysics/src/driver.cpp b/apps/multiphysics/src/driver.cpp index a74ab2df2..378c56cc2 100644 --- a/apps/multiphysics/src/driver.cpp +++ b/apps/multiphysics/src/driver.cpp @@ -224,7 +224,7 @@ void Driver::initialize() // a function is used to set the node coords, ensuring the compiler doesn't change the FOR_ALL // to be a FOR_ALL_CLASS. Be careful with using FOR_ALL (etc) in classes as some compilers will - // change the coding, adding a *this to the lambda function, which creates a bug on a GPU. + // change the coding, adding a *this to the lambda function, which can create a bug on a GPU. setting_nodes(State.node.coords, final_node_coords, mesh.num_nodes, mesh.num_dims); // --- calculate bdy sets ---//