Commit 726c6d4c authored by incardon's avatar incardon

Fixing LLVM compilation

parent c1d01c1f
......@@ -79,7 +79,7 @@ public:
*
*/
template<unsigned int dim, typename Graph, unsigned int se,typename T, unsigned int dim_c, int... pos>
template<unsigned int dim, typename Graph, int se,typename T, unsigned int dim_c, int... pos>
class Graph_constructor_impl
{
public:
......@@ -368,7 +368,7 @@ public:
* \tparam pos... (optional)one or more integer indicating the spatial properties
*
*/
template <unsigned int se,typename T, unsigned int dim_c, int... pos>
template <int se,typename T, unsigned int dim_c, int... pos>
static Graph construct(const size_t (& sz)[dim], Box<dim,T> dom)
{
return Graph_constructor_impl<dim,Graph,se,T,dim_c,pos...>::construct(sz,dom);
......
......@@ -44,6 +44,9 @@ class grid_dist_id
//! Space Decomposition
Decomposition dec;
//! Extension of each grid: Domain and ghost + domain
openfpm::vector<GBoxes<device_grid::dims>> gdb_ext;
//! Size of the grid on each dimension
size_t g_sz[dim];
......@@ -190,9 +193,10 @@ public:
size_t l_res[dim];
// Allocate the grids
for (size_t i = 0 ; i < n_grid ; i++)
{
gdb_ext.add();
// Get the local hyper-cube
SpaceBox<dim,St> sp = dec.getLocalHyperCube(i);
......@@ -215,8 +219,14 @@ public:
// convert from Ghost<dim,St> to Ghost<dim,size_t>
Ghost<dim,size_t> g_int_t = g_int;
// for each local grid save the extension of ghost + domain part
gdb_ext.last().Dbox = sp_t;
// Enlarge sp with the Ghost size
sp_t.enlarge(g_int_t);
sp_t.enlarge_fix_P1(g_int_t);
// Translate the domain (see GDBoxes for a visual meaning)
gdb_ext.last().Dbox.translate(g_int_t.getP1());
// Get the local size
for (size_t i = 0 ; i < dim ; i++) {l_res[i] = sp_t.getHigh(i) - sp_t.getLow(i);}
......@@ -237,7 +247,7 @@ public:
*/
grid_dist_iterator<dim,device_grid> getDomainIterator()
{
grid_dist_iterator<dim,device_grid> it(loc_grid,0);
grid_dist_iterator<dim,device_grid> it(loc_grid,gdb_ext);
return it;
}
......@@ -299,9 +309,11 @@ class grid_dist_id<1,T,Decomposition,Memory,device_grid>
size_t g_sz[1];
//! Communicator class
Vcluster & v_cl;
//! Extension of each grid: Domain and ghost + domain
openfpm::vector<GBoxes<device_grid::dims>> gdb_ext;
/*! \brief Get the grid size
*
* Get the grid size, given a domain, the resolution on it and another spaceBox
......@@ -349,6 +361,9 @@ public:
grid_dist_id(Vcluster v_cl, Decomposition & dec, size_t (& g_sz)[1], Box<1,T> & ghost)
:ghost(ghost),loc_grid(NULL),v_cl(v_cl)
{
// All this code is completely untested to assume broken
std::cout << "Error: " << __FILE__ << ":" << __LINE__ << " this structure is untested to assume broken ";
// fill the global size of the grid
for (int i = 0 ; i < 1 ; i++) {this->g_sz[i] = g_sz[i];}
......@@ -360,6 +375,9 @@ public:
grid_dist_id(size_t (& g_sz)[1])
:v_cl(*global_v_cluster),ghost(0)
{
// All this code is completely untested to assume broken
std::cout << "Error: " << __FILE__ << ":" << __LINE__ << " this structure is untested to assume broken ";
// fill the global size of the grid
for (int i = 0 ; i < 1 ; i++) {this->g_sz[i] = g_sz[i];}
......@@ -376,24 +394,20 @@ public:
size_t n_grid = 1;
// create local grids for each hyper-cube
loc_grid = v_cl.allocate<device_grid>(n_grid);
// Size of the grid on each dimension
size_t l_res[1];
// Calculate the local grid size
l_res[0] = g_sz[0] / v_cl.getProcessingUnits();
// Distribute the remaining
size_t residual = g_sz[0] % v_cl.getProcessingUnits();
if (v_cl.getProcessUnitID() < residual)
l_res[0]++;
// Set the dimensions of the local grid
loc_grid.get(0).template resize<Memory>(l_res);
}
......@@ -408,7 +422,7 @@ public:
*/
grid_dist_iterator<1,device_grid> getDomainIterator()
{
grid_dist_iterator<1,device_grid> it(loc_grid,0);
grid_dist_iterator<1,device_grid> it(loc_grid,gdb_ext);
return it;
}
......
......@@ -8,12 +8,47 @@
#ifndef GRID_DIST_ID_ITERATOR_HPP_
#define GRID_DIST_ID_ITERATOR_HPP_
/*! \brief This structure store the Box that define the domain inside the Ghost + domain box
*
\verbatim
(Ghost + Domain)
+------------------+
| |
| +------------+ <---------- (Domain)
| | | |
| | Domain | |
| | Box | |
| | | |
| | | |
| +------------+ |
| |
+------------------+
(0,0)
\endverbatim
*
* * Domain
*
* \tparam dim dimensionality
*
*/
template<unsigned int dim>
struct GBoxes
{
//! Ghost + Domain ghost
Box<dim,size_t> GDbox;
//! Domain box
Box<dim,size_t> Dbox;
};
#include "grid_dist_key.hpp"
#include "VCluster.hpp"
/*! \brief Distributed grid iterator
*
* Iterator across the local element of the distributed grid
* Iterator across the local elements of the distributed grid
*
*/
......@@ -26,6 +61,9 @@ class grid_dist_iterator
//! List of the grids we are going to iterate
Vcluster_object_array<device_grid> & gList;
//! Extension of each grid: domain and ghost + domain
const openfpm::vector<GBoxes<device_grid::dims>> & gdb_ext;
//! Actual iterator
grid_key_dx_iterator_sub<dim> a_it;
......@@ -39,13 +77,12 @@ class grid_dist_iterator
* \param gk std::vector of the local grid
*
*/
grid_dist_iterator(Vcluster_object_array<device_grid> & gk, size_t m)
:g_c(0),gList(gk),m(m)
grid_dist_iterator(Vcluster_object_array<device_grid> & gk, const openfpm::vector<GBoxes<device_grid::dims>> & gdb_ext)
:g_c(0),gdb_ext(gdb_ext),gList(gk),m(m)
{
// Initialize the current iterator
// with the first grid
a_it.reinitialize(gList[0].getDomainIterator());
a_it.reinitialize(gList[0].getIterator(gdb_ext.get(0).Dbox.getKP1(),gdb_ext.get(0).Dbox.getKP2()));
}
// Destructor
......@@ -58,15 +95,16 @@ class grid_dist_iterator
* assign
*
*/
grid_dist_iterator<dim,device_grid> & operator=(const grid_dist_iterator<dim,device_grid> & gdi)
/* grid_dist_iterator<dim,device_grid> & operator=(const grid_dist_iterator<dim,device_grid> & gdi)
{
g_c = gdi.g_c;
gList = gdi.gList;
a_it = gdi.a_it;
m = gdi.m;
gdb_ext = gdi.gdb_ext;
return *this;
}
}*/
/*! \brief Get the next element
*
......@@ -89,9 +127,10 @@ class grid_dist_iterator
g_c++;
// get the next grid iterator
if (g_c < gList.size())
a_it = gList[g_c].getDomainIterator();
{
a_it.reinitialize(gList[g_c].getIterator(gdb_ext.get(g_c).Dbox.getKP1(),gdb_ext.get(g_c).Dbox.getKP2()));
}
}
return *this;
......@@ -102,7 +141,6 @@ class grid_dist_iterator
* \return true if there is the next, false otherwise
*
*/
bool isNext()
{
// If there are no other grid stop
......
......@@ -72,16 +72,16 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
BOOST_REQUIRE_EQUAL(count,1024*1024);
size_t count_check = 0;
dom = g_dist.getDomainIterator();
auto dom2 = g_dist.getDomainIterator();
while (dom.isNext())
while (dom2.isNext())
{
auto key = dom.get();
auto key = dom2.get();
BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key),count_check);
count_check++;
++dom;
++dom2;
}
/* auto g_it = g_dist.getIteratorBulk();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment