Skip to content
Snippets Groups Projects
Commit 0985040d authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Ghost get and put example + small fixes for NO_POSITION

parent d24117db
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* *
* \subpage Vector_0_simple * \subpage Vector_0_simple
* \subpage Vector_1_celllist * \subpage Vector_1_celllist
* \subpage Vector_1_ghost_get
* \subpage Vector_2_expression * \subpage Vector_2_expression
* \subpage Vector_3_md * \subpage Vector_3_md
* \subpage Vector_4_reo_root * \subpage Vector_4_reo_root
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
* </div> * </div>
* \endhtmlonly * \endhtmlonly
* *
* ## inclusion ## {#inclusion} * ## inclusion ## {#e0_v_inclusion}
* *
* In order to use distributed vectors in our code we have to include the file Vector/vector_dist.hpp * In order to use distributed vectors in our code we have to include the file Vector/vector_dist.hpp
* *
...@@ -62,7 +63,7 @@ int main(int argc, char* argv[]) ...@@ -62,7 +63,7 @@ int main(int argc, char* argv[])
* Here we * Here we
* * Initialize the library * * Initialize the library
* * we create a Box that define our domain * * we create a Box that define our domain
* * An array that define out boundary conditions * * An array that define our boundary conditions
* * A Ghost object that will define the extension of the ghost part in physical units * * A Ghost object that will define the extension of the ghost part in physical units
* *
* *
......
...@@ -173,6 +173,9 @@ int main(int argc, char* argv[]) ...@@ -173,6 +173,9 @@ int main(int argc, char* argv[])
* no properties. If we want to synchronize also properties we have to specify which one. * no properties. If we want to synchronize also properties we have to specify which one.
* For example with <0,1,2> here we synchronize the scalar property (0), the vector (1), and the rank 2 tensor (2) * For example with <0,1,2> here we synchronize the scalar property (0), the vector (1), and the rank 2 tensor (2)
* *
* \warning Every ghost_get by default reset the status of the ghost so the information are lost
*
* \see \ref e1_gg_options
* *
* \htmlonly * \htmlonly
* <a href="#" onclick="hide_show('vector-video-5')" >Video 1</a> * <a href="#" onclick="hide_show('vector-video-5')" >Video 1</a>
......
...@@ -366,12 +366,9 @@ class vector_dist_comm ...@@ -366,12 +366,9 @@ class vector_dist_comm
// Create the shift boxes // Create the shift boxes
createShiftBox(); createShiftBox();
if (opt != SKIP_LABELLING) if (!(opt & SKIP_LABELLING))
lg_m = v_prp.size(); lg_m = v_prp.size();
// v_pos.resize(lg_m);
// v_prp.resize(lg_m);
if (box_f.size() == 0) if (box_f.size() == 0)
return; return;
else else
...@@ -822,10 +819,11 @@ public: ...@@ -822,10 +819,11 @@ public:
// send vector for each processor // send vector for each processor
typedef openfpm::vector<prp_object> send_vector; typedef openfpm::vector<prp_object> send_vector;
v_pos.resize(g_m); if (!(opt & NO_POSITION))
v_pos.resize(g_m);
// reset the ghost part // reset the ghost part
if (opt != SKIP_LABELLING) if (!(opt & SKIP_LABELLING))
{ {
v_prp.resize(g_m); v_prp.resize(g_m);
} }
...@@ -839,22 +837,21 @@ public: ...@@ -839,22 +837,21 @@ public:
fill_send_ghost_prp_buf<send_vector, prp_object, prp...>(v_prp,g_send_prp); fill_send_ghost_prp_buf<send_vector, prp_object, prp...>(v_prp,g_send_prp);
// Create and fill the send buffer for the particle position // Create and fill the send buffer for the particle position
if (opt != NO_POSITION) if (!(opt & NO_POSITION))
fill_send_ghost_pos_buf(v_pos,g_pos_send); fill_send_ghost_pos_buf(v_pos,g_pos_send);
prc_recv_get.clear(); prc_recv_get.clear();
recv_sz_get.clear(); recv_sz_get.clear();
if (opt == SKIP_LABELLING) if (opt & SKIP_LABELLING)
{ {
op_ssend_gg_recv_merge opm(g_m); op_ssend_gg_recv_merge opm(g_m);
// v_cl.SSendRecvP_op<op_ssend_recv_merge<op>
v_cl.SSendRecvP_op<op_ssend_gg_recv_merge,send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,opm,prc_recv_get,recv_sz_get); v_cl.SSendRecvP_op<op_ssend_gg_recv_merge,send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,opm,prc_recv_get,recv_sz_get);
} }
else else
v_cl.SSendRecvP<send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,prc_recv_get,recv_sz_get); v_cl.SSendRecvP<send_vector,decltype(v_prp),prp...>(g_send_prp,v_prp,prc_g_opart,prc_recv_get,recv_sz_get);
if (opt != NO_POSITION) if (!(opt & NO_POSITION))
{ {
prc_recv_get.clear(); prc_recv_get.clear();
recv_sz_get.clear(); recv_sz_get.clear();
...@@ -1071,7 +1068,7 @@ public: ...@@ -1071,7 +1068,7 @@ public:
if (v_prp.size() - lg_m != o_part_loc.size()) if (v_prp.size() - lg_m != o_part_loc.size())
{ {
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " Local ghost particles = " << v_prp.size() - lg_m << " != " << o_part_loc.size() << std::endl; std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " Local ghost particles = " << v_prp.size() - lg_m << " != " << o_part_loc.size() << std::endl;
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << "Check that you did a ghost_get before a ghost_put" << std::endl; std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " Check that you did a ghost_get before a ghost_put" << std::endl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment