Commit 4024e4f3 authored by Pietro Incardona's avatar Pietro Incardona

Ghost unbounded clean

parent 97cce61f
This diff is collapsed.
#ifndef GRID_DIST_UNIT_TEST_HPP
#define GRID_DIST_UNIT_TEST_HPP
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "Point_test.hpp"
#include "grid_dist_id.hpp"
#include "data_type/scalar.hpp"
#include "data_type/aggregate.hpp"
......
......@@ -235,7 +235,7 @@ void Test3D_unb_ghost_periodic(const Box<3,float> & domain, long int k)
if (g_dist.template get<0>(key) != -1 && out_p == true)
out_cnt++;
if ( /*g_dist.template get<0>(key) != -1 &&*/ info.LinId(key_g) != g_dist.template get<0>(key) )
if ( g_dist.template get<0>(key) != -1 && info.LinId(key_g) != g_dist.template get<0>(key) )
match &= false;
++dom_gi;
......
......@@ -48,9 +48,6 @@ template<unsigned int dim> periodicity<dim> create_non_periodic()
*/
template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::vector<GBoxes<Decomposition::dims>> & gdb_ext, Decomposition & dec, CellDecomposer_sm<Decomposition::dims,typename Decomposition::stype,shift<dim,typename Decomposition::stype>> & cd_sm)
{
Box<Decomposition::dims, typename Decomposition::stype> g_rnd_box;
for (size_t i = 0 ; i < Decomposition::dims ; i++) {g_rnd_box.setHigh(i,0.5); g_rnd_box.setLow(i,-0.5);}
// Get the number of local grid needed
size_t n_grid = dec.getNSubDomain();
......@@ -112,4 +109,126 @@ template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::ve
spacing[i] = cd_sm.getCellBox().getP2()[i];
}
/*! \brief it store a box, its unique id and the sub-domain from where it come from
*
*/
template<unsigned int dim> struct i_box_id
{
//! Box
::Box<dim,long int> box;
//! id
size_t g_id;
//! r_sub id of the sub-domain in the sent list
size_t r_sub;
//! Sector where it live the linked external ghost box
comb<dim> cmb;
//! sub
size_t sub;
};
/*! \brief it store an internal ghost box, the linked external ghost box and the sub-domain from where
* it come from as internal ghost box
*
*/
template<unsigned int dim> struct i_lbox_id
{
//! Box
::Box<dim,long int> box;
//! sub-domain id
size_t sub;
//! external ghost box linked to this internal ghost box
size_t k;
//! combination
comb<dim> cmb;
};
/*! \brief It store the information about the external ghost box
*
*
*/
template <unsigned int dim> struct e_box_id
{
//! Box defining the external ghost box in global coordinates
::Box<dim,long int> g_e_box;
//! Box defining the external ghost box in local coordinates
::Box<dim,long int> l_e_box;
//! Sector position of the external ghost
comb<dim> cmb;
//! Id
size_t g_id;
//! sub_id in which sub-domain this box live
size_t sub;
};
/*! \brief It store the information about the local external ghost box
*
*
*/
template <unsigned int dim> struct e_lbox_id
{
//! Box defining the external ghost box in local coordinates
::Box<dim,long int> box;
//! Sector position of the local external ghost box
comb<dim> cmb;
//! sub_id in which sub-domain this box live
size_t sub;
};
/*! \brief Per-processor Internal ghost box
*
*/
template <unsigned int dim> struct ip_box_grid
{
// ghost in grid units
openfpm::vector<i_box_id<dim>> bid;
//! processor id
size_t prc;
};
/*! \brief local Internal ghost box
*
*/
template <unsigned int dim> struct i_lbox_grid
{
// ghost in grid units
openfpm::vector<i_lbox_id<dim>> bid;
};
/*! \brief Per-processor external ghost box
*
*/
template <unsigned int dim>struct ep_box_grid
{
// ghost in grid units
openfpm::vector<e_box_id<dim>> bid;
//! processor id
size_t prc;
};
/*! \brief Per-processor external ghost box
*
*/
template <unsigned int dim> struct e_lbox_grid
{
// ghost in grid units
openfpm::vector<e_lbox_id<dim>> bid;
};
#endif /* SRC_GRID_GRID_DIST_UTIL_HPP_ */
LINKLIBS = $(METIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS) $(PETSC_LIB) $(HDF5_LDFLAGS) $(HDF5_LIBS) $(PARMETIS_LIB)
LINKLIBS = $(METIS_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_IOSTREAMS_LIB) $(CUDA_LIBS) $(PETSC_LIB) $(HDF5_LDFLAGS) $(HDF5_LIBS) $(PARMETIS_LIB) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(BOOST_CHRONO_LIB) $(BOOST_TIMER_LIB) $(BOOST_SYSTEM_LIB)
noinst_PROGRAMS = pdata
pdata_SOURCES = main.cpp lib/pdata.cpp test_multiple_o.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
pdata_SOURCES = main.cpp Grid/grid_dist_id_unit_test.cpp lib/pdata.cpp test_multiple_o.cpp ../openfpm_devices/src/memory/HeapMemory.cpp ../openfpm_devices/src/memory/PtrMemory.cpp ../openfpm_vcluster/src/VCluster.cpp ../openfpm_devices/src/Memleak_check.cpp
pdata_CXXFLAGS = $(PETSC_INCLUDE) $(HDF5_CPPFLAGS) $(CUDA_CFLAGS) $(INCLUDES_PATH) $(PARMETIS_INCLUDE) $(METIS_INCLUDE) $(BOOST_CPPFLAGS) $(H5PART_INCLUDE) -DPARALLEL_IO -Wno-unused-local-typedefs
pdata_CFLAGS = $(CUDA_CFLAGS)
pdata_LDADD = $(LINKLIBS) -lmetis -lparmetis
......
......@@ -122,24 +122,11 @@ BOOST_AUTO_TEST_CASE( dec_optimizer_test_use_p)
for(size_t i = 0 ; i < box_nn_processor.size() ; i++)
{
bool nn[] = {false,false,false,false,false,false,false,false};
BOOST_REQUIRE_EQUAL(box_nn_processor.get(i).size(),7ul);
BOOST_REQUIRE_EQUAL(box_nn_processor.get(i).size(),8ul);
for (size_t j = 0 ; j < box_nn_processor.get(i).size(); j++)
{
BOOST_REQUIRE(box_nn_processor.get(i).get(j) < 8);
nn[box_nn_processor.get(i).get(j)] = true;
}
// search the neighborhood
size_t cnt = 0;
for(size_t i = 0 ; i < 8 ; i++)
{
if (nn[i] == false)
cnt++;
}
BOOST_REQUIRE_EQUAL(cnt,1ul);
}
// check
......
#include <iostream>
#include "config.h"
#define NO_WARNING
#include "Graph/CartesianGraphFactory.hpp"
......@@ -7,8 +6,21 @@
#define BOOST_DISABLE_ASSERTS
#define BOOST_TEST_MODULE "C++ test module for OpenFPM_pdata project"
#include <boost/test/included/unit_test.hpp>
#include "config.h"
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
// initialization function:
bool init_unit_test()
{
return true;
}
// entry point:
int main(int argc, char* argv[])
{
return boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
}
#include "Grid/grid_dist_id.hpp"
#include "Point_test.hpp"
......@@ -24,7 +36,6 @@
#include "Decomposition/ORB_unit_test.hpp"
#include "Decomposition/Distribution/metis_util_unit_test.hpp"
#include "dec_optimizer_unit_test.hpp"
#include "Grid/grid_dist_id_unit_test.hpp"
#include "Vector/vector_dist_unit_test.hpp"
#include "Decomposition/Distribution/Distribution_unit_tests.hpp"
//#include "DLB/DLB_unit_test.hpp"
......
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