Commit 8e1a23f1 authored by incardon's avatar incardon

Improved documentation + examples code

parent b9720be7
...@@ -5,8 +5,9 @@ All notable changes to this project will be documented in this file. ...@@ -5,8 +5,9 @@ All notable changes to this project will be documented in this file.
### Added ### Added
- Introduced getDomainIterator for Cell-list - Introduced getDomainIterator for Cell-list
- Example to show how to add sensors in SPH/particle based methods (see) - Example to show how to add sensors in SPH/particle based methods (see Vector/7_SPH_opt)
- Vortex in Cell example - Increased performance of 7_SPH_opt
- Vortex in Cell example Numerics/Vortex_in_cell
- Interpolation functions (see Numerics/vortex_in_cell example) - Interpolation functions (see Numerics/vortex_in_cell example)
- Gray-scott 3d example with stencil iterator optimixation (see Grid/gray_scott_3d example) - Gray-scott 3d example with stencil iterator optimixation (see Grid/gray_scott_3d example)
- HDF5 Check point restart for vector_dist particles (see Vector/1_HDF5_save_and_load) - HDF5 Check point restart for vector_dist particles (see Vector/1_HDF5_save_and_load)
...@@ -14,11 +15,13 @@ All notable changes to this project will be documented in this file. ...@@ -14,11 +15,13 @@ All notable changes to this project will be documented in this file.
- A way to specify names for properties and select properties to write (in PROGRESS) - A way to specify names for properties and select properties to write (in PROGRESS)
- Ghost put on grid (see Vortex in Cell example) - Ghost put on grid (see Vortex in Cell example)
- getDomainIterator stencil for faster stencil codes iterators see (Grid/gray_scott_3d example) - getDomainIterator stencil for faster stencil codes iterators see (Grid/gray_scott_3d example)
- Agebraic multigrid solvers interface for linear systems (see Vortex in Cell example) - Algebraic multigrid solvers interface for linear systems (see Vortex in Cell example)
- Added setPropNames in vector_dist see Vector/0_simple
### Fixed ### Fixed
- Installation of PETSC in case with MUMPS try without MUMPS - Installation of PETSC in case with MUMPS try without MUMPS
- In case of miss compilation ignore system wide installation - In case of miss compilation ignore system wide installation
- 2 Bugs in 7_SPH_opt and 7_SPH_opt error in Kernel and update for boundary particles
- Bug in VTK writer binary in case of vectors - Bug in VTK writer binary in case of vectors
- Bug in VTK writer binary: long int are not supported removing output - Bug in VTK writer binary: long int are not supported removing output
- Bug in FDScheme in the constructor with stencil bigger than one - Bug in FDScheme in the constructor with stencil bigger than one
...@@ -26,7 +29,11 @@ All notable changes to this project will be documented in this file. ...@@ -26,7 +29,11 @@ All notable changes to this project will be documented in this file.
- Bug Performance bug in the grid iterator - Bug Performance bug in the grid iterator
### Changed ### Changed
- CellList types has changed (one additional template parameter) - CellList types has changed for example
CellList<3, double, FAST, shift<3,double>>
become
CellList<3, double, Mem_fast<3, double>, shift<3, double>>
- getIterator in CellList changed getCellIterator
- Gris iterator types has changes (one additional template parameter) - Gris iterator types has changes (one additional template parameter)
## [0.8.0] 28 February 2016 ## [0.8.0] 28 February 2016
......
...@@ -1139,7 +1139,7 @@ int main(int argc, char* argv[]) ...@@ -1139,7 +1139,7 @@ int main(int argc, char* argv[])
{ {
// Initialize // Initialize
openfpm_init(&argc,&argv); openfpm_init(&argc,&argv);
{
// Domain, a rectangle // Domain, a rectangle
Box<3,float> domain({0.0,0.0,0.0},{22.0,5.57,5.57}); Box<3,float> domain({0.0,0.0,0.0},{22.0,5.57,5.57});
...@@ -1190,9 +1190,9 @@ int main(int argc, char* argv[]) ...@@ -1190,9 +1190,9 @@ int main(int argc, char* argv[])
v_cl.execute(); v_cl.execute();
// Now we set the size of phi_s // Now we set the size of phi_s
phi_s[0].resize(tot_part,particles.size_local()); phi_s[0].resize(g_vort.size(),g_vort.getLocalDomainSize());
phi_s[1].resize(tot_part,particles.size_local()); phi_s[1].resize(g_vort.size(),g_vort.getLocalDomainSize());
phi_s[2].resize(tot_part,particles.size_local()); phi_s[2].resize(g_vort.size(),g_vort.getLocalDomainSize());
// And we initially set it to zero // And we initially set it to zero
phi_s[0].setZero(); phi_s[0].setZero();
...@@ -1266,6 +1266,7 @@ int main(int argc, char* argv[]) ...@@ -1266,6 +1266,7 @@ int main(int argc, char* argv[])
if (i % 100 == 0) {check_point_and_save(particles,g_vort,g_vel,g_dvort,i);} if (i % 100 == 0) {check_point_and_save(particles,g_vort,g_vel,g_dvort,i);}
} }
}
openfpm_finalize(); openfpm_finalize();
} }
......
...@@ -326,12 +326,14 @@ int main(int argc, char* argv[]) ...@@ -326,12 +326,14 @@ int main(int argc, char* argv[])
* ## Visualization, write VTK files ## {#e0_s_vis_vtk} * ## Visualization, write VTK files ## {#e0_s_vis_vtk}
* *
* With this function we output the particle position in VTK format. A VTK file * With this function we output the particle position in VTK format. A VTK file
* contain information about particle position and properties. Such file can be visualizaed * contain information about particle position and properties. Such file can be visualized
* with program like paraview. In case this program run on several processor Each processor * with a program like paraview. In case this program run on several processor each processor
* generate a VTK file. VTK has two format one is the ASCII that is human readable but produce * generate a VTK file. VTK has two format one is the ASCII that is human readable but produce
* bigger file the other is the binary that produce not-human readable files, but smaller * bigger file the other is the binary that produce not-human readable files, but smaller
* and more efficent files to read for Paraview. In order to create a Binary VTK file use the * and more efficent files to read for Paraview. In order to create a Binary VTK file use the
* option VTK_WRITER in combination with FORMAT_BINARY * option VTK_WRITER in combination with FORMAT_BINARY. By default properties does not have name
* the VTK writer will label them "attr0" for the first property "attr1" for the second and so on
* in case we want to assign names to the properties we can use the function setPropNames
* *
* \snippet Vector/0_simple/main.cpp vtk * \snippet Vector/0_simple/main.cpp vtk
* *
...@@ -347,6 +349,9 @@ int main(int argc, char* argv[]) ...@@ -347,6 +349,9 @@ int main(int argc, char* argv[])
//! \cond [vtk] \endcond //! \cond [vtk] \endcond
openfpm::vector<std::string> names({"scalar","vector","tensor"});
vd.setPropNames(names);
// save vtk format (vtk is always the default) // save vtk format (vtk is always the default)
vd.write("particles"); vd.write("particles");
......
/*! \page Vector Vector
*
* \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_5_md_vl_sym_crs
* \subpage Vector_6_complex_usage
* \subpage Vector_7_sph_dlb
* \subpage Vector_7_sph_dlb_opt
*
*/
/*! /*!
* \page Vector_1_HDF5 HDF5 save and load * \page Vector_1_HDF5 HDF5 save and load
* *
......
...@@ -215,7 +215,7 @@ int main(int argc, char* argv[]) ...@@ -215,7 +215,7 @@ int main(int argc, char* argv[])
* *
* for each neighborhood particle of we calculate the distance. This distance is * for each neighborhood particle of we calculate the distance. This distance is
* accumulated on the property 0. On the vector property (1) the distance vector is accumulated. * accumulated on the property 0. On the vector property (1) the distance vector is accumulated.
* While on the tensor the moment of inertia is calculated * While on the tensor the moment of inertia is calculated.
* *
* \f$ s = \sum_{q = Neighborhood(p)} |p-q| \f$ * \f$ s = \sum_{q = Neighborhood(p)} |p-q| \f$
* *
...@@ -363,6 +363,40 @@ int main(int argc, char* argv[]) ...@@ -363,6 +363,40 @@ int main(int argc, char* argv[])
//! \cond [verletlist] \endcond //! \cond [verletlist] \endcond
/*!
* \page Vector_1_celllist Vector 1 Cell-list
*
* ## Cell-list types ## {#e1_cls_types}
*
* Cell-list can have different types. The dafault that we get from getCellList is called
* CELL_MEMFAST. Exist other two types of Cell-list called CELL_MEMBAL and CELL_MEMMw.
* They all expose the same interface and same functionality so from a user prospective there
* is no difference. Internally they use different memory layout and they can consume
* more or less memory at the cost of speed. The first called CELL_MEMFAST has memory complexity
* equivalent to \f$N_{cells} * N_mco\f$ where \f$N_{cells}\f$ is the number of cells and \f$N_{mco}\f$
* is the maximum number of particles in a cell it is the fastest in access but consume a lot
* of memory. The CELL_MEMBAL has memory complexity \f$N_{cells} + N_{parts}\f$ it consume less memory
* it **can (must be evaluated case by case)** be slower because access require the resolution of
* pointer to pointer. CELL_MEMMW has memory complexity \f$N_{parts}\f$ access the cell list requires
* the calculation of an hashing function. The peculiarity of this Cell-list is that does not depend
* from the number of cells. We suggest in anycase to use the default until memory is not a problem.
*
* \note CELL_MEMBAL and CELLMEMMW are macro that require two parameters
* one is the dimensionality of the space the other is the type of the space
*
*
* \snippet Vector/1_celllist/main.cpp cell_list_types
*
*/
//! \cond [cell_list_types] \endcond
// Get cell list
auto NN4 = vd.getCellList<CELL_MEMBAL(3,float)>(r_cut);
auto NN5 = vd.getCellList<CELL_MEMMW(3,float)>(r_cut);
//! \cond [cell_list_types] \endcond
/*! /*!
* \page Vector_1_celllist Vector 1 Cell-list * \page Vector_1_celllist Vector 1 Cell-list
* *
......
...@@ -406,7 +406,12 @@ int main(int argc, char* argv[]) ...@@ -406,7 +406,12 @@ int main(int argc, char* argv[])
* *
* \f[ \vec{v}(t_{n+1}) = \vec{v}_p(t_n+1/2) + \frac{1}{2} \delta t \vec{a}(t_n+1) \f] * \f[ \vec{v}(t_{n+1}) = \vec{v}_p(t_n+1/2) + \frac{1}{2} \delta t \vec{a}(t_n+1) \f]
* *
* The cell-list structure is required to calculate forces * The cell-list structure is required to calculate forces. As demonstration
* purpose instead of using the standard Cell-list with (getCellList) we use the CELL_MEMBAL
* type. The impact in performance of using the CELL_MEMBAL instead of CELL_MEMFAST is less
* than 1% on the other hand CELL_MEMFAST use 16 Megabyte of memory
*
* \see \ref e1_cls_types
* *
* Inside this cycle we are using several features that has been explained before in particular * Inside this cycle we are using several features that has been explained before in particular
* *
...@@ -430,7 +435,10 @@ int main(int argc, char* argv[]) ...@@ -430,7 +435,10 @@ int main(int argc, char* argv[])
//! \cond [md steps] \endcond //! \cond [md steps] \endcond
// Get the Cell list structure // Get the Cell list structure
auto NN = vd.getCellList(r_cut); auto NN = vd.getCellList<CELL_MEMBAL(3,double)>(r_cut);
// The standard
// auto NN = vd.getCellList(r_cut);
// calculate forces // calculate forces
calc_forces(vd,NN,sigma12,sigma6,r_cut*r_cut); calc_forces(vd,NN,sigma12,sigma6,r_cut*r_cut);
......
...@@ -323,9 +323,19 @@ int main(int argc, char* argv[]) ...@@ -323,9 +323,19 @@ int main(int argc, char* argv[])
* *
* \see \ref md_e5_sym * \see \ref md_e5_sym
* *
* The difference is that we create a symmetric Verlet-list for crossing scheme instead of a normal one * With two major differences. First we create a symmetric Verlet-list for crossing scheme instead of a normal one
* \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp sim verlet * \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp sim verlet
* *
* Second we **MUST** give the option BIND_DEC_TO_GHOST when we constructing the vector. This option
* force the vector to decompose the domain in a compatible way for the CRS scheme
*
* \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp bind_dec_ghost
*
* Because we will use the crossing scheme and the option BIND_DEC_TO_GHOST we can remove the lower part
* of the ghost as explained initially in this example
*
* \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp remove_lower_part
*
* The rest of the code remain unchanged * The rest of the code remain unchanged
* *
* \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp simulation * \snippet Vector/5_molecular_dynamic_sym_crs/main.cpp simulation
...@@ -356,14 +366,22 @@ int main(int argc, char* argv[]) ...@@ -356,14 +366,22 @@ int main(int argc, char* argv[])
// Boundary conditions // Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC}; size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
//! \cond [remove_lower_part] \endcond
// ghost, big enough to contain the interaction radius // ghost, big enough to contain the interaction radius
Ghost<3,float> ghost(r_gskin); Ghost<3,float> ghost(r_gskin);
ghost.setLow(0,0.0); ghost.setLow(0,0.0);
ghost.setLow(1,0.0); ghost.setLow(1,0.0);
ghost.setLow(2,0.0); ghost.setLow(2,0.0);
//! \cond [remove_lower_part] \endcond
//! \cond [bind_dec_ghost] \endcond
vector_dist<3,double, aggregate<double[3],double[3]> > vd(0,box,bc,ghost,BIND_DEC_TO_GHOST); vector_dist<3,double, aggregate<double[3],double[3]> > vd(0,box,bc,ghost,BIND_DEC_TO_GHOST);
//! \cond [bind_dec_ghost] \endcond
size_t k = 0; size_t k = 0;
size_t start = vd.accum(); size_t start = vd.accum();
......
openfpm_numerics @ 173b92ab
Subproject commit 6a195bfeb04d2db72c88f552996fcaec3cd44796 Subproject commit 173b92abc7585e0a3099b69301b21c2b0accc362
...@@ -38,7 +38,7 @@ class ie_ghost ...@@ -38,7 +38,7 @@ class ie_ghost
openfpm::vector<p_box<dim,T> > vb_int; openfpm::vector<p_box<dim,T> > vb_int;
//! Cell-list that store the geometrical information of the internal ghost boxes //! Cell-list that store the geometrical information of the internal ghost boxes
CellList<dim,T,Mem_fast<dim,T>,shift<dim,T>> geo_cell; CellList<dim,T,Mem_fast,shift<dim,T>> geo_cell;
//! shift vectors //! shift vectors
openfpm::vector<Point<dim,T>> shifts; openfpm::vector<Point<dim,T>> shifts;
......
...@@ -101,6 +101,9 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi ...@@ -101,6 +101,9 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
//! Communicator class //! Communicator class
Vcluster & v_cl; Vcluster & v_cl;
//! properties names
openfpm::vector<std::string> prp_names;
//! It map a global ghost id (g_id) to the external ghost box information //! It map a global ghost id (g_id) to the external ghost box information
//! It is unique across all the near processor //! It is unique across all the near processor
std::unordered_map<size_t,size_t> g_id_to_external_ghost_box; std::unordered_map<size_t,size_t> g_id_to_external_ghost_box;
...@@ -695,7 +698,6 @@ public: ...@@ -695,7 +698,6 @@ public:
* *
* \param dec Decomposition * \param dec Decomposition
* \param g_sz grid size on each dimension * \param g_sz grid size on each dimension
* \param domain Box that contain the grid
* \param ghost Ghost part * \param ghost Ghost part
* *
*/ */
...@@ -714,7 +716,6 @@ public: ...@@ -714,7 +716,6 @@ public:
* *
* \param dec Decomposition * \param dec Decomposition
* \param g_sz grid size on each dimension * \param g_sz grid size on each dimension
* \param domain Box that contain the grid
* \param ghost Ghost part * \param ghost Ghost part
* *
*/ */
...@@ -733,7 +734,6 @@ public: ...@@ -733,7 +734,6 @@ public:
* *
* \param dec Decomposition * \param dec Decomposition
* \param g_sz grid size on each dimension * \param g_sz grid size on each dimension
* \param domain Box that contain the grid
* \param g Ghost part (given in grid units) * \param g Ghost part (given in grid units)
* *
* \warning In very rare case the ghost part can be one point bigger than the one specified * \warning In very rare case the ghost part can be one point bigger than the one specified
...@@ -995,7 +995,7 @@ public: ...@@ -995,7 +995,7 @@ public:
/*! \brief It gathers the information about local grids for all of the processors /*! \brief It gathers the information about local grids for all of the processors
* *
* * \param gdb_ext_global where to store the grid infos
* *
*/ */
void getGlobalGridsInfo(openfpm::vector<GBoxes<device_grid::dims>> & gdb_ext_global) const void getGlobalGridsInfo(openfpm::vector<GBoxes<device_grid::dims>> & gdb_ext_global) const
...@@ -1435,6 +1435,7 @@ public: ...@@ -1435,6 +1435,7 @@ public:
* * internal_ghost_X.vtk Internal ghost boxes in grid units for the local processor X * * internal_ghost_X.vtk Internal ghost boxes in grid units for the local processor X
* *
* \param output directory where to put the files + prefix * \param output directory where to put the files + prefix
* \param opt options
* *
* \return true if the write operation succeed * \return true if the write operation succeed
* *
...@@ -1456,7 +1457,7 @@ public: ...@@ -1456,7 +1457,7 @@ public:
Point<dim,St> offset = getOffset(i); Point<dim,St> offset = getOffset(i);
vtk_g.add(loc_grid.get(i),offset,cd_sm.getCellBox().getP2(),gdb_ext.get(i).Dbox); vtk_g.add(loc_grid.get(i),offset,cd_sm.getCellBox().getP2(),gdb_ext.get(i).Dbox);
} }
vtk_g.write(output + "_" + std::to_string(v_cl.getProcessUnitID()) + ".vtk", "grids", ft); vtk_g.write(output + "_" + std::to_string(v_cl.getProcessUnitID()) + ".vtk", prp_names, "grids", ft);
return true; return true;
} }
...@@ -1567,6 +1568,19 @@ public: ...@@ -1567,6 +1568,19 @@ public:
} }
} }
/*! \brief Set the properties names
*
* It is useful to specify name for the properties in vtk writers
*
* \param names set of properties names
*
*/
void setPropNames(const openfpm::vector<std::string> & names)
{
prp_names = names;
}
/*! \brief It move all the grid parts that do not belong to the local processor to the respective processor /*! \brief It move all the grid parts that do not belong to the local processor to the respective processor
* *
* *
......
...@@ -109,11 +109,16 @@ struct interp_ele ...@@ -109,11 +109,16 @@ struct interp_ele
* *
* \param key_dst destination point * \param key_dst destination point
* \param grid_dst Destination grid * \param grid_dst Destination grid
* \param x source grid
* \param key_src source point * \param key_src source point
* \param grid_src Source grid * \param interp_pos interpolation points
* *
*/ */
inline interp_ele(const grid_dist_key_dx<Grid_dst::dims> & key_dst, Grid_dst & grid_dst, const Grid_src & x, const grid_dist_key_dx<Grid_src::dims> & key_src, openfpm::vector<std::vector<comb<Grid_src::dims>>> (&interp_pos)[nst_pos]) inline interp_ele(const grid_dist_key_dx<Grid_dst::dims> & key_dst,
Grid_dst & grid_dst,
const Grid_src & x,
const grid_dist_key_dx<Grid_src::dims> & key_src,
openfpm::vector<std::vector<comb<Grid_src::dims>>> (&interp_pos)[nst_pos])
:key_dst(key_dst),grid_dst(grid_dst),key_src(key_src),interp_pos(interp_pos),x(x){}; :key_dst(key_dst),grid_dst(grid_dst),key_src(key_src),interp_pos(interp_pos),x(x){};
...@@ -129,7 +134,11 @@ struct interp_ele ...@@ -129,7 +134,11 @@ struct interp_ele
{std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object";}; {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object";};
#endif #endif
//! It call the copy function for each property /*! \brief Interpolate each point in the destination grid for each property
*
* \param t property id
*
*/
template<typename Tsrc> template<typename Tsrc>
inline void operator()(Tsrc& t) inline void operator()(Tsrc& t)
{ {
......
...@@ -99,9 +99,9 @@ struct gcl<dim,St,CellList_gen<dim, St, Process_keys_hilb,Mem_type, shift<dim, S ...@@ -99,9 +99,9 @@ struct gcl<dim,St,CellList_gen<dim, St, Process_keys_hilb,Mem_type, shift<dim, S
} }
}; };
#define CELL_MEMFAST(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_fast<dim,St>, shift<dim, St> > #define CELL_MEMFAST(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> >
#define CELL_MEMBAL(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_bal<dim,St>, shift<dim, St> > #define CELL_MEMBAL(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_bal, shift<dim, St> >
#define CELL_MEMMW(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_mw<dim,St>, shift<dim, St> > #define CELL_MEMMW(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_mw, shift<dim, St> >
/*! \brief Distributed vector /*! \brief Distributed vector
* *
...@@ -158,6 +158,9 @@ private: ...@@ -158,6 +158,9 @@ private:
//! option used to create this vector //! option used to create this vector
size_t opt = 0; size_t opt = 0;
//! Name of the properties
openfpm::vector<std::string> prp_names;
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se_class3_vector<prop::max_prop,dim,St,Decomposition,self> se3; se_class3_vector<prop::max_prop,dim,St,Decomposition,self> se3;
...@@ -836,13 +839,16 @@ public: ...@@ -836,13 +839,16 @@ public:
* \return the Cell list * \return the Cell list
* *
*/ */
template<typename CellL = CellList<dim, St, Mem_fast<dim,St>, shift<dim, St> > > CellL getCellListSym(St r_cut) template<typename CellL = CellList<dim, St, Mem_fast, shift<dim, St> > > CellL getCellListSym(St r_cut)
{ {
#ifdef SE_CLASS1 #ifdef SE_CLASS1
if ((opt & BIND_DEC_TO_GHOST)) if ((opt & BIND_DEC_TO_GHOST))
{ {
std::cerr << __FILE__ << ":" << __LINE__ << " error to get symmetric cell-list you must construct the vector with the option BIND_DEC_TO_GHOST " << std::endl; if (ghost.getLow(dim-1) == 0.0)
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT); {
std::cerr << __FILE__ << ":" << __LINE__ << " Error the vector has been constructed without BIND_DEC_TO_GHOST, If you construct a vector without BIND_DEC_TO_GHOST the ghost must be full without reductions " << std::endl;
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
}
} }
#endif #endif
...@@ -876,7 +882,7 @@ public: ...@@ -876,7 +882,7 @@ public:
* \return the Cell list * \return the Cell list
* *
*/ */
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<dim,St>, shift<dim, St> > > CellL getCellList(St r_cut) template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut)
{ {
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
...@@ -901,7 +907,7 @@ public: ...@@ -901,7 +907,7 @@ public:
* \return the Cell list * \return the Cell list
* *
*/ */
template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast<dim,St>, shift<dim, St> > > CellL getCellList_hilb(St r_cut) template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast, shift<dim, St> > > CellL getCellList_hilb(St r_cut)
{ {
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
...@@ -961,7 +967,7 @@ public: ...@@ -961,7 +967,7 @@ public:
* \param cell_list Cell list to update * \param cell_list Cell list to update
* *
*/ */
template<typename CellL = CellList<dim, St, Mem_fast<dim,St>, shift<dim, St> > > void updateCellListSym(CellL & cell_list) template<typename CellL = CellList<dim, St, Mem_fast, shift<dim, St> > > void updateCellListSym(CellL & cell_list)
{ {
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
...@@ -1006,7 +1012,7 @@ public: ...@@ -1006,7 +1012,7 @@ public:
* \return the CellList * \return the CellList
* *
*/ */
template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast<dim,St>, shift<dim, St> > > CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge) template<typename CellL = CellList_gen<dim, St, Process_keys_lin, Mem_fast, shift<dim, St> > > CellL getCellList(St r_cut, const Ghost<dim, St> & enlarge)
{ {
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
...@@ -1046,7 +1052,7 @@ public: ...@@ -1046,7 +1052,7 @@ public:
* \return The Cell-list * \return The Cell-list
* *
*/ */
template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast<dim,St>, shift<dim, St> > > CellL getCellList_hilb(St r_cut, const Ghost<dim, St> & enlarge) template<typename CellL = CellList_gen<dim, St, Process_keys_hilb, Mem_fast, shift<dim, St> > > CellL getCellList_hilb(St r_cut, const Ghost<dim, St> & enlarge)
{ {
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
...@@ -1105,6 +1111,14 @@ public: ...@@ -1105,6 +1111,14 @@ public:
*/ */
VerletList<dim,St,FAST,shift<dim,St> > getVerletCrs(St r_cut) VerletList<dim,St,FAST,shift<dim,St> > getVerletCrs(St r_cut)
{ {
#ifdef SE_CLASS1
if ((opt & BIND_DEC_TO_GHOST))
{
std::cerr << __FILE__ << ":" << __LINE__ << " Error the vector has been constructed without BIND_DEC_TO_GHOST, getVerletCrs require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
}
#endif
#ifdef SE_CLASS3 #ifdef SE_CLASS3
se3.getNN(); se3.getNN();
#endif #endif
...@@ -1206,6 +1220,14 @@ public: ...@@ -1206,6 +1220,14 @@ public:
} }
else if (opt == VL_CRS_SYMMETRIC) else if (opt == VL_CRS_SYMMETRIC)
{ {
#ifdef SE_CLASS1
if ((opt & BIND_DEC_TO_GHOST))
{
std::cerr << __FILE__ << ":" << __LINE__ << " Error the vector has been constructed without BIND_DEC_TO_GHOST, updateVerlet with the option VL_CRS_SYMMETRIC require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
}
#endif
auto & NN = ver.getInternalCellList(); auto & NN = ver.getInternalCellList();
// Here we have to check that the Box defined by the Cell-list is the same as the domain box of this // Here we have to check that the Box defined by the Cell-list is the same as the domain box of this
...@@ -1265,7 +1287,7 @@ public: ...@@ -1265,7 +1287,7 @@ public:
* \param m an order of a hilbert curve * \param m an order of a hilbert curve
* *
*/ */
template<typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_fast<dim,St>,shift<dim,St> > > void reorder (int32_t m) template<typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_fast,shift<dim,St> > > void reorder (int32_t m)
{ {
reorder(m,getDecomposition().getGhost()); reorder(m,getDecomposition().getGhost());
} }
...@@ -1283,7 +1305,7 @@ public: ...@@ -1283,7 +1305,7 @@ public:
* \param enlarge In case of padding particles the cell list must be enlarged, like a ghost this parameter say how much must be enlarged * \param enlarge In case of padding particles the cell list must be enlarged, like a ghost this parameter say how much must be enlarged
* *
*/ */
template<typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_fast<dim,St>,shift<dim,St> > > void reorder(int32_t m, const Ghost<dim,St> & enlarge) template<typename CellL=CellList_gen<dim,St,Process_keys_lin,Mem_fast,shift<dim,St> > > void reorder(int32_t m, const Ghost<dim,St> & enlarge)
{ {
// reset the ghost part // reset the ghost part
v_pos.resize(g_m); v_pos.resize(g_m);
...@@ -1767,7 +1789,7 @@ public: ...@@ -1767,7 +1789,7 @@ public:
std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + std::to_string(".vtk")); std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + std::to_string(".vtk"));
// Write the VTK file // Write the VTK file
return vtk_writer.write(output,"particles",ft); return vtk_writer.write(output,prp_names,"particles",ft);
} }
return false; return false;
...@@ -1835,7 +1857,7 @@ public: ...@@ -1835,7 +1857,7 @@ public:
std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + "_" + std::to_string(iteration) + std::to_string(".vtk")); std::string output = std::to_string(out + "_" + std::to_string(v_cl.getProcessUnitID()) + "_" + std::to_string(iteration) + std::to_string(".vtk"));
// Write the VTK file // Write the VTK file
return vtk_writer.write(output,"particles",ft); return vtk_writer.write(output,prp_names,"particles",ft);
} }
} }
...@@ -1965,6 +1987,14 @@ public: ...@@ -1965,6 +1987,14 @@ public:
*/ */
template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS_Cell(cli & NN) template<typename cli> ParticleItCRS_Cells<dim,cli> getParticleIteratorCRS_Cell(cli & NN)
{ {
#ifdef SE_CLASS1
if ((opt & BIND_DEC_TO_GHOST))
{
std::cerr << __FILE__ << ":" << __LINE__ << " Error the vector has been constructed without BIND_DEC_TO_GHOST, getParticleIteratorCRS_Cell require the vector to be constructed with BIND_DEC_TO_GHOST option " << std::endl;
ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT);
}
#endif
// Shift // Shift
grid_key_dx<dim> shift; grid_key_dx<dim> shift;
...@@ -1982,6 +2012,18 @@ public: ...@@ -1982,6 +2012,18 @@ public:
NN.getNNc_sym()); NN.getNNc_sym());