Skip to content
Snippets Groups Projects
Commit baf78730 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Add pdata

parent 812b8f0b
No related branches found
No related tags found
No related merge requests found
...@@ -593,7 +593,7 @@ p1[0]<-----+ +----> p2[0] ...@@ -593,7 +593,7 @@ p1[0]<-----+ +----> p2[0]
* \return a duplicated decomposition with different ghost boxes * \return a duplicated decomposition with different ghost boxes
* *
*/ */
CartDecomposition<dim,T,Memory,Domain> duplicate(Ghost<dim,T> & g) CartDecomposition<dim,T,Memory,Domain> duplicate(const Ghost<dim,T> & g)
{ {
CartDecomposition<dim,T,Memory,Domain> cart(v_cl); CartDecomposition<dim,T,Memory,Domain> cart(v_cl);
...@@ -613,10 +613,10 @@ p1[0]<-----+ +----> p2[0] ...@@ -613,10 +613,10 @@ p1[0]<-----+ +----> p2[0]
cart.ss_box = ss_box; cart.ss_box = ss_box;
cart.ghost = g; cart.ghost = g;
nn_prcs<dim,T>::create(box_nn_processor, sub_domains); cart.create(box_nn_processor, sub_domains);
calculateGhostBoxes(); cart.Initialize_geo_cell_lists();
Initialize_geo_cell_lists(); cart.calculateGhostBoxes();
return cart; return cart;
} }
...@@ -955,9 +955,14 @@ p1[0]<-----+ +----> p2[0] ...@@ -955,9 +955,14 @@ p1[0]<-----+ +----> p2[0]
*/ */
bool is_equal(CartDecomposition<dim,T,Memory,Domain> & cart) bool is_equal(CartDecomposition<dim,T,Memory,Domain> & cart)
{ {
static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal(static_cast<ie_loc_ghost<dim,T>&>(cart)); if (static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal(static_cast<ie_loc_ghost<dim,T>&>(cart)) == false)
static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)); return false;
static_cast<ie_ghost<dim,T>*>(this)->is_equal(static_cast<ie_ghost<dim,T>&>(cart));
if (static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)) == false)
return false;
if (static_cast<ie_ghost<dim,T>*>(this)->is_equal(static_cast<ie_ghost<dim,T>&>(cart)) == false)
return false;
if (sub_domains != cart.sub_domains) if (sub_domains != cart.sub_domains)
return false; return false;
...@@ -994,9 +999,14 @@ p1[0]<-----+ +----> p2[0] ...@@ -994,9 +999,14 @@ p1[0]<-----+ +----> p2[0]
*/ */
bool is_equal_ng(CartDecomposition<dim,T,Memory,Domain> & cart) bool is_equal_ng(CartDecomposition<dim,T,Memory,Domain> & cart)
{ {
static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal_ng(static_cast<ie_loc_ghost<dim,T>&>(cart)); if (static_cast<ie_loc_ghost<dim,T>*>(this)->is_equal_ng(static_cast<ie_loc_ghost<dim,T>&>(cart)) == false)
static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)); return false;
static_cast<ie_ghost<dim,T>*>(this)->is_equal(static_cast<ie_ghost<dim,T>&>(cart));
if (static_cast<nn_prcs<dim,T>*>(this)->is_equal(static_cast<nn_prcs<dim,T>&>(cart)) == false)
return false;
if (static_cast<ie_ghost<dim,T>*>(this)->is_equal_ng(static_cast<ie_ghost<dim,T>&>(cart)) == false)
return false;
if (sub_domains != cart.sub_domains) if (sub_domains != cart.sub_domains)
return false; return false;
......
...@@ -80,13 +80,12 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use) ...@@ -80,13 +80,12 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use)
CartDecomposition<3,float> dec2 = dec.duplicate(); CartDecomposition<3,float> dec2 = dec.duplicate();
dec2.check_consistency(); dec2.check_consistency();
// check that dec and dec2 contain the same information
bool ret = dec.is_equal(dec2); bool ret = dec.is_equal(dec2);
// We check if the two decomposition are equal // We check if the two decomposition are equal
BOOST_REQUIRE_EQUAL(ret,true); BOOST_REQUIRE_EQUAL(ret,true);
// check that dec and dec2 contain the same information
// We duplicate the decomposition redefining the ghost // We duplicate the decomposition redefining the ghost
// Define ghost // Define ghost
...@@ -98,10 +97,11 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use) ...@@ -98,10 +97,11 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_test_use)
ret = dec3.check_consistency(); ret = dec3.check_consistency();
BOOST_REQUIRE_EQUAL(ret,true); BOOST_REQUIRE_EQUAL(ret,true);
// Check that g3 is equal to dec2 with the exception of the ghost part dec3.write("output_dec3_1.vtk");
// Check that dec3 is equal to dec2 with the exception of the ghost part
ret = dec3.is_equal_ng(dec2); ret = dec3.is_equal_ng(dec2);
BOOST_REQUIRE_EQUAL(ret,true); BOOST_REQUIRE_EQUAL(ret,true);
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
......
...@@ -626,6 +626,8 @@ public: ...@@ -626,6 +626,8 @@ public:
return false; return false;
} }
} }
return true;
} }
/*! \brief Check if the ie_loc_ghosts contain the same information with the exception of the ghost part /*! \brief Check if the ie_loc_ghosts contain the same information with the exception of the ghost part
...@@ -650,14 +652,14 @@ public: ...@@ -650,14 +652,14 @@ public:
return false; return false;
for (size_t j = 0 ; j < getProcessorNIGhost(i) ; j++) for (size_t j = 0 ; j < getProcessorNIGhost(i) ; j++)
{ {
if (getProcessorIGhostBox(i,j).intersect(ig.getProcessorIGhostBox(i,j),bt) == false) if (getProcessorIGhostBox(i,j).Intersect(ig.getProcessorIGhostBox(i,j),bt) == false)
return false; return false;
if (getProcessorIGhostId(i,j).intersect(ig.getProcessorIGhostId(i,j),bt) == false) if (getProcessorIGhostId(i,j) != ig.getProcessorIGhostId(i,j))
return false; return false;
if (getProcessorIGhostSub(i,j) != ig.getProcessorIGhostSub(i,j)) if (getProcessorIGhostSub(i,j) != ig.getProcessorIGhostSub(i,j))
return false; return false;
} }
if (getIGhostBox(i) != ig.getIGhostBox(i)) if (getIGhostBox(i).Intersect(ig.getIGhostBox(i),bt) == false)
return false; return false;
if (getIGhostBoxProcessor(i) != ig.getIGhostBoxProcessor(i)) if (getIGhostBoxProcessor(i) != ig.getIGhostBoxProcessor(i))
return false; return false;
...@@ -669,18 +671,20 @@ public: ...@@ -669,18 +671,20 @@ public:
return false; return false;
for (size_t j = 0 ; j < getProcessorNEGhost(i) ; j++) for (size_t j = 0 ; j < getProcessorNEGhost(i) ; j++)
{ {
if (getProcessorEGhostBox(i,j).intersect(ig.getProcessorEGhostBox(i,j),bt) == false) if (getProcessorEGhostBox(i,j).Intersect(ig.getProcessorEGhostBox(i,j),bt) == false)
return false; return false;
if (getProcessorEGhostId(i,j),intersect(ig.getProcessorEGhostId(i,j),bt) == false) if (getProcessorEGhostId(i,j) != ig.getProcessorEGhostId(i,j))
return false; return false;
if (getProcessorEGhostSub(i,j) != ig.getProcessorEGhostSub(i,j)) if (getProcessorEGhostSub(i,j) != ig.getProcessorEGhostSub(i,j))
return false; return false;
} }
if (getEGhostBox(i) != ig.getEGhostBox(i)) if (getEGhostBox(i).Intersect(ig.getEGhostBox(i),bt) == false)
return false; return false;
if (getEGhostBoxProcessor(i).intersect(ig.getEGhostBoxProcessor(i),bt) == false) if (getEGhostBoxProcessor(i) != ig.getEGhostBoxProcessor(i))
return false; return false;
} }
return true;
} }
}; };
......
...@@ -487,9 +487,37 @@ public: ...@@ -487,9 +487,37 @@ public:
// Decomposition used // Decomposition used
typedef Decomposition decomposition; typedef Decomposition decomposition;
static inline Ghost<dim,float> convert_ghost(const Ghost<dim,long int> & gd,const CellDecomposer_sm<dim,St> & cd_sm)
{
Ghost<dim,float> gc;
// get the grid spacing
Box<dim,St> sp = cd_sm.getCellBox();
// enlarge 0.001 of the spacing
sp.magnify_fix_P1(1.1);
// set the ghost
for (size_t i = 0 ; i < dim ; i++)
{
gc.setLow(i,-sp.getHigh(i));
gc.setHigh(i,sp.getHigh(i));
}
return gc;
}
//! constructor //! constructor
grid_dist_id(Decomposition & dec, const size_t (& g_sz)[dim], const Box<dim,St> & domain, const Ghost<dim,St> & ghost) grid_dist_id(Decomposition & dec, const size_t (& g_sz)[dim], const Box<dim,St> & domain, const Ghost<dim,St> & ghost)
:domain(domain),ghost(ghost),dec(dec),v_cl(*global_v_cluster)
{
InitializeCellDecomposer(g_sz);
InitializeStructures(g_sz);
}
//! constructor
grid_dist_id(Decomposition && dec, const size_t (& g_sz)[dim], const Box<dim,St> & domain, const Ghost<dim,St> & ghost)
:domain(domain),ghost(ghost),dec(dec),v_cl(*global_v_cluster) :domain(domain),ghost(ghost),dec(dec),v_cl(*global_v_cluster)
{ {
InitializeCellDecomposer(g_sz); InitializeCellDecomposer(g_sz);
...@@ -523,18 +551,7 @@ public: ...@@ -523,18 +551,7 @@ public:
{ {
InitializeCellDecomposer(g_sz); InitializeCellDecomposer(g_sz);
// get the grid spacing ghost = convert_ghost(g,cd_sm);
Box<dim,St> sp = cd_sm.getCellBox();
// enlarge 0.001 of the spacing
sp.magnify_fix_P1(1.1);
// set the ghost
for (size_t i = 0 ; i < dim ; i++)
{
ghost.setLow(i,-sp.getHigh(i));
ghost.setHigh(i,sp.getHigh(i));
}
InitializeDecomposition(g_sz); InitializeDecomposition(g_sz);
// Initialize structures // Initialize structures
...@@ -553,18 +570,26 @@ public: ...@@ -553,18 +570,26 @@ public:
{ {
InitializeCellDecomposer(g_sz); InitializeCellDecomposer(g_sz);
// get the grid spacing ghost = convert_ghost(g,cd_sm);
Box<dim,St> sp = cd_sm.getCellBox();
// enlarge 0.001 of the spacing InitializeDecomposition(g_sz);
sp.magnify_fix_P1(1.1); // Initialize structures
InitializeStructures(g_sz);
}
// set the ghost /*! \brief Constrcuctor
for (size_t i = 0 ; i < dim ; i++) *
{ * \param g_sz array with the grid size on each dimension
ghost.setLow(i,-sp.getHigh(i)); * \param domain domain where this grid live
ghost.setHigh(i,sp.getHigh(i)); * \param g Ghost given in grid units
} *
*/
grid_dist_id(Decomposition && dec, const size_t (& g_sz)[dim],const Box<dim,St> & domain, const Ghost<dim,long int> & g)
:domain(domain),dec(dec),v_cl(*global_v_cluster),ginfo(g_sz),ginfo_v(g_sz)
{
InitializeCellDecomposer(g_sz);
ghost = convert_ghost(g,cd_sm);
InitializeDecomposition(g_sz); InitializeDecomposition(g_sz);
// Initialize structures // Initialize structures
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment