From b9e183c271e9488ffe3aea1a3492d748a71b03f4 Mon Sep 17 00:00:00 2001 From: nikbott Date: Tue, 7 Jul 2026 09:31:37 -0300 Subject: [PATCH 1/2] style(mpi): clang-format main.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main.cpp predates enforced clang-format and was never in a lint changed-set, so it carried trailing whitespace and non-conforming line breaks. Pure formatting, no behavior change — done separately so the follow-up removal is reviewable on its own. Co-Authored-By: Claude Opus 4.8 --- mpi/main.cpp | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/mpi/main.cpp b/mpi/main.cpp index e390ffd..dad6ed2 100644 --- a/mpi/main.cpp +++ b/mpi/main.cpp @@ -2,19 +2,21 @@ * @file main.cpp * @brief Main Entry Point. */ +#include +#include +#include + #include "core.hpp" -#include "tree.hpp" #include "physics.hpp" +#include "tree.hpp" #include "viz.hpp" -#include -#include -#include using namespace amr; int main(int argc, char** argv) { amr::mpi::Context mpi(argc, argv); - if (mpi.rank == 0) std::cout << "=== AMR System (SoA + Strong Types) ===\n"; + if (mpi.rank == 0) + std::cout << "=== AMR System (SoA + Strong Types) ===\n"; Config cfg; cfg.max_level = 20; @@ -23,50 +25,56 @@ int main(int argc, char** argv) { cfg.radius = 0.25; { - if (mpi.rank == 0) std::cout << "\n--- 2D Quadtree ---\n"; + if (mpi.rank == 0) + std::cout << "\n--- 2D Quadtree ---\n"; DistributedTree<2> tree(cfg.max_level); CircleOracle oracle(cfg); int steps = 0; - while(tree.refine(oracle)) { + while (tree.refine(oracle)) { tree.repartition(); size_t n = tree.global_size(); - if (mpi.rank == 0) std::cout << "Refine step " << ++steps << ": " << n << " leaves\n"; + if (mpi.rank == 0) + std::cout << "Refine step " << ++steps << ": " << n << " leaves\n"; } - if (mpi.rank == 0) std::cout << "Balancing...\n"; + if (mpi.rank == 0) + std::cout << "Balancing...\n"; tree.repartition(); auto start = std::chrono::high_resolution_clock::now(); tree.balance(); auto end = std::chrono::high_resolution_clock::now(); tree.verify_global(); if (mpi.rank == 0) { - std::cout << "Balanced in " - << std::chrono::duration_cast(end-start).count() + std::cout << "Balanced in " + << std::chrono::duration_cast(end - start).count() << "ms. Final size: " << tree.global_size() << "\n"; } viz::write_svg(tree, "mesh_2d_rank_" + std::to_string(mpi.rank) + ".svg"); } { - if (mpi.rank == 0) std::cout << "\n--- 3D Octree ---\n"; + if (mpi.rank == 0) + std::cout << "\n--- 3D Octree ---\n"; DistributedTree<3> tree(cfg.max_level); SphereOracle oracle(cfg); int steps = 0; - while(tree.refine(oracle)) { + while (tree.refine(oracle)) { tree.repartition(); size_t n = tree.global_size(); - if (mpi.rank == 0) std::cout << "Refine step " << ++steps << ": " << n << " leaves\n"; + if (mpi.rank == 0) + std::cout << "Refine step " << ++steps << ": " << n << " leaves\n"; } - if (mpi.rank == 0) std::cout << "Balancing...\n"; + if (mpi.rank == 0) + std::cout << "Balancing...\n"; tree.repartition(); auto start = std::chrono::high_resolution_clock::now(); tree.balance(); auto end = std::chrono::high_resolution_clock::now(); if (mpi.rank == 0) { - std::cout << "Balanced in " - << std::chrono::duration_cast(end-start).count() + std::cout << "Balanced in " + << std::chrono::duration_cast(end - start).count() << "ms. Final size: " << tree.global_size() << "\n"; } - //viz::write_vtk(tree, "mesh_3d_rank_" + std::to_string(mpi.rank) + ".vtk"); + // viz::write_vtk(tree, "mesh_3d_rank_" + std::to_string(mpi.rank) + ".vtk"); } return 0; -} \ No newline at end of file +} From ac8a95fd32d45033ef16be09d07ec35a0e22a245 Mon Sep 17 00:00:00 2001 From: nikbott Date: Tue, 7 Jul 2026 09:32:24 -0300 Subject: [PATCH 2/2] refactor(mpi): drop commented-out write_vtk call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dead commented-out code flagged by CodeQL (cpp/commented-out-code) — the one open code-scanning alert. Viz remains available via mpi/viz.hpp when wanted. Co-Authored-By: Claude Opus 4.8 --- mpi/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/mpi/main.cpp b/mpi/main.cpp index dad6ed2..2753d24 100644 --- a/mpi/main.cpp +++ b/mpi/main.cpp @@ -74,7 +74,6 @@ int main(int argc, char** argv) { << std::chrono::duration_cast(end - start).count() << "ms. Final size: " << tree.global_size() << "\n"; } - // viz::write_vtk(tree, "mesh_3d_rank_" + std::to_string(mpi.rank) + ".vtk"); } return 0; }