Commit 772908fe authored by incardon's avatar incardon

Fixing skin iterator

parent f9e665a2
......@@ -101,7 +101,7 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
// and calculate the grid sizes
size_t sz[Decomposition::dims];
for (size_t j = 0 ; j < Decomposition::dims ; j++)
sz[j] = gdb_ext.get(gc).GDbox.getHigh(j) + 1;
{sz[j] = gdb_ext.get(gc).GDbox.getHigh(j) + 1;}
grid_sm<Decomposition::dims,void> g_sm(sz);
......@@ -112,15 +112,6 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
}
}
/*! \brief Get the actual key
*
* \return the actual key
*
*/
inline grid_dist_key_dx<Decomposition::dims> get_int()
{
return grid_dist_key_dx<Decomposition::dims>(g_c,a_it.get());
}
public:
......@@ -216,8 +207,8 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
{
// If there are no other grid stop
if (g_c >= gdb_ext.size())
return false;
if (a_its_p >= a_its.size())
{return false;}
return true;
}
......@@ -255,6 +246,16 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
return k_glob;
}
/*! \brief Get the actual key
*
* \return the actual key
*
*/
inline grid_dist_key_dx<Decomposition::dims> get_int()
{
return grid_dist_key_dx<Decomposition::dims>(g_c,a_it.get());
}
/*! \brief Copy operator=
*
* \param tmp iterator to copy
......
......@@ -22,6 +22,9 @@
*/
template<typename Decomposition> static inline bool compute_subset(const openfpm::vector<GBoxes<Decomposition::dims>> & gdb_ext, size_t g_c, grid_key_dx<Decomposition::dims> & start, grid_key_dx<Decomposition::dims> & stop, grid_key_dx<Decomposition::dims> & start_c, grid_key_dx<Decomposition::dims> & stop_c)
{
if (gdb_ext.get(g_c).Dbox.isValid() == false)
{return false;}
// Intersect the grid keys
for (size_t i = 0 ; i < Decomposition::dims ; i++)
......@@ -29,18 +32,18 @@ template<typename Decomposition> static inline bool compute_subset(const openfpm
long int start_p = gdb_ext.get(g_c).Dbox.getP1().get(i) + gdb_ext.get(g_c).origin.get(i);
long int stop_p = gdb_ext.get(g_c).Dbox.getP2().get(i) + gdb_ext.get(g_c).origin.get(i);
if (start.get(i) <= start_p)
start_c.set_d(i,gdb_ext.get(g_c).Dbox.getP1().get(i));
{start_c.set_d(i,gdb_ext.get(g_c).Dbox.getP1().get(i));}
else if (start.get(i) <= stop_p)
start_c.set_d(i,start.get(i) - gdb_ext.get(g_c).origin.get(i));
{start_c.set_d(i,start.get(i) - gdb_ext.get(g_c).origin.get(i));}
else
return false;
{return false;}
if (stop.get(i) >= stop_p)
stop_c.set_d(i,gdb_ext.get(g_c).Dbox.getP2().get(i));
{stop_c.set_d(i,gdb_ext.get(g_c).Dbox.getP2().get(i));}
else if (stop.get(i) >= start_p)
stop_c.set_d(i,stop.get(i) - gdb_ext.get(g_c).origin.get(i));
{stop_c.set_d(i,stop.get(i) - gdb_ext.get(g_c).origin.get(i));}
else
return false;
{return false;}
}
return true;
......
......@@ -481,7 +481,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
Vcluster<> & v_cl = create_vcluster();
if ( v_cl.getProcessingUnits() > 32 )
return;
{return;}
long int big_step = k / 30;
big_step = (big_step == 0)?1:big_step;
......@@ -501,7 +501,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
sz[2] = k;
if (k <= 9)
continue;
{continue;}
// factor
float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
......@@ -510,7 +510,21 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
Ghost<3,float> g(0.01 / factor);
// Distributed grid with id decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> g_dist(sz,domain,g);
grid_dist_id<3, float, aggregate<float>, CartDecomposition<3,float>> g_dist(sz,domain,g);
// Set all the grid to zero
auto it = g_dist.getDomainIterator();
while (it.isNext())
{
auto p = it.get();
auto gp = it.getGKey(p);
g_dist.template get<0>(p) = 0.0;
++it;
}
// check the consistency of the decomposition
bool val = g_dist.getDecomposition().check_consistency();
......@@ -536,6 +550,7 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
while (it_dec.isNext())
{
auto key_dec = it_dec.get();
auto key_dec_loc = it_dec.get_int();
// one of the coordinate has to be or 3 or 8, none of
// None of the coordinates must be bigger that
......@@ -545,12 +560,14 @@ void Test3D_decskinit(const Box<3,float> & domain, long int k)
for (size_t i = 0; i < 3 ; i++)
{
if (key_dec.get(i) == 3 || key_dec.get(i) == k - 3)
eight_or_three = true;
{eight_or_three = true;}
if (key_dec.get(i) > k - 3 || key_dec.get(i) < 3 )
good = false;
{good = false;}
}
g_dist.template get<0>(key_dec_loc) = 1.0;
tot_good &= (eight_or_three) || good;
cnt++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment