From ee9eeaac5accae65bfa8363e1374fc54cd33cf9a Mon Sep 17 00:00:00 2001
From: Fanny CHOPOT <fanny.chopot.ocre@cea.fr>
Date: Thu, 26 Apr 2018 08:57:44 +0200
Subject: [PATCH] correction fonction updateVolumeCenter()

---
 src/mesh/MeshData.hpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp
index 480f72453..3e6b9eab7 100644
--- a/src/mesh/MeshData.hpp
+++ b/src/mesh/MeshData.hpp
@@ -72,12 +72,11 @@ private:
       });
   }
 
-  // Ajout fonction pour calculer h_i+1/2
   KOKKOS_INLINE_FUNCTION
   void _updateVolumeCenter()
   {
-    const Kokkos::View<const unsigned int**>& cell_nodes
-      = m_mesh.connectivity().cellNodes();
+    const Kokkos::View<const unsigned int**>& face_cells
+      = m_mesh.connectivity().faceCells();
 
     const Kokkos::View<const unsigned short*> face_nb_cells
       = m_mesh.connectivity().faceNbCells();
@@ -88,14 +87,16 @@ private:
     const Kokkos::View<const unsigned short*> cell_nb_faces
       = m_mesh.connectivity().cellNbFaces();
 
-    Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
+    const Kokkos::View<const Rd*> xr = m_mesh.xr();
+
+    Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l){
 	double sum_cjr_xj = 0;
-	for (int l=0; l<cell_nb_faces(j); ++l) {
-	  for (int R=0; R<face_nb_cells[l]; R++) {
-	   sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,face_cell_local_face(l,R)));
-	  }
+	for (int local_cell_number=0; local_cell_number<face_nb_cells(l); ++local_cell_number) { 
+	  int j  = face_cells(l,local_cell_number);
+	  int local_face_number_in_cell = face_cell_local_face(l,local_cell_number);
+	  sum_cjr_xj -= (m_xj[j]-xr(l), m_Cjr(j, local_face_number_in_cell));
 	}
-	m_Vl[j] = inv_dimension * sum_cjr_xj;
+	m_Vl[l] =  sum_cjr_xj; 
       });
   }
 
@@ -151,7 +152,7 @@ public:
       m_Cjr("Cjr", mesh.numberOfCells(), mesh.connectivity().maxNbNodePerCell()),
       m_xj("xj", mesh.numberOfCells()),
       m_Vj("Vj", mesh.numberOfCells()),
-      m_Vl("Vl", mesh.numberOfCells())
+      m_Vl("Vl", mesh.numberOfFaces())
   {
     if (dimension==1) {
       // in 1d Cjr are computed once for all
-- 
GitLab