From e43bafa5e59d7199ba7c24219d6d6dbfebe42332 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 18 Jul 2018 10:53:06 +0200
Subject: [PATCH] Add NodeByCellData::operator=

performs a shallow copy
---
 src/main.cpp                  | 1 -
 src/mesh/MeshData.hpp         | 8 ++------
 src/scheme/NodeByCellData.hpp | 2 ++
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 1a1d939cc..a2e5222d8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -197,7 +197,6 @@ int main(int argc, char *argv[])
           typedef TinyVector<MeshType::dimension> Rd;
 
           const Kokkos::View<const double*> Vj = mesh_data.Vj();
-          const NodeByCellData<Rd> Cjr = mesh_data.Cjr();
 
           const double tmax=0.2;
           double t=0;
diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp
index 79c8cbba1..56d98058c 100644
--- a/src/mesh/MeshData.hpp
+++ b/src/mesh/MeshData.hpp
@@ -214,12 +214,8 @@ public:
           m_Cjr(j,0)=-1;
           m_Cjr(j,1)= 1;
         });
-      // in 1d njr=Cjr
-#warning set equality between njr and Cjr
-      Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
-          m_njr(j,0)=-1;
-          m_njr(j,1)= 1;
-        });
+      // in 1d njr=Cjr (here performs a shallow copy)
+      m_njr=m_Cjr;
       Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
           m_ljr(j,0)= 1;
           m_ljr(j,1)= 1;
diff --git a/src/scheme/NodeByCellData.hpp b/src/scheme/NodeByCellData.hpp
index 723cd1f48..4659ec148 100644
--- a/src/scheme/NodeByCellData.hpp
+++ b/src/scheme/NodeByCellData.hpp
@@ -96,6 +96,8 @@ class NodeByCellData
     }
   };
 
+  NodeByCellData& operator=(const NodeByCellData&) = default;
+
   KOKKOS_INLINE_FUNCTION
   DataType& operator()(const size_t& j, const size_t& r)
   {
-- 
GitLab