Commit d4e03ce3 authored by incardon's avatar incardon

Last changes to ghost cell

parent 699c8959
......@@ -9,10 +9,7 @@ AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([src/config/config.h])
m4_ifdef([ACX_PTHREAD],,[m4_include([m4/acx_pthread.m4])])
m4_ifdef([AX_CHECK_CL],,[m4_include([m4/ax_opencl.m4])])
m4_ifdef([AX_BOOST_BASE],,[m4_include([m4/ax_boost_base.m4])])
m4_ifdef([AX_BOOST_PROGRAM_OPTIONS],,[m4_include([m4/ax_boost_program_options.m4])])
m4_ifdef([AX_BOOST_THREAD],,[m4_include([m4/ax_boost_thread.m4])])
m4_ifdef([AX_BOOST],,[m4_include([m4/ax_boost.m4])])
m4_ifdef([ACX_MPI],,[m4_include([m4/acx_mpi.m4])])
m4_ifdef([AX_OPENMP],,[m4_include([m4/ax_openmp.m4])])
m4_ifdef([AX_CUDA],,[m4_include([m4/ax_cuda.m4])])
......@@ -53,7 +50,7 @@ if test x"$debuger" = x"yes"; then
CXXFLAGS="$CXXFLAGS -g3 -Wall -O0 "
NVCCFLAGS+="$NVCCFLAGS -g -O0 "
else
CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -flto -funroll-loops "
CXXFLAGS="$CXXFLAGS -Wall -O3 -g3 -funroll-loops "
NVCCFLAGS+="$NVCCFLAGS -O3 "
fi
......@@ -80,6 +77,10 @@ fi
INCLUDES_PATH+="-I. -Isrc/config/ -I../../metis_install/include -I../../OpenFPM_IO/src -I../../OpenFPM_data/src -I../../OpenFPM_devices/src -I../../OpenFPM_vcluster/src/"
##### CHECK FOR BOOST ##############
AX_BOOST([1.52],[],[])
####### Checking for GPU support
AX_CUDA
......@@ -116,10 +117,6 @@ AM_CONDITIONAL(BUILDCUDA, test ! x$NVCC = x"no")
AC_DEFINE([HAVE_MPI],[],[MPI Enabled])
#####
AX_CHECK_COMPILER_FLAGS([-Wno-unused-but-set-variable],[CXXFLAGS="$CXXFLAGS -Wno-unused-but-set-variable"],[])
AC_SUBST(NVCCFLAGS)
AC_SUBST(INCLUDES_PATH)
......
......@@ -956,6 +956,7 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
../../OpenFPM_data/src/Grid/comb.hpp \
../../OpenFPM_data/src/Grid/grid_key_expression.hpp \
../../OpenFPM_data/src/Space/Shape/Point.hpp \
../../OpenFPM_data/src/Grid/Encap.hpp \
../../OpenFPM_data/src/Grid/grid_key.hpp \
../../OpenFPM_data/src/Grid/Encap.hpp \
../../OpenFPM_data/src/memory_array.hpp \
......@@ -3059,6 +3060,8 @@ pdata-VCluster.o: ../../OpenFPM_vcluster/src/VCluster.cpp \
../../OpenFPM_data/src/Space/Shape/Point.hpp:
../../OpenFPM_data/src/Grid/Encap.hpp:
../../OpenFPM_data/src/Grid/grid_key.hpp:
../../OpenFPM_data/src/Grid/Encap.hpp:
......
......@@ -921,6 +921,7 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_data/src/Grid/comb.hpp \
../../OpenFPM_data/src/Grid/grid_key_expression.hpp \
../../OpenFPM_data/src/Space/Shape/Point.hpp \
../../OpenFPM_data/src/Grid/Encap.hpp \
../../OpenFPM_data/src/Grid/grid_key.hpp \
../../OpenFPM_data/src/Grid/Encap.hpp \
../../OpenFPM_data/src/memory_array.hpp \
......@@ -1288,13 +1289,78 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_data/src/Space/SpaceBox.hpp \
../../OpenFPM_data/src/Space/Shape/Point.hpp \
../../OpenFPM_data/src/Space/Shape/Box.hpp \
../../OpenFPM_data/src/Grid/Encap.hpp Grid/grid_dist_id_iterator.hpp \
../../OpenFPM_data/src/Space/Ghost.hpp Grid/grid_dist_id_iterator.hpp \
Grid/grid_dist_key.hpp ../../OpenFPM_data/src/Point_test.hpp \
../../OpenFPM_data/src/base_type.hpp Decomposition/CartDecomposition.hpp \
Decomposition/Decomposition.hpp ../../OpenFPM_data/src/global_const.hpp \
SubdomainGraphNodes.hpp metis_util.hpp \
../../metis_install/include/metis.h /usr/include/inttypes.h \
../../OpenFPM_IO/src/VTKWriter.hpp dec_optimizer.hpp \
../../OpenFPM_IO/src/VTKWriter.hpp \
../../OpenFPM_IO/src/VTKWriter_graph.hpp \
../../OpenFPM_IO/src/VTKWriter_vector_box.hpp \
/usr/include/boost/math/special_functions/pow.hpp \
/usr/include/boost/math/policies/error_handling.hpp \
/usr/include/boost/math/tools/precision.hpp \
/usr/include/boost/format.hpp \
/usr/include/boost/format/detail/compat_workarounds.hpp \
/usr/include/boost/format/detail/config_macros.hpp \
/usr/include/boost/format/detail/workarounds_gcc-2_95.hpp \
/usr/include/boost/format/detail/workarounds_stlport.hpp \
/usr/include/boost/format/format_fwd.hpp \
/usr/include/boost/format/internals_fwd.hpp \
/usr/include/boost/format/internals.hpp \
/usr/include/boost/format/alt_sstream.hpp \
/usr/include/boost/format/alt_sstream_impl.hpp \
/usr/include/boost/format/format_class.hpp \
/usr/include/boost/format/exceptions.hpp \
/usr/include/boost/format/format_implementation.hpp \
/usr/include/boost/format/group.hpp \
/usr/include/boost/format/feed_args.hpp \
/usr/include/boost/format/detail/msvc_disambiguater.hpp \
/usr/include/boost/format/parsing.hpp \
/usr/include/boost/format/free_funcs.hpp \
/usr/include/boost/format/detail/unset_macros.hpp \
../../OpenFPM_IO/src/util.hpp \
/usr/include/boost/iostreams/device/mapped_file.hpp \
/usr/include/boost/iostreams/close.hpp \
/usr/include/boost/iostreams/categories.hpp \
/usr/include/boost/iostreams/flush.hpp \
/usr/include/boost/iostreams/detail/dispatch.hpp \
/usr/include/boost/iostreams/detail/select.hpp \
/usr/include/boost/iostreams/traits.hpp \
/usr/include/boost/iostreams/detail/bool_trait_def.hpp \
/usr/include/boost/iostreams/detail/template_params.hpp \
/usr/include/boost/preprocessor/control/expr_if.hpp \
/usr/include/boost/iostreams/detail/config/wide_streams.hpp \
/usr/include/boost/iostreams/detail/is_iterator_range.hpp \
/usr/include/boost/iostreams/detail/config/disable_warnings.hpp \
/usr/include/boost/iostreams/detail/config/enable_warnings.hpp \
/usr/include/boost/iostreams/detail/select_by_size.hpp \
/usr/include/boost/preprocessor/iteration/local.hpp \
/usr/include/boost/preprocessor/iteration/detail/local.hpp \
/usr/include/boost/iostreams/detail/wrap_unwrap.hpp \
/usr/include/boost/iostreams/detail/enable_if_stream.hpp \
/usr/include/boost/iostreams/traits_fwd.hpp \
/usr/include/boost/iostreams/detail/streambuf.hpp \
/usr/include/boost/iostreams/operations_fwd.hpp \
/usr/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp \
/usr/include/boost/iostreams/detail/ios.hpp \
/usr/include/boost/iostreams/read.hpp \
/usr/include/boost/iostreams/char_traits.hpp \
/usr/include/boost/iostreams/detail/char_traits.hpp \
/usr/include/boost/iostreams/seek.hpp \
/usr/include/boost/iostreams/positioning.hpp \
/usr/include/boost/iostreams/detail/config/codecvt.hpp \
/usr/include/boost/iostreams/detail/config/fpos.hpp \
/usr/include/boost/iostreams/write.hpp \
/usr/include/boost/iostreams/concepts.hpp \
/usr/include/boost/iostreams/detail/default_arg.hpp \
/usr/include/boost/iostreams/detail/config/auto_link.hpp \
/usr/include/boost/config/auto_link.hpp \
/usr/include/boost/iostreams/detail/config/dyn_link.hpp \
/usr/include/boost/iostreams/detail/path.hpp \
/usr/include/boost/config/abi_prefix.hpp \
/usr/include/boost/config/abi_suffix.hpp dec_optimizer.hpp \
../../OpenFPM_data/src/NN/CellList/CellDecomposer.hpp \
/usr/include/c++/4.8.3/unordered_map \
/usr/include/c++/4.8.3/bits/hashtable.h \
......@@ -1306,9 +1372,9 @@ pdata-main.o: main.cpp /usr/include/stdc-predef.h \
../../OpenFPM_data/src/NN/CellList/CellNNIterator.hpp \
../../OpenFPM_data/src/NN/CellList/CellListBal.hpp \
../../OpenFPM_data/src/NN/CellList/CellListMem.hpp \
../../OpenFPM_data/src/util.hpp unit_test_init_cleanup.hpp \
Decomposition/ORB_unit_test.hpp Decomposition/ORB.hpp \
../../OpenFPM_data/src/data_type/scalar.hpp \
../../OpenFPM_data/src/Space/Ghost.hpp ../../OpenFPM_IO/src/util.hpp \
unit_test_init_cleanup.hpp Decomposition/ORB_unit_test.hpp \
Decomposition/ORB.hpp ../../OpenFPM_data/src/data_type/scalar.hpp \
Graph/CartesianGraphFactory_unit_test.hpp \
Graph/CartesianGraphFactory.hpp metis_util_unit_test.hpp metis_util.hpp \
dec_optimizer_unit_test.hpp dec_optimizer.hpp \
......@@ -3344,6 +3410,8 @@ Graph/CartesianGraphFactory.hpp:
../../OpenFPM_data/src/Space/Shape/Point.hpp:
../../OpenFPM_data/src/Grid/Encap.hpp:
../../OpenFPM_data/src/Grid/grid_key.hpp:
../../OpenFPM_data/src/Grid/Encap.hpp:
......@@ -4164,7 +4232,7 @@ Grid/grid_dist_id.hpp:
../../OpenFPM_data/src/Space/Shape/Box.hpp:
../../OpenFPM_data/src/Grid/Encap.hpp:
../../OpenFPM_data/src/Space/Ghost.hpp:
Grid/grid_dist_id_iterator.hpp:
......@@ -4190,6 +4258,136 @@ metis_util.hpp:
../../OpenFPM_IO/src/VTKWriter.hpp:
../../OpenFPM_IO/src/VTKWriter_graph.hpp:
../../OpenFPM_IO/src/VTKWriter_vector_box.hpp:
/usr/include/boost/math/special_functions/pow.hpp:
/usr/include/boost/math/policies/error_handling.hpp:
/usr/include/boost/math/tools/precision.hpp:
/usr/include/boost/format.hpp:
/usr/include/boost/format/detail/compat_workarounds.hpp:
/usr/include/boost/format/detail/config_macros.hpp:
/usr/include/boost/format/detail/workarounds_gcc-2_95.hpp:
/usr/include/boost/format/detail/workarounds_stlport.hpp:
/usr/include/boost/format/format_fwd.hpp:
/usr/include/boost/format/internals_fwd.hpp:
/usr/include/boost/format/internals.hpp:
/usr/include/boost/format/alt_sstream.hpp:
/usr/include/boost/format/alt_sstream_impl.hpp:
/usr/include/boost/format/format_class.hpp:
/usr/include/boost/format/exceptions.hpp:
/usr/include/boost/format/format_implementation.hpp:
/usr/include/boost/format/group.hpp:
/usr/include/boost/format/feed_args.hpp:
/usr/include/boost/format/detail/msvc_disambiguater.hpp:
/usr/include/boost/format/parsing.hpp:
/usr/include/boost/format/free_funcs.hpp:
/usr/include/boost/format/detail/unset_macros.hpp:
../../OpenFPM_IO/src/util.hpp:
/usr/include/boost/iostreams/device/mapped_file.hpp:
/usr/include/boost/iostreams/close.hpp:
/usr/include/boost/iostreams/categories.hpp:
/usr/include/boost/iostreams/flush.hpp:
/usr/include/boost/iostreams/detail/dispatch.hpp:
/usr/include/boost/iostreams/detail/select.hpp:
/usr/include/boost/iostreams/traits.hpp:
/usr/include/boost/iostreams/detail/bool_trait_def.hpp:
/usr/include/boost/iostreams/detail/template_params.hpp:
/usr/include/boost/preprocessor/control/expr_if.hpp:
/usr/include/boost/iostreams/detail/config/wide_streams.hpp:
/usr/include/boost/iostreams/detail/is_iterator_range.hpp:
/usr/include/boost/iostreams/detail/config/disable_warnings.hpp:
/usr/include/boost/iostreams/detail/config/enable_warnings.hpp:
/usr/include/boost/iostreams/detail/select_by_size.hpp:
/usr/include/boost/preprocessor/iteration/local.hpp:
/usr/include/boost/preprocessor/iteration/detail/local.hpp:
/usr/include/boost/iostreams/detail/wrap_unwrap.hpp:
/usr/include/boost/iostreams/detail/enable_if_stream.hpp:
/usr/include/boost/iostreams/traits_fwd.hpp:
/usr/include/boost/iostreams/detail/streambuf.hpp:
/usr/include/boost/iostreams/operations_fwd.hpp:
/usr/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp:
/usr/include/boost/iostreams/detail/ios.hpp:
/usr/include/boost/iostreams/read.hpp:
/usr/include/boost/iostreams/char_traits.hpp:
/usr/include/boost/iostreams/detail/char_traits.hpp:
/usr/include/boost/iostreams/seek.hpp:
/usr/include/boost/iostreams/positioning.hpp:
/usr/include/boost/iostreams/detail/config/codecvt.hpp:
/usr/include/boost/iostreams/detail/config/fpos.hpp:
/usr/include/boost/iostreams/write.hpp:
/usr/include/boost/iostreams/concepts.hpp:
/usr/include/boost/iostreams/detail/default_arg.hpp:
/usr/include/boost/iostreams/detail/config/auto_link.hpp:
/usr/include/boost/config/auto_link.hpp:
/usr/include/boost/iostreams/detail/config/dyn_link.hpp:
/usr/include/boost/iostreams/detail/path.hpp:
/usr/include/boost/config/abi_prefix.hpp:
/usr/include/boost/config/abi_suffix.hpp:
dec_optimizer.hpp:
../../OpenFPM_data/src/NN/CellList/CellDecomposer.hpp:
......@@ -4214,7 +4412,9 @@ dec_optimizer.hpp:
../../OpenFPM_data/src/NN/CellList/CellListMem.hpp:
../../OpenFPM_data/src/util.hpp:
../../OpenFPM_data/src/Space/Ghost.hpp:
../../OpenFPM_IO/src/util.hpp:
unit_test_init_cleanup.hpp:
......
......@@ -22,8 +22,7 @@
#include "NN/CellList/CellDecomposer.hpp"
#include <unordered_map>
#include "NN/CellList/CellList.hpp"
template<unsigned int dim, typename T> using Ghost = Box<dim,T>;
#include "Space/Ghost.hpp"
/**
* \brief This class decompose a space into subspaces
......@@ -52,6 +51,15 @@ template<unsigned int dim, typename T> using Ghost = Box<dim,T>;
template<unsigned int dim, typename T, template<typename> class device_l=openfpm::device_cpu, typename Memory=HeapMemory, template<unsigned int, typename> class Domain=Box, template<typename, typename, typename, typename, unsigned int> class data_s = openfpm::vector>
class CartDecomposition
{
struct N_box
{
// id of the processor in the nn_processor list
size_t id;
// Near processor sub-domains
typename openfpm::vector<::Box<dim,T>> bx;
};
struct Box_proc
{
// Intersection between the local sub-domain enlarged by the ghost and the contiguous processor
......@@ -89,21 +97,21 @@ private:
SpaceBox<dim,T> sub_domain;
//! the set of all local sub-domain as vector
data_s<SpaceBox<dim,T>,device_l<SpaceBox<dim,T>>,Memory,openfpm::vector_grow_policy_default, openfpm::vect_isel<SpaceBox<dim,T>>::value > sub_domains;
openfpm::vector<SpaceBox<dim,T>> sub_domains;
//! List of near processors
openfpm::vector<size_t> nn_processors;
//! for each sub-domain, contain the list of the neighborhood processors
//! and for each processor contain the boxes calculated from the intersection
//! of the sub-domain ghost with the near-by processor sub-domain ()
//! of the sub-domain + ghost with the near-by processor sub-domain ()
openfpm::vector< openfpm::vector< Box_proc > > box_nn_processor_int;
//! for each box, contain the list of the neighborhood processors
//! for each sub-domain, contain the list of the neighborhood processors
openfpm::vector<openfpm::vector<long unsigned int> > box_nn_processor;
// for each near-processor store the sub-domain of the near processor
std::unordered_map<size_t,typename openfpm::vector<::Box<dim,T>> > nn_processor_subdomains;
std::unordered_map<size_t, N_box> nn_processor_subdomains;
//! Structure that contain for each sub-domain box the processor id
//! exist for efficient global communication
......@@ -144,22 +152,6 @@ private:
//! and the near processor sub-domains
CellList<dim,T,FAST> geo_cell;
/*! \brief Enlarge the ghost domain
*
* \param the box
* \param gh spacing of the margin to enlarge
*
*/
void enlarge(::Box<dim,T> & box, Ghost<dim,T> & gh)
{
typedef ::Box<dim,T> g;
for (size_t j = 0 ; j < dim ; j++)
{
box.template getBase<g::p1>(j) = box.template getBase<g::p1>(j) - gh.template getBase<g::p1>(j);
box.template getBase<g::p2>(j) = box.template getBase<g::p2>(j) + gh.template getBase<g::p2>(j);
}
}
/*! \brief Create internally the decomposition
*
......@@ -170,24 +162,20 @@ private:
{
// Calculate the total number of box and and the spacing
// on each direction
// Get the box containing the domain
SpaceBox<dim,T> bs = domain.getBox();
for (unsigned int i = 0; i < dim ; i++)
{
// Calculate the spacing
spacing[i] = (bs.getHigh(i) - bs.getLow(i)) / gr.size(i);
}
// Here we use METIS
// Create a cartesian grid graph
CartesianGraphFactory<dim,Graph_CSR<nm_part_v,nm_part_e>> g_factory_part;
// Processor graph
Graph_CSR<nm_part_v,nm_part_e> gp = g_factory_part.template construct<NO_EDGE,T,dim-1>(gr.getSize(),domain);
// Get the number of processing units
......@@ -200,16 +188,13 @@ private:
Metis<Graph_CSR<nm_part_v,nm_part_e>> met(gp,Np);
// decompose
met.decompose<nm_part_v::id>();
// fill the structure that store the processor id for each sub-domain
fine_s.resize(gr.size());
// Optimize the decomposition creating bigger spaces
// And reducing Ghost over-stress
dec_optimizer<dim,Graph_CSR<nm_part_v,nm_part_e>> d_o(gp,gr.getSize());
// set of Boxes produced by the decomposition optimizer
......@@ -218,7 +203,8 @@ private:
// optimize the decomposition
d_o.template optimize<nm_part_v::sub_id,nm_part_v::id>(gp,p_id,loc_box,box_nn_processor);
// produce the list of the contiguous processor
// produce the list of the contiguous processor (nn_processors) and link nn_processor_subdomains to the
// processor list
for (size_t i = 0 ; i < box_nn_processor.size() ; i++)
{
for (size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
......@@ -232,18 +218,65 @@ private:
auto last = std::unique(nn_processors.begin(), nn_processors.end());
nn_processors.erase(last, nn_processors.end());
// produce the list of the contiguous processor (nn_processors) and link nn_processor_subdomains to the
// processor list
for (size_t i = 0 ; i < box_nn_processor.size() ; i++)
{
for (size_t j = 0 ; j < box_nn_processor.get(i).size() ; j++)
{
// processor id near to this sub-domain
size_t proc_id = box_nn_processor.get(i).get(j);
size_t k = 0;
// search inside near processor list
for (k = 0 ; k < nn_processors.size() ; k++)
if (nn_processors.get(k) == proc_id) break;
nn_processor_subdomains[proc_id].id = k;
}
}
// Initialize ss_box and bbox
if (loc_box.size() >= 0)
{
SpaceBox<dim,T> sub_d(loc_box.get(0));
sub_d.mul(spacing);
sub_d.expand(spacing);
// add the sub-domain
sub_domains.add(sub_d);
ss_box = sub_d;
bbox = sub_d;
}
// convert into sub-domain
for (size_t s = 0 ; s < loc_box.size() ; s++)
for (size_t s = 1 ; s < loc_box.size() ; s++)
{
SpaceBox<dim,T> sub_d(loc_box.get(s));
// re-scale with spacing
sub_d.spacing(spacing);
// re-scale and add spacing (the end is the starting point of the next domain + spacing)
sub_d.mul(spacing);
sub_d.expand(spacing);
// add the sub-domain
sub_domains.add(sub_d);
// Calculate the bound box
bbox.enclose(sub_d);
// Create the smallest box contained in all sub-domain
ss_box.contained(sub_d);
}
//++++++++++++++++++++++++++++++++++++++++ Debug output NN boxes
{
VTKWriter<openfpm::vector<::SpaceBox<dim,T>>,VECTOR_BOX> vtk_box1;
vtk_box1.add(sub_domains);
vtk_box1.write(std::string("loc_") + std::to_string(v_cl.getProcessUnitID()) + std::string(".vtk"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// fill fine_s structure
// fine_s structure contain the processor id for each sub-sub-domain
// with sub-sub-domain we mean the sub-domain decomposition before
......@@ -314,21 +347,28 @@ private:
* \param total message size to receive from all the processors
* \param the total number of processor want to communicate with you
* \param i processor id
* \param ri request id (it is an id that goes from 0 to total_p, and is unique
* every time message_alloc is called)
* \param ptr a pointer to the vector_dist structure
*
* \return the pointer where to store the message
*
*/
static void * message_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, void * ptr)
static void * message_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr)
{
// cast the pointer
CartDecomposition<dim,T,device_l,Memory,Domain,data_s> * cd = static_cast< CartDecomposition<dim,T,device_l,Memory,Domain,data_s> *>(ptr);
if (cd->v_cl.getProcessUnitID() == 0)
{
std::cout << "Receiving from " << i << " msg size: " << msg_i << "\n";
}
// Resize the memory
cd->nn_processor_subdomains[i].resize(msg_i);
cd->nn_processor_subdomains[i].bx.resize(msg_i);
// Return the receive pointer
return cd->nn_processor_subdomains[i].getPointer();
return cd->nn_processor_subdomains[i].bx.getPointer();
}
public:
......@@ -341,6 +381,9 @@ public:
CartDecomposition(CartDecomposition<dim,T,device_l,Memory,Domain,data_s> && cd)
:sub_domain(cd.sub_domain),gr(cd.gr),cd(cd.cd),domain(cd.domain),v_cl(cd.v_cl)
{
// Reset the box to zero
bbox.zero();
//! Subspace selected
//! access_key in case of grid is just the set of the index to access the grid
id_sub.swap(cd.id_sub);
......@@ -362,7 +405,10 @@ public:
*/
CartDecomposition(Vcluster & v_cl)
:id_sub(0),v_cl(v_cl)
{}
{
// Reset the box to zero
bbox.zero();
}
/*! \brief Cartesian decomposition constructor, it divide the space in boxes
*
......@@ -372,10 +418,12 @@ public:
*
*/
CartDecomposition(std::vector<size_t> dec, Domain<dim,T> domain, Vcluster & v_cl)
:id_sub(0),gr(dec),cd(domain,dec),domain(domain),v_cl(v_cl)
:id_sub(0),gr(dec),cd(domain,dec,0),domain(domain),v_cl(v_cl)
{
// Create the decomposition
// Reset the box to zero
bbox.zero();
// Create the decomposition
CreateDecomposition(v_cl);
}
......@@ -383,6 +431,72 @@ public:
~CartDecomposition()
{}
openfpm::vector<size_t> ids;
/*! \brief Given a position it return if the position belong to any neighborhood processor ghost
*
* \param p Particle position
*
* \param return the processor ids
*
*/
const openfpm::vector<size_t> ghost_processorID(Point<dim,T> & p)
{
ids.clear();
// Check with geo-cell if a particle is inside one Cell caotaining boxes
auto cell_it = geo_cell.getCellIterator(p);
// For each element in the cell, check if the point is inside the box
// if it is store the processor id
while (cell_it.isNext())
{
size_t bid = cell_it.get();
if (vb_int.get(bid).box.isInside(p) == true)
{
ids.add(vb_int.get(bid).proc);
}
}
return ids;
}
/*! \brief Given a position it return if the position belong to any neighborhood processor ghost
*
* \param p Particle position
*
* \param return the processor ids
*
*/
template<typename Mem> inline const openfpm::vector<size_t> gh