From 00d7c663924dd586c0a607dcabf7edd96954d18b Mon Sep 17 00:00:00 2001
From: Yaroslav <beorn.90@gmail.com>
Date: Mon, 9 Jan 2017 14:54:36 +0100
Subject: [PATCH] checkpoint restart working

---
 src/Grid/grid_dist_id.hpp                     | 17 -------
 ...grid_dist_id_HDF5_chckpnt_restart_test.hpp | 48 ++++---------------
 src/Grid/grid_dist_id_comm.hpp                | 22 ---------
 3 files changed, 9 insertions(+), 78 deletions(-)

diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp
index 8d4501c86..e2147bd3e 100644
--- a/src/Grid/grid_dist_id.hpp
+++ b/src/Grid/grid_dist_id.hpp
@@ -1729,23 +1729,6 @@ public:
 		this->template map_(dec,cd_sm,loc_grid,loc_grid_old,gdb_ext,gdb_ext_old,gdb_ext_global);
 	}
 
-	void gdb_ext_info()
-	{
-		for (size_t i = 0; i < gdb_ext.size(); i++)
-		{
-			Box<dim,long int> box = gdb_ext.get(i).Dbox;
-			box += gdb_ext.get(i).origin;
-			std::cout << "(" << box.getLow(0) << "; " << box.getLow(1) << "); (" << box.getHigh(0) << "; " << box.getHigh(1) << ")" << std::endl;
-		}
-		std::cout << "--------------" << std::endl;
-		for (size_t i = 0; i < dec.getNSubDomain(); i++)
-		{
-			std::cout << "(" << dec.getSubDomain(i).getLow(0) << "; " << dec.getSubDomain(i).getLow(1) << "); (" << dec.getSubDomain(i).getHigh(0) << "; " << dec.getSubDomain(i).getHigh(1) << ")" << std::endl;
-		}
-		std::cout << "******************" << std::endl;
-	}
-
-
 	inline void save(const std::string & filename) const
 	{
 		std::cout << "Loc_grid.size() before save: " << loc_grid.size() << std::endl;
diff --git a/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp b/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
index 14e7ee7ae..2bf3fda54 100644
--- a/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
+++ b/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
@@ -16,12 +16,12 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_save_test )
 {
 
 	// Input data
-	size_t k = 10;
+	size_t k = 1000;
 
 	float ghost_part = 0.0;
 
 	// Domain
-	Box<2,float> domain({0.0,0.0},{1.0,1.0});
+	Box<2,float> domain({-1.0,-1.0},{1.0,1.0});
 
 	Vcluster & v_cl = create_vcluster();
 
@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_save_test )
 	Ghost<2,float> g(ghost_part);
 
 	// Distributed grid with id decomposition
-	grid_dist_id<2, float, scalar<float>, CartDecomposition<2,float>> g_dist(sz,domain,g);
+	grid_dist_id<2, float, scalar<float[2]>, CartDecomposition<2,float>> g_dist(sz,domain,g);
 
 	// get the decomposition
 	auto & dec = g_dist.getDecomposition();
@@ -61,7 +61,8 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_save_test )
 
 		auto keyg = g_dist.getGKey(key);
 
-		g_dist.template get<0>(key) = keyg.get(0);
+		g_dist.template get<0>(key)[0] = keyg.get(0);
+		g_dist.template get<0>(key)[1] = keyg.get(1);
 
 		++it;
 		count++;
@@ -93,7 +94,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 {
 
 	// Input data
-	size_t k = 10;
+	size_t k = 1000;
 
 	float ghost_part = 0.0;
 
@@ -118,7 +119,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 	Ghost<2,float> g(ghost_part);
 
 	// Distributed grid with id decomposition
-	grid_dist_id<2, float, scalar<float>, CartDecomposition<2,float>> g_dist(sz,domain,g);
+	grid_dist_id<2, float, scalar<float[2]>, CartDecomposition<2,float>> g_dist(sz,domain,g);
 
 	g_dist.getDecomposition().write("Before_load_grid_decomposition");
 	g_dist.write("Before_Loaded_grid");
@@ -148,7 +149,8 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 
 		auto keyg = g_dist.getGKey(key);
 
-		BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key), keyg.get(0));
+		BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key)[0], keyg.get(0));
+		BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key)[1], keyg.get(1));
 
 		++it;
 		count++;
@@ -168,38 +170,6 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 	BOOST_REQUIRE_EQUAL(sum, (size_t)k*k);
 }
 
-BOOST_AUTO_TEST_CASE( grid_gdb_test )
-{
-	// Input data
-	size_t k = 10;
-
-	float ghost_part = 0.2;
-
-	// Domain
-	Box<2,float> domain({0.0,0.0},{1.0,1.0});
-
-	Vcluster & v_cl = create_vcluster();
-
-	// Skip this test on big scale
-	if (v_cl.getProcessingUnits() >= 32)
-		return;
-
-	if (v_cl.getProcessUnitID() == 0)
-			std::cout << "Testing gdb_ext grid info..." << std::endl;
-
-	// grid size
-	size_t sz[2];
-	sz[0] = k;
-	sz[1] = k;
-
-	// Ghost
-	Ghost<2,float> g(ghost_part);
-
-	// Distributed grid with id decomposition
-	grid_dist_id<2, float, scalar<float>, CartDecomposition<2,float>> g_dist(sz,domain,g);
-
-	g_dist.gdb_ext_info();
-}
 
 BOOST_AUTO_TEST_SUITE_END()
 
diff --git a/src/Grid/grid_dist_id_comm.hpp b/src/Grid/grid_dist_id_comm.hpp
index b6b3f6578..d1863a87e 100644
--- a/src/Grid/grid_dist_id_comm.hpp
+++ b/src/Grid/grid_dist_id_comm.hpp
@@ -124,13 +124,6 @@ public:
 							loc_grid.get(j).get_o(key) = g.get_o(key2);
 							count2++;
 
-							////////// DEBUG ///////////////
-							if (g.template get<0>(key2) != 1)
-							{
-								//std::cout << "WRONG ZZZZ" << std::endl;
-								//std::cout << "Start: " << start2 << "; Stop: " << stop2 << "; G size: (" << p.get(0) << "; " << p.get(1) << "); Key: " << str << std::endl;
-
-							}
 							++it;
 						}
 					}
@@ -308,21 +301,6 @@ public:
 
 					// Add to the labeling vector
 					lbl_b.get(p_id).add(aggr);
-
-					auto it2 = gr_send.getIterator();
-
-					while (it2.isNext())
-					{
-						auto key3 = it2.get();
-
-						if (gr_send.template get<0>(key3) != 1)
-						{
-							//std::string str = key3.to_string();
-							//std::cout << "Wrong!" << std::endl;
-							//std::cout << "Start: " << start2 << "; Stop: " << stop2 << "; Grid send size: (" << p2.get(0) << "; " << p2.get(1) << "); " << "Key: " << str << std::endl;
-						}
-						++it2;
-					}
 				}
 			}
 		}
-- 
GitLab