diff --git a/Jenkinsfile b/Jenkinsfile
index 4e5279a7cc4b931f5498e19a7525be700d5377d1..2d622a19bf28eb0d92f009f889cd6884593abbcb 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,5 +1,8 @@
#!groovy
+timeout(180)
+{
+
parallel (
@@ -123,4 +126,5 @@ parallel (
}
)
+}
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 567033182f1851fcce48c0b7f9e0f42f2da227ee..0000000000000000000000000000000000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-SUBDIRS = src images openfpm_data openfpm_io openfpm_devices openfpm_vcluster openfpm_numerics
-
-ACLOCAL_AMFLAGS = -I m4
-
-bin_PROGRAMS =
-
-pdata:
- cd src && make
-
-data:
- cd openfpm_data/src && make
-
-devices:
- cd openfpm_devices/src && make
-
-vcluster:
- cd openfpm_vcluster/src && make
-
-io:
- cd openfpm_io/src && make
-
-numerics:
- cd openfpm_numerics/src && make
-
-actual_test:
- cd src && make actual_test
-
-
-
-test_pdata:
- cd src && make test
-
-test_data:
- cd openfpm_data/src && make test
-
-test_devices:
- cd openfpm_devices/src && make test
-
-test_vcluster:
- cd openfpm_vcluster/src && make test
-
-test_io:
- cd openfpm_io/src && make test
-
-test_numerics:
- cd openfpm_numerics/src && make test
-
-test: test_devices test_data test_vcluster test_pdata test_io test_numerics
-
-.PHONY: test_pdata test_data test_devices test_vcluster test_io test_numerics
-
diff --git a/example/Vector/1_ghost_get_put/main.cpp b/example/Vector/1_ghost_get_put/main.cpp
index 0180e4942c5241f87f32ef83e34f6fe1fdf22313..6edb63b08bce8ef13aa6774afb3dd18fd8b81c71 100644
--- a/example/Vector/1_ghost_get_put/main.cpp
+++ b/example/Vector/1_ghost_get_put/main.cpp
@@ -10,7 +10,6 @@
*
* This example shows more in details the functionalities of **ghost_get** and **ghost_put** for a distributed vector.
*
- *
* ## Inclusion ## {#e1_v_inclusion}
*
* We activate the vector_dist functionalities
@@ -175,7 +174,7 @@ int main(int argc, char* argv[])
* Before and after. The blue arrows in the first image indicate the vector field
* for the real particles. In the second image instead the red arrow indicate the
* vector field for the real particle. The blue arrow indicate the ghosts. We can
- * note that the blue arrow doea not contain the correct vector. The reason is that
+ * note that the blue arrow does not contain the correct vector. The reason is that
* when we used **ghost_get** we synchronized the scalar, and the tensor, but not the vector.
*
* \see \ref e1_part_ghost
@@ -187,6 +186,34 @@ int main(int argc, char* argv[])
*
* \endhtmlonly
*
+ * ## So ... how I have to put these ghost_get ##
+ *
+ * The first thing to do is to place the ghost in a way that the program work
+ * in parallel for sure. In order to do this we can do the following reasoning:
+ * If we have a loop over particles we distinguish two type of loops:
+ *
+ * * A loop that iterate over particles
+ * * A loop that iterate over particles and neighborhood particles
+ *
+ *
+ * If the loop is of the first type (you do not loop over the neighborhood particles)
+ * ghost_get is not necessary. If I am in the second case I need a ghost_get. The
+ * second point is which property I have to synchronize ghost_get<...>(), or more
+ * practically what I have to put in the ... . To answer this we have to check all
+ * the properties that we use from the neighborhood particles and pass it to ghost_get
+ * as a list. To summarize:
+ \code{.unparsed}
+
+ I am doing a simple loop over particles (1), or I am looping also over neighborhood particles (2)?
+ For the case (1) the answer is "I do not need ghost_get". For the case (2) the answer is "I need ghost_get"
+
+ if I am on the case (2) the second question is which parameters should I use ?
+ The answer is look at all vd.getProp<...>(b) where b is a neighborhood particle. All ... properties should appear in
+ ghost_get<...>()
+
+ \endcode
+ * This reasoning is always enough to have ghost_get function always placed correctly. For
+ * more fine tuning look at the options below
*
*/
diff --git a/images/Metis_gen_vtk.cpp b/images/Metis_gen_vtk.cpp
index fab84b629b64ed764f6e86a55be4db0f1fa7b96d..7cf1277656de10a99ba44092dc6381206f871ac5 100644
--- a/images/Metis_gen_vtk.cpp
+++ b/images/Metis_gen_vtk.cpp
@@ -16,7 +16,7 @@
int main(int argc, char ** argv)
{
- CartesianGraphFactory<2,Graph_CSR> g_factory;
+ CartesianGraphFactory<2,Graph_CSR,nm_e>> g_factory;
// Cartesian grid
size_t sz[2] = {20,20};
@@ -28,19 +28,19 @@ int main(int argc, char ** argv)
// Graph to decompose
- Graph_CSR g = g_factory.construct(sz,box,bc);
+ Graph_CSR,nm_e> g = g_factory.construct(sz,box,bc);
// Convert the graph to metis
- Metis> met(g,4);
+ Metis,nm_e>> met(g,4);
// decompose
- met.decompose();
+ met.decompose();
// Write the decomposition
- VTKWriter,VTK_GRAPH> vtk(g);
+ VTKWriter,nm_e>,VTK_GRAPH> vtk(g);
vtk.write("Metis/vtk_partition.vtk");
}
diff --git a/openfpm_data b/openfpm_data
index 808312d7af8c8f94c746a6d6213737a1d5d506f4..f982d0ac3f3ae0eefbd1ca9e39a700b8898f8ee9 160000
--- a/openfpm_data
+++ b/openfpm_data
@@ -1 +1 @@
-Subproject commit 808312d7af8c8f94c746a6d6213737a1d5d506f4
+Subproject commit f982d0ac3f3ae0eefbd1ca9e39a700b8898f8ee9
diff --git a/openfpm_devices b/openfpm_devices
index f3508e0b1535cf724a7376c38ab58f3ac4b697e8..9f473a4f9e8bd1301fa9721bdb384b15f763aec6 160000
--- a/openfpm_devices
+++ b/openfpm_devices
@@ -1 +1 @@
-Subproject commit f3508e0b1535cf724a7376c38ab58f3ac4b697e8
+Subproject commit 9f473a4f9e8bd1301fa9721bdb384b15f763aec6
diff --git a/openfpm_io b/openfpm_io
index 10a8194fadb8009f1dc9cb22d0f118d612170267..eafa24bd983173dfd9c4e9c49e88b160096066ff 160000
--- a/openfpm_io
+++ b/openfpm_io
@@ -1 +1 @@
-Subproject commit 10a8194fadb8009f1dc9cb22d0f118d612170267
+Subproject commit eafa24bd983173dfd9c4e9c49e88b160096066ff
diff --git a/openfpm_vcluster b/openfpm_vcluster
index df344ad1e781b02b91b111e0904bd06d9970b042..95f93aaa9ef1df480d9daf8d2f8c4295513c9f9b 160000
--- a/openfpm_vcluster
+++ b/openfpm_vcluster
@@ -1 +1 @@
-Subproject commit df344ad1e781b02b91b111e0904bd06d9970b042
+Subproject commit 95f93aaa9ef1df480d9daf8d2f8c4295513c9f9b
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e048fec43ba78370084b34b97a26bc8b59228ae..a56b261aae3c2f6f12dd8d9b3a1b5eebfb1cf25b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,10 +14,14 @@ else()
set(CUDA_SOURCES)
endif()
-add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp
+add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp
+ Amr/grid_dist_amr_unit_tests.cpp
+ Amr/tests/amr_base_unit_tests.cpp
Debug/debug_test.cpp
Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp
Grid/tests/grid_dist_id_unit_test.cpp
+ Grid/tests/sgrid_dist_id_unit_tests.cpp
+ #Grid/tests/grid_dist_id_dlb_unit_test.cpp
Grid/tests/staggered_grid_dist_unit_test.cpp
Vector/tests/vector_dist_cell_list_tests.cpp
Vector/tests/vector_dist_complex_prp_unit_test.cpp
diff --git a/src/Decomposition/CartDecomposition.hpp b/src/Decomposition/CartDecomposition.hpp
index 709aec59b2ea4220da8702992c72f7d02270a4be..4a1624c7ee92f34a65b92b955d308d12619b2833 100755
--- a/src/Decomposition/CartDecomposition.hpp
+++ b/src/Decomposition/CartDecomposition.hpp
@@ -378,7 +378,7 @@ public:
// Optimize the decomposition creating bigger spaces
// And reducing Ghost over-stress
- dec_optimizer> d_o(dist.getGraph(), gr_dist.getSize());
+ dec_optimizer, nm_e>> d_o(dist.getGraph(), gr_dist.getSize());
// Ghost
Ghost ghe;
@@ -391,7 +391,7 @@ public:
}
// optimize the decomposition
- d_o.template optimize(dist.getGraph(), p_id, loc_box, box_nn_processor,ghe,bc);
+ d_o.template optimize(dist.getGraph(), p_id, loc_box, box_nn_processor,ghe,bc);
// Initialize
if (loc_box.size() > 0)
@@ -454,9 +454,6 @@ public:
// Check if the box is valid
if (bound.isValidN() == true)
{
- // Not necessary, but I prefer
- bound.enlarge(ghost);
-
// calculate the sub-divisions
size_t div[dim];
for (size_t i = 0; i < dim; i++)
@@ -873,7 +870,10 @@ public:
cart.cd = cd;
cart.domain = domain;
for (size_t i = 0 ; i < dim ; i++)
- {cart.spacing[i] = spacing[i];};
+ {
+ cart.spacing[i] = spacing[i];
+ cart.magn[i] = magn[i];
+ };
cart.bbox = bbox;
cart.ghost = g;
@@ -916,7 +916,10 @@ public:
cart.domain = domain;
cart.sub_domains_global = sub_domains_global;
for (size_t i = 0 ; i < dim ; i++)
- {cart.spacing[i] = spacing[i];};
+ {
+ cart.spacing[i] = spacing[i];
+ cart.magn[i] = magn[i];
+ };
cart.ghost = ghost;
@@ -1027,6 +1030,9 @@ public:
dist = cart.dist;
commCostSet = cart.commCostSet;
cd = cart.cd;
+ gr_dist = cart.gr_dist;
+ dist = cart.dist;
+
domain = cart.domain;
sub_domains_global.swap(cart.sub_domains_global);
@@ -1842,6 +1848,23 @@ public:
return v_cl;
}
+ /*! \brief Deallocate structures that identify a point to which internal ghost is located
+ *
+ */
+ void free_geo_cell()
+ {
+ ie_ghost::free_geo_cell();
+ }
+
+ /*! \brief Deallocate structures that identify a point to which internal ghost is located
+ *
+ */
+ void free_fines()
+ {
+ fine_s.clear();
+ fine_s.destroy();
+ }
+
/*! \brief function to check the consistency of the information of the decomposition
*
* \return false if is inconsistent
diff --git a/src/Decomposition/Distribution/DistParMetisDistribution.hpp b/src/Decomposition/Distribution/DistParMetisDistribution.hpp
index 232c1941c5b335b968caf424991f3c10fe7feca5..ddfe9fca9f98eca424b1ab1cd56296e9caee3888 100644
--- a/src/Decomposition/Distribution/DistParMetisDistribution.hpp
+++ b/src/Decomposition/Distribution/DistParMetisDistribution.hpp
@@ -26,10 +26,10 @@ class DistParMetisDistribution
Box domain;
//! Processor sub-sub-domain graph
- DistGraph_CSR g;
+ DistGraph_CSR, nm_e> g;
//! Convert the graph to parmetis format
- DistParmetis> parmetis_graph;
+ DistParmetis, nm_e>> parmetis_graph;
//! Init vtxdist needed for Parmetis
openfpm::vector vtxdist;
@@ -91,20 +91,20 @@ public:
domain = dom;
//! Create sub graph
- DistGraphFactory> dist_g_factory;
+ DistGraphFactory, nm_e>> dist_g_factory;
g = dist_g_factory.template construct(gr.getSize(), domain);
g.getDecompositionVector(vtxdist);
if (dim == 2)
for (size_t i = 0; i < g.getNVertex(); i++)
- g.vertex(i).template get()[2] = 0;
+ g.vertex(i).template get()[2] = 0;
}
/*! \brief Get the current graph (main)
*
*/
- DistGraph_CSR & getGraph()
+ DistGraph_CSR, nm_e> & getGraph()
{
return g;
}
@@ -118,7 +118,7 @@ public:
parmetis_graph.initSubGraph(g);
//! Decompose
- parmetis_graph.decompose(g);
+ parmetis_graph.template decompose(g);
//! Get result partition for this processors
idx_t *partition = parmetis_graph.getPartition();
@@ -143,7 +143,7 @@ public:
parmetis_graph.reset(g);
//! Refine
- parmetis_graph.refine(g);
+ parmetis_graph.template refine(g);
//! Get result partition for this processors
idx_t *partition = parmetis_graph.getPartition();
@@ -194,10 +194,10 @@ public:
std::cerr << __FILE__ << ":" << __LINE__ << " Position - Such vertex doesn't exist (id = " << id << ", " << "total size = " << g.getNVertex() << ")\n";
#endif
- pos[0] = g.vertex(id).template get()[0];
- pos[1] = g.vertex(id).template get()[1];
+ pos[0] = g.vertex(id).template get()[0];
+ pos[1] = g.vertex(id).template get()[1];
if (dim == 3)
- pos[2] = g.vertex(id).template get()[2];
+ pos[2] = g.vertex(id).template get()[2];
}
/*! \brief Function that set the weight of the vertex
@@ -215,7 +215,7 @@ public:
#endif
// If the vertex is inside this processor update the value
- g.vertex(id).template get() = weight;
+ g.vertex(id).template get() = weight;
}
@@ -242,7 +242,7 @@ public:
std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << g.getTotNVertex() << ")\n";
#endif
- return g.vertex(id).template get();
+ return g.vertex(id).template get();
}
/*! \brief Compute the processor load counting the total weights of its vertices
@@ -255,7 +255,7 @@ public:
for (size_t i = 0; i < g.getNVertex(); i++)
{
- load += g.vertex(i).template get();
+ load += g.vertex(i).template get();
}
return load;
}
@@ -292,7 +292,7 @@ public:
std::cerr << __FILE__ << ":" << __LINE__ << "Migration - Such vertex doesn't exist (id = " << id << ", " << "total size = " << g.getNVertex() << ")\n";
#endif
- g.vertex(id).template get() = migration;
+ g.vertex(id).template get() = migration;
}
/*! \brief Set communication cost of the edge id
@@ -338,7 +338,7 @@ public:
*/
void write(const std::string & file)
{
- VTKWriter, DIST_GRAPH> gv2(g);
+ VTKWriter, nm_e>, DIST_GRAPH> gv2(g);
gv2.write(std::to_string(file + ".vtk"));
}
diff --git a/src/Decomposition/Distribution/MetisDistribution.hpp b/src/Decomposition/Distribution/MetisDistribution.hpp
index f0a022b7af973f3fccafa561d83f98c4a66efc2b..5c9179d9261772f5b286ffb4a861c9e4f04bb647 100644
--- a/src/Decomposition/Distribution/MetisDistribution.hpp
+++ b/src/Decomposition/Distribution/MetisDistribution.hpp
@@ -53,13 +53,13 @@ class MetisDistribution
Box domain;
//! Global sub-sub-domain graph
- Graph_CSR gp;
+ Graph_CSR, nm_e> gp;
//! Flag that indicate if we are doing a test (In general it fix the seed)
bool testing = false;
//! Metis decomposer utility
- Metis> metis_graph;
+ Metis, nm_e>> metis_graph;
//! unordered map that map global sub-sub-domain to owned_cost_sub id
std::unordered_map owner_scs;
@@ -104,7 +104,7 @@ class MetisDistribution
public:
- static constexpr unsigned int computation = nm_v::computation;
+ static constexpr unsigned int computation = nm_v_computation;
/*! \brief constructor
*
@@ -182,20 +182,20 @@ public:
domain = dom;
// Create a cartesian grid graph
- CartesianGraphFactory> g_factory_part;
- gp = g_factory_part.template construct(gr.getSize(), domain, bc);
+ CartesianGraphFactory, nm_e>> g_factory_part;
+ gp = g_factory_part.template construct(gr.getSize(), domain, bc);
// Init to 0.0 axis z (to fix in graphFactory)
if (dim < 3)
{
for (size_t i = 0; i < gp.getNVertex(); i++)
{
- gp.vertex(i).template get()[2] = 0.0;
+ gp.vertex(i).template get()[2] = 0.0;
}
}
for (size_t i = 0; i < gp.getNVertex(); i++)
- gp.vertex(i).template get() = i;
+ gp.vertex(i).template get() = i;
}
/*! \brief Get the current graph (main)
@@ -203,7 +203,7 @@ public:
* \return the current sub-sub domain Graph
*
*/
- Graph_CSR & getGraph()
+ Graph_CSR, nm_e> & getGraph()
{
#ifdef SE_CLASS2
check_valid(this,8);
@@ -230,7 +230,7 @@ public:
{
// we fill the assignment
for (size_t i = 0 ; i < recv_ass.size() ; i++)
- gp.template vertex_p(recv_ass.get(i).id) = recv_ass.get(i).w;
+ gp.template vertex_p(recv_ass.get(i).id) = recv_ass.get(i).w;
metis_graph.initMetisGraph(v_cl.getProcessingUnits(),true);
}
@@ -239,13 +239,13 @@ public:
metis_graph.onTest(testing);
// decompose
- metis_graph.decompose();
+ metis_graph.template decompose();
if (recv_ass.size() != 0)
{
// we fill the assignment
for (size_t i = 0 ; i < recv_ass.size() ; i++)
- recv_ass.get(i).w = gp.template vertex_p(recv_ass.get(i).id);
+ recv_ass.get(i).w = gp.template vertex_p(recv_ass.get(i).id);
}
else
{
@@ -255,7 +255,7 @@ public:
for (size_t i = 0 ; i < gp.getNVertex() ; i++)
{
recv_ass.get(i).id = i;
- recv_ass.get(i).w = gp.template vertex_p(i);
+ recv_ass.get(i).w = gp.template vertex_p(i);
}
}
}
@@ -277,7 +277,7 @@ public:
// Fill the metis graph
for (size_t i = 0 ; i < recv_ass.size() ; i++)
{
- gp.template vertex_p(recv_ass.get(i).id) = recv_ass.get(i).w;
+ gp.template vertex_p(recv_ass.get(i).id) = recv_ass.get(i).w;
if (recv_ass.get(i).w == v_cl.getProcessUnitID())
{
@@ -330,10 +330,10 @@ public:
check_overflow(id);
// Copy the geometrical informations inside the pos vector
- pos[0] = gp.vertex(id).template get()[0];
- pos[1] = gp.vertex(id).template get()[1];
+ pos[0] = gp.vertex(id).template get()[0];
+ pos[1] = gp.vertex(id).template get()[1];
if (dim == 3)
- pos[2] = gp.vertex(id).template get()[2];
+ {pos[2] = gp.vertex(id).template get()[2];}
}
/*! \brief function that get the computational cost of the sub-sub-domain
@@ -349,7 +349,7 @@ public:
check_valid(this,8);
#endif
check_overflow(id);
- return gp.vertex(id).template get();
+ return gp.vertex(id).template get();
}
@@ -394,7 +394,7 @@ public:
check_overflow(id);
#endif
- gp.vertex(id).template get() = cost;
+ gp.vertex(id).template get() = cost;
}
/*! \brief Set communication cost between neighborhood sub-sub-domains (weight on the edge)
@@ -522,7 +522,7 @@ public:
check_valid(this,8);
#endif
- VTKWriter, VTK_GRAPH> gv2(gp);
+ VTKWriter, nm_e>, VTK_GRAPH> gv2(gp);
gv2.write(std::to_string(v_cl.getProcessUnitID()) + "_" + out + ".vtk");
}
@@ -545,7 +545,7 @@ public:
if (v_cl.getProcessUnitID() == 0)
{
for (size_t i = 0; i < gp.getNVertex(); i++)
- loads.get(gp.template vertex_p(i)) += gp.template vertex_p(i);
+ {loads.get(gp.template vertex_p(i)) += gp.template vertex_p(i);}
for (size_t i = 0 ; i < v_cl.getProcessingUnits() ; i++)
{
diff --git a/src/Decomposition/Distribution/ParMetisDistribution.hpp b/src/Decomposition/Distribution/ParMetisDistribution.hpp
index 456a57a57dd0fdca971de2c53af3e0bf7d210c73..dc562b37826adb6882acf0513303bf4874b96bf7 100644
--- a/src/Decomposition/Distribution/ParMetisDistribution.hpp
+++ b/src/Decomposition/Distribution/ParMetisDistribution.hpp
@@ -48,10 +48,10 @@ class ParMetisDistribution
Box domain;
//! Global sub-sub-domain graph
- Graph_CSR gp;
+ Graph_CSR, nm_e> gp;
//! Convert the graph to parmetis format
- Parmetis> parmetis_graph;
+ Parmetis, nm_e>> parmetis_graph;
//! Id of the sub-sub-domain where we set the costs
openfpm::vector sub_sub_owner;
@@ -115,10 +115,10 @@ class ParMetisDistribution
auto v_id = m2g.find(l)->second.id;
// Update proc id in the vertex (using the old map)
- gp.template vertex_p(v_id) = partitions.get(i).get(k);
+ gp.template vertex_p(v_id) = partitions.get(i).get(k);
if (partitions.get(i).get(k) == (long int)v_cl.getProcessUnitID())
- sub_sub_owner.add(v_id);
+ {sub_sub_owner.add(v_id);}
// Add vertex to temporary structure of distribution (needed to update main graph)
v_per_proc.get(partitions.get(i).get(k)).add(getVertexGlobalId(l));
@@ -138,12 +138,12 @@ class ParMetisDistribution
for (size_t i = 0 ; i < gp.getNVertex(); ++i)
{
- size_t pid = gp.template vertex_p(i);
+ size_t pid = gp.template vertex_p(i);
rid j = rid(vtxdist.get(pid).id + cnt.get(pid));
gid gi = gid(i);
- gp.template vertex_p(i) = j.id;
+ gp.template vertex_p(i) = j.id;
cnt.get(pid)++;
setMapId(j,gi);
@@ -328,8 +328,8 @@ public:
domain = dom;
// Create a cartesian grid graph
- CartesianGraphFactory> g_factory_part;
- gp = g_factory_part.template construct(gr.getSize(), domain, bc);
+ CartesianGraphFactory, nm_e>> g_factory_part;
+ gp = g_factory_part.template construct(gr.getSize(), domain, bc);
initLocalToGlobalMap();
//! Get the number of processing units
@@ -354,12 +354,12 @@ public:
{
for (size_t i = 0; i < gp.getNVertex(); i++)
{
- gp.vertex(i).template get()[2] = 0.0;
+ gp.vertex(i).template get()[2] = 0.0;
}
}
for (size_t i = 0; i < gp.getNVertex(); i++)
{
- gp.vertex(i).template get() = i;
+ gp.vertex(i).template get() = i;
}
}
@@ -367,7 +367,7 @@ public:
/*! \brief Get the current graph (main)
*
*/
- Graph_CSR & getGraph()
+ Graph_CSR, nm_e> & getGraph()
{
return gp;
}
@@ -466,10 +466,10 @@ public:
#endif
// Copy the geometrical informations inside the pos vector
- pos[0] = gp.vertex(id).template get()[0];
- pos[1] = gp.vertex(id).template get()[1];
+ pos[0] = gp.vertex(id).template get()[0];
+ pos[1] = gp.vertex(id).template get()[1];
if (dim == 3)
- pos[2] = gp.vertex(id).template get()[2];
+ pos[2] = gp.vertex(id).template get()[2];
}
/*! \brief Function that set the weight of the vertex
@@ -481,15 +481,15 @@ public:
inline void setComputationCost(size_t id, size_t weight)
{
if (!verticesGotWeights)
- verticesGotWeights = true;
+ {verticesGotWeights = true;}
#ifdef SE_CLASS1
if (id >= gp.getNVertex())
- std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n";
+ {std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n";}
#endif
// Update vertex in main graph
- gp.vertex(id).template get() = weight;
+ gp.vertex(id).template get() = weight;
}
/*! \brief Checks if weights are used on the vertices
@@ -513,7 +513,7 @@ public:
std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n";
#endif
- return gp.vertex(id).template get();
+ return gp.vertex(id).template get();
}
/*! \brief Compute the processor load counting the total weights of its vertices
@@ -529,7 +529,7 @@ public:
for (rid i = vtxdist.get(p_id); i < vtxdist.get(p_id+1) ; ++i)
- load += gp.vertex(m2g.find(i)->second.id).template get();
+ load += gp.vertex(m2g.find(i)->second.id).template get();
//std::cout << v_cl.getProcessUnitID() << " weight " << load << " size " << sub_g.getNVertex() << "\n";
return load;
@@ -547,7 +547,7 @@ public:
std::cerr << __FILE__ << ":" << __LINE__ << "Such vertex doesn't exist (id = " << id << ", " << "total size = " << gp.getNVertex() << ")\n";
#endif
- gp.vertex(id).template get() = migration;
+ gp.vertex(id).template get() = migration;
}
/*! \brief Set communication cost of the edge id
@@ -618,6 +618,22 @@ public:
return gp.getNChilds(id);
}
+ /*! \brief In case we do not do Dynamic load balancing this this data-structure it is safe to eliminate the full internal graph
+ *
+ *
+ *
+ */
+ void destroy_internal_graph()
+ {
+ gp.destroy();
+ partitions.clear();
+ partitions.shrink_to_fit();
+ v_per_proc.clear();
+ v_per_proc.shrink_to_fit();
+ m2g.clear();
+ m2g.rehash(0);
+ }
+
/*! \brief Print the current distribution and save it to VTK file
*
* \param file filename
@@ -625,7 +641,7 @@ public:
*/
void write(const std::string & file)
{
- VTKWriter, VTK_GRAPH> gv2(gp);
+ VTKWriter, nm_e>, VTK_GRAPH> gv2(gp);
gv2.write(std::to_string(v_cl.getProcessUnitID()) + "_" + file + ".vtk");
}
@@ -663,6 +679,18 @@ public:
return *this;
}
+ /*! \brief return the the position of the sub-sub-domain
+ *
+ * \param i sub-sub-domain id
+ * \param p point
+ *
+ */
+ void getSubSubDomainPos(size_t j, Point & p)
+ {
+ for (size_t i = 0 ; i < dim ; i++)
+ {p.get(i) = gp.template vertex_p<0>(sub_sub_owner.get(j))[i];}
+ }
+
/*! \brief Get the decomposition counter
*
* \return the decomposition counter
diff --git a/src/Decomposition/Distribution/SpaceDistribution.hpp b/src/Decomposition/Distribution/SpaceDistribution.hpp
index 714a67b0db7f6a313e198a80b3316972231e74c3..eee50baa23321e38cac8cfe7eed774072185df6f 100644
--- a/src/Decomposition/Distribution/SpaceDistribution.hpp
+++ b/src/Decomposition/Distribution/SpaceDistribution.hpp
@@ -33,7 +33,7 @@ class SpaceDistribution
Box domain;
//! Global sub-sub-domain graph
- Graph_CSR gp;
+ Graph_CSR, nm_e> gp;
public:
@@ -86,24 +86,24 @@ public:
domain = dom;
// Create a cartesian grid graph
- CartesianGraphFactory> g_factory_part;
- gp = g_factory_part.template construct(gr.getSize(), domain, bc);
+ CartesianGraphFactory, nm_e>> g_factory_part;
+ gp = g_factory_part.template construct(gr.getSize(), domain, bc);
// Init to 0.0 axis z (to fix in graphFactory)
if (dim < 3)
{
for (size_t i = 0; i < gp.getNVertex(); i++)
- gp.vertex(i).template get()[2] = 0.0;
+ gp.vertex(i).template get()[2] = 0.0;
}
for (size_t i = 0; i < gp.getNVertex(); i++)
- gp.vertex(i).template get() = i;
+ gp.vertex(i).template get() = i;
}
/*! \brief Get the current graph (main)
*
*/
- Graph_CSR & getGraph()
+ Graph_CSR, nm_e> & getGraph()
{
return gp;
}
@@ -212,7 +212,7 @@ public:
{
auto key = it2.get();
- gp.template vertex_p(gr.LinId(key)) = g.template get<0>(key);
+ gp.template vertex_p(gr.LinId(key)) = g.template get<0>(key);
++it2;
}
@@ -253,10 +253,10 @@ public:
#endif
// Copy the geometrical informations inside the pos vector
- pos[0] = gp.vertex(id).template get()[0];
- pos[1] = gp.vertex(id).template get()[1];
+ pos[0] = gp.vertex(id).template get()[0];
+ pos[1] = gp.vertex(id).template get()[1];
if (dim == 3)
- pos[2] = gp.vertex(id).template get()[2];
+ pos[2] = gp.vertex(id).template get()[2];
}
/*! \brief Function that set the weight of the vertex
@@ -357,7 +357,7 @@ public:
*/
void write(const std::string & file)
{
- VTKWriter, VTK_GRAPH> gv2(gp);
+ VTKWriter, nm_e>, VTK_GRAPH> gv2(gp);
gv2.write(std::to_string(v_cl.getProcessUnitID()) + "_" + file + ".vtk");
}
diff --git a/src/Decomposition/Distribution/metis_util.hpp b/src/Decomposition/Distribution/metis_util.hpp
index 3b3129a3d4627567220cfabc25eeff44f834e09a..6da3f698b8bcc7f17a68a85be91b8eeb04ead058 100644
--- a/src/Decomposition/Distribution/metis_util.hpp
+++ b/src/Decomposition/Distribution/metis_util.hpp
@@ -149,9 +149,9 @@ class Metis
for (size_t i = 0; i < g.getNVertex(); i++)
{
// Add weight to vertex and migration cost
- Mg.vwgt[i] = g.vertex(i).template get();
+ Mg.vwgt[i] = g.vertex(i).template get();
Mg.vwgt[i] = (Mg.vwgt[i] == 0)?1:Mg.vwgt[i];
- Mg.vsize[i] = g.vertex(i).template get();
+ Mg.vsize[i] = g.vertex(i).template get();
Mg.vsize[i] = (Mg.vsize[i] == 0)?1:Mg.vsize[i];
// Calculate the starting point in the adjacency list
diff --git a/src/Decomposition/Distribution/metis_util_unit_test.hpp b/src/Decomposition/Distribution/metis_util_unit_test.hpp
index 0b2f4d1c2f60999453f83dedc1e1b9a413fb84fa..fc9cc729c4a21f14a94ae440e0c08a7a4695535f 100644
--- a/src/Decomposition/Distribution/metis_util_unit_test.hpp
+++ b/src/Decomposition/Distribution/metis_util_unit_test.hpp
@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE( Metis_test_use)
if (v_cl.getProcessUnitID() != 0)
return;
- CartesianGraphFactory<3,Graph_CSR> g_factory;
+ CartesianGraphFactory<3,Graph_CSR,nm_e>> g_factory;
CartesianGraphFactory<3,Graph_CSR> g_factory_part;
// Cartesian grid
@@ -46,26 +46,26 @@ BOOST_AUTO_TEST_CASE( Metis_test_use)
size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
// Graph to decompose
- Graph_CSR g = g_factory.construct(sz,box,bc);
+ Graph_CSR,nm_e> g = g_factory.construct(sz,box,bc);
// Processor graph
Graph_CSR gp = g_factory_part.construct(sz,box,bc);
// Convert the graph to metis
- Metis> met(g,8);
+ Metis,nm_e>> met(g,8);
// decompose
met.decompose(gp);
- met.decompose();
+ met.decompose();
// Write the VTK file
VTKWriter,VTK_GRAPH> vtk(gp);
vtk.write("vtk_metis_util_gp.vtk");
- VTKWriter,VTK_GRAPH> vtk2(g);
+ VTKWriter,nm_e>,VTK_GRAPH> vtk2(g);
vtk2.write("vtk_metis_util_g.vtk");
// check that match
diff --git a/src/Decomposition/Distribution/parmetis_dist_util.hpp b/src/Decomposition/Distribution/parmetis_dist_util.hpp
index 1952ee5de351080f57b37291ad9ff032ca454d31..66f577cd3e23846e3c1cc6128b3380351b4d0c8c 100755
--- a/src/Decomposition/Distribution/parmetis_dist_util.hpp
+++ b/src/Decomposition/Distribution/parmetis_dist_util.hpp
@@ -143,8 +143,8 @@ class DistParmetis
size_t idx = sub_g.nodeById(j);
// Add weight to vertex and migration cost
- Mg.vwgt[i] = sub_g.vertex(idx).template get();
- Mg.vsize[i] = sub_g.vertex(idx).template get();
+ Mg.vwgt[i] = sub_g.vertex(idx).template get();
+ Mg.vsize[i] = sub_g.vertex(idx).template get();
// Calculate the starting point in the adjacency list
Mg.xadj[id] = prev;
diff --git a/src/Decomposition/Distribution/parmetis_util.hpp b/src/Decomposition/Distribution/parmetis_util.hpp
index 14e658664364caf61205c7355807c859ff911586..4ef7af152a2417ed0501a1fa54965e25ab0af957 100755
--- a/src/Decomposition/Distribution/parmetis_util.hpp
+++ b/src/Decomposition/Distribution/parmetis_util.hpp
@@ -174,8 +174,8 @@ class Parmetis
gid idx = m2g.find(i)->second;
// Add weight to vertex and migration cost
- Mg.vwgt[j] = g.vertex(idx.id).template get();
- Mg.vsize[j] = g.vertex(idx.id).template get();
+ Mg.vwgt[j] = g.vertex(idx.id).template get();
+ Mg.vsize[j] = g.vertex(idx.id).template get();
// Calculate the starting point in the adjacency list
Mg.xadj[id] = prev;
@@ -186,7 +186,7 @@ class Parmetis
size_t child = g.getChild(idx.id, s);
- Mg.adjncy[prev + s] = g.vertex(child).template get();
+ Mg.adjncy[prev + s] = g.vertex(child).template get();
Mg.adjwgt[prev + s] = g.getChildEdge(idx.id, s).template get();
}
diff --git a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph0_test.vtk b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph0_test.vtk
index dcf99916688c27374d407f1529db09b786f37103..c6989ea512109045cbc3ebd0cca1c170eb35a7c9 100644
--- a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph0_test.vtk
+++ b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph0_test.vtk
@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
-0.000000 0.000000 0.000000
-0.125000 0.000000 0.000000
-0.250000 0.000000 0.000000
-0.375000 0.000000 0.000000
-0.500000 0.000000 0.000000
-0.625000 0.000000 0.000000
-0.750000 0.000000 0.000000
-0.875000 0.000000 0.000000
-0.000000 0.125000 0.000000
-0.125000 0.125000 0.000000
-0.250000 0.125000 0.000000
-0.375000 0.125000 0.000000
-0.500000 0.125000 0.000000
-0.625000 0.125000 0.000000
-0.750000 0.125000 0.000000
-0.875000 0.125000 0.000000
-0.000000 0.250000 0.000000
-0.125000 0.250000 0.000000
-0.250000 0.250000 0.000000
-0.375000 0.250000 0.000000
-0.500000 0.250000 0.000000
-0.625000 0.250000 0.000000
-0.750000 0.250000 0.000000
-0.875000 0.250000 0.000000
-0.000000 0.375000 0.000000
-0.125000 0.375000 0.000000
-0.250000 0.375000 0.000000
-0.375000 0.375000 0.000000
-0.500000 0.375000 0.000000
-0.625000 0.375000 0.000000
-0.750000 0.375000 0.000000
-0.875000 0.375000 0.000000
-0.000000 0.500000 0.000000
-0.125000 0.500000 0.000000
-0.250000 0.500000 0.000000
-0.375000 0.500000 0.000000
-0.500000 0.500000 0.000000
-0.625000 0.500000 0.000000
-0.750000 0.500000 0.000000
-0.875000 0.500000 0.000000
-0.000000 0.625000 0.000000
-0.125000 0.625000 0.000000
-0.250000 0.625000 0.000000
-0.375000 0.625000 0.000000
-0.500000 0.625000 0.000000
-0.625000 0.625000 0.000000
-0.750000 0.625000 0.000000
-0.875000 0.625000 0.000000
-0.000000 0.750000 0.000000
-0.125000 0.750000 0.000000
-0.250000 0.750000 0.000000
-0.375000 0.750000 0.000000
-0.500000 0.750000 0.000000
-0.625000 0.750000 0.000000
-0.750000 0.750000 0.000000
-0.875000 0.750000 0.000000
-0.000000 0.875000 0.000000
-0.125000 0.875000 0.000000
-0.250000 0.875000 0.000000
-0.375000 0.875000 0.000000
-0.500000 0.875000 0.000000
-0.625000 0.875000 0.000000
-0.750000 0.875000 0.000000
-0.875000 0.875000 0.000000
+0.000000 0.000000 0
+0.125000 0.000000 0
+0.250000 0.000000 0
+0.375000 0.000000 0
+0.500000 0.000000 0
+0.625000 0.000000 0
+0.750000 0.000000 0
+0.875000 0.000000 0
+0.000000 0.125000 0
+0.125000 0.125000 0
+0.250000 0.125000 0
+0.375000 0.125000 0
+0.500000 0.125000 0
+0.625000 0.125000 0
+0.750000 0.125000 0
+0.875000 0.125000 0
+0.000000 0.250000 0
+0.125000 0.250000 0
+0.250000 0.250000 0
+0.375000 0.250000 0
+0.500000 0.250000 0
+0.625000 0.250000 0
+0.750000 0.250000 0
+0.875000 0.250000 0
+0.000000 0.375000 0
+0.125000 0.375000 0
+0.250000 0.375000 0
+0.375000 0.375000 0
+0.500000 0.375000 0
+0.625000 0.375000 0
+0.750000 0.375000 0
+0.875000 0.375000 0
+0.000000 0.500000 0
+0.125000 0.500000 0
+0.250000 0.500000 0
+0.375000 0.500000 0
+0.500000 0.500000 0
+0.625000 0.500000 0
+0.750000 0.500000 0
+0.875000 0.500000 0
+0.000000 0.625000 0
+0.125000 0.625000 0
+0.250000 0.625000 0
+0.375000 0.625000 0
+0.500000 0.625000 0
+0.625000 0.625000 0
+0.750000 0.625000 0
+0.875000 0.625000 0
+0.000000 0.750000 0
+0.125000 0.750000 0
+0.250000 0.750000 0
+0.375000 0.750000 0
+0.500000 0.750000 0
+0.625000 0.750000 0
+0.750000 0.750000 0
+0.875000 0.750000 0
+0.000000 0.875000 0
+0.125000 0.875000 0
+0.250000 0.875000 0
+0.375000 0.875000 0
+0.500000 0.875000 0
+0.625000 0.875000 0
+0.750000 0.875000 0
+0.875000 0.875000 0
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
diff --git a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph1_test.vtk b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph1_test.vtk
index d0d289f29ed2547edb989d16439d0e270b76f5c3..032cbbcf8101e5d3a4779a6715d76601ef8c6edb 100644
--- a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph1_test.vtk
+++ b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph1_test.vtk
@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
-0.000000 0.000000 0.000000
-0.125000 0.000000 0.000000
-0.250000 0.000000 0.000000
-0.375000 0.000000 0.000000
-0.500000 0.000000 0.000000
-0.625000 0.000000 0.000000
-0.750000 0.000000 0.000000
-0.875000 0.000000 0.000000
-0.000000 0.125000 0.000000
-0.125000 0.125000 0.000000
-0.250000 0.125000 0.000000
-0.375000 0.125000 0.000000
-0.500000 0.125000 0.000000
-0.625000 0.125000 0.000000
-0.750000 0.125000 0.000000
-0.875000 0.125000 0.000000
-0.000000 0.250000 0.000000
-0.125000 0.250000 0.000000
-0.250000 0.250000 0.000000
-0.375000 0.250000 0.000000
-0.500000 0.250000 0.000000
-0.625000 0.250000 0.000000
-0.750000 0.250000 0.000000
-0.875000 0.250000 0.000000
-0.000000 0.375000 0.000000
-0.125000 0.375000 0.000000
-0.250000 0.375000 0.000000
-0.375000 0.375000 0.000000
-0.500000 0.375000 0.000000
-0.625000 0.375000 0.000000
-0.750000 0.375000 0.000000
-0.875000 0.375000 0.000000
-0.000000 0.500000 0.000000
-0.125000 0.500000 0.000000
-0.250000 0.500000 0.000000
-0.375000 0.500000 0.000000
-0.500000 0.500000 0.000000
-0.625000 0.500000 0.000000
-0.750000 0.500000 0.000000
-0.875000 0.500000 0.000000
-0.000000 0.625000 0.000000
-0.125000 0.625000 0.000000
-0.250000 0.625000 0.000000
-0.375000 0.625000 0.000000
-0.500000 0.625000 0.000000
-0.625000 0.625000 0.000000
-0.750000 0.625000 0.000000
-0.875000 0.625000 0.000000
-0.000000 0.750000 0.000000
-0.125000 0.750000 0.000000
-0.250000 0.750000 0.000000
-0.375000 0.750000 0.000000
-0.500000 0.750000 0.000000
-0.625000 0.750000 0.000000
-0.750000 0.750000 0.000000
-0.875000 0.750000 0.000000
-0.000000 0.875000 0.000000
-0.125000 0.875000 0.000000
-0.250000 0.875000 0.000000
-0.375000 0.875000 0.000000
-0.500000 0.875000 0.000000
-0.625000 0.875000 0.000000
-0.750000 0.875000 0.000000
-0.875000 0.875000 0.000000
+0.000000 0.000000 0
+0.125000 0.000000 0
+0.250000 0.000000 0
+0.375000 0.000000 0
+0.500000 0.000000 0
+0.625000 0.000000 0
+0.750000 0.000000 0
+0.875000 0.000000 0
+0.000000 0.125000 0
+0.125000 0.125000 0
+0.250000 0.125000 0
+0.375000 0.125000 0
+0.500000 0.125000 0
+0.625000 0.125000 0
+0.750000 0.125000 0
+0.875000 0.125000 0
+0.000000 0.250000 0
+0.125000 0.250000 0
+0.250000 0.250000 0
+0.375000 0.250000 0
+0.500000 0.250000 0
+0.625000 0.250000 0
+0.750000 0.250000 0
+0.875000 0.250000 0
+0.000000 0.375000 0
+0.125000 0.375000 0
+0.250000 0.375000 0
+0.375000 0.375000 0
+0.500000 0.375000 0
+0.625000 0.375000 0
+0.750000 0.375000 0
+0.875000 0.375000 0
+0.000000 0.500000 0
+0.125000 0.500000 0
+0.250000 0.500000 0
+0.375000 0.500000 0
+0.500000 0.500000 0
+0.625000 0.500000 0
+0.750000 0.500000 0
+0.875000 0.500000 0
+0.000000 0.625000 0
+0.125000 0.625000 0
+0.250000 0.625000 0
+0.375000 0.625000 0
+0.500000 0.625000 0
+0.625000 0.625000 0
+0.750000 0.625000 0
+0.875000 0.625000 0
+0.000000 0.750000 0
+0.125000 0.750000 0
+0.250000 0.750000 0
+0.375000 0.750000 0
+0.500000 0.750000 0
+0.625000 0.750000 0
+0.750000 0.750000 0
+0.875000 0.750000 0
+0.000000 0.875000 0
+0.125000 0.875000 0
+0.250000 0.875000 0
+0.375000 0.875000 0
+0.500000 0.875000 0
+0.625000 0.875000 0
+0.750000 0.875000 0
+0.875000 0.875000 0
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
diff --git a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph2_test.vtk b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph2_test.vtk
index a0aa5eb72dfd5efd32ebae411d1efc595f413639..a6e39770ee025a5035e5c0610cbec8c1ebfbff19 100644
--- a/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph2_test.vtk
+++ b/src/Decomposition/Distribution/test_data/dec_optimizer_disc_graph2_test.vtk
@@ -359,70 +359,70 @@ LINES 224 672
2 63 55
POINT_DATA 64
VECTORS x float
-0.000000 0.000000 0.000000
-0.125000 0.000000 0.000000
-0.250000 0.000000 0.000000
-0.375000 0.000000 0.000000
-0.500000 0.000000 0.000000
-0.625000 0.000000 0.000000
-0.750000 0.000000 0.000000
-0.875000 0.000000 0.000000
-0.000000 0.125000 0.000000
-0.125000 0.125000 0.000000
-0.250000 0.125000 0.000000
-0.375000 0.125000 0.000000
-0.500000 0.125000 0.000000
-0.625000 0.125000 0.000000
-0.750000 0.125000 0.000000
-0.875000 0.125000 0.000000
-0.000000 0.250000 0.000000
-0.125000 0.250000 0.000000
-0.250000 0.250000 0.000000
-0.375000 0.250000 0.000000
-0.500000 0.250000 0.000000
-0.625000 0.250000 0.000000
-0.750000 0.250000 0.000000
-0.875000 0.250000 0.000000
-0.000000 0.375000 0.000000
-0.125000 0.375000 0.000000
-0.250000 0.375000 0.000000
-0.375000 0.375000 0.000000
-0.500000 0.375000 0.000000
-0.625000 0.375000 0.000000
-0.750000 0.375000 0.000000
-0.875000 0.375000 0.000000
-0.000000 0.500000 0.000000
-0.125000 0.500000 0.000000
-0.250000 0.500000 0.000000
-0.375000 0.500000 0.000000
-0.500000 0.500000 0.000000
-0.625000 0.500000 0.000000
-0.750000 0.500000 0.000000
-0.875000 0.500000 0.000000
-0.000000 0.625000 0.000000
-0.125000 0.625000 0.000000
-0.250000 0.625000 0.000000
-0.375000 0.625000 0.000000
-0.500000 0.625000 0.000000
-0.625000 0.625000 0.000000
-0.750000 0.625000 0.000000
-0.875000 0.625000 0.000000
-0.000000 0.750000 0.000000
-0.125000 0.750000 0.000000
-0.250000 0.750000 0.000000
-0.375000 0.750000 0.000000
-0.500000 0.750000 0.000000
-0.625000 0.750000 0.000000
-0.750000 0.750000 0.000000
-0.875000 0.750000 0.000000
-0.000000 0.875000 0.000000
-0.125000 0.875000 0.000000
-0.250000 0.875000 0.000000
-0.375000 0.875000 0.000000
-0.500000 0.875000 0.000000
-0.625000 0.875000 0.000000
-0.750000 0.875000 0.000000
-0.875000 0.875000 0.000000
+0.000000 0.000000 0
+0.125000 0.000000 0
+0.250000 0.000000 0
+0.375000 0.000000 0
+0.500000 0.000000 0
+0.625000 0.000000 0
+0.750000 0.000000 0
+0.875000 0.000000 0
+0.000000 0.125000 0
+0.125000 0.125000 0
+0.250000 0.125000 0
+0.375000 0.125000 0
+0.500000 0.125000 0
+0.625000 0.125000 0
+0.750000 0.125000 0
+0.875000 0.125000 0
+0.000000 0.250000 0
+0.125000 0.250000 0
+0.250000 0.250000 0
+0.375000 0.250000 0
+0.500000 0.250000 0
+0.625000 0.250000 0
+0.750000 0.250000 0
+0.875000 0.250000 0
+0.000000 0.375000 0
+0.125000 0.375000 0
+0.250000 0.375000 0
+0.375000 0.375000 0
+0.500000 0.375000 0
+0.625000 0.375000 0
+0.750000 0.375000 0
+0.875000 0.375000 0
+0.000000 0.500000 0
+0.125000 0.500000 0
+0.250000 0.500000 0
+0.375000 0.500000 0
+0.500000 0.500000 0
+0.625000 0.500000 0
+0.750000 0.500000 0
+0.875000 0.500000 0
+0.000000 0.625000 0
+0.125000 0.625000 0
+0.250000 0.625000 0
+0.375000 0.625000 0
+0.500000 0.625000 0
+0.625000 0.625000 0
+0.750000 0.625000 0
+0.875000 0.625000 0
+0.000000 0.750000 0
+0.125000 0.750000 0
+0.250000 0.750000 0
+0.375000 0.750000 0
+0.500000 0.750000 0
+0.625000 0.750000 0
+0.750000 0.750000 0
+0.875000 0.750000 0
+0.000000 0.875000 0
+0.125000 0.875000 0
+0.250000 0.875000 0
+0.375000 0.875000 0
+0.500000 0.875000 0
+0.625000 0.875000 0
+0.750000 0.875000 0
+0.875000 0.875000 0
SCALARS migration unsigned_int
LOOKUP_TABLE default
0
diff --git a/src/Decomposition/cuda/decomposition_cuda_tests.cu b/src/Decomposition/cuda/decomposition_cuda_tests.cu
index 1521e8edf26cd592889be360606edbfd2f3d3b3c..a0d4db13af22d68e76dbdcc15eff8feeb9f14a93 100644
--- a/src/Decomposition/cuda/decomposition_cuda_tests.cu
+++ b/src/Decomposition/cuda/decomposition_cuda_tests.cu
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_check_cross_consistency_between_proc_idb
p2 = p1;
- p2.get(j) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(j),-1.0);
+// p2.get(j) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(j),-1.0);
auto gpudec = dec.toKernel();
diff --git a/src/Decomposition/dec_optimizer_unit_test.hpp b/src/Decomposition/dec_optimizer_unit_test.hpp
index c23b33c633017e52c84d570f11214cd89bc11799..84a1d7b522286568aa97745a14b72e9876da8815 100644
--- a/src/Decomposition/dec_optimizer_unit_test.hpp
+++ b/src/Decomposition/dec_optimizer_unit_test.hpp
@@ -22,7 +22,7 @@ BOOST_AUTO_TEST_SUITE( dec_optimizer_test )
BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_np)
{
- CartesianGraphFactory<3,Graph_CSR> g_factory;
+ CartesianGraphFactory<3,Graph_CSR,nm_e>> g_factory;
CartesianGraphFactory<3,Graph_CSR> g_factory_part;
// Cartesian grid
@@ -35,30 +35,30 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_np)
size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
// Graph to decompose
- Graph_CSR g = g_factory.construct(sz,box,bc);
+ Graph_CSR,nm_e> g = g_factory.construct(sz,box,bc);
// Processor graph
Graph_CSR gp = g_factory_part.construct(sz,box,bc);
// Convert the graph to metis
- Metis> met(g,16);
+ Metis,nm_e>> met(g,16);
// decompose
met.decompose(gp);
- met.decompose();
+ met.decompose();
// optimize
- dec_optimizer<3,Graph_CSR> d_o(g,sz);
+ dec_optimizer<3,Graph_CSR,nm_e>> d_o(g,sz);
Ghost<3,size_t> ghe(1);
grid_key_dx<3> keyZero(0,0,0);
- d_o.optimize(keyZero,g,ghe,bc);
+ d_o.optimize(keyZero,g,ghe,bc);
}
BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_p)
{
- CartesianGraphFactory<3,Graph_CSR> g_factory;
+ CartesianGraphFactory<3,Graph_CSR,nm_e>> g_factory;
CartesianGraphFactory<3,Graph_CSR> g_factory_part;
// Cartesian grid
@@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_p)
size_t bc[] = {PERIODIC,PERIODIC,PERIODIC};
// Graph to decompose
- Graph_CSR g = g_factory.construct(sz,box,bc);
+ Graph_CSR,nm_e> g = g_factory.construct(sz,box,bc);
// Processor graph
Graph_CSR gp = g_factory_part.construct(sz,box,bc);
@@ -97,13 +97,13 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_p)
grid_key_dx<3> key(i,j,k);
gp.vertex(gs.LinId(key)).get() = id;
- g.vertex(gs.LinId(key)).get() = id;
+ g.vertex(gs.LinId(key)).get() = id;
}
}
}
// optimize
- dec_optimizer<3,Graph_CSR> d_o(g,sz);
+ dec_optimizer<3,Graph_CSR,nm_e>> d_o(g,sz);
grid_key_dx<3> keyZero(0,0,0);
@@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_p)
Ghost<3,size_t> ghe(1);
// gp,p_id,loc_box,box_nn_processor,bc
- d_o.optimize(g,-1,dec_o,box_nn_processor,ghe,bc);
+ d_o.optimize(g,-1,dec_o,box_nn_processor,ghe,bc);
BOOST_REQUIRE_EQUAL(box_nn_processor.size(),8ul);
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
if (vcl.getProcessingUnits() != 3)
return;
- CartesianGraphFactory<2,Graph_CSR> g_factory;
+ CartesianGraphFactory<2,Graph_CSR,nm_e>> g_factory;
// Cartesian grid
size_t sz[2] = {GS_SIZE,GS_SIZE};
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
size_t bc[] = {NON_PERIODIC,NON_PERIODIC};
// Graph to decompose
- Graph_CSR g = g_factory.construct(sz,box,bc);
+ Graph_CSR,nm_e> g = g_factory.construct(sz,box,bc);
SimpleRNG rng;
@@ -163,14 +163,14 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
{
auto vk = vit.get();
- g.vertex_p(vk) = rng.GetUniform() * 2.9999;
- g.vertex_p(vk) = 100;
+ g.vertex_p(vk) = rng.GetUniform() * 2.9999;
+ g.vertex_p(vk) = 100;
++vit;
}
// optimize
- dec_optimizer<2,Graph_CSR> d_o(g,sz);
+ dec_optimizer<2,Graph_CSR,nm_e>> d_o(g,sz);
// set of Boxes produced by the decomposition optimizer
openfpm::vector<::Box<2, size_t>> loc_box;
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
openfpm::vector > box_nn_processor;
Ghost<2,size_t> ghe(1);
- d_o.optimize(g, vcl.getProcessUnitID(), loc_box, box_nn_processor,ghe,bc);
+ d_o.optimize(g, vcl.getProcessUnitID(), loc_box, box_nn_processor,ghe,bc);
std::stringstream str_g;
str_g << "dec_optimizer_disc_graph" << vcl.getProcessUnitID() << ".vtk";
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_disconnected_subdomains_np)
std::stringstream str_st;
str_st << "src/Decomposition/Distribution/test_data/dec_optimizer_disc_sub" << vcl.getProcessUnitID() << "_test.vtk";
- VTKWriter,VTK_GRAPH> wrt(g);
+ VTKWriter,nm_e>,VTK_GRAPH> wrt(g);
wrt.write("dec_optimizer_disc_graph" + std::to_string(vcl.getProcessUnitID()) + ".vtk");
VTKWriter>, VECTOR_BOX> vtk_box1;
diff --git a/src/Decomposition/ie_ghost.hpp b/src/Decomposition/ie_ghost.hpp
index 3cd43fd281a72e014f1a479247945c25bdc57cd2..9124fdd7574d62dc612fdc670c1434c591c917aa 100755
--- a/src/Decomposition/ie_ghost.hpp
+++ b/src/Decomposition/ie_ghost.hpp
@@ -204,7 +204,15 @@ protected:
void Initialize_geo_cell(const Box & domain, const size_t (&div)[dim])
{
// Initialize the geo_cell structure
- geo_cell.Initialize(domain,div,0);
+ geo_cell.Initialize(domain,div,1);
+ }
+
+ /*! \brief Deallocate structures that identify a point to which internal ghost is located
+ *
+ */
+ void free_geo_cell()
+ {
+ geo_cell.destroy();
}
/*! \brief Create the box_nn_processor_int (bx part) structure
@@ -423,8 +431,8 @@ protected:
// update the geo_cell list
// get the cells this box span
- const grid_key_dx p1 = geo_cell.getCellGrid(b_int.getP1());
- const grid_key_dx p2 = geo_cell.getCellGrid(b_int.getP2());
+ const grid_key_dx p1 = geo_cell.getCellGrid_me(b_int.getP1());
+ const grid_key_dx p2 = geo_cell.getCellGrid_pe(b_int.getP2());
// Get the grid and the sub-iterator
auto & gi = geo_cell.getGrid();
diff --git a/src/Decomposition/ie_loc_ghost.hpp b/src/Decomposition/ie_loc_ghost.hpp
index 45938be42ce479dce43fa6194b82bae0b6038a1a..2e93329ceabc4c6d30e494df95affeb2a98fe2b9 100755
--- a/src/Decomposition/ie_loc_ghost.hpp
+++ b/src/Decomposition/ie_loc_ghost.hpp
@@ -504,7 +504,7 @@ public:
/*! \brief Considering that sub-domains has N internal local ghost box identified
* with the 0 <= k < N that come from the intersection of 2 sub-domains i and j
* where j is enlarged, given the sub-domain i and the id k of the internal box,
- * it return the id of the other sub-domain that produced the intersection
+ * it return the id j of the other sub-domain that produced the intersection
*
* \param i sub-domain
* \param k id
@@ -519,7 +519,7 @@ public:
/*! \brief Considering that sub-domains has N external local ghost box identified
* with the 0 <= k < N that come from the intersection of 2 sub-domains i and j
* where i is enlarged, given the sub-domain i and the id k of the external box,
- * it return the id of the other sub-domain that produced the intersection
+ * it return the id of the other sub-domain j that produced the intersection
*
* \param i sub-domain
* \param k id
diff --git a/src/Decomposition/tests/CartDecomposition_unit_test.cpp b/src/Decomposition/tests/CartDecomposition_unit_test.cpp
index 8d23de4571e00a5bf67cdb34da045512feb8901b..bc06bdbded0b22b2758d10bfab97e50f52148be1 100755
--- a/src/Decomposition/tests/CartDecomposition_unit_test.cpp
+++ b/src/Decomposition/tests/CartDecomposition_unit_test.cpp
@@ -3,6 +3,7 @@
#include "Decomposition/CartDecomposition.hpp"
#include "util/mathutil.hpp"
+#include "nn_processor_unit_test.hpp"
BOOST_AUTO_TEST_SUITE (CartDecomposition_test)
diff --git a/src/Decomposition/nn_processor_unit_test.hpp b/src/Decomposition/tests/nn_processor_unit_test.hpp
similarity index 100%
rename from src/Decomposition/nn_processor_unit_test.hpp
rename to src/Decomposition/tests/nn_processor_unit_test.hpp
diff --git a/src/Grid/Iterators/grid_dist_id_iterator.hpp b/src/Grid/Iterators/grid_dist_id_iterator.hpp
index 7c3ca85e995bbb7f815164e1a2eed97838bdaf41..eacea46e2a66696c042bcd19f8d376b3aaa53d83 100644
--- a/src/Grid/Iterators/grid_dist_id_iterator.hpp
+++ b/src/Grid/Iterators/grid_dist_id_iterator.hpp
@@ -10,27 +10,39 @@
#define FREE 1
#define FIXED 2
+#define ITERATION_ISOLATION 4
#include "Grid/grid_dist_key.hpp"
#include "VCluster/VCluster.hpp"
#include "util/GBoxes.hpp"
-
-/*! \brief Distributed grid iterator
- *
- * Iterator across the local elements of the distributed grid
- *
- * \tparam dim dimensionality of the grid
- * \tparam device_grid type of basic grid
- * \tparam impl implementation
- *
- */
-template
-class grid_dist_iterator
+template
+struct selvg
{
-
+ template
+ static inline void call(a_it_type & a_it, gdb_ext_type & gdb_ext, gList_type & gList, size_t & g_c)
+ {
+ if (gdb_ext.get(g_c).Dbox.isValid() == false)
+ {g_c++;}
+ else
+ {
+ a_it.reinitialize(gList.get(g_c).getIterator(gdb_ext.get(g_c).Dbox.getKP1(),gdb_ext.get(g_c).Dbox.getKP2()));
+ if (a_it.isNext() == false) {g_c++;}
+ }
+ }
};
+template<>
+struct selvg
+{
+ template
+ static inline void call(a_it_type & a_it, gdb_ext_type & gdb_ext, gList_type & gList, size_t & g_c)
+ {
+ // Full iterator (no subset)
+ a_it.reinitialize(gList.get(g_c).getIterator());
+ if (a_it.isNext() == false) {g_c++;}
+ }
+};
/*! \brief Distributed grid iterator
*
@@ -38,23 +50,24 @@ class grid_dist_iterator
*
* \tparam dim dimensionality of the grid
* \tparam device_grid type of basic grid
- * \tparam impl implementation
+ * \tparam stencil it inject the code to calculate stencil offset
+ * \tparam sub_iterator it indicate the sub-iterator type of the device_grid
*
*/
-template
-class grid_dist_iterator
+template
+class grid_dist_iterator
{
//! grid list counter
size_t g_c;
//! List of the grids we are going to iterate
- openfpm::vector & gList;
+ const openfpm::vector & gList;
//! Extension of each grid: domain and ghost + domain
const openfpm::vector