From 7e829dee3f4c0be0d838e5b50b828433a73798d5 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@localhost.localdomain> Date: Tue, 9 Aug 2016 14:51:45 +0200 Subject: [PATCH] enforcing the test of grid --- src/Grid/grid_dist_id.hpp | 2 +- src/Grid/grid_dist_id_unit_test_unb_ghost.hpp | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp index 452fcc657..b531a8c60 100644 --- a/src/Grid/grid_dist_id.hpp +++ b/src/Grid/grid_dist_id.hpp @@ -301,7 +301,7 @@ class grid_dist_id if (init_local_i_g_box == true) return; - // Get the number of near processors + // Get the number of sub-domains for (size_t i = 0 ; i < dec.getNSubDomain() ; i++) { loc_ig_box.add(); diff --git a/src/Grid/grid_dist_id_unit_test_unb_ghost.hpp b/src/Grid/grid_dist_id_unit_test_unb_ghost.hpp index 89656d481..8875f5522 100644 --- a/src/Grid/grid_dist_id_unit_test_unb_ghost.hpp +++ b/src/Grid/grid_dist_id_unit_test_unb_ghost.hpp @@ -147,7 +147,7 @@ void Test3D_unb_ghost_periodic(const Box<3,float> & domain, long int k) sz[2] = k; // Ghost - Ghost<3,float> g(0.1); + Ghost<3,float> g(0.491); // periodicity periodicity<3> pr = {{PERIODIC,PERIODIC,PERIODIC}}; @@ -219,6 +219,9 @@ void Test3D_unb_ghost_periodic(const Box<3,float> & domain, long int k) auto key = dom_gi.get(); auto key_g = g_dist.getGKey(key); + // Return the boxes containing the grids + auto & gb = dom_gi.getGBoxes(); + // transform the key to be periodic for (size_t i = 0 ; i < 3 ; i++) { @@ -231,8 +234,25 @@ void Test3D_unb_ghost_periodic(const Box<3,float> & domain, long int k) if (g_dist.template get<0>(key) != -1 && out_p == true) out_cnt++; - if ( g_dist.template get<0>(key) != -1 && info.LinId(key_g) != g_dist.template get<0>(key) ) - match &= false; + // The last points can be invalid because of rounding off problems + bool can_invalid = false; + if (key.getKey().get(0) == 0 || key.getKey().get(1) == 0 || key.getKey().get(2) == 0) + can_invalid = true; + else if (key.getKey().get(0) == gb.get(key.getSub()).GDbox.getHigh(0) || + key.getKey().get(1) == gb.get(key.getSub()).GDbox.getHigh(1) || + key.getKey().get(2) == gb.get(key.getSub()).GDbox.getHigh(2)) + can_invalid = true; + + if (can_invalid == true) + { + if ( g_dist.template get<0>(key) != -1 && info.LinId(key_g) != g_dist.template get<0>(key) ) + match &= false; + } + else + { + if (info.LinId(key_g) != g_dist.template get<0>(key) ) + match &= false; + } ++dom_gi; } -- GitLab