Commit 72e81984 authored by incardon's avatar incardon
Browse files

Release with multiphase fixed

parents 528ec206 8ead4d8b
......@@ -153,7 +153,7 @@ int main(int argc, char* argv[])
auto CL_phase1 = phases.get(1).getCellList(r_cut);
// This function create a Verlet-list between phases 0 and 1
auto NN_ver01 = createVerlet(phases.get(0),CL_phase1,r_cut);
auto NN_ver01 = createVerlet(phases.get(0),phases.get(1),CL_phase1,r_cut);
//! \cond [create multi-phase verlet] \endcond
......@@ -236,7 +236,7 @@ int main(int argc, char* argv[])
auto CL_all = createCellListM<2>(phases,r_cut);
// This create a Verlet-list between phase0 and all the other phases
auto NNver0_all = createVerletM<2>(phases.get(0),CL_all,r_cut);
auto NNver0_all = createVerletM<2>(0,phases.get(0),phases,CL_all,r_cut);
//! \cond [create multi-phase multi verlet] \endcond
......@@ -419,7 +419,7 @@ int main(int argc, char* argv[])
CL_all = createCellListSymM<2>(phases,r_cut);
// Type of the multiphase Verlet-list
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;
// for each phase we create one Verlet-list that contain the neighborhood
// from all the phases
......@@ -428,16 +428,16 @@ int main(int argc, char* argv[])
// Here we create a Verlet-list between each phases
// 0 to all
NNver_all[0] = createVerletSymM<2>(phases.get(0),CL_all,r_cut);
NNver_all[0] = createVerletSymM<2>(0,phases.get(0),phases,CL_all,r_cut);
// 1 to all
NNver_all[1] = createVerletSymM<2>(phases.get(1),CL_all,r_cut);
NNver_all[1] = createVerletSymM<2>(1,phases.get(1),phases,CL_all,r_cut);
// 2 to all
NNver_all[2] = createVerletSymM<2>(phases.get(2),CL_all,r_cut);
NNver_all[2] = createVerletSymM<2>(2,phases.get(2),phases,CL_all,r_cut);
// 3 to all
NNver_all[3] = createVerletSymM<2>(phases.get(3),CL_all,r_cut);
NNver_all[3] = createVerletSymM<2>(3,phases.get(3),phases,CL_all,r_cut);
// For each phase
for (size_t i = 0 ; i < phases.size() ; i++)
......
openfpm_data @ bd8d455f
Subproject commit cdd40c06fc9e90f9cc0875d888436ee8a903179a
Subproject commit bd8d455f1545b29b8b3eca37d2c0d390dd311a54
openfpm_numerics @ bc9efd0e
Subproject commit 9e49bd9594b1b1c0d9cdd19e609aaba7a163d907
Subproject commit bc9efd0e62982ec86bd6d53e43fb4db1b041a82c
......@@ -1220,6 +1220,16 @@ public:
return v_pos;
}
/*! \brief return the position vector of all the particles
*
* \return the particle position vector
*
*/
openfpm::vector<Point<dim,St>> & getPosVector()
{
return v_pos;
}
/*! \brief It return the sum of the particles in the previous processors
*
* \return the particles number
......
......@@ -77,6 +77,24 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_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<>();
}
......@@ -128,7 +146,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 +245,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 +341,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 +396,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;
}
......
......@@ -7,6 +7,8 @@
#include "config.h"
#undef VERSION
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
......
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