Commit ddd5c942 authored by incardon's avatar incardon

Fixing conflicts

parents 549a1af9 7a583b50
# Change Log
All notable changes to this project will be documented in this file.
## [0.5.1] - Mid september
## [0.6.0] - End October 2016
### Added
- Symmetric cell-list/verlet list
- Multi-phase cell-list and Multi-phase cell-list
- Added ghost_get that keep properties
- Examples: 1_ghost_get_put it show how to use ghost_get and put with the new options
4_multiphase_celllist_verlet completely rewritten for new Cell-list and multiphase verlet
5_molecular_dynamic use case of symmetric cell-list and verlet list with ghost put
6_complex_usage It show how the flexibility of openfpm can be used to debug your program
### Fixed
- Option NO_POSITION was untested
### Changes
## [0.5.1] - 27 September 2016
### Added
- ghost_put support for particles
- Full-Support for complex property on vector_dist (Serialization)
- Added examples for serialization of complex properties 4_Vector
- improved speed of the iterators
### Fixed
- Installation PETSC installation fail in case of preinstalled MPI
......@@ -131,17 +149,14 @@ All notable changes to this project will be documented in this file.
- Algebraic Multigrid solver
- Parallel VTK, improved visualization
- Asynchronous communication
## [0.6.0] - Middle of October
## [0.7.0] - December of October
### Added
- Asynchronous communication
- Symmetric Cell list and Verlet (15 days)
- Semantic communication (??)
- Improved Finite difference interface (15 days)
## [0.6.0] - Beginning of September
- Complex properties and serialization interface (15 days)
......@@ -2,11 +2,14 @@
*
* \subpage Vector_0_simple
* \subpage Vector_1_celllist
* \subpage Vector_1_ghost_get
* \subpage Vector_2_expression
* \subpage Vector_3_md
* \subpage Vector_4_reo_root
* \subpage Vector_4_cp
* \subpage Vector_4_mp_cl
* \subpage Vector_5_md_vl_sym
* \subpage Vector_6_complex_usage
*
*/
......@@ -37,7 +40,7 @@
* </div>
* \endhtmlonly
*
* ## inclusion ## {#inclusion}
* ## inclusion ## {#e0_v_inclusion}
*
* In order to use distributed vectors in our code we have to include the file Vector/vector_dist.hpp
*
......@@ -60,7 +63,7 @@ int main(int argc, char* argv[])
* Here we
* * Initialize the library
* * we create a Box that define our domain
* * An array that define out boundary conditions
* * An array that define our boundary conditions
* * A Ghost object that will define the extension of the ghost part in physical units
*
*
......@@ -345,7 +348,7 @@ int main(int argc, char* argv[])
*
* ## Finalize ## {#finalize_e0_sim}
*
* At the very end of the program we have always to de-initialize the library
* At the very end of the program we have always de-initialize the library
*
* \snippet Vector/0_simple/main.cpp finalize
*
......
......@@ -173,6 +173,9 @@ int main(int argc, char* argv[])
* no properties. If we want to synchronize also properties we have to specify which one.
* For example with <0,1,2> here we synchronize the scalar property (0), the vector (1), and the rank 2 tensor (2)
*
* \warning Every ghost_get by default reset the status of the ghost so the information are lost
*
* \see \ref e1_gg_options
*
* \htmlonly
* <a href="#" onclick="hide_show('vector-video-5')" >Video 1</a>
......
......@@ -7,9 +7,8 @@ LDIR =
OBJ = main.o
OBJ_EXPR = main_expr.o
OBJ_VL = main_vl.o
OBJ_VL_SYM = main_vl_sym.o
all: md_dyn md_dyn_expr md_dyn_vl md_dyn_vl_sym
all: md_dyn md_dyn_expr md_dyn_vl
%.o: %.cpp
$(CC) -fext-numeric-literals -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
......@@ -23,14 +22,11 @@ md_dyn_expr: $(OBJ_EXPR)
md_dyn_vl: $(OBJ_VL)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
md_dyn_vl_sym: $(OBJ_VL_SYM)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
run: all
source $$HOME/openfpm_vars; mpirun -np 3 ./md_dyn; mpirun -np 3 ./md_dyn_expr; mpirun -np 3 ./md_dyn_vl; mpirun -np 3 ./md_dyn_vl_sym;
source $$HOME/openfpm_vars; mpirun -np 3 ./md_dyn; mpirun -np 3 ./md_dyn_expr; mpirun -np 3 ./md_dyn_vl;
.PHONY: clean all run
clean:
rm -f *.o *~ core md_dyn md_dyn_expr md_dyn_vl md_dyn_vl_sym
rm -f *.o *~ core md_dyn md_dyn_expr md_dyn_vl
This diff is collapsed.
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "data_type/aggregate.hpp"
#include "NN/CellList/CellListM.hpp"
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* [TOC]
*
*
* # Vector Multi Phase cell-list # {#e4_ph_cl}
*
* This example show multi-phase cell lists for the distributed vector
*
* \warning BETA version
*
*/
int main(int argc, char* argv[])
{
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* ## Initialization ##
*
* Here we Initialize the library, and we create a set of distributed vectors all forced to have the same
* decomposition. Each vector identify one phase
*
* \snippet Vector/4_multiphase_celllist/main.cpp Initialization and parameters
*
*/
//! \cond [Initialization and parameters] \endcond
openfpm_init(&argc,&argv);
Vcluster & v_cl = create_vcluster();
// we will place the particles on a grid like way with 128 particles on each direction
size_t sz[3] = {128,128,128};
// The domain
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
float r_cut = 0.05;
// ghost, big enough to contain the interaction radius
Ghost<3,float> ghost(r_cut);
openfpm::vector< vector_dist<3,float, aggregate<double,double>> > phases;
// first phase
phases.add( vector_dist<3,float, aggregate<double,double>>(4096,box,bc,ghost) );
// The other 3 phases
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
phases.add( vector_dist<3,float, aggregate<double,double>>(phases.get(0).getDecomposition(),4096) );
//! \cond [Initialization and parameters] \endcond
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* ## Initialization ##
*
* We initialize all the phases with particle randomly positioned in the space
*
* \snippet Vector/4_multiphase_celllist/main.cpp rand dist
*
*/
//! \cond [rand dist] \endcond
auto it = phases.get(0).getDomainIterator();
// For all the particles
while (it.isNext())
{
// for all phases
for (size_t i = 0 ; i < phases.size() ; i++)
{
auto key = it.get();
phases.get(i).getPos(key)[0] = (float)rand() / RAND_MAX;
phases.get(i).getPos(key)[1] = (float)rand() / RAND_MAX;
phases.get(i).getPos(key)[2] = (float)rand() / RAND_MAX;
}
// next point
++it;
}
// Redistribute all the phases in the mean while also take the iterators of all the phases
typedef decltype(phases.get(0).getIterator()) iterator;
openfpm::vector<iterator> phase_it;
for (size_t i = 0 ; i < phases.size() ; i++)
phases.get(i).map();
//! \cond [rand dist] \endcond
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* ## Multi-phase cell-list construction ##
*
* In this part we construct the Multi-phase cell list. The multiphase cell list has 3 parameters
* * one is the dimensionality (3)
* * The precision of the coordinates (float),
* * How many bit to use for the phase.
* Multi-phase cell-list try to pack into a 64bit number information about the particle id and the
* the phase id.
*
* \snippet Vector/4_multiphase_celllist/main.cpp cl construction
*
*/
//! \cond [cl construction] \endcond
// Construct one single Multi-phase cell list to use in the computation
// in 3d, precision float, 2 bit dedicated to the phase for a maximum of 2^2 = 4 (Maximum number of phase)
//
//
size_t div[3];
Box<3,float> box_cl;
phases.get(0).getCellListParams(r_cut,div,box_cl);
CellListM<3,float,2> NN;
NN.Initialize(box_cl,div);
// for all the phases i
for (size_t i = 0; i < phases.size() ; i++)
{
// iterate across all the particle of the phase i
auto it = phases.get(i).getDomainIterator();
while (it.isNext())
{
auto key = it.get();
// Add the particle of the phase i to the cell list
NN.add(phases.get(i).getPos(key), key.getKey(), i);
++it;
}
}
//! \cond [cl construction] \endcond
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* ## Multi-phase cell-list usage ##
*
* After construction we show how to use the Cell-list. In this case we accumulate on the property
* 0 of the phase 0 the distance of the near particles from all the phases
*
* \snippet Vector/4_multiphase_celllist/main.cpp cl usage
*
*/
//! \cond [cl usage] \endcond
vector_dist<3,float, aggregate<double,double> > & current_phase = phases.get(0);
// Get the iterator of the particles of phase 0
auto it2 = current_phase.getIterator();
// For each particle ...
while (it2.isNext())
{
// ... p
auto p = it2.get();
// Get the position of the particle p
Point<3,float> xp = current_phase.getPos(p);
// Get an iterator of all the particles neighborhood of p
auto Np = NN.getNNIterator(NN.getCell(current_phase.getPos(p)));
// For each particle near p
while (Np.isNext())
{
// Get the particle q near to p
auto q = Np.getP();
// Get from which phase it come from
auto ph_q = Np.getV();
Point<3,float> xq = phases.get(ph_q).getPos(q);
// we accumulate all the distances
current_phase.getProp<0>(p) = norm(xp - xq);
++Np;
}
// Next particle p
++it2;
}
//! \cond [cl usage] \endcond
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* ## Finalize ## {#finalize}
*
* At the very end of the program we have always de-initialize the library
*
* \snippet Vector/4_multiphase_celllist/main.cpp finalize
*
*/
//! \cond [finalize] \endcond
openfpm_finalize();
//! \cond [finalize] \endcond
/*!
* \page Vector_4_mp_cl Vector 4 Multi Phase cell-list
*
* # Full code # {#code}
*
* \include Vector/4_multiphase_celllist/main.cpp
*
*/
}
......@@ -9,16 +9,16 @@ OBJ = main.o
%.o: %.cpp
$(CC) -fext-numeric-literals -O3 -g -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
cell: $(OBJ)
multip: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: cell
all: multip
run: all
source $$HOME/openfpm_vars; mpirun -np 2 ./cell
source $$HOME/openfpm_vars; mpirun -np 2 ./multip
.PHONY: clean all run
clean:
rm -f *.o *~ core cell
rm -f *.o *~ core multip
This diff is collapsed.
include ../../example.mk
CC=mpic++
LDIR =
OBJ_DORD = main.o
all: complex_use
%.o: %.cpp
$(CC) -fext-numeric-literals -O3 -g -c --std=c++11 $(OPT) -o $@ $< $(INCLUDE_PATH)
complex_use: $(OBJ_DORD)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
run: all_test
source $$HOME/openfpm_vars; mpirun -np 3 ./complex_use
.PHONY: clean all run all_test on_test
clean:
rm -f *.o *~ core complex_use
This diff is collapsed.
openfpm_data @ ed732d7f
Subproject commit fdf6629cc30bb52c73b703e2f66146439aebb7bc
Subproject commit ed732d7fe9e9644a9ad49f319923874b0c2c9e78
openfpm_devices @ ecadd99f
Subproject commit f46e31235688bd15c2a808ba7aa1bd413908bb8a
Subproject commit ecadd99fabe515ba06f00a5e7c656777c6bb9860
openfpm_io @ 5cf76966
Subproject commit 62b8316404bf98c5cc5ad299563425656cfd3003
Subproject commit 5cf769662d6e57a7a2fd12d1cfc835fd2793bc7b
......@@ -38,7 +38,7 @@ PROJECT_NAME = "OpenFPM_pdata"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 0.5.1
PROJECT_NUMBER = 0.6.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
......
openfpm_vcluster @ 2d24d5c6
Subproject commit c65f473077ccf64b3e0848238fb235a38b443526
Subproject commit 2d24d5c6dfab646fbeac429f53ef24a4e19631ac
......@@ -181,6 +181,9 @@ if [ ! -d "$1/MUMPS" ]; then
$sed_command -i "/LIBBLAS\s=\s-lblas/c\LIBBLAS = -lopenblas" Makefile.inc
$sed_command -i "/INCPAR\s\+=\s\-I\/usr\/include/c\INCPAR =" Makefile.inc
$sed_command -i "/LIBPAR\s\+=\s\$(SCALAP)\s\-L\/usr\/lib\s\-lmpi/c\LIBPAR = \$(SCALAP)" Makefile.inc
make -j $2
if [ $? -eq 0 ]; then
......
......@@ -31,11 +31,10 @@ class ie_ghost
//! It store the same information of box_nn_processor_int organized by processor id
openfpm::vector< Box_dom<dim,T> > proc_int_box;
// External ghost boxes for this processor, indicated with G8_0 G9_0 ...
//! External ghost boxes for this processor
openfpm::vector<p_box<dim,T> > vb_ext;
// Internal ghost boxes for this processor domain, indicated with B8_0 B9_0 ..... in the figure
// below as a linear vector
//! Internal ghost boxes for this processor domain
openfpm::vector<p_box<dim,T> > vb_int;
//! Cell-list that store the geometrical information of the internal ghost boxes
......@@ -44,8 +43,10 @@ class ie_ghost
//! shift vectors
openfpm::vector<Point<dim,T>> shifts;
// Temporal buffers to return information for ghost_processorID
//! Temporal buffers to return temporal information for ghost_processorID
openfpm::vector<std::pair<size_t,size_t>> ids_p;
//! Temporal buffers to return temporal information
openfpm::vector<size_t> ids;
......@@ -188,6 +189,9 @@ protected:
* The geo cell list structure exist to speed up the labelling the points if they fall on some
* internal ghost
*
* \param domain where the cell list is defined
* \param div number of division of the cell list
*
*/
void Initialize_geo_cell(const Box<dim,T> & domain, const size_t (&div)[dim])
{
......@@ -200,7 +204,11 @@ protected:
* For each sub-domain of the local processor it store the intersection between the enlarged
* sub-domain of the calling processor with the adjacent processors sub-domains (External ghost box)
*
* \param v_cl Virtual cluster
* \param ghost margins
* \param subdomains vector of local sundomains
* \param box_nn_processor it will store for each sub-domain the near processors
* \param nn_prcs contain the sub-domains of the near processors
*
* \note Are the G8_0 G9_0 G9_1 G5_0 boxes in calculateGhostBoxes
* \see calculateGhostBoxes
......@@ -296,8 +304,8 @@ protected:
* \param v_cl Virtual cluster
* \param ghost margins
* \param sub_domains
* \param box_nn_processors sub-domains of the adjacent processors
* \param nn_prcs structure that store the adjacent processor information
* \param box_nn_processors sub-domains of the near processors
* \param nn_prcs structure that store the near processor sub-domains
* \param geo_cell Cell list that store the subdomain information
*
* \note Are the B8_0 B9_0 B9_1 B5_0 boxes in calculateGhostBoxes
......@@ -508,6 +516,8 @@ public:
* This function return the set of shift vectors that determine such shift, for example
* in the example above the shift at position 5 will be (0,-1.0)
*
* \return the shift vectors
*
*/
const openfpm::vector<Point<dim,T>> & getShiftVectors()
{
......@@ -667,6 +677,8 @@ public:
}
/*! \brief Given the internal ghost box id, it return the internal ghost box
*
* \param b_id internal ghost box id
*
* \return the internal ghost box
*
......@@ -679,6 +691,8 @@ public:
/*! \brief Given the internal ghost box id, it return the near processor at witch belong
* or the near processor that produced this internal ghost box
*
* \param internal ghost box id
*
* \return the processor id of the ghost box
*
*/
......@@ -698,6 +712,8 @@ public:
}
/*! \brief Given the external ghost box id, it return the external ghost box
*
* \param b_id external ghost box id
*
* \return the external ghost box
*
......@@ -710,6 +726,8 @@ public:
/*! \brief Given the external ghost box id, it return the near processor at witch belong
* or the near processor that produced this external ghost box
*
* \param b_id external ghost box id
*
* \return the processor id of the external ghost box
*
*/
......@@ -721,6 +739,7 @@ public:
/*! /brief Given a point it return the set of boxes in which the point fall
*
* \param p Point to check
*
* \return An iterator with the id's of the internal boxes in which the point fall
*
*/
......@@ -757,6 +776,8 @@ public:
*
* \param return the processor ids (not the rank, the id in the near processor list)
*
* \return a vector of pairs containinf the requested infromation
*
*/
template <typename id1, typename id2> inline const openfpm::vector<std::pair<size_t,size_t>> ghost_processorID_pair(Point<dim,T> & p, const int opt = MULTIPLE)
{
......@@ -806,6 +827,8 @@ public:
*
* \param return the processor ids
*
* \return a vector containing the requested information
*
*/
template <typename id> inline const openfpm::vector<size_t> ghost_processorID(Point<dim,T> & p, const int opt = MULTIPLE)
{
......@@ -842,10 +865,12 @@ public:
/*! \brief Given a position it return if the position belong to any neighborhood processor ghost
* (Internal ghost)
*
* \tparam id type of if to get box_id processor_id lc_processor_id
* \tparam id1 first index type to get box_id processor_id lc_processor_id
* \tparam id2 second index type to get box_id processor_id lc_processor_id
*
* \param p Particle position
*
* \param return the processor ids
* \return a vector of pair containing the requested information
*
*/
template<typename id1, typename id2, typename Mem> inline const openfpm::vector<std::pair<size_t,size_t>> ghost_processorID_pair(const encapc<1,Point<dim,T>,Mem> & p, const int opt = MULTIPLE)
......
......@@ -200,7 +200,6 @@ class grid_dist_id
{
// Get the internal ghost boxes and transform into grid units
::Box<dim,St> ib_dom = dec.getProcessorIGhostBox(i,j);
ib_dom -= cd_sm.getOrig();
::Box<dim,long int> ib = cd_sm.convertDomainSpaceIntoGridUnits(ib_dom,dec.periodicity());
// Check if ib is valid if not it mean that the internal ghost does not contain information so skip it
......@@ -321,7 +320,6 @@ class grid_dist_id
{
// Get the internal ghost boxes and transform into grid units
::Box<dim,St> ib_dom = dec.getLocalIGhostBox(i,j);
ib_dom -= cd_sm.getOrig();
::Box<dim,long int> ib = cd_sm.convertDomainSpaceIntoGridUnits(ib_dom,dec.periodicity());
// Check if ib is valid if not it mean that the internal ghost does not contain information so skip it
......
......@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter3D_test)
{
// Get the local hyper-cube
SpaceBox<3,float> sub = dec.getSubDomain(i);
sub -= domain.getP1();
// sub -= domain.getP1();
Box<3,size_t> g_box = g_dist.getCellDecomposer().convertDomainSpaceIntoGridUnits(sub,bc);
......
......@@ -78,9 +78,7 @@ template<int dim, typename Decomposition> inline void create_gdb_ext(openfpm::ve
// Get the local sub-domain (Grid conversion must be done with the domain P1 equivalent to 0.0)
// consider that the sub-domain with point P1 equivalent to the domain P1 is a (0,0,0) in grid unit
SpaceBox<Decomposition::dims, typename Decomposition::stype> sp = dec.getSubDomain(i);
sp -= cd_sm.getOrig();
SpaceBox<Decomposition::dims, typename Decomposition::stype> sp_g = dec.getSubDomainWithGhost(i);
sp_g -= cd_sm.getOrig();
// Convert from SpaceBox<dim,St> to SpaceBox<dim,long int>
SpaceBox<Decomposition::dims,long int> sp_t = cd_sm.convertDomainSpaceIntoGridUnits(sp,dec.periodicity());
......
......@@ -66,11 +66,13 @@ struct vtk_write<ele,vtk,false>
template<typename T>
struct extends
{
//! number of elements
static inline size_t mul()
{
return 1;
}
//! number of indexes
static inline size_t dim()
{
return 0;
......@@ -81,11 +83,13 @@ struct extends
template<typename T,size_t N1>
struct extends<T[N1]>
{
//! number of elements
static inline size_t mul()
{
return N1;
}
//! number of indexes
static inline size_t dim()
{
return 1;
......@@ -96,11 +100,13 @@ struct extends<T[N1]>
template<typename T,size_t N1,size_t N2>
struct extends<T[N1][N2]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2;
}
//! number of indexes
static inline size_t dim()
{
return 2;
......@@ -111,11 +117,13 @@ struct extends<T[N1][N2]>
template<typename T,size_t N1,size_t N2,size_t N3>
struct extends<T[N1][N2][N3]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2 * N3;
}
//! number of indexes
static inline size_t dim()
{
return 3;
......@@ -126,11 +134,13 @@ struct extends<T[N1][N2][N3]>
template<typename T,size_t N1,size_t N2,size_t N3,size_t N4>
struct extends<T[N1][N2][N3][N4]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2 * N3 * N4;
}
//! number of indexes
static inline size_t dim()
{
return 4;
......@@ -141,11 +151,13 @@ struct extends<T[N1][N2][N3][N4]>
template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5>
struct extends<T[N1][N2][N3][N4][N5]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2 * N3 * N4 * N5;
}
//! number of indexes
static inline size_t dim()
{
return 5;
......@@ -156,11 +168,13 @@ struct extends<T[N1][N2][N3][N4][N5]>
template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6>
struct extends<T[N1][N2][N3][N4][N5][N6]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2 * N3 * N4 * N5 * N6;
}
//! number of indexes
static inline size_t dim()
{
return 6;
......@@ -171,11 +185,13 @@ struct extends<T[N1][N2][N3][N4][N5][N6]>
template<typename T,size_t N1,size_t N2,size_t N3,size_t N4,size_t N5, size_t N6, size_t N7>
struct extends<T[N1][N2][N3][N4][N5][N6][N7]>
{
//! number of elements
static inline size_t mul()
{
return N1 * N2 * N3 * N4 * N5 * N6 * N7;