Commit 050d72a3 authored by incardon's avatar incardon

Fixing multiphase

parent 4f8545ff
openfpm_data @ faeef943
Subproject commit 8deb38dbbfc01236406144fdb68b04f08231f66f
Subproject commit faeef943191e3ffbf6607c7f7c2b04eaa702dcb9
openfpm_numerics @ dd445d74
Subproject commit 2a805e31cd0bc1e5fe89c8f6a03ba22b1691ad2d
Subproject commit dd445d74febaa67c37256178662b205733521031
......@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_test )
auto CL_all = createCellListM<2>(phases,r_cut);
// This create a Verlet-list between phase 0 and all the other phases
auto NNver0_all = createVerletM<2>(phases.get(0),phases,CL_all,r_cut);
auto NNver0_all = createVerletM<2>(0,phases.get(0),phases,CL_all,r_cut);
it = phases.get(0).getDomainIterator();
......@@ -227,6 +227,24 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
for (size_t i = 0 ; i < 4 ; i++)
{
phases.get(i).map();
}
// randomize a little the particles
for (size_t p = 0 ; p < phases.size() ; p++)
{
openfpm::vector<Point<3,float>> vt;
for (size_t j = 0 ; j < phases.get(p).size_local() ; j++)
{
vt.add(phases.get(p).getPos((j + p*133) % phases.get(p).size_local()));
}
phases.get(p).getPosVector().swap(vt);
}
// Sync all phases
for (size_t i = 0 ; i < 4 ; i++)
{
phases.get(i).ghost_get<>();
}
......@@ -305,15 +323,15 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
// This function create an "Empty" Multiphase Cell List
auto CL_all = createCellListSymM<2>(phases,r_cut);
typedef decltype(createVerletSymM<2>(phases.get(0),phases,CL_all,r_cut)) verlet_type;
typedef decltype(createVerletSymM<2>(0,phases.get(0),phases,CL_all,r_cut)) verlet_type;
verlet_type NNver_all[4];
// This create a Verlet-list between phase all phases to all the other phases
NNver_all[0] = createVerletSymM<2>(phases.get(0),phases,CL_all,r_cut);
NNver_all[1] = createVerletSymM<2>(phases.get(1),phases,CL_all,r_cut);
NNver_all[2] = createVerletSymM<2>(phases.get(2),phases,CL_all,r_cut);
NNver_all[3] = createVerletSymM<2>(phases.get(3),phases,CL_all,r_cut);
NNver_all[0] = createVerletSymM<2>(0,phases.get(0),phases,CL_all,r_cut);
NNver_all[1] = createVerletSymM<2>(1,phases.get(1),phases,CL_all,r_cut);
NNver_all[2] = createVerletSymM<2>(2,phases.get(2),phases,CL_all,r_cut);
NNver_all[3] = createVerletSymM<2>(3,phases.get(3),phases,CL_all,r_cut);
// all phases to all phases
......@@ -360,6 +378,14 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
ret &= phases.get(2).getProp<0>(p) == 32;
ret &= phases.get(3).getProp<0>(p) == 32;
if (ret == false)
{
std::cout << phases.get(0).getProp<0>(p) << std::endl;
std::cout << phases.get(1).getProp<0>(p) << std::endl;
std::cout << phases.get(2).getProp<0>(p) << std::endl;
std::cout << phases.get(3).getProp<0>(p) << std::endl;
}
++it;
}
......
......@@ -20,7 +20,7 @@ template<typename Vector, typename CL, typename T> VerletList<Vector::dims,typen
return ver;
}
template<unsigned int sh_byte, typename Vector , typename Vector1,typename CL, typename T> VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> createVerletM(Vector & v, Vector1 & phases, CL & cl, T r_cut)
template<unsigned int sh_byte, typename Vector , typename Vector1,typename CL, typename T> VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> createVerletM(size_t pp, Vector & v, Vector1 & phases, CL & cl, T r_cut)
{
VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> ver;
......@@ -29,7 +29,7 @@ template<unsigned int sh_byte, typename Vector , typename Vector1,typename CL, t
for (size_t i = 0 ; i < phases.size() ; i++)
v_phases.add(pos_v<Vector::dims,typename Vector::stype>(phases.get(i).getPosVector()));
ver.Initialize(cl,r_cut,v.getPosVector(),v_phases,v.size_local());
ver.Initialize(cl,pp,r_cut,v.getPosVector(),v_phases,v.size_local());
return ver;
}
......@@ -79,7 +79,7 @@ template<typename Vector,typename CL, typename T> VerletList<Vector::dims,typena
return ver;
}
template<unsigned int sh_byte, typename Vector, typename Vector1 ,typename CL, typename T> VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> createVerletSymM(Vector & v, Vector1 & phases, CL & cl, T r_cut)
template<unsigned int sh_byte, typename Vector, typename Vector1 ,typename CL, typename T> VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> createVerletSymM(size_t pp, Vector & v, Vector1 & phases, CL & cl, T r_cut)
{
VerletListM<Vector::dims,typename Vector::stype,sh_byte,CL,shift<Vector::dims,typename Vector::stype>> ver;
......@@ -88,7 +88,7 @@ template<unsigned int sh_byte, typename Vector, typename Vector1 ,typename CL, t
for (size_t i = 0 ; i < phases.size() ; i++)
v_phases.add(pos_v<Vector::dims,typename Vector::stype>(phases.get(i).getPosVector()));
ver.Initialize(cl,r_cut,v.getPosVector(),v_phases,v.size_local(),VL_SYMMETRIC);
ver.Initialize(cl,pp,r_cut,v.getPosVector(),v_phases,v.size_local(),VL_SYMMETRIC);
return ver;
}
......
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