Commit 95524c6a authored by incardon's avatar incardon

Testing gitlab

parent c52f28ba
Pipeline #1147 failed with stages
in 28 minutes and 11 seconds
......@@ -39,6 +39,7 @@
#include "data_type/aggregate.hpp"
#include "Domain_NN_calculator_cart.hpp"
#include "cuda/CartDecomposition_gpu.cuh"
#include "Domain_icells_cart.hpp"
#define CARTDEC_ERROR 2000lu
......@@ -130,7 +131,11 @@ template<unsigned int dim> static void nsub_to_div(size_t (& div)[dim], size_t n
*/
template<unsigned int dim, typename T, typename Memory, template <typename> class layout_base, typename Distribution>
class CartDecomposition: public ie_loc_ghost<dim, T>, public nn_prcs<dim, T>, public ie_ghost<dim,T,Memory,layout_base>, public domain_nn_calculator_cart<dim>
class CartDecomposition: public ie_loc_ghost<dim, T,layout_base, Memory>,
public nn_prcs<dim, T,layout_base,Memory>,
public ie_ghost<dim,T,Memory,layout_base>,
public domain_nn_calculator_cart<dim>,
public domain_icell_calculator<dim,T,layout_base,Memory>
{
public:
......@@ -164,7 +169,7 @@ protected:
openfpm::vect_isel<SpaceBox<dim, T>>::value>::access_key acc_key;
//! the set of all local sub-domain as vector
openfpm::vector<SpaceBox<dim, T>> sub_domains;
openfpm::vector<SpaceBox<dim, T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> sub_domains;
//! the remote set of all sub-domains as vector of 'sub_domains' vectors
mutable openfpm::vector<Box_map<dim, T>,Memory,typename layout_base<Box_map<dim, T>>::type,layout_base> sub_domains_global;
......@@ -421,8 +426,8 @@ public:
proc_box.enclose(loc_box.get(s));
}
nn_prcs<dim,T>::create(box_nn_processor, sub_domains);
nn_prcs<dim,T>::applyBC(domain,ghost,bc);
nn_prcs<dim,T,layout_base,Memory>::create(box_nn_processor, sub_domains);
nn_prcs<dim,T,layout_base,Memory>::applyBC(domain,ghost,bc);
// fill fine_s structure
// fine_s structure contain the processor id for each sub-sub-domain
......@@ -646,7 +651,7 @@ public:
ie_ghost<dim, T,Memory,layout_base>::create_box_nn_processor_ext(v_cl, ghost, sub_domains, box_nn_processor, *this);
ie_ghost<dim, T,Memory,layout_base>::create_box_nn_processor_int(v_cl, ghost, sub_domains, box_nn_processor, *this);
ie_loc_ghost<dim,T>::create(sub_domains,domain,ghost,bc);
ie_loc_ghost<dim,T,layout_base,Memory>::create(sub_domains,domain,ghost,bc);
// Ghost box information must be re-offloaded
host_dev_transfer = false;
......@@ -682,7 +687,7 @@ public:
*
*/
CartDecomposition(Vcluster<> & v_cl)
:nn_prcs<dim, T>(v_cl), v_cl(v_cl), dist(v_cl),ref_cnt(0)
:nn_prcs<dim, T, layout_base,Memory>(v_cl), v_cl(v_cl), dist(v_cl),ref_cnt(0)
{
// Reset the box to zero
bbox.zero();
......@@ -694,7 +699,7 @@ public:
*
*/
CartDecomposition(const CartDecomposition<dim,T,Memory,layout_base,Distribution> & cart)
:nn_prcs<dim,T>(cart.v_cl),v_cl(cart.v_cl),dist(v_cl),ref_cnt(0)
:nn_prcs<dim,T,layout_base,Memory>(cart.v_cl),v_cl(cart.v_cl),dist(v_cl),ref_cnt(0)
{
this->operator=(cart);
}
......@@ -705,7 +710,7 @@ public:
*
*/
CartDecomposition(CartDecomposition<dim,T,Memory,layout_base,Distribution> && cart)
:nn_prcs<dim,T>(cart.v_cl),v_cl(cart.v_cl),dist(v_cl),ref_cnt(0)
:nn_prcs<dim,T,layout_base,Memory>(cart.v_cl),v_cl(cart.v_cl),dist(v_cl),ref_cnt(0)
{
this->operator=(cart);
}
......@@ -878,8 +883,8 @@ public:
for (size_t i = 0 ; i < dim ; i++)
cart.bc[i] = bc[i];
(static_cast<nn_prcs<dim,T> &>(cart)).create(box_nn_processor, sub_domains);
(static_cast<nn_prcs<dim,T> &>(cart)).applyBC(domain,ghost,bc);
(static_cast<nn_prcs<dim,T,layout_base,Memory> &>(cart)).create(box_nn_processor, sub_domains);
(static_cast<nn_prcs<dim,T,layout_base,Memory> &>(cart)).applyBC(domain,ghost,bc);
cart.Initialize_geo_cell_lists();
cart.calculateGhostBoxes();
......@@ -896,8 +901,8 @@ public:
{
CartDecomposition<dim,T,Memory,layout_base,Distribution> cart(v_cl);
(static_cast<ie_loc_ghost<dim,T>*>(&cart))->operator=(static_cast<ie_loc_ghost<dim,T>>(*this));
(static_cast<nn_prcs<dim,T>*>(&cart))->operator=(static_cast<nn_prcs<dim,T>>(*this));
(static_cast<ie_loc_ghost<dim,T, layout_base,Memory>*>(&cart))->operator=(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>>(*this));
(static_cast<nn_prcs<dim,T,layout_base,Memory>*>(&cart))->operator=(static_cast<nn_prcs<dim,T,layout_base,Memory>>(*this));
(static_cast<ie_ghost<dim,T,Memory,layout_base>*>(&cart))->operator=(static_cast<ie_ghost<dim,T,Memory,layout_base>>(*this));
cart.sub_domains = sub_domains;
......@@ -933,8 +938,8 @@ public:
{
CartDecomposition<dim,T> cart(v_cl);
(static_cast<ie_loc_ghost<dim,T>*>(&cart))->operator=(static_cast<ie_loc_ghost<dim,T>>(*this));
(static_cast<nn_prcs<dim,T>*>(&cart))->operator=(static_cast<nn_prcs<dim,T>>(*this));
(static_cast<ie_loc_ghost<dim,T,layout_base2,Memory2>*>(&cart))->operator=(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>>(*this));
(static_cast<nn_prcs<dim,T,layout_base2,Memory2>*>(&cart))->operator=(static_cast<nn_prcs<dim,T,layout_base,Memory>>(*this));
ie_ghost<dim,T,Memory,layout_base> * ptr = static_cast<ie_ghost<dim,T,Memory,layout_base> *>((CartDecomposition<dim,T,Memory,layout_base,Distribution> *)this);
(static_cast<ie_ghost<dim,T,Memory2,layout_base2>*>(&cart))->operator=(ptr->template duplicate<Memory2,layout_base2>());
......@@ -970,8 +975,8 @@ public:
*/
CartDecomposition<dim,T,Memory, layout_base, Distribution> & operator=(const CartDecomposition & cart)
{
static_cast<ie_loc_ghost<dim,T>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T>>(cart));
static_cast<nn_prcs<dim,T>*>(this)->operator=(static_cast<nn_prcs<dim,T>>(cart));
static_cast<ie_loc_ghost<dim,T,layout_base,Memory>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>>(cart));
static_cast<nn_prcs<dim,T,layout_base,Memory>*>(this)->operator=(static_cast<nn_prcs<dim,T,layout_base,Memory>>(cart));
static_cast<ie_ghost<dim,T,Memory,layout_base>*>(this)->operator=(static_cast<ie_ghost<dim,T,Memory,layout_base>>(cart));
sub_domains = cart.sub_domains;
......@@ -1010,8 +1015,8 @@ public:
*/
CartDecomposition<dim,T,Memory,layout_base, Distribution> & operator=(CartDecomposition && cart)
{
static_cast<ie_loc_ghost<dim,T>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T>>(cart));
static_cast<nn_prcs<dim,T>*>(this)->operator=(static_cast<nn_prcs<dim,T>>(cart));
static_cast<ie_loc_ghost<dim,T,layout_base,Memory>*>(this)->operator=(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>>(cart));
static_cast<nn_prcs<dim,T,layout_base,Memory>*>(this)->operator=(static_cast<nn_prcs<dim,T,layout_base,Memory>>(cart));
static_cast<ie_ghost<dim,T,Memory,layout_base>*>(this)->operator=(static_cast<ie_ghost<dim,T,Memory,layout_base>>(cart));
sub_domains.swap(cart.sub_domains);
......@@ -1324,9 +1329,9 @@ public:
box_nn_processor.clear();
fine_s.clear();
loc_box.clear();
nn_prcs<dim, T>::reset();
nn_prcs<dim, T,layout_base,Memory>::reset();
ie_ghost<dim,T,Memory,layout_base>::reset();
ie_loc_ghost<dim, T>::reset();
ie_loc_ghost<dim, T,layout_base,Memory>::reset();
}
/*! \brief Start decomposition
......@@ -1347,6 +1352,14 @@ public:
domain_nn_calculator_cart<dim>::reset();
domain_nn_calculator_cart<dim>::setParameters(proc_box);
domain_icell_calculator<dim,T,layout_base,Memory>
::CalculateInternalCells(v_cl,
ie_ghost<dim, T,Memory,layout_base>::private_get_vb_int_box(),
sub_domains,
this->getProcessorBounds(),
this->getGhost().getRcut(),
this->getGhost());
}
/*! \brief Refine the decomposition, available only for ParMetis distribution, for Metis it is a null call
......@@ -1556,7 +1569,8 @@ public:
return domain;
}
openfpm::vector<SpaceBox<dim, T>> getSubDomains() const
const openfpm::vector<SpaceBox<dim, T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> &
getSubDomains() const
{
return sub_domains;
}
......@@ -1808,9 +1822,9 @@ public:
vtk_box1.add(sub_domains);
vtk_box1.write(output + std::string("subdomains_") + std::to_string(v_cl.getProcessUnitID()) + std::string(".vtk"));
nn_prcs<dim, T>::write(output);
nn_prcs<dim, T,layout_base,Memory>::write(output);
ie_ghost<dim,T,Memory,layout_base>::write(output, v_cl.getProcessUnitID());
ie_loc_ghost<dim, T>::write(output, v_cl.getProcessUnitID());
ie_loc_ghost<dim, T,layout_base,Memory>::write(output, v_cl.getProcessUnitID());
return true;
}
......@@ -1835,7 +1849,7 @@ public:
*/
bool check_consistency()
{
if (ie_loc_ghost<dim, T>::check_consistency(getNSubDomain()) == false)
if (ie_loc_ghost<dim, T,layout_base,Memory>::check_consistency(getNSubDomain()) == false)
return false;
return true;
......@@ -1860,21 +1874,21 @@ public:
std::cout << "External ghost box\n";
for (size_t p = 0; p<nn_prcs < dim, T>::getNNProcessors(); p++)
for (size_t p = 0; p<nn_prcs < dim, T, layout_base, Memory>::getNNProcessors(); p++)
{
for (size_t i = 0; i<ie_ghost <dim,T,Memory,layout_base>::getProcessorNEGhost(p); i++)
{
std::cout << ie_ghost<dim,T,Memory,layout_base>::getProcessorEGhostBox(p, i).toString() << " prc=" << nn_prcs<dim, T>::IDtoProc(p) << " id=" << ie_ghost<dim,T,Memory,layout_base>::getProcessorEGhostId(p, i) << "\n";
std::cout << ie_ghost<dim,T,Memory,layout_base>::getProcessorEGhostBox(p, i).toString() << " prc=" << nn_prcs<dim, T, layout_base,Memory>::IDtoProc(p) << " id=" << ie_ghost<dim,T,Memory,layout_base>::getProcessorEGhostId(p, i) << "\n";
}
}
std::cout << "Internal ghost box\n";
for (size_t p = 0; p<nn_prcs < dim, T>::getNNProcessors(); p++)
for (size_t p = 0; p<nn_prcs < dim, T, layout_base, Memory>::getNNProcessors(); p++)
{
for (size_t i = 0; i<ie_ghost<dim,T,Memory,layout_base>::getProcessorNIGhost(p); i++)
{
std::cout << ie_ghost<dim,T,Memory,layout_base>::getProcessorIGhostBox(p, i).toString() << " prc=" << nn_prcs<dim, T>::IDtoProc(p) << " id=" << ie_ghost<dim,T,Memory,layout_base>::getProcessorIGhostId(p, i) << "\n";
std::cout << ie_ghost<dim,T,Memory,layout_base>::getProcessorIGhostBox(p, i).toString() << " prc=" << nn_prcs<dim, T, layout_base, Memory>::IDtoProc(p) << " id=" << ie_ghost<dim,T,Memory,layout_base>::getProcessorIGhostId(p, i) << "\n";
}
}
}
......@@ -1888,10 +1902,10 @@ public:
*/
bool is_equal(CartDecomposition<dim,T,Memory> & cart)
{
if (static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal(static_cast<ie_loc_ghost<dim,T>&>(cart)) == false)
if (static_cast<ie_loc_ghost<dim,T,layout_base,Memory>*>(this)->is_equal(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>&>(cart)) == false)
return false;
if (static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)) == false)
if (static_cast<nn_prcs<dim,T,layout_base,Memory>*>(this)->is_equal(static_cast<nn_prcs<dim,T, layout_base,Memory>&>(cart)) == false)
return false;
if (static_cast<ie_ghost<dim,T,Memory,layout_base>*>(this)->is_equal(static_cast<ie_ghost<dim,T,Memory,layout_base>&>(cart)) == false)
......@@ -1934,10 +1948,10 @@ public:
*/
bool is_equal_ng(CartDecomposition<dim,T,Memory> & cart)
{
if (static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal_ng(static_cast<ie_loc_ghost<dim,T>&>(cart)) == false)
if (static_cast<ie_loc_ghost<dim,T,layout_base,Memory>*>(this)->is_equal_ng(static_cast<ie_loc_ghost<dim,T,layout_base,Memory>&>(cart)) == false)
return false;
if (static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)) == false)
if (static_cast<nn_prcs<dim,T,layout_base,Memory>*>(this)->is_equal(static_cast<nn_prcs<dim,T,layout_base,Memory>&>(cart)) == false)
return false;
if (static_cast<ie_ghost<dim,T,Memory,layout_base>*>(this)->is_equal_ng(static_cast<ie_ghost<dim,T,Memory,layout_base>&>(cart)) == false)
......
......@@ -246,8 +246,8 @@ public:
for (size_t i = 0 ; i < dim ; i++)
this->bc[i] = dec.bc[i];
(static_cast<nn_prcs<dim,T> &>(*this)).create(this->box_nn_processor, this->sub_domains);
(static_cast<nn_prcs<dim,T> &>(*this)).applyBC(ext_domain,g,this->bc);
(static_cast<nn_prcs<dim,T,layout_base,Memory> &>(*this)).create(this->box_nn_processor, this->sub_domains);
(static_cast<nn_prcs<dim,T, layout_base,Memory> &>(*this)).applyBC(ext_domain,g,this->bc);
this->Initialize_geo_cell_lists();
this->calculateGhostBoxes();
......
......@@ -100,7 +100,7 @@ class ie_ghost
* for the processor p_id
*
*/
inline size_t link_ebx_ibx(const nn_prcs<dim,T> & nn_p, size_t p_id, size_t i)
inline size_t link_ebx_ibx(const nn_prcs<dim,T,layout_base,Memory> & nn_p, size_t p_id, size_t i)
{
// Search for the correct id
size_t k = 0;
......@@ -224,9 +224,9 @@ protected:
*/
void create_box_nn_processor_ext(Vcluster<> & v_cl,
Ghost<dim,T> & ghost,
openfpm::vector<SpaceBox<dim,T>> & sub_domains,
openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains,
const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor,
const nn_prcs<dim,T> & nn_p)
const nn_prcs<dim,T,layout_base,Memory> & nn_p)
{
box_nn_processor_int.resize(sub_domains.size());
proc_int_box.resize(nn_p.getNNProcessors());
......@@ -326,9 +326,9 @@ protected:
*/
void create_box_nn_processor_int(Vcluster<> & v_cl,
Ghost<dim,T> & ghost,
openfpm::vector<SpaceBox<dim,T>> & sub_domains,
openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains,
const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor,
const nn_prcs<dim,T> & nn_p)
const nn_prcs<dim,T,layout_base,Memory> & nn_p)
{
box_nn_processor_int.resize(sub_domains.size());
proc_int_box.resize(nn_p.getNNProcessors());
......
......@@ -23,7 +23,7 @@
* \see CartDecomposition
*
*/
template<unsigned int dim, typename T>
template<unsigned int dim, typename T, template <typename> class layout_base, typename Memory>
class ie_loc_ghost
{
//! It contain the calculated local ghost boxes
......@@ -40,7 +40,7 @@ class ie_loc_ghost
*
*/
void create_loc_ghost_ebox(Ghost<dim,T> & ghost,
openfpm::vector<SpaceBox<dim,T>> & sub_domains,
openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains,
openfpm::vector<Box_loc_sub<dim,T>> & sub_domains_prc)
{
comb<dim> zero;
......@@ -101,7 +101,7 @@ class ie_loc_ghost
*
*/
void create_loc_ghost_ibox(Ghost<dim,T> & ghost,
openfpm::vector<SpaceBox<dim,T>> & sub_domains,
openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains,
openfpm::vector<Box_loc_sub<dim,T>> & sub_domains_prc)
{
comb<dim> zero;
......@@ -163,7 +163,7 @@ class ie_loc_ghost
for (size_t j = 0 ; j < cmbs.size() ; j++)
{
if (nn_prcs<dim,T>::check_valid(cmbs[j],bc) == false)
if (nn_prcs<dim,T,layout_base,Memory>::check_valid(cmbs[j],bc) == false)
continue;
Box<dim,T> bp;
......@@ -249,7 +249,7 @@ public:
* \param bc Boundary conditions
*
*/
void create(openfpm::vector<SpaceBox<dim,T>> & sub_domains, Box<dim,T> & domain , Ghost<dim,T> & ghost , const size_t (&bc)[dim] )
void create(openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains, Box<dim,T> & domain , Ghost<dim,T> & ghost , const size_t (&bc)[dim] )
{
// It will store local sub-domains + borders
openfpm::vector<Box_loc_sub<dim,T>> sub_domains_prc;
......@@ -275,13 +275,13 @@ public:
ie_loc_ghost() {};
//! Constructor from another ie_loc_ghost
ie_loc_ghost(const ie_loc_ghost<dim,T> & ilg)
ie_loc_ghost(const ie_loc_ghost<dim,T,layout_base,Memory> & ilg)
{
this->operator=(ilg);
};
//! Constructor from temporal ie_loc_ghost
ie_loc_ghost(ie_loc_ghost<dim,T> && ilg)
ie_loc_ghost(ie_loc_ghost<dim,T,layout_base,Memory> && ilg)
{
this->operator=(ilg);
}
......@@ -293,7 +293,7 @@ public:
* \return itself
*
*/
ie_loc_ghost<dim,T> & operator=(const ie_loc_ghost<dim,T> & ilg)
ie_loc_ghost<dim,T,layout_base,Memory> & operator=(const ie_loc_ghost<dim,T,layout_base,Memory> & ilg)
{
loc_ghost_box = ilg.loc_ghost_box;
return *this;
......@@ -306,12 +306,50 @@ public:
* \return itself
*
*/
ie_loc_ghost<dim,T> & operator=(ie_loc_ghost<dim,T> && ilg)
ie_loc_ghost<dim,T,layout_base,Memory> & operator=(ie_loc_ghost<dim,T,layout_base,Memory> && ilg)
{
loc_ghost_box.swap(ilg.loc_ghost_box);
return *this;
}
/*! \brief copy the ie_loc_ghost
*
* \param ilg object to copy
*
* \return itself
*
*/
template<template <typename> class layout_base2, typename Memory2>
ie_loc_ghost<dim,T,layout_base,Memory> & operator=(const ie_loc_ghost<dim,T,layout_base2,Memory2> & ilg)
{
loc_ghost_box = ilg.private_get_loc_ghost_box();
return *this;
}
/*! \brief copy the ie_loc_ghost
*
* \param ilg object to copy
*
* \return itself
*
*/
template<template <typename> class layout_base2, typename Memory2>
ie_loc_ghost<dim,T,layout_base,Memory> & operator=(ie_loc_ghost<dim,T,layout_base2,Memory2> && ilg)
{
loc_ghost_box.swap(ilg.private_get_loc_ghost_box());
return *this;
}
/*! \brief Get the internal loc_ghost_box
*
* \return the internal loc_ghost_box
*
*/
inline openfpm::vector<lBox_dom<dim,T>> & private_get_loc_ghost_box()
{
return loc_ghost_box;
}
/*! \brief Get the number of local sub-domains
*
* \return the number of local sub-domains
......@@ -590,7 +628,7 @@ public:
* \return true if they match
*
*/
bool is_equal(ie_loc_ghost<dim,T> & ilg)
bool is_equal(ie_loc_ghost<dim,T,layout_base,Memory> & ilg)
{
if (ilg.loc_ghost_box.size() != loc_ghost_box.size())
return false;
......@@ -637,7 +675,7 @@ public:
* ghost part
*
*/
bool is_equal_ng(ie_loc_ghost<dim,T> & ilg)
bool is_equal_ng(ie_loc_ghost<dim,T,layout_base,Memory> & ilg)
{
return true;
}
......
......@@ -19,7 +19,7 @@
* \see CartDecomposition
*
*/
template<unsigned int dim, typename T>
template<unsigned int dim, typename T, template <typename> class layout_base, typename Memory>
class nn_prcs
{
//! Virtual cluster
......@@ -139,7 +139,7 @@ class nn_prcs
static void * message_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, size_t tag, void * ptr)
{
// cast the pointer
nn_prcs<dim,T> * cd = static_cast< nn_prcs<dim,T> *>(ptr);
nn_prcs<dim,T,layout_base,Memory> * cd = static_cast< nn_prcs<dim,T,layout_base,Memory> *>(ptr);
cd->nn_processor_subdomains[i].bx.resize(msg_i / sizeof(::Box<dim,T>) );
......@@ -276,14 +276,14 @@ public:
{}
//! Constructor from another nn_prcs
nn_prcs(const nn_prcs<dim,T> & ilg)
nn_prcs(const nn_prcs<dim,T,layout_base,Memory> & ilg)
:v_cl(ilg.v_cl),recv_cnt(0),aBC(false)
{
this->operator=(ilg);
};
//! Constructor from temporal ie_loc_ghost
nn_prcs(nn_prcs<dim,T> && ilg)
nn_prcs(nn_prcs<dim,T,layout_base,Memory> && ilg)
:v_cl(ilg.v_cl),recv_cnt(0),aBC(false)
{
this->operator=(ilg);
......@@ -321,7 +321,7 @@ public:
* \return itself
*
*/
nn_prcs<dim,T> & operator=(const nn_prcs<dim,T> & nnp)
nn_prcs<dim,T,layout_base,Memory> & operator=(const nn_prcs<dim,T,layout_base,Memory> & nnp)
{
nn_processors = nnp.nn_processors;
nn_processor_subdomains = nnp.nn_processor_subdomains;
......@@ -338,7 +338,7 @@ public:
* \return itself
*
*/
nn_prcs<dim,T> & operator=(nn_prcs<dim,T> && nnp)
nn_prcs<dim,T,layout_base,Memory> & operator=(nn_prcs<dim,T,layout_base,Memory> && nnp)
{
nn_processors.swap(nnp.nn_processors);
nn_processor_subdomains.swap(nnp.nn_processor_subdomains);
......@@ -348,13 +348,90 @@ public:
return *this;
}
/*! \brief Copy the object
*
* \param nnp object to copy
*
* \return itself
*
*/
template<typename Memory2, template <typename> class layout_base2>
nn_prcs<dim,T,layout_base,Memory> & operator=(const nn_prcs<dim,T,layout_base2,Memory2> & nnp)
{
nn_processors = nnp.private_get_nn_processors();
nn_processor_subdomains = nnp.private_get_nn_processor_subdomains();
proc_adj_box = nnp.private_get_proc_adj_box();
boxes = nnp.private_get_boxes();
return *this;
}
/*! \brief Return the internal nn_processor struct
*
* \return the internal nn_processor struct
*
*/
openfpm::vector<size_t> & private_get_nn_processors()
{
return nn_processors;
}
/*! \brief Return the internal nn_processor_subdomains
*
* \return the internal nn_processor_subdomains
*
*/
std::unordered_map<size_t, N_box<dim,T>> & private_get_nn_processor_subdomains()
{
return nn_processor_subdomains;
}
/*! \brief Return the internal proc_adj_box
*
* \return the internal proc_adj_box
*
*/
openfpm::vector<openfpm::vector<size_t>> & private_get_proc_adj_box()
{
return proc_adj_box;
}
/*! \brief Return the internal boxes structure
*
* \return the internal boxes structure
*
*/
openfpm::vector< openfpm::vector< ::SpaceBox<dim,T>> > & private_get_boxes()
{
return boxes;
}
/*! \brief Copy the object
*
* \param nnp object to copy
*
* \return itself
*
*/
template<typename Memory2, template <typename> class layout_base2>
nn_prcs<dim,T,layout_base,Memory> & operator=(nn_prcs<dim,T,layout_base2,Memory2> && nnp)
{
nn_processors.swap(nnp.private_get_nn_processors());
nn_processor_subdomains.swap(nnp.private_get_nn_processor_subdomains());
proc_adj_box.swap(nnp.private_get_proc_adj_box());
boxes = nnp.private_get_boxes();
return *this;
}
/*! \brief Create the list of adjacent processors and the list of adjacent sub-domains
*
* \param box_nn_processor list of adjacent processors for each sub-domain
* \param sub_domains list of local sub-domains
*
*/
void create(const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor, const openfpm::vector<SpaceBox<dim,T>> & sub_domains)
void create(const openfpm::vector<openfpm::vector<long unsigned int> > & box_nn_processor,
const openfpm::vector<SpaceBox<dim,T>,Memory,typename layout_base<SpaceBox<dim, T>>::type,layout_base> & sub_domains)
{
// produce the list of the adjacent processor (nn_processors) list
for (size_t i = 0 ; i < box_nn_processor.size() ; i++)
......@@ -412,7 +489,7 @@ public:
nn_processor_subdomains.reserve(nn_processors.size());
// Get the sub-domains of the near processors
v_cl.sendrecvMultipleMessagesNBX(nn_processors,boxes,nn_prcs<dim,T>::message_alloc, this ,NEED_ALL_SIZE);
v_cl.sendrecvMultipleMessagesNBX(nn_processors,boxes,nn_prcs<dim,T,layout_base,Memory>::message_alloc, this ,NEED_ALL_SIZE);
// Add to all the received sub-domains the information that they live in the central sector
for ( auto it = nn_processor_subdomains.begin(); it != nn_processor_subdomains.end(); ++it )
......@@ -645,7 +722,7 @@ public:
* \return true if they are equal
*
*/
bool is_equal(nn_prcs<dim,T> & np)
bool is_equal(nn_prcs<dim,T,layout_base,Memory> & np)
{