8 #ifndef DISTGRAPHFACTORYOLD_HPP_ 
    9 #define DISTGRAPHFACTORYOLD_HPP_ 
   11 #include "VCluster/VCluster.hpp" 
   12 #include "Vector/map_vector.hpp" 
   13 #include "Graph/map_graph.hpp" 
   14 #include "Grid/grid_sm.hpp" 
   15 #include "Space/Shape/Box.hpp" 
   16 #include "Space/Shape/HyperCube.hpp" 
   47 template<
unsigned int dim, 
typename dT, 
typename G_v, 
typename v, 
int impl>
 
   66             szd(
szd), gk(gk), g_v(g_v), gs(gs)
 
   74         typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<T::value>>::type t_val;
 
   76         g_v.template get<t_val::value>() = 
gk.get(T::value) * 
szd[T::value];
 
  107 template<
unsigned int dim, 
typename dT, 
typename G_v, 
typename v>
 
  151 template<
unsigned int dim, 
typename dT, 
typename G_v, 
typename v>
 
  171     :
szd(
szd), gk(gk), g_v(g_v), gs(gs)
 
  179         typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val;
 
  180         typedef typename boost::mpl::at<typename G_v::T_type::type,t_val>::type s_type;
 
  182         for (
size_t i = 0 ; i < std::extent<s_type>::value ; i++)
 
  183             g_v.template get<t_val::value>()[i] = 0.0;
 
  185         for (
size_t i = 0 ; i < dim ; i++)
 
  186             g_v.template get<t_val::value>()[i] = 
gk.get(i) * 
static_cast<float>(
szd[i]);
 
  197 template<
int i, 
typename p, 
typename Graph, 
int ... pos>
 
  201     typedef typename boost::mpl::at<p, boost::mpl::int_<0>>::type v_element;
 
  202     typedef typename boost::mpl::at<typename Graph::V_type::type, v_element>::type pos_prop_type;
 
  206         value = ((
sizeof...(pos) != 0) * (std::is_array<pos_prop_type>::value + 1))
 
  218 template<
typename p, 
typename Graph, 
int ... pos>
 
  236 template<
unsigned int dim, 
typename Graph, 
int se, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
  248         for (
size_t i = 0; i < dim; i++)
 
  270         size_t mod_v = g.
size() % Np;
 
  271         size_t div_v = g.
size() / Np;
 
  276         for (
int i = 0; i <= Np; i++)
 
  279                 vtxdist.get(i) = (div_v + 1) * (i);
 
  281                 vtxdist.get(i) = (div_v) * (i) + mod_v;
 
  285         size_t gp_size = vtxdist.get(p_id + 1) - vtxdist.get(p_id);
 
  291         gp.initDistributionVector(vtxdist);
 
  312             if (v_id < vtxdist.get(p_id + 1) && v_id >= vtxdist.get(p_id))
 
  319                 auto obj = gp.vertex(local_it);
 
  325                 fill_prop_v<dim, T, decltype(gp.vertex(local_it)), 
typename to_boost_vmpl<pos...>::type, 
fill_prop_v_by_type<
sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g);
 
  329                 boost::mpl::for_each<boost::mpl::range_c<int, 0, 
sizeof...(pos)> >(flp);
 
  333                 gp.setGlobalMap(v_id, local_it, v_id);
 
  337                 for (
size_t d = dim - 1; d >= dim_c; d--)
 
  345                     for (
size_t j = 0; j < c.size(); j++)
 
  353                         for (
size_t s = 0; s < dim; s++)
 
  355                             ele_sz += szd[s] * abs(c[j][s]);
 
  361                         size_t start_v = local_it;
 
  362                         size_t end_v = g.template LinId<CheckExistence>(key, c[j].getComb());
 
  365                         if (end_v < g.
size())
 
  368                             gp.template addEdge<NoCheck>(start_v, end_v).
template get<se>() = ele_sz;
 
  390 template<
unsigned int dim, 
typename Graph, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
  403         for (
size_t i = 0; i < dim; i++)
 
  425         size_t mod_v = g.
size() % Np;
 
  426         size_t div_v = g.
size() / Np;
 
  431         for (
size_t i = 0; i <= Np; i++)
 
  434                 vtxdist.get(i) = (div_v + 1) * (i);
 
  436                 vtxdist.get(i) = (div_v) * (i) + mod_v;
 
  439         size_t gp_size = vtxdist.get(p_id + 1) - vtxdist.get(p_id);
 
  445         gp.initDistributionVector(vtxdist);
 
  466             if (v_id < (
size_t)vtxdist.get(p_id + 1) && v_id >= (size_t)vtxdist.get(p_id))
 
  471                 auto obj = gp.vertex(local_it);
 
  477                 fill_prop_v<dim, T, decltype(gp.vertex(local_it)), 
typename to_boost_vmpl<pos...>::type, 
fill_prop_v_by_type<
sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g);
 
  481                 boost::mpl::for_each<boost::mpl::range_c<int, 0, 
sizeof...(pos)> >(flp);
 
  485                 gp.setGlobalMap(v_id, local_it, v_id);
 
  489                 for (
size_t d = dim - 1; d >= dim_c; d--)
 
  497                     for (
size_t j = 0; j < c.size(); j++)
 
  505                         for (
size_t s = 0; s < dim; s++)
 
  507                             ele_sz += szd[s] * abs(c[j][s]);
 
  513                         size_t start_v = local_it;
 
  514                         size_t end_v = g.template LinId<CheckExistence>(key, c[j].getComb());
 
  517                         if (end_v < g.
size())
 
  520                             gp.addEdge(start_v, end_v, v_id, end_v);
 
  540 template<
unsigned int dim, 
typename Graph>
 
  565     template<
int se, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
G_v & g_v
Vertex object to fill. 
 
mem_id LinId(const grid_key_dx< N > &gk, const char sum_id[N]) const 
Linearization of the grid_key_dx with a specified shift. 
 
This class work as a functor. 
 
static std::vector< comb< dim > > getCombinations_R(size_t d)
 
T getLow(int i) const 
get the i-coordinate of the low bound interval of the box 
 
grid_key_dx is the key to access any element in the grid 
 
size_t getProcessUnitID()
Get the process unit id. 
 
size_t size() const 
Return the size of the grid. 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom)
Construct Cartesian graph. 
 
Operator for vector and scalar property. 
 
T getHigh(int i) const 
get the high interval of the box 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom)
Construct Cartesian graph. 
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom)
Construct a cartesian graph, with V and E edge properties. 
 
grid_key_dx< dim > & gk
grid_key_dx Reference containing the actual position 
 
Implementation of VCluster class. 
 
to_boost_vmpl_impl< id...>::type type
constrict an mpl vector from the variadic 
 
const grid_key_dx< dim > & get() const 
Get the actual key. 
 
bool isNext()
Check if there is the next element. 
 
This class represent an N-dimensional box. 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
grid_key_dx< dim > & gk
grid_key_dx Reference containing the actual position 
 
This class construct a cartesian graph. 
 
fill_prop_v(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs)
Fill the object from where to take the properties. 
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
fill_prop_v(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs)
Fill the object from where to take the properties. 
 
G_v & g_v
Vertex object to fill. 
 
This class calculate elements of the hyper-cube. 
 
Graph constructor function specialization. 
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
const dT(& szd)[dim]
Reference to an array containing the spacing. 
 
const grid_sm< dim, void > & gs
grid info 
 
fill_prop_v(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs)
Fill the object from where to take the properties. 
 
size_t getProcessingUnits()
Get the total number of processors. 
 
const grid_sm< dim, void > & gs
grid info