From 5490216bc084ded28a841751f617706d8fd49b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Thu, 7 Sep 2023 11:10:56 +0200 Subject: [PATCH] feat: print sums of input and output field --- naaice/BTCS_2D_NAAICE.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/naaice/BTCS_2D_NAAICE.cpp b/naaice/BTCS_2D_NAAICE.cpp index a3937b4..fe15455 100644 --- a/naaice/BTCS_2D_NAAICE.cpp +++ b/naaice/BTCS_2D_NAAICE.cpp @@ -112,6 +112,8 @@ int main(int argc, char *argv[]) { MatrixXd concentrations = rmVecTocmMatrix(init_values_vec, row, col); grid.setConcentrations(concentrations); + const double sum_init = concentrations.sum(); + // // (optional) set alphas of the grid, e.g.: const auto alphax_vec = CSVToVector(INPUT_ALPHAX_FILE); MatrixXd alphax = rmVecTocmMatrix(alphax_vec, row, col); @@ -154,4 +156,12 @@ int main(int argc, char *argv[]) { // // **** RUN SIMULATION **** simulation.run(); + + const double sum_after = grid.getConcentrations().sum(); + + std::cout << "Sum of init field: " << std::to_string(sum_init) + << "\nSum after iteration: " << std::to_string(sum_after) + << std::endl; + + return 0; }