8 #ifndef CARTESIANGRAPHFACTORY_HPP_ 
    9 #define CARTESIANGRAPHFACTORY_HPP_ 
   11 #include "Vector/map_vector.hpp" 
   12 #include "Graph/map_graph.hpp" 
   13 #include "Grid/grid_sm.hpp" 
   14 #include "Space/Shape/Box.hpp" 
   15 #include "Space/Shape/HyperCube.hpp" 
   17 #define NO_VERTEX_ID -1 
   25 template<
unsigned int dim, 
typename G_v, 
int prp>
 
   31         g_v.template get<prp>() = gs.
LinId(gk);
 
   39 template<
unsigned int dim, 
typename G_v>
 
   76 template<
unsigned int dim, 
int lin_
id, 
typename dT, 
typename G_v, 
typename v, 
int impl>
 
   98     :domain(domain), 
szd(
szd), gk(gk), g_v(g_v), gs(gs)
 
  106         typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<T::value>>::type t_val;
 
  108         g_v.template get<t_val::value>() = 
gk.get(T::value) * 
szd[T::value] + 
domain.
getLow(T::value);
 
  139 template<
unsigned int dim, 
int lin_
id, 
typename dT, 
typename G_v, 
typename v>
 
  183 template<
unsigned int dim, 
int lin_
id, 
typename dT, 
typename G_v, 
typename v>
 
  205     :domain(domain), 
szd(
szd), gk(gk), g_v(g_v), gs(gs)
 
  213         typedef typename boost::fusion::result_of::at<v, boost::mpl::int_<0>>::type t_val;
 
  214         typedef typename boost::mpl::at<typename G_v::T_type::type,t_val>::type s_type;
 
  216         for (
size_t i = 0 ; i < std::extent<s_type>::value ; i++)
 
  217             g_v.template get<t_val::value>()[i] = 0.0;
 
  219         for (
size_t i = 0 ; i < dim ; i++)
 
  220             g_v.template get<t_val::value>()[i] = 
gk.get(i) * 
static_cast<float>(
szd[i]) + 
domain.
getLow(i);
 
  233 template<
int i, 
typename p, 
typename Graph, 
int ... pos>
 
  238     typedef typename boost::mpl::at<p, boost::mpl::int_<0>>::type 
v_element;
 
  241     typedef typename boost::mpl::at<typename Graph::V_type::type, v_element>::type 
pos_prop_type;
 
  245         value = ((
sizeof...(pos) != 0) * (std::is_array<pos_prop_type>::value + 1))
 
  257 template<
typename p, 
typename Graph, 
int ... pos>
 
  275 template<
unsigned int dim, 
int lin_id, 
typename Graph, 
int se, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
  294         for (
size_t i = 0; i < dim; i++)
 
  326         while (k_it.isNext())
 
  332             auto obj = gp.vertex(g.
LinId(key));
 
  338             fill_prop<dim, lin_id, T, decltype(gp.vertex(g.
LinId(key))), 
typename to_boost_vmpl<pos...>::type, 
fill_prop_by_type<
sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
 
  342             boost::mpl::for_each<boost::mpl::range_c<int, 0, 
sizeof...(pos)> >(flp);
 
  346             for (
long int d = dim-1 ; d >= dim_c ; d--)
 
  354                 for (
size_t j = 0; j < c.size(); j++)
 
  363                     for (
size_t s = 0 ; s < dim ; s++)
 
  364                         ele_sz += szd[s] * abs(c[j][s]);
 
  369                     size_t start_v = g.
LinId(key);
 
  371                     size_t end_v = g.template LinId<CheckExistence>(key,c[j].getComb(),bc);
 
  374                     gp.template addEdge<CheckExistence>(start_v, end_v).
template get<se>() = ele_sz;
 
  396 template<
unsigned int dim, 
int lin_id, 
typename Graph, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
  416         for (
size_t i = 0; i < dim; i++)
 
  448         while (k_it.isNext())
 
  453             auto obj = gp.vertex(g.
LinId(key));
 
  459             fill_prop<dim, lin_id, T, decltype(gp.vertex(g.
LinId(key))), 
typename to_boost_vmpl<pos...>::type, 
fill_prop_by_type<
sizeof...(pos), p, Graph, pos...>::value> flp(obj, szd, key, g, dom);
 
  463             boost::mpl::for_each_ref<boost::mpl::range_c<int, 0, 
sizeof...(pos)> >(flp);
 
  467             for (
long int d = dim-1 ; d >= dim_c ; d--)
 
  475                 for (
size_t j = 0; j < c.size(); j++)
 
  480                     size_t start_v = g.
LinId(key);
 
  482                     size_t end_v = g.template LinId<CheckExistence>(key,c[j].getComb(),bc);
 
  485                     gp.template addEdge<CheckExistence>(start_v, end_v);
 
  506 template<
unsigned int dim, 
typename Graph>
 
  539     template<
int se, 
int id_prp, 
typename T, 
unsigned int dim_c, 
int ... pos>
 
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. 
 
const grid_sm< dim, void > & gs
grid info 
 
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 
 
Operator for vector and scalar property. 
 
fill_prop(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs, const Box< dim, dT > &domain)
Fill the object from where to take the properties. 
 
Graph constructor function specialization. 
 
grid_key_dx< dim > & gk
grid_key_dx Reference containing the actual position 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom, const size_t(&bc)[dim])
Construct a cartesian graph. 
 
G_v & g_v
Vertex object to fill. 
 
size_t size() const 
Return the size of the grid. 
 
T getHigh(int i) const 
get the high interval of the box 
 
G_v & g_v
Vertex object to fill. 
 
fill_prop(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs, const Box< dim, dT > &domain)
Fill the object from where to take the properties. 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom, const size_t(&bc)[dim])
Construct a cartesian graph. 
 
const Box< dim, dT > & domain
Domain. 
 
This class construct a cartesian graph. 
 
boost::mpl::at< typename Graph::V_type::type, v_element >::type pos_prop_type
Get the property v_element (v_element is a number) 
 
static void fill(G_v &g_v, const grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs)
function that fill with linearization indexes 
 
static void fill(G_v &g_v, const grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs)
function that fill with linearization indexes 
 
const dT(& szd)[dim]
Reference to an array containing the spacing. 
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
fill_prop(G_v &g_v, const dT(&szd)[dim], grid_key_dx< dim > &gk, const grid_sm< dim, void > &gs, const Box< dim, dT > &domain)
Fill the object from where to take the properties. 
 
boost::mpl::at< p, boost::mpl::int_< 0 > >::type v_element
Get the element 0. 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
void operator()(T &t) const 
It call the function for each property we want to copy. 
 
grid_key_dx< dim > & gk
grid_key_dx Reference containing the actual position 
 
const Box< dim, dT > & domain
Domain. 
 
This class calculate elements of the hyper-cube. 
 
static Graph construct(const size_t(&sz)[dim], Box< dim, T > dom, const size_t(&bc)[dim])
Construct a cartesian graph, with V and E edge properties. 
 
Operator to fill the property 'prp' with the linearization of indexes. 
 
const grid_sm< dim, void > & gs
grid info