From 5e729e6e02e0101953bc9e3f58fd1877f6ab3f18 Mon Sep 17 00:00:00 2001
From: Axelle <axelle.drouard@orange.fr>
Date: Thu, 14 Nov 2024 16:52:04 +0100
Subject: [PATCH] Synchronize for MPI

---
 src/scheme/EulerKineticSolver2D.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/scheme/EulerKineticSolver2D.cpp b/src/scheme/EulerKineticSolver2D.cpp
index 470663f98..f2130599b 100644
--- a/src/scheme/EulerKineticSolver2D.cpp
+++ b/src/scheme/EulerKineticSolver2D.cpp
@@ -8,12 +8,15 @@
 #include <mesh/MeshFlatNodeBoundary.hpp>
 #include <mesh/MeshNodeBoundary.hpp>
 #include <mesh/MeshVariant.hpp>
+#include <scheme/DiscreteFunctionDPkVariant.hpp>
 #include <scheme/DiscreteFunctionDescriptorP0Vector.hpp>
 #include <scheme/DiscreteFunctionP0Vector.hpp>
 #include <scheme/DiscreteFunctionUtils.hpp>
 #include <scheme/IBoundaryConditionDescriptor.hpp>
 #include <scheme/IDiscreteFunctionDescriptor.hpp>
 #include <scheme/InflowListBoundaryConditionDescriptor.hpp>
+#include <scheme/PolynomialReconstruction.hpp>
+#include <scheme/PolynomialReconstructionDescriptor.hpp>
 #include <scheme/SymmetryBoundaryConditionDescriptor.hpp>
 
 #include <analysis/GaussLegendreQuadratureDescriptor.hpp>
@@ -827,6 +830,21 @@ class EulerKineticSolver2D
     const DiscreteFunctionP0<const double> rho_u2 = compute_PFn(Fn_rho_u2);
     const DiscreteFunctionP0<const double> rho_E  = compute_PFn(Fn_rho_E);
 
+    std::vector<std::shared_ptr<const IBoundaryDescriptor>> symmetry_boundary_descriptor_list;
+    // Reconstruction uniquement à l'intérieur
+    // for (auto&& bc_descriptor : bc_descriptor_list) {
+    //   if (bc_descriptor->type() == IBoundaryConditionDescriptor::Type::symmetry) {
+    //     symmetry_boundary_descriptor_list.push_back(bc_descriptor->boundaryDescriptor_shared());
+    //   }
+    // }
+
+    PolynomialReconstructionDescriptor reconstruction_descriptor(IntegrationMethodType::cell_center, 1,
+                                                                 symmetry_boundary_descriptor_list);
+
+    auto reconstruction =
+      PolynomialReconstruction{reconstruction_descriptor}.build(Fn_rho, Fn_rho_u1, Fn_rho_u2, Fn_rho_E);
+    auto DPk_Fn_rho = reconstruction[0]->get<DiscreteFunctionDPkVector<Dimension, const double>>();
+
     // NodeArray<double> Fr_rho    = compute_Flux1(Fn_rho);
     // NodeArray<double> Fr_rho_u1 = compute_Flux1(Fn_rho_u1);
     // NodeArray<double> Fr_rho_u2 = compute_Flux1(Fn_rho_u2);
@@ -844,6 +862,11 @@ class EulerKineticSolver2D
 
     apply_scalar_bc(Fr_rho, Fr_rho_u1, Fr_rho_u2, Fr_rho_E, rho, rho_u1, rho_u2, rho_E, bc_list);
 
+    synchronize(Fr_rho);
+    synchronize(Fr_rho_u1);
+    synchronize(Fr_rho_u2);
+    synchronize(Fr_rho_E);
+
     // DiscreteFunctionP0Vector<double> deltaLFn_rho    = compute_deltaLFn(Fr_rho);
     // DiscreteFunctionP0Vector<double> deltaLFn_rho_u1 = compute_deltaLFn(Fr_rho_u1);
     // DiscreteFunctionP0Vector<double> deltaLFn_rho_u2 = compute_deltaLFn(Fr_rho_u2);
-- 
GitLab