Commit 12a3ac70 authored by incardon's avatar incardon

Copy decomposition for grid

parent 9a77a582
......@@ -131,7 +131,7 @@ public:
*
* \param id sub-domain id
*
* \return the number of internal ghost box
* \return the number of external ghost box
*
*/
inline size_t getLocalNEGhost(size_t id)
......
......@@ -39,6 +39,8 @@
* \snippet grid_dist_id_unit_test.hpp Create and access a distributed grid complex
* ### Synchronize a distributed grid for complex structures
* \snippet grid_dist_id_unit_test.hpp Synchronized distributed grid complex
* ### Construct two grid with the same decomposition
* \snippet grid_dist_id_unit_test.hpp Construct two grid with the same decomposition
*
*/
template<unsigned int dim, typename St, typename T, typename Decomposition,typename Memory=HeapMemory , typename device_grid=grid_cpu<dim,T> >
......@@ -368,11 +370,6 @@ public:
// fill the global size of the grid
for (size_t i = 0 ; i < dim ; i++) {this->g_sz[i] = g_sz[i];}
// Get the number of processor and calculate the number of sub-domain
// for decomposition
size_t n_proc = v_cl.getProcessingUnits();
size_t n_sub = n_proc * SUB_UNIT_FACTOR;
// Create local grid
Create();
......
......@@ -616,8 +616,6 @@ void Test3D_complex(const Box<3,float> & domain, long int k)
void Test3D_dup(const Box<3,float> & domain, long int k)
{
typedef Point_test<float> p;
long int big_step = k / 30;
big_step = (big_step == 0)?1:big_step;
long int small_step = 1;
......@@ -646,7 +644,7 @@ void Test3D_dup(const Box<3,float> & domain, long int k)
// Ghost
Ghost<3,float> g(0.01 / factor);
//! [Construct two grid with the same topology]
//! [Construct two grid with the same decomposition]
// Distributed grid with id decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> g_dist1(sz,domain,g);
......@@ -654,7 +652,9 @@ void Test3D_dup(const Box<3,float> & domain, long int k)
// another grid with the same decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> g_dist2(g_dist1.getDecomposition(),sz,domain,g);
//! [Construct two grid with the same topology]
//! [Construct two grid with the same decomposition]
BOOST_REQUIRE_EQUAL(g_dist2.getDecomposition().ref(),2);
auto dom_g1 = g_dist1.getDomainIterator();
auto dom_g2 = g_dist2.getDomainIterator();
......@@ -674,6 +674,42 @@ void Test3D_dup(const Box<3,float> & domain, long int k)
BOOST_REQUIRE_EQUAL(check,true);
}
// 3D test
for ( ; k >= 2 ; k-= (k > 2*big_step)?big_step:small_step )
{
BOOST_TEST_CHECKPOINT( "Testing 3D copy decomposition grid k=" << k );
// grid size
size_t sz[3];
sz[0] = k;
sz[1] = k;
sz[2] = k;
// factor
float factor = pow(global_v_cluster->getProcessingUnits()/2.0f,1.0f/3.0f);
// Ghost
Ghost<3,float> g(0.01 / factor);
//! [Construct two grid with the same decomposition]
// Distributed grid with id decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> * g_dist1 = new grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>>(sz,domain,g);
// another grid with the same decomposition
grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>> * g_dist2 = new grid_dist_id<3, float, Point_test<float>, CartDecomposition<3,float>>(g_dist1->getDecomposition(),sz,domain,g);
//! [Construct two grid with the same decomposition]
BOOST_REQUIRE_EQUAL(g_dist2->getDecomposition().ref(),2);
delete g_dist1;
BOOST_REQUIRE_EQUAL(g_dist2->getDecomposition().ref(),1);
BOOST_REQUIRE_EQUAL(g_dist2->getDecomposition().getLocalNEGhost(0) != 0, true);
BOOST_REQUIRE_EQUAL(g_dist2->getDecomposition().check_consistency(),false);
}
}
BOOST_AUTO_TEST_CASE( grid_dist_id_iterator_test_use)
......
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