Commit 5ffbd4b5 authored by incardon's avatar incardon

Merging with master

parents 14f1c4aa 7214aa38
...@@ -278,5 +278,5 @@ else ...@@ -278,5 +278,5 @@ else
fi fi
fi fi
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Info:\", \"color\": \"#00FF00\", \"text\":\"$MACHINE completed succeffuly the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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 curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Info:\", \"color\": \"#00FF00\", \"text\":\"$2 completed succeffuly the openfpm_pdata test \" }] }" https://hooks.slack.com/services/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
...@@ -151,5 +151,5 @@ int main(int argc, char* argv[]) ...@@ -151,5 +151,5 @@ int main(int argc, char* argv[])
// //
// Deinitialize the library // Deinitialize the library
// //
delete(global_v_cluster); delete_global_v_cluster();
} }
...@@ -154,5 +154,5 @@ int main(int argc, char* argv[]) ...@@ -154,5 +154,5 @@ int main(int argc, char* argv[])
// //
// Deinitialize the library // Deinitialize the library
// //
delete(global_v_cluster); delete_global_v_cluster();
} }
...@@ -118,9 +118,17 @@ int main(int argc, char* argv[]) ...@@ -118,9 +118,17 @@ int main(int argc, char* argv[])
v_cl.execute(); v_cl.execute();
// //
// ### WIKI 14 ### // ### WIKI 9 ###
//
// Output the particle position for each processor
//
vd.write("output");
//
// ### WIKI 10 ###
// //
// Deinitialize the library // Deinitialize the library
// //
delete(global_v_cluster); delete_global_v_cluster();
} }
...@@ -161,7 +161,7 @@ else ...@@ -161,7 +161,7 @@ else
## if MPI or METIS installation required install it ## if MPI or METIS installation required install it
if [ $conf_err -eq 200 ]; then if [ $conf_err -eq 200 ]; then
echo "MPI not found try to install" echo "MPI not found try to install, $MPI_installed"
if [ $MPI_installed -eq 1 ]; then if [ $MPI_installed -eq 1 ]; then
echo "Error the installation of MPI failed" echo "Error the installation of MPI failed"
exit 1 exit 1
...@@ -169,7 +169,7 @@ else ...@@ -169,7 +169,7 @@ else
./script/install_MPI.sh $i_dir $compiler_opt ./script/install_MPI.sh $i_dir $compiler_opt
MPI_installed=1 MPI_installed=1
export PATH="$PATH:$i_dir/MPI/bin" export PATH="$PATH:$i_dir/MPI/bin"
configure_options="$configure_options CXX=mpic++ "
elif [ $conf_err -eq 201 ]; then elif [ $conf_err -eq 201 ]; then
echo "Metis not found try to install" echo "Metis not found try to install"
if [ $METIS_installed -eq 1 ]; then if [ $METIS_installed -eq 1 ]; then
...@@ -197,8 +197,8 @@ fi ...@@ -197,8 +197,8 @@ fi
### Create example.mk ### Create example.mk
install_base=$(cat install_dir) install_base=$(cat install_dir)
echo "INCLUDE_PATH=-I. -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include" > example.mk echo "INCLUDE_PATH=-I. -I$install_base/openfpm_pdata/include/config -I$install_base/openfpm_pdata/include -I$install_base/openfpm_data/include -I$install_base/openfpm_vcluster/include -I$install_base/openfpm_io/include -I$install_base/openfpm_devices/include -I$i_dir/METIS/include -I$i_dir/BOOST/include" > example.mk
echo "LIBS_PATH=-L$install_base/openfpm_devices/lib -L$install_base/openfpm_vcluster/lib -L$i_dir/METIS/lib " >> example.mk echo "LIBS_PATH=-L$install_base/openfpm_devices/lib -L$install_base/openfpm_vcluster/lib -L$i_dir/METIS/lib -L$i_dir/BOOST/lib " >> example.mk
echo "LIBS=-lvcluster -lofpmmemory -lmetis -lboost_iostreams" >> example.mk echo "LIBS=-lvcluster -lofpmmemory -lmetis -lboost_iostreams" >> example.mk
cp example.mk src/example.mk cp example.mk src/example.mk
cp example.mk example/example.mk cp example.mk example/example.mk
......
#! /bin/bash
function detect_gcc_or_clang()
{
command -v $1 >/dev/null 2>&1
if [ $? -ne 0 ]; then
dgc_ret=0
return
fi
# First we try to understand if g++ command line is linked to clang
$1 --version | grep "Apple LLVM"
if [ $? == 0 ]; then
echo "Apple LLVM based g++"
# we try the detect the version
major=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\1/g')
# we check if the detection is garbage
echo "$major" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dgc_major=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\1/g')
dgc_middle=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\2/g')
dgc_minor=$($1 --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*(.*/\3/g')
if [ $dgc_major -gt 6 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_major -lt 6 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your Apple clang $major.middle;$minor is too old, 6.1.0 or higher is required"
dgc_ret=0
elif [ $dgc_middle -gt 1 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_minor -lt 1 ]; then
echo -e "clang++ $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your Apple clang $major.middle;$minor is too old, 6.1.0 or higher is required"
dgc_ret=0
else
echo -e "Apple clang++ version $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
fi
return
fi
dgc_ret=2
return
fi
$1 --version | grep $1
if [ $? == 0 -a x"$1" == x"gcc" ]; then
dgc_major=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dgc_middle=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dgc_minor=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dgc_major -gt 4 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
elif [ $dgc_major -lt 4 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
elif [ $dgc_middle -gt 8 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
elif [ $dgc_middle -lt 8 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
elif [ $dgc_minor -gt 1 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=g++
dgc_ret=1
else
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m FAILED \033[0m your g++ version is too old, 4.8.2 at least required"
dgc_ret=0
fi
return
fi
$1 --version | grep $1
if [ $? == 0 -a x"$1" == x"clang" ]; then
dgc_major=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dgc_middle=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dgc_minor=$($1 --version | grep $1 | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dgc_major -gt 3 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_major -lt 3 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your clang version is too old 3.6.0 at least required"
dgc_ret=0
elif [ $dgc_middle -gt 6 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=1
elif [ $dgc_middle -lt 6 ]; then
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your clang version is too old 3.6.0 at least required"
dgc_ret=0
else
echo -e "$1 $dgc_major.$dgc_middle.$dgc_minor \033[92;1m SUCCESS \033[0m"
dgc_compiler=clang++
dgc_ret=0
fi
return
fi
dgc_ret=0
}
#! /bin/bash
function detect_osx()
{
if [ x"$1" != x"osx" ]; then
return
fi
# Try first pattern
version=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
echo "$version" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dosx_major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
dosx_middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
dosx_minor=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $dosx_major -gt 10 ]; then
dosx_ret=1
elif [ $dosx_major -lt 10 ]; then
dosx_ret=0
elif [ $dosx_middle -gt 10 ]; then
dosx_ret=1
elif [ $dosx_middle -lt 10 ]; then
dosx_ret=1
else
dosx_ret=0
fi
fi
version=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\1/g')
echo "$version" | egrep -q '^[0-9]+$'
if [ $? == 0 ]; then
dosx_major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\1/g')
dosx_middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\).*/\2/g')
if [ $dosx_major -gt 10 ]; then
dosx_ret=1
elif [ $dosx_major -lt 10 ]; then
dosx_ret=0
elif [ $dosx_middle -gt 10 ]; then
dosx_ret=1
elif [ $dosx_middle -lt 10 ]; then
dosx_ret=1
else
dosx_ret=0
fi
fi
}
...@@ -12,6 +12,8 @@ source script/solve_wget ...@@ -12,6 +12,8 @@ source script/solve_wget
source script/solve_automake source script/solve_automake
source script/solve_brew source script/solve_brew
source script/solve_libtool source script/solve_libtool
source script/detect_gcc
source script/detect_osx
discover_os discover_os
discover_package_manager $platform discover_package_manager $platform
...@@ -139,103 +141,19 @@ fi ...@@ -139,103 +141,19 @@ fi
#### Detecting g++ #### Detecting g++
if [ x"$platform" == x"osx" ]; then detect_gcc_or_clang gcc
## we try to detect osx version if [ $dgc_ret -eq 0 ]; then
major=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\1/g') solve_gpp $platform
middle=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\2/g') detect_gcc_or_clang gcc-4.9
minor=$(g++ --version | grep LLVM | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)svn.*/\3/g') if [ $dgc_ret -eq 0 ]; then
exit 1
echo "$major" | egrep -q '^[0-9]+$'
is_maj_num=$?
echo "$minor" | egrep -q '^[0-9]+$'
is_min_num=$?
echo "$middle" | egrep -q '^[0-9]+$'
is_mid_num=$?
command -v g++-4.9 >/dev/null 2>&1
opt1=$?
# Major middle and minor should contain only numbers, if they dont, and smaller than 2 character otherwise the detection was garbage
if [ $is_maj_num -ne 0 -o $is_min_num -ne 0 -o $is_mid_num -ne 0 ]; then
if [ $opt1 -eq 1 ]; then
## the detection is garbage, gcc49 id not present, now we check the system
major=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
middle=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
minor=$(sw_vers | grep ProductVersion | sed 's/.*\([0-9][0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $major -gt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
elif [ $major -lt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor is older than 10.10.X, so is probably going to fail with the actual compiler"
echo "One possible solution is to try to install gcc 4.9"
solve_gpp $platform
elif [ $middle -gt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
elif [ $middle -lt 10 ]; then
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor is older than 10.10.X, so is probably going to fail with the actual compiler"
echo "One possible solution is to try to install gcc 4.9"
solve_gpp $platform
else
echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo "g++ seem to be present, but we failed to detect the version. Your system $major.$middle.$minor seem to be recent enough, so we will continue the installation"
sleep 10
fi
fi
else
## the detection is good check the compiler
if [ $major -gt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $major -lt 3 ]; then
echo -e "clang++ $major.$middle.$minor \033[91;5;1m FAILED \033[0m your clang $major.middle;$minor is too old, 3.6.0 or higher is required"
solve_gpp $platform
elif [ $middle -gt 6 ]; then
echo -e "clang++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $middle -lt 6 ]; then
echo -e "clang++\033[91;5;1m FAILED \033[0m your clang is out of date, update to 3.6.0 or higher is required"
solve_gpp $platform
else
echo -e "clang++ version $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
fi
fi fi
else elif [ $dgc_ret -eq 2 ]; then
command -v g++ >/dev/null 2>&1 detect_osx $platform
if [ $? -ne 0 ]; then if [ $dosx_ret -eq 1 ]; then
echo >&2 echo -e "\033[30;43;5;1m------------------------------- WARNING --------------------------------\033[0m"
echo -e "Configure\033[91;5;1m FAILED \033[0m" echo "g++ seem to be present, but we failed to detect the version. Your system $dosx_major.$dosx_middle.$dosx_minor seem to be recent enough, so we will continue the installation"
echo "OpenFPM require g++ but it's not installed, searching a solution..." sleep 10
solve_gpp $platform
command -v g++ >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "g++\033[91;5;1m FAILED \033[0m"
exit 1
else
echo -e "g++\033[92;1m SUCCESS \033[0m"
fi
else
major=$(g++ --version | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1/g')
middle=$(g++ --version | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\2/g')
minor=$(g++ --version | grep g++ | sed 's/.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\3/g')
if [ $major -gt 4 ]; then
echo -e "g++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $major -lt 4 ]; then
echo -e "g++ $major.$middle.$minor \033[91;5;1m FAILED \033[0m your g++ version is too old"
elif [ $middle -gt 8 ]; then
echo -e "g++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
elif [ $middle -lt 8 ]; then
echo -e "g++ $major.$middle.$minor \033[91;5;1m FAILED \033[0m your g++ version is too old"
elif [ $minor -gt 1 ]; then
echo -e "g++ $major.$middle.$minor \033[92;1m SUCCESS \033[0m"
else
echo -e "g++ $major.$middle.$minor \033[92;1m FAILED \033[0m your g++ version is too old"
fi
fi fi
fi fi
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -334,15 +334,33 @@ private: ...@@ -334,15 +334,33 @@ private:
// Receive counter // Receive counter
size_t recv_cnt; size_t recv_cnt;
// reference counter of the object in case is shared between object
long int ref_cnt;
public: public:
//! Increment the reference counter
void incRef()
{ref_cnt++;}
//! Decrement the reference counter
void decRef()
{ref_cnt--;}
//! Return the reference counter
long int ref()
{
return ref_cnt;
}
/*! \brief Cartesian decomposition constructor /*! \brief Cartesian decomposition constructor
* *
* \param v_cl Virtual cluster, used internally to handle or pipeline communication * \param v_cl Virtual cluster, used internally to handle or pipeline communication
* *
*/ */
CartDecomposition(Vcluster & v_cl) CartDecomposition(Vcluster & v_cl)
:nn_prcs<dim,T>(v_cl),v_cl(v_cl) :nn_prcs<dim,T>(v_cl),v_cl(v_cl),ref_cnt(0)
{ {
// Reset the box to zero // Reset the box to zero
bbox.zero(); bbox.zero();
......
#ifndef DIST_MODEL_HPP
#define DIST_MODEL_HPP
#include "metis.h"
/*! \brief This class do graph partitioning
*
* This class do graph partitioning, it use METIS internaly
*
*/
template<typename Graph, typename algorithm>
class GraphPartitioning
{
//! Structure that store the graph
Graph & grp;
/*! Constructor
*
* It load the graph to partition
*
* \param g Graph to store
*
*/
GraphPartitioning(Graph & g)
:grp(g)
{}
};
#endif
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
* *
* \param id sub-domain id * \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) inline size_t getLocalNEGhost(size_t id)
......
...@@ -40,8 +40,13 @@ ...@@ -40,8 +40,13 @@
* \snippet grid_dist_id_unit_test.hpp Create and access a distributed grid complex * \snippet grid_dist_id_unit_test.hpp Create and access a distributed grid complex
* ### Synchronize a distributed grid for complex structures * ### Synchronize a distributed grid for complex structures
* \snippet grid_dist_id_unit_test.hpp Synchronized distributed grid complex * \snippet grid_dist_id_unit_test.hpp Synchronized distributed grid complex
<<<<<<< HEAD
* ### Usage of a grid dist iterator sub * ### Usage of a grid dist iterator sub
* \snippet grid_dist_id_unit_test.hpp Usage of a sub_grid iterator * \snippet grid_dist_id_unit_test.hpp Usage of a sub_grid iterator
=======
* ### Construct two grid with the same decomposition
* \snippet grid_dist_id_unit_test.hpp Construct two grid with the same decomposition
>>>>>>> master
* *
*/ */
template<unsigned int dim, typename St, typename T, typename Decomposition,typename Memory=HeapMemory , typename device_grid=grid_cpu<dim,T> > template<unsigned int dim, typename St, typename T, typename Decomposition,typename Memory=HeapMemory , typename device_grid=grid_cpu<dim,T> >
...@@ -57,7 +62,7 @@ class grid_dist_id ...@@ -57,7 +62,7 @@ class grid_dist_id
Vcluster_object_array<device_grid> loc_grid; Vcluster_object_array<device_grid> loc_grid;
//! Space Decomposition //! Space Decomposition
Decomposition dec; Decomposition & dec;
//! Extension of each grid: Domain and ghost + domain //! Extension of each grid: Domain and ghost + domain
openfpm::vector<GBoxes<device_grid::dims>> gdb_ext; openfpm::vector<GBoxes<device_grid::dims>> gdb_ext;
...@@ -356,6 +361,7 @@ class grid_dist_id ...@@ -356,6 +361,7 @@ class grid_dist_id
} }
} }
<<<<<<< HEAD
/*! \brief Create the grids on memory /*! \brief Create the grids on memory
* *
*/ */
...@@ -363,6 +369,18 @@ class grid_dist_id ...@@ -363,6 +369,18 @@ class grid_dist_id
{ {
Box<dim,St> g_rnd_box; Box<dim,St> g_rnd_box;
for (size_t i = 0 ; i < dim ; i++) {g_rnd_box.setHigh(i,0.5); g_rnd_box.setLow(i,-0.5);} for (size_t i = 0 ; i < dim ; i++) {g_rnd_box.setHigh(i,0.5); g_rnd_box.setLow(i,-0.5);}
=======
public:
//! 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)
{
// Increment the reference counter of the decomposition
dec.incRef();
check_size(g_sz);
>>>>>>> master
// Get the number of local grid needed // Get the number of local grid needed
size_t n_grid = dec.getNLocalHyperCube(); size_t n_grid = dec.getNLocalHyperCube();
...@@ -370,6 +388,7 @@ class grid_dist_id ...@@ -370,6 +388,7 @@ class grid_dist_id
// create local grids for each hyper-cube // create local grids for each hyper-cube
loc_grid = v_cl.allocate<device_grid>(n_grid); loc_grid = v_cl.allocate<device_grid>(n_grid);
<<<<<<< HEAD
// Size of the grid on each dimension // Size of the grid on each dimension
size_t l_res[dim]; size_t l_res[dim];
...@@ -385,10 +404,15 @@ class grid_dist_id ...@@ -385,10 +404,15 @@ class grid_dist_id
// Convert from SpaceBox<dim,St> to SpaceBox<dim,long int> // Convert from SpaceBox<dim,St> to SpaceBox<dim,long int>
SpaceBox<dim,long int> sp_t = cd_sm.convertDomainSpaceIntoGridUnits(sp); SpaceBox<dim,long int> sp_t = cd_sm.convertDomainSpaceIntoGridUnits(sp);
SpaceBox<dim,long int> sp_tg = cd_sm.convertDomainSpaceIntoGridUnits(sp_g); SpaceBox<dim,long int> sp_tg = cd_sm.convertDomainSpaceIntoGridUnits(sp_g);
=======
// fill the global size of the grid
for (size_t i = 0 ; i < dim ; i++) {this->g_sz[i] = g_sz[i];}
>>>>>>> master
//! Save the origin of the sub-domain of the local grid //! Save the origin of the sub-domain of the local grid
gdb_ext.last().origin = sp_tg.getP1(); gdb_ext.last().origin = sp_tg.getP1();
<<<<<<< HEAD
// save information about the local grid: domain box seen inside the domain + ghost box (see GDBoxes for a visual meaning) // save information about the local grid: domain box seen inside the domain + ghost box (see GDBoxes for a visual meaning)
// and where the GDBox start, or the origin of the local grid (+ghost) in global coordinate // and where the GDBox start, or the origin of the local grid (+ghost) in global coordinate
gdb_ext.last().Dbox = sp_t; gdb_ext.last().Dbox = sp_t;
...@@ -403,6 +427,10 @@ class grid_dist_id ...@@ -403,6 +427,10 @@ class grid_dist_id
// Set the dimensions of the local grid // Set the dimensions of the local grid
loc_grid.get(i).resize(l_res); loc_grid.get(i).resize(l_res);
} }
=======
// Calculate ghost boxes
dec.calculateGhostBoxes();
>>>>>>> master
} }