Commit 318e7496 authored by incardon's avatar incardon

Fixing running test with SE_CLASS3

parent 63e26b66
openfpm_numerics @ 4cbdaaa7
Subproject commit 9a13102746a2160146c84318e54832c4d1c8e30e
Subproject commit 4cbdaaa7e37d236b598c130187170559d07d94c3
......@@ -117,7 +117,7 @@ public:
if (extends< typename boost::mpl::at<typename T::type,boost::mpl::int_<p> >::type >::mul() != cmb.size())
std::cerr << __FILE__ << ":" << __LINE__ << " error properties has " << extends< typename boost::mpl::at<typename T::type,boost::mpl::int_<p> >::type >::mul() << " components, but " << cmb.size() << "has been defined \n";
#endif
c_prp.get(p) = cmb;
c_prp[p] = cmb;
}
/*! \brief It set all the properties defined to be staggered on the default location
......
This diff is collapsed.
......@@ -558,7 +558,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_class3_check_nan_inf )
{
try
{
auto it = vd.getDomainIterator();
vd.getPosRead(0);
}
catch (std::exception & e)
{
......@@ -585,7 +585,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_class3_check_nan_inf )
{
try
{
auto it = vd2.getDomainIterator();
vd2.getLastPosRead();
}
catch (std::exception & e)
{
......
......@@ -743,6 +743,8 @@ public:
#endif
}
#ifndef ONLY_READWRITE_GETTER
/*! \brief Get the position of the last element
*
* \return the position of the element in space
......@@ -765,6 +767,8 @@ public:
return v_prp.template get<id>(g_m - 1);
}
#endif
////////////////////////////// READ AND WRITE VERSION //////////
/*! \brief Get the position of the last element
......@@ -775,7 +779,7 @@ public:
inline auto getLastPosRead() -> decltype(v_pos.template get<0>(0))
{
#ifdef SE_CLASS3
se3.read<prop::max_prop_real>(*this,g_m-1);
se3.template read<prop::max_prop_real>(*this,g_m-1);
#endif
return v_pos.template get<0>(g_m - 1);
......@@ -806,7 +810,7 @@ public:
inline auto getLastPosWrite() -> decltype(v_pos.template get<0>(0))
{
#ifdef SE_CLASS3
se3.write<prop::max_prop_real>(*this,g_m-1);
se3.template write<prop::max_prop_real>(*this,g_m-1);
#endif
return v_pos.template get<0>(g_m - 1);
......@@ -822,7 +826,7 @@ public:
template<unsigned int id> inline auto getLastPropWrite() -> decltype(v_prp.template get<id>(0))
{
#ifdef SE_CLASS3
se3.write<id>(*this,g_m-1);
se3.template write<id>(*this,g_m-1);
#endif
return v_prp.template get<id>(g_m - 1);
......@@ -882,10 +886,11 @@ public:
* \return the Cell list
*
*/
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut)
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, bool no_se3 = false)
{
#ifdef SE_CLASS3
se3.getNN();
if (no_se3 == false)
{se3.getNN();}
#endif
#ifdef SE_CLASS1
check_ghost_compatible_rcut(r_cut);
......@@ -895,7 +900,7 @@ public:
Ghost<dim,St> g = getDecomposition().getGhost();
g.magnify(1.013);
return getCellList<CellL>(r_cut, g);
return getCellList<CellL>(r_cut, g,no_se3);
}
/*! \brief Construct an hilbert cell list starting from the stored particles
......@@ -930,10 +935,11 @@ public:
* \param cell_list Cell list to update
*
*/
template<typename CellL> void updateCellList(CellL & cell_list)
template<typename CellL> void updateCellList(CellL & cell_list, bool no_se3 = false)
{
#ifdef SE_CLASS3
se3.getNN();
if (no_se3 == false)
{se3.getNN();}
#endif
// This function assume equal spacing in all directions
......@@ -1012,10 +1018,11 @@ public:
* \return the CellList
*
*/
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge)
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge, bool no_se3 = false)
{
#ifdef SE_CLASS3
se3.getNN();
if (no_se3 == false)
{se3.getNN();}
#endif
CellL cell_list;
......@@ -1032,7 +1039,7 @@ public:
cell_list.Initialize(pbox, div, g_m);
cell_list.set_ndec(getDecomposition().get_ndec());
updateCellList(cell_list);
updateCellList(cell_list,no_se3);
return cell_list;
}
......@@ -1987,6 +1994,10 @@ public:
*/
template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS_Cell(cli & NN)
{
#ifdef SE_CLASS3
se3.getIterator();
#endif
#ifdef SE_CLASS1
if (!(opt & BIND_DEC_TO_GHOST))
{
......
......@@ -119,6 +119,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_hdf5_save_test )
BOOST_AUTO_TEST_CASE( vector_dist_hdf5_load_test )
{
#ifndef SE_CLASS3
Vcluster & v_cl = create_vcluster();
Box<dim,float> box;
......@@ -169,6 +171,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_hdf5_load_test )
++it2;
}
#endif
}
BOOST_AUTO_TEST_SUITE_END()
......
......@@ -222,21 +222,21 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
phases.get(2).add();
phases.get(3).add();
phases.get(0).getLastPos()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(0).getLastPos()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(0).getLastPos()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(0).getLastPosWrite()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(0).getLastPosWrite()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(0).getLastPosWrite()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(1).getLastPos()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(1).getLastPos()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(1).getLastPos()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(1).getLastPosWrite()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(1).getLastPosWrite()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(1).getLastPosWrite()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(2).getLastPos()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(2).getLastPos()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(2).getLastPos()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(2).getLastPosWrite()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(2).getLastPosWrite()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(2).getLastPosWrite()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(3).getLastPos()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(3).getLastPos()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(3).getLastPos()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
phases.get(3).getLastPosWrite()[0] = key.get(0) * g_it.getSpacing(0) + box.getLow(0);
phases.get(3).getLastPosWrite()[1] = key.get(1) * g_it.getSpacing(1) + box.getLow(1);
phases.get(3).getLastPosWrite()[2] = key.get(2) * g_it.getSpacing(2) + box.getLow(2);
++g_it;
}
......@@ -289,8 +289,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
// Neighborhood particle q
auto q = Np.get();
phases.get(0).getProp<0>(p)++;
phases.get(1).getProp<0>(q)++;
phases.get(0).getPropWrite<0>(p)++;
phases.get(1).getPropWrite<0>(q)++;
++Np;
}
......@@ -301,13 +301,19 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
phases.get(0).ghost_put<add_,0>();
phases.get(1).ghost_put<add_,0>();
#ifdef SE_CLASS3
phases.get(1).getDomainIterator();
#endif
it = phases.get(0).getDomainIterator();
while (it.isNext())
{
auto p = it.get();
ret &= phases.get(0).getProp<0>(p) == 7;
ret &= phases.get(1).getProp<0>(p) == 7;
ret &= phases.get(0).getPropRead<0>(p) == 7;
ret &= phases.get(1).getPropRead<0>(p) == 7;
++it;
}
......@@ -330,7 +336,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
{
auto p = it.get();
phases.get(i).getProp<0>(p) = 0;
phases.get(i).getPropWrite<0>(p) = 0;
++it;
}
......@@ -371,8 +377,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
// Get from which phase it come from
auto ph_q = Np.getV();
phases.get(i).getProp<0>(p)++;
phases.get(ph_q).getProp<0>(q)++;
phases.get(i).getPropWrite<0>(p)++;
phases.get(ph_q).getPropWrite<0>(q)++;
++Np;
}
......@@ -386,22 +392,30 @@ BOOST_AUTO_TEST_CASE( vector_dist_multiphase_cell_list_sym_test )
phases.get(2).ghost_put<add_,0>();
phases.get(3).ghost_put<add_,0>();
#ifdef SE_CLASS3
it = phases.get(1).getDomainIterator();
it = phases.get(2).getDomainIterator();
it = phases.get(3).getDomainIterator();
#endif
it = phases.get(0).getDomainIterator();
while (it.isNext())
{
auto p = it.get();
ret &= phases.get(0).getProp<0>(p) == 32;
ret &= phases.get(1).getProp<0>(p) == 32;
ret &= phases.get(2).getProp<0>(p) == 32;
ret &= phases.get(3).getProp<0>(p) == 32;
ret &= phases.get(0).getPropRead<0>(p) == 32;
ret &= phases.get(1).getPropRead<0>(p) == 32;
ret &= phases.get(2).getPropRead<0>(p) == 32;
ret &= phases.get(3).getPropRead<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;
std::cout << phases.get(0).getPropRead<0>(p) << std::endl;
std::cout << phases.get(1).getPropRead<0>(p) << std::endl;
std::cout << phases.get(2).getPropRead<0>(p) << std::endl;
std::cout << phases.get(3).getPropRead<0>(p) << std::endl;
}
++it;
......
This diff is collapsed.
......@@ -1675,13 +1675,13 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
vd.add();
vd.getLastPos()[0] = key.get(0)*it.getSpacing(0);
vd.getLastPos()[1] = key.get(1)*it.getSpacing(1);
vd.getLastPos()[2] = key.get(2)*it.getSpacing(2);
vd.getLastPosWrite()[0] = key.get(0)*it.getSpacing(0);
vd.getLastPosWrite()[1] = key.get(1)*it.getSpacing(1);
vd.getLastPosWrite()[2] = key.get(2)*it.getSpacing(2);
// Fill some properties randomly
vd.getLastProp<0>() = 0.0;
vd.getLastPropWrite<0>() = 0.0;
++it;
}
......@@ -1712,12 +1712,12 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
while (Np.isNext())
{
auto q = Np.get();
Point<3,float> xq = vd.getPos(q);
Point<3,float> xq = vd.getPosRead(q);
float dist = xp.distance(xq);
if (dist < r_cut)
vd.getProp<0>(q) += a*(-dist*dist+r_cut*r_cut);
vd.getPropWrite<0>(q) += a*(-dist*dist+r_cut*r_cut);
++Np;
}
......@@ -1738,7 +1738,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
float constant2 = vd.getProp<0>(it3.get());
if (fabs(constant - constant2)/constant > eps)
{
Point<3,float> p = vd.getPos(it3.get());
Point<3,float> p = vd.getPosRead(it3.get());
std::cout << p.toString() << " " << constant2 << "/" << constant << " " << v_cl.getProcessUnitID() << std::endl;
ret = false;
......@@ -1755,7 +1755,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
{
auto key = itp.get();
vd.getProp<0>(key) = 0.0;
vd.getPropWrite<0>(key) = 0.0;
++itp;
}
......@@ -1772,7 +1772,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
{
// particle p
auto p = it2.get();
Point<3,float> xp = vd.getPos(p);
Point<3,float> xp = vd.getPosRead(p);
// Get an iterator over the neighborhood particles of p
auto Np = NN.getNNIterator<NO_CHECK>(NN.getCell(xp));
......@@ -1781,12 +1781,12 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
while (Np.isNext())
{
auto q = Np.get();
Point<3,float> xq = vd.getPos(q);
Point<3,float> xq = vd.getPosRead(q);
float dist = xp.distance(xq);
if (dist < r_cut)
vd.getProp<0>(q) += a*(-dist*dist+r_cut*r_cut);
vd.getPropWrite<0>(q) += a*(-dist*dist+r_cut*r_cut);
++Np;
}
......@@ -1799,15 +1799,15 @@ BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
bool ret = true;
auto it3 = vd.getDomainIterator();
float constant = vd.getProp<0>(it3.get());
float constant = vd.getPropRead<0>(it3.get());
float eps = 0.001;
while (it3.isNext())
{
float constant2 = vd.getProp<0>(it3.get());
float constant2 = vd.getPropRead<0>(it3.get());
if (fabs(constant - constant2)/constant > eps)
{
Point<3,float> p = vd.getPos(it3.get());
Point<3,float> p = vd.getPosRead(it3.get());
std::cout << p.toString() << " " << constant2 << "/" << constant << " " << v_cl.getProcessUnitID() << std::endl;
ret = false;
......
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