8 #ifndef SRC_DECOMPOSITION_DISTRIBUTION_SPACEDISTRIBUTIONWEIGHT_HPP_ 
    9 #define SRC_DECOMPOSITION_DISTRIBUTION_SPACEDISTRIBUTIONWEIGHT_HPP_ 
   13 #include "util/mathutil.hpp" 
   14 #include "NN/CellList/CellDecomposer.hpp" 
   24 template<
unsigned int dim, 
typename T>
 
   25 class SpaceDistributionWeight
 
   49     SpaceDistributionWeight(
Vcluster & v_cl)
 
   59     SpaceDistributionWeight(SpaceDistributionWeight<dim,T> && pm)
 
   73         for (
size_t i = 0 ; i < dim ; i++)
 
   82         gp = g_factory_part.template construct<NO_EDGE, 
nm_v::id, T, dim - 1, 0>(gr.getSize(), domain, bc);
 
   87             for (
size_t i = 0; i < gp.getNVertex(); i++)
 
   88                 gp.vertex(i).template get<nm_v::x>()[2] = 0.0;
 
   90         for (
size_t i = 0; i < gp.getNVertex(); i++)
 
   91             gp.vertex(i).template get<nm_v::global_id>() = i;
 
  111         v_cl.SGather(id_w,0);
 
  117         tot /= v_cl.getProcessingUnits();
 
  120         if (v_cl.getProcessUnitID() == 0)
 
  122             for (
size_t i = 0 ; i < id_w.
size() ; i++)
 
  123                 gp.template vertex_p<nm_v::computation>(id_w.get(i).id) = id_w.get(i).w;
 
  130             for (
size_t i = 0; i < dim ; i++)
 
  132                 if (max < gr.size(i))
 
  137             size_t order = openfpm::math::log2_64(max);
 
  138             if (1ul << order < max)
 
  141             size_t n = 1 << order;
 
  145             CellDecomposer_sm<dim,T> cd_sm;
 
  146             cd_sm.setDimensions(domain, gr.getSize(), 0);
 
  156             for (
size_t i = 0 ; i < dim ; i++)
 
  157                 spacing[i] = (domain.getHigh(i) - domain.getLow(i)) / n;
 
  169                 g.template get<0>(
key) = -1;
 
  177             while (h_it.isNext())
 
  179               auto key = h_it.get();
 
  184               for (
size_t i = 0 ; i < dim ; i++)
 
  185                   p.
get(i) = 
key.get(i) * spacing[i] + spacing[i] / 2;
 
  189               if (g.template get<0>(sp) == -1)
 
  191                   g.template get<0>(sp) = proc_d;
 
  207                 auto key = it2.get();
 
  209                 gp.template vertex_p<nm_v::proc_id>(gr.LinId(
key)) = g.template get<0>(
key);
 
  211                 id_w.get(g.template get<1>(
key)) = g.template get<1>(
key);
 
  243         return gr.size() % v_cl.getProcessingUnits();
 
  252     void getSubSubDomainPosition(
size_t id, T (&pos)[dim])
 
  255         if (
id >= gp.getNVertex())
 
  256             std::cerr << __FILE__ << 
":" << __LINE__ << 
"Such vertex doesn't exist (id = " << 
id << 
", " << 
"total size = " << gp.getNVertex() << 
")\n";
 
  260         pos[0] = gp.vertex(
id).template get<nm_v::x>()[0];
 
  261         pos[1] = gp.vertex(
id).template get<nm_v::x>()[1];
 
  263             pos[2] = gp.vertex(
id).template get<nm_v::x>()[2];
 
  272     inline void setComputationCost(
size_t id, 
size_t weight)
 
  274         std::cout << __FILE__ << 
":" << __LINE__ << 
" You are trying to set the computation cost on a fixed decomposition, this operation has no effect" << std::endl;
 
  281     bool weightsAreUsed()
 
  291     size_t getSubSubDomainComputationCost(
size_t id)
 
  300     size_t getProcessorLoad()
 
  303         size_t Np = v_cl.getProcessingUnits();
 
  307         size_t N_tot = gr.size();
 
  308         size_t N_best_each = N_tot / Np;
 
  309         size_t N_rest = N_tot % Np;
 
  311         if (v_cl.getProcessUnitID() < N_rest)
 
  322     void setMigrationCost(
size_t id, 
size_t migration)
 
  332     void setCommunicationCost(
size_t v_id, 
size_t e, 
size_t communication)
 
  339     size_t getNSubSubDomains()
 
  341         return gp.getNVertex();
 
  348     size_t getNSubSubDomainNeighbors(
size_t id)
 
  350         return gp.getNChilds(
id);
 
  358     void write(
const std::string & file)
 
  361         gv2.write(std::to_string(v_cl.getProcessUnitID()) + 
"_" + file + 
".vtk");
 
  377         domain = dist.domain;
 
grid_key_dx is the key to access any element in the grid 
 
Class that distribute sub-sub-domains across processors using an hilbert curve to divide the space...
 
This class implement the point shape in an N-dimensional space. 
 
Implementation of VCluster class. 
 
This class construct a cartesian graph. 
 
Graph_CSR< nm_v, nm_e > gp
Global sub-sub-domain graph. 
 
Box< dim, T > domain
rectangular domain to decompose 
 
const T & get(size_t i) const 
Get coordinate. 
 
This class represent an N-dimensional box. 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
static const unsigned int id
id property id in boost::fusion::vector 
 
grid_sm< dim, void > gr
Structure that store the cartesian grid information. 
 
Implementation of 1-D std::vector like structure.