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 @@ ...@@ -39,6 +39,7 @@
#include "data_type/aggregate.hpp" #include "data_type/aggregate.hpp"
#include "Domain_NN_calculator_cart.hpp" #include "Domain_NN_calculator_cart.hpp"
#include "cuda/CartDecomposition_gpu.cuh" #include "cuda/CartDecomposition_gpu.cuh"
#include "Domain_icells_cart.hpp"
#define CARTDEC_ERROR 2000lu #define CARTDEC_ERROR 2000lu
...@@ -130,7 +131,11 @@ template<unsigned int dim> static void nsub_to_div(size_t (& div)[dim], size_t n ...@@ -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> 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: public:
...@@ -164,7 +169,7 @@ protected: ...@@ -164,7 +169,7 @@ protected:
openfpm::vect_isel<SpaceBox<dim, T>>::value>::access_key acc_key; openfpm::vect_isel<SpaceBox<dim, T>>::value>::access_key acc_key;
//! the set of all local sub-domain as vector //! 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 //! 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; 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: ...@@ -421,8 +426,8 @@ public:
proc_box.enclose(loc_box.get(s)); proc_box.enclose(loc_box.get(s));
} }
nn_prcs<dim,T>::create(box_nn_processor, sub_domains); nn_prcs<dim,T,layout_base,Memory>::create(box_nn_processor, sub_domains);
nn_prcs<dim,T>::applyBC(domain,ghost,bc); nn_prcs<dim,T,layout_base,Memory>::applyBC(domain,ghost,bc);
// fill fine_s structure // fill fine_s structure
// fine_s structure contain the processor id for each sub-sub-domain // fine_s structure contain the processor id for each sub-sub-domain
...@@ -646,7 +651,7 @@ public: ...@@ -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_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_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 // Ghost box information must be re-offloaded
host_dev_transfer = false; host_dev_transfer = false;
...@@ -682,7 +687,7 @@ public: ...@@ -682,7 +687,7 @@ public:
* *
*/ */
CartDecomposition(Vcluster<> & v_cl) 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 // Reset the box to zero
bbox.zero(); bbox.zero();
...@@ -694,7 +699,7 @@ public: ...@@ -694,7 +699,7 @@ public:
* *
*/ */
CartDecomposition(const CartDecomposition<dim,T,Memory,layout_base,Distribution> & cart) 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); this->operator=(cart);
} }
...@@ -705,7 +710,7 @@ public: ...@@ -705,7 +710,7 @@ public:
* *
*/ */
CartDecomposition(CartDecomposition<dim,T,Memory,layout_base,Distribution> && cart) 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); this->operator=(cart);
} }
...@@ -878,8 +883,8 @@ public: ...@@ -878,8 +883,8 @@ public:
for (size_t i = 0 ; i < dim ; i++) for (size_t i = 0 ; i < dim ; i++)
cart.bc[i] = bc[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,layout_base,Memory> &>(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)).applyBC(domain,ghost,bc);
cart.Initialize_geo_cell_lists(); cart.Initialize_geo_cell_lists();
cart.calculateGhostBoxes(); cart.calculateGhostBoxes();
...@@ -896,8 +901,8 @@ public: ...@@ -896,8 +901,8 @@ public:
{ {
CartDecomposition<dim,T,Memory,layout_base,Distribution> cart(v_cl); 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<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>*>(&cart))->operator=(static_cast<nn_prcs<dim,T>>(*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)); (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; cart.sub_domains = sub_domains;
...@@ -933,8 +938,8 @@ public: ...@@ -933,8 +938,8 @@ public:
{ {
CartDecomposition<dim,T> cart(v_cl); 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<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>*>(&cart))->operator=(static_cast<nn_prcs<dim,T>>(*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); 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>()); (static_cast<ie_ghost<dim,T,Memory2,layout_base2>*>(&cart))->operator=(ptr->template duplicate<Memory2,layout_base2>());
...@@ -970,8 +975,8 @@ public: ...@@ -970,8 +975,8 @@ public:
*/ */
CartDecomposition<dim,T,Memory, layout_base, Distribution> & operator=(const CartDecomposition & cart) 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<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>*>(this)->operator=(static_cast<nn_prcs<dim,T>>(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)); 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; sub_domains = cart.sub_domains;
...@@ -1010,8 +1015,8 @@ public: ...@@ -1010,8 +1015,8 @@ public:
*/ */
CartDecomposition<dim,T,Memory,layout_base, Distribution> & operator=(CartDecomposition && cart) 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<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>*>(this)->operator=(static_cast<nn_prcs<dim,T>>(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)); 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); sub_domains.swap(cart.sub_domains);
...@@ -1324,9 +1329,9 @@ public: ...@@ -1324,9 +1329,9 @@ public:
box_nn_processor.clear(); box_nn_processor.clear();
fine_s.clear(); fine_s.clear();
loc_box.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_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 /*! \brief Start decomposition
...@@ -1347,6 +1352,14 @@ public: ...@@ -1347,6 +1352,14 @@ public:
domain_nn_calculator_cart<dim>::reset(); domain_nn_calculator_cart<dim>::reset();
domain_nn_calculator_cart<dim>::setParameters(proc_box); 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 /*! \brief Refine the decomposition, available only for ParMetis distribution, for Metis it is a null call
...@@ -1556,7 +1569,8 @@ public: ...@@ -1556,7 +1569,8 @@ public:
return domain; 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; return sub_domains;
} }
...@@ -1808,9 +1822,9 @@ public: ...@@ -1808,9 +1822,9 @@ public:
vtk_box1.add(sub_domains); vtk_box1.add(sub_domains);
vtk_box1.write(output + std::string("subdomains_") + std::to_string(v_cl.getProcessUnitID()) + std::string(".vtk")); 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_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; return true;
} }
...@@ -1835,7 +1849,7 @@ public: ...@@ -1835,7 +1849,7 @@ public:
*/ */
bool check_consistency() 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 false;
return true; return true;
...@@ -1860,21 +1874,21 @@ public: ...@@ -1860,21 +1874,21 @@ public:
std::cout << "External ghost box\n"; 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++) 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"; 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++) 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: ...@@ -1888,10 +1902,10 @@ public:
*/ */
bool is_equal(CartDecomposition<dim,T,Memory> & cart) 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; 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; 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) 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: ...@@ -1934,10 +1948,10 @@ public:
*/ */
bool is_equal_ng(CartDecomposition<dim,T,Memory> & cart) 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; 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; 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) 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: ...@@ -246,8 +246,8 @@ public:
for (size_t i = 0 ; i < dim ; i++) for (size_t i = 0 ; i < dim ; i++)
this->bc[i] = dec.bc[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,layout_base,Memory> &>(*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)).applyBC(ext_domain,g,this->bc);
this->Initialize_geo_cell_lists(); this->Initialize_geo_cell_lists();
this->calculateGhostBoxes(); this->calculateGhostBoxes();
......
...@@ -100,7 +100,7 @@ class ie_ghost ...@@ -100,7 +100,7 @@ class ie_ghost
* for the processor p_id * 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 // Search for the correct id
size_t k = 0; size_t k = 0;
...@@ -224,9 +224,9 @@ protected: ...@@ -224,9 +224,9 @@ protected:
*/ */
void create_box_nn_processor_ext(Vcluster<> & v_cl, void create_box_nn_processor_ext(Vcluster<> & v_cl,
Ghost<dim,T> & ghost, 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 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()); box_nn_processor_int.resize(sub_domains.size());
proc_int_box.resize(nn_p.getNNProcessors()); proc_int_box.resize(nn_p.getNNProcessors());
...@@ -326,9 +326,9 @@ protected: ...@@ -326,9 +326,9 @@ protected:
*/ */
void create_box_nn_processor_int(Vcluster<> & v_cl, void create_box_nn_processor_int(Vcluster<> & v_cl,
Ghost<dim,T> & ghost, 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 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()); box_nn_processor_int.resize(sub_domains.size());
proc_int_box.resize(nn_p.getNNProcessors()); proc_int_box.resize(nn_p.getNNProcessors());
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* \see CartDecomposition * \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 class ie_loc_ghost
{ {
//! It contain the calculated local ghost boxes //! It contain the calculated local ghost boxes
...@@ -40,7 +40,7 @@ class ie_loc_ghost ...@@ -40,7 +40,7 @@ class ie_loc_ghost
* *
*/ */
void create_loc_ghost_ebox(Ghost<dim,T> & 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) openfpm::vector<Box_loc_sub<dim,T>> & sub_domains_prc)
{ {
comb<dim> zero; comb<dim> zero;
...@@ -101,7 +101,7 @@ class ie_loc_ghost ...@@ -101,7 +101,7 @@ class ie_loc_ghost
* *
*/ */
void create_loc_ghost_ibox(Ghost<dim,T> & 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) openfpm::vector<Box_loc_sub<dim,T>> & sub_domains_prc)
{ {
comb<dim> zero; comb<dim> zero;
...@@ -163,7 +163,7 @@ class ie_loc_ghost ...@@ -163,7 +163,7 @@ class ie_loc_ghost
for (size_t j = 0 ; j < cmbs.size() ; j++) 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; continue;
Box<dim,T> bp; Box<dim,T> bp;
...@@ -249,7 +249,7 @@ public: ...@@ -249,7 +249,7 @@ public:
* \param bc Boundary conditions * \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 // It will store local sub-domains + borders
openfpm::vector<Box_loc_sub<dim,T>> sub_domains_prc; openfpm::vector<Box_loc_sub<dim,T>> sub_domains_prc;
...@@ -275,13 +275,13 @@ public: ...@@ -275,13 +275,13 @@ public:
ie_loc_ghost() {}; ie_loc_ghost() {};
//! Constructor from another 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); this->operator=(ilg);
}; };
//! Constructor from temporal ie_loc_ghost //! 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); this->operator=(ilg);
} }
...@@ -293,7 +293,7 @@ public: ...@@ -293,7 +293,7 @@ public:
* \return itself * \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; loc_ghost_box = ilg.loc_ghost_box;
return *this; return *this;
...@@ -306,12 +306,50 @@ public: ...@@ -306,12 +306,50 @@ public:
* \return itself * \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); loc_ghost_box.swap(ilg.loc_ghost_box);
return *this; 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()