Commit af336a3c authored by incardon's avatar incardon

Fixing recalculation of ShiftBox in case of periodic boundary condition for vector_dist

parent 406f3750
...@@ -853,7 +853,7 @@ public: ...@@ -853,7 +853,7 @@ public:
for (size_t i = 0 ; i < dim ; i++) for (size_t i = 0 ; i < dim ; i++)
{ {
if (bc[i] == PERIODIC) if (bc[i] == PERIODIC)
pt[i] = openfpm::math::periodic_l(pt[i],domain.getHigh(i),domain.getLow(i)); {pt[i] = openfpm::math::periodic_l(pt[i],domain.getHigh(i),domain.getLow(i));}
} }
} }
...@@ -871,7 +871,7 @@ public: ...@@ -871,7 +871,7 @@ public:
for (size_t i = 0 ; i < dim ; i++) for (size_t i = 0 ; i < dim ; i++)
{ {
if (bc[i] == PERIODIC) if (bc[i] == PERIODIC)
pt.get(i) = openfpm::math::periodic_l(pt.get(i),domain.getHigh(i),domain.getLow(i)); {pt.get(i) = openfpm::math::periodic_l(pt.get(i),domain.getHigh(i),domain.getLow(i));}
} }
} }
...@@ -889,7 +889,7 @@ public: ...@@ -889,7 +889,7 @@ public:
for (size_t i = 0 ; i < dim ; i++) for (size_t i = 0 ; i < dim ; i++)
{ {
if (bc[i] == PERIODIC) if (bc[i] == PERIODIC)
pt.template get<0>()[i] = openfpm::math::periodic_l(pt.template get<0>()[i],domain.getHigh(i),domain.getLow(i)); {pt.template get<0>()[i] = openfpm::math::periodic_l(pt.template get<0>()[i],domain.getHigh(i),domain.getLow(i));}
} }
} }
......
...@@ -839,7 +839,7 @@ public: ...@@ -839,7 +839,7 @@ public:
{ {
size_t bid = cell_it.get(); size_t bid = cell_it.get();
if (vb_int.get(bid).box.isInside(p) == true) if (vb_int.get(bid).box.isInsideNP(p) == true)
{ {
ids.add(id::id(vb_int.get(bid),bid)); ids.add(id::id(vb_int.get(bid),bid));
} }
...@@ -883,7 +883,7 @@ public: ...@@ -883,7 +883,7 @@ public:
{ {
size_t bid = cell_it.get(); size_t bid = cell_it.get();
if (vb_int.get(bid).box.isInside(p) == true) if (vb_int.get(bid).box.isInsideNP(p) == true)
{ {
ids_p.add(std::pair<size_t,size_t>(id1::id(vb_int.get(bid),bid),id2::id(vb_int.get(bid),bid))); ids_p.add(std::pair<size_t,size_t>(id1::id(vb_int.get(bid),bid),id2::id(vb_int.get(bid),bid)));
} }
...@@ -926,7 +926,7 @@ public: ...@@ -926,7 +926,7 @@ public:
{ {
size_t bid = cell_it.get(); size_t bid = cell_it.get();
if (vb_int.get(bid).box.isInside(p) == true) if (vb_int.get(bid).box.isInsideNP(p) == true)
{ {
ids.add(id::id(vb_int.get(bid),bid)); ids.add(id::id(vb_int.get(bid),bid));
} }
......
...@@ -252,12 +252,6 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi ...@@ -252,12 +252,6 @@ class grid_dist_id_iterator_dec_skin : protected grid_skin_iterator_bc<Decomposi
// shift // shift
k_glob = k_glob + gdb_ext.get(sub_id).origin; k_glob = k_glob + gdb_ext.get(sub_id).origin;
if (k_glob.get(0) > 11)
{
int debug = 0;
debug++;
}
return k_glob; return k_glob;
} }
......
...@@ -204,8 +204,8 @@ class vector_dist_comm ...@@ -204,8 +204,8 @@ class vector_dist_comm
return end_id; return end_id;
} }
//! Flags that indicate that the function createShiftBox() has been called //! From which decomposition the shift boxes are calculated
bool is_shift_box_created = false; long int shift_box_ndec = -1;
//! this map is used to check if a combination is already present //! this map is used to check if a combination is already present
std::unordered_map<size_t, size_t> map_cmb; std::unordered_map<size_t, size_t> map_cmb;
...@@ -226,11 +226,11 @@ class vector_dist_comm ...@@ -226,11 +226,11 @@ class vector_dist_comm
*/ */
void createShiftBox() void createShiftBox()
{ {
if (is_shift_box_created == true) if (shift_box_ndec == (long int)dec.get_ndec())
return; return;
// Add local particles coming from periodic boundary, the only boxes that count are the one // Add local particles coming from periodic boundary, the only boxes that count are the one
// touching the border, filter them // touching the border
for (size_t i = 0; i < dec.getNLocalSub(); i++) for (size_t i = 0; i < dec.getNLocalSub(); i++)
{ {
size_t Nl = dec.getLocalNIGhost(i); size_t Nl = dec.getLocalNIGhost(i);
...@@ -261,7 +261,7 @@ class vector_dist_comm ...@@ -261,7 +261,7 @@ class vector_dist_comm
} }
} }
is_shift_box_created = true; shift_box_ndec = dec.get_ndec();
} }
/*! \brief Local ghost from labeled particles /*! \brief Local ghost from labeled particles
...@@ -333,7 +333,7 @@ class vector_dist_comm ...@@ -333,7 +333,7 @@ class vector_dist_comm
{ {
for (size_t j = 0; j < box_f.get(i).size(); j++) for (size_t j = 0; j < box_f.get(i).size(); j++)
{ {
if (box_f.get(i).get(j).isInside(v_pos.get(key)) == true) if (box_f.get(i).get(j).isInsideNP(v_pos.get(key)) == true)
{ {
size_t lin_id = dec.convertShift(box_cmb.get(i)); size_t lin_id = dec.convertShift(box_cmb.get(i));
......
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