Commit ea0c3057 authored by incardon's avatar incardon
Browse files

Improved documentation + removed garbage

parent 054b034f
......@@ -197,9 +197,9 @@ public:
return exp_sum;
}
/*! \brief sum an a combination to the grid_key
/*! \brief sum a point to the grid_key
*
* \param comb combination (or relative movement)
* \param p point (or relative movement)
*
* \return a grid_key_dx_expression that encapsulate the expression
*
......@@ -213,7 +213,7 @@ public:
/*! \brief sum an a combination to the grid_key
*
* \param comb combination (or relative movement)
* \param cmb combination (or relative movement)
*
* \return a grid_key_dx_expression that encapsulate the expression
*
......@@ -227,7 +227,7 @@ public:
/*! \brief sum an a combination to the grid_key
*
* \param comb combination (or relative movement)
* \param cmb combination (or relative movement)
*
* \return a grid_key_dx_expression that encapsulate the expression
*
......@@ -295,7 +295,12 @@ public:
}
//! set the grid key from a list of numbers
/*! \brief set the Key from a list of numbers
*
* \param v list of number
* \param t list of number
*
*/
template<typename a, typename ...T>void set(a v, T...t)
{
#ifdef SE_CLASS1
......@@ -310,6 +315,8 @@ public:
*
* \see toPoint
*
* \return a point long int
*
*/
Point<dim,long int> toPointS() const
{
......@@ -337,6 +344,8 @@ public:
*
* \see toPointS
*
* \return a point unsigned long int
*
*/
Point<dim,size_t> toPoint() const
{
......@@ -402,7 +411,10 @@ private:
/*! \brief Recursively invert the assignment
*
* Recursively invert the assignment at compile-time
* Recursively invert the assignment at compile-time (hopefully)
*
* \param v list of numbers
* \param t list of numbers
*
*/
template<typename a, typename ...T>void invert_assign(a v,T...t)
......@@ -411,11 +423,17 @@ private:
invert_assign(t...);
}
/*! \brief assignment
*
* \param v list of number
*
*/
template<typename a, typename ...T>void invert_assign(a v)
{
k[0] = v;
}
//! Constructor
void invert_assign()
{
}
......
......@@ -661,13 +661,15 @@ public:
}
/*! \brief Get an iterator over particles following the cell structure
*
* \param dom_cells cells in the domain
*
* \return a particle iterator
*
*/
ParticleIt_Cells<dim,CellList<dim,T,Mem_fast<dim,T>,transform,base>> getDomainIterator(openfpm::vector<size_t> & dom_cells)
ParticleIt_Cells<dim,CellList<dim,T,Mem_fast,transform,base>> getDomainIterator(openfpm::vector<size_t> & dom_cells)
{
ParticleIt_Cells<dim,CellList<dim,T,Mem_fast<dim,T>,transform,base>> it(*this,dom_cells);
ParticleIt_Cells<dim,CellList<dim,T,Mem_fast,transform,base>> it(*this,dom_cells);
return it;
}
......
This diff is collapsed.
......@@ -27,7 +27,7 @@
template<unsigned int dim,
typename T,
template <unsigned int, typename> class Prock,
typename Mem_type = Mem_fast<dim,T>,
typename Mem_type = Mem_fast,
typename transform = no_transform<dim,T>,
typename base=openfpm::vector<size_t>>
class CellList_gen : public CellList<dim,T,Mem_type,transform,base>
......
......@@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE( ParticleItCRS_Cells_iterator )
}
// Initialize a cell list
CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>> NN;
CellList<dim,float,Mem_fast,shift<dim,float>> NN;
NN.Initialize(box,div,1);
......@@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE( ParticleItCRS_Cells_iterator )
}
//Test the iterator
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>>> it_cl(NN,dom,anom,NN.getNNc_sym());
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast,shift<dim,float>>> it_cl(NN,dom,anom,NN.getNNc_sym());
size_t count = 0;
......@@ -266,7 +266,7 @@ BOOST_AUTO_TEST_CASE( ParticleItCRS_Cells_iterator )
++it2;
}
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>>> it_cl2(NN,dom,anom,NN.getNNc_sym());
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast,shift<dim,float>>> it_cl2(NN,dom,anom,NN.getNNc_sym());
count = 0;
......@@ -302,7 +302,7 @@ BOOST_AUTO_TEST_CASE( ParticleIt_Cells_NN_iterator )
}
// Initialize a cell list
CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>> NN;
CellList<dim,float,Mem_fast,shift<dim,float>> NN;
NN.Initialize(box,div,1);
......@@ -372,7 +372,7 @@ BOOST_AUTO_TEST_CASE( ParticleIt_Cells_NN_iterator )
}
//Test the iterator
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>>> it_cl(NN,dom,anom,NN.getNNc_sym());
ParticleItCRS_Cells<dim,CellList<dim,float,Mem_fast,shift<dim,float>>> it_cl(NN,dom,anom,NN.getNNc_sym());
size_t count = 0;
......@@ -423,7 +423,7 @@ BOOST_AUTO_TEST_CASE( ParticleIt_Cells_iterator )
}
// Initialize a cell list
CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>> NN;
CellList<dim,float,Mem_fast,shift<dim,float>> NN;
NN.Initialize(box,div,1);
......@@ -448,7 +448,7 @@ BOOST_AUTO_TEST_CASE( ParticleIt_Cells_iterator )
}
//Test the iterator
ParticleIt_Cells<dim,CellList<dim,float,Mem_fast<dim,float>,shift<dim,float>>> it_cl(NN,dom,290);
ParticleIt_Cells<dim,CellList<dim,float,Mem_fast,shift<dim,float>>> it_cl(NN,dom,290);
size_t count = 0;
......
......@@ -49,7 +49,7 @@ struct PV_cl
* ### Declaration of a Multi-Phase cell list and usage
*
*/
template<unsigned int dim, typename T, unsigned int sh_byte, typename CellBase=CellList<dim,T,Mem_fast<dim,T>,shift<dim, T>> >
template<unsigned int dim, typename T, unsigned int sh_byte, typename CellBase=CellList<dim,T,Mem_fast,shift<dim, T>> >
class CellListM : public CellBase
{
//! Mask to get the high bits of a number
......@@ -60,19 +60,28 @@ class CellListM : public CellBase
public:
//! Type of the iterator for the neighborhood
typedef CellNNIteratorSymM<dim,CellListM<dim,T,sh_byte,CellBase>,sh_byte,RUNTIME,NO_CHECK> SymNNIterator;
//! Default Constructor
CellListM()
{};
//! Copy constructor
/*! \brief Copy constructor
*
* \param cell Cell to copy
*
*/
CellListM(const CellListM<dim,T,sh_byte,CellBase> & cell)
{
this->operator=(cell);
}
//! Copy constructor
/*! \brief Copy constructor
*
* \param cell Cell to copy
*
*/
CellListM(CellListM<dim,T,sh_byte,CellBase> && cell)
{
this->operator=(cell);
......
......@@ -357,14 +357,14 @@ BOOST_AUTO_TEST_CASE( CellList_use)
SpaceBox<3,double> box({0.0f,0.0f,0.0f},{1.0f,1.0f,1.0f});
SpaceBox<3,double> box2({-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f});
Test_cell_s<3,double,CellList<3,double,Mem_fast<3,double>>>(box);
Test_cell_s<3,double,CellList<3,double,Mem_fast<3,double>,shift<3,double>> >(box2);
Test_cell_s<3,double,CellList<3,double,Mem_fast>>(box);
Test_cell_s<3,double,CellList<3,double,Mem_fast,shift<3,double>> >(box2);
Test_cell_sM<3,double,CellListM<3,double,8>>(box);
Test_cell_sM<3,double,CellListM<3,double,8>>(box2);
Test_cell_s<3,double,CellList<3,double,Mem_bal<3,double>>>(box);
Test_cell_s<3,double,CellList<3,double,Mem_mw<3,double>>>(box);
Test_cell_s<3,double,CellList<3,double,Mem_bal>>(box);
Test_cell_s<3,double,CellList<3,double,Mem_mw>>(box);
std::cout << "End cell list" << "\n";
......@@ -373,7 +373,7 @@ BOOST_AUTO_TEST_CASE( CellList_use)
BOOST_AUTO_TEST_CASE( CellList_consistent )
{
Test_CellDecomposer_consistent<CellList<2,float,Mem_fast<3,double>,shift<2,float>>>();
Test_CellDecomposer_consistent<CellList<2,float,Mem_fast,shift<2,float>>>();
}
BOOST_AUTO_TEST_CASE( CellList_NNc_csr_calc )
......
......@@ -35,8 +35,6 @@
* \tparam T type of the space float, double, complex
*
*/
template<unsigned int dim, typename T>
class Mem_bal
{
typedef openfpm::vector<size_t> base;
......@@ -47,9 +45,6 @@ class Mem_bal
public:
// Object type that the structure store
typedef T value_type;
inline void init_to_zero(size_t slot, size_t tot_n_cell)
{
//resize the vector to needed number of cells
......
......@@ -16,8 +16,14 @@
#include "util/common.hpp"
#include "Vector/map_vector.hpp"
template<unsigned int dim, typename T>
/*! \brief It is a class that work like a vector of vector
*
* It is a class that work like a vector(1) of vector(2). To emulate
* the vector of vector it use a 1D array of size N_ele * N_max_slot
* where N_ele is the number of elements in vector(1) and N_max_slot
* is the maximum number of elements across the vectors
*
*/
class Mem_fast
{
//! Number of slot for each cell
......@@ -26,6 +32,7 @@ class Mem_fast
//! number of particle in each cell list
openfpm::vector<size_t> cl_n;
//! base that store the data
typedef typename openfpm::vector<size_t> base;
//! elements that each cell store (each cell can store a number
......@@ -58,6 +65,12 @@ class Mem_fast
protected:
/*! \brief Initialize the data to zero
*
* \param slot number of slot for each cell
* \param tot_n_cell total number of cells
*
*/
inline void init_to_zero(size_t slot, size_t tot_n_cell)
{
this->slot = slot;
......@@ -72,6 +85,11 @@ protected:
cl_base.resize(tot_n_cell * slot);
}
/*! \brief copy an object Mem_fast
*
* \param mem Mem_fast to copy
*
*/
inline void operator=(const Mem_fast & mem)
{
slot = mem.slot;
......@@ -80,6 +98,22 @@ protected:
cl_base = mem.cl_base;
}
/*! \brief copy an object Mem_fast
*
* \param mem Mem_fast to copy
*
*/
inline void operator=(Mem_fast && mem)
{
this->swap(mem);
}
/*! \brief Add an element to the cell
*
* \param cell_id id of the cell
* \param ele element to add
*
*/
inline void addCell(size_t cell_id, typename base::value_type ele)
{
// Get the number of element the cell is storing
......@@ -97,6 +131,12 @@ protected:
cl_n.get(cell_id)++;
}
/*! \brief Add an element to the cell
*
* \param cell_id id of the cell
* \param ele element to add
*
*/
inline void add(size_t cell_id, typename base::value_type ele)
{
// add the element to the cell
......@@ -104,26 +144,63 @@ protected:
this->addCell(cell_id,ele);
}
/*! \brief Get an element in the cell
*
* \param cell id of the cell
* \param ele element id in the cell
*
* \return the reference to the selected element
*
*/
inline auto get(size_t cell, size_t ele) -> decltype(cl_base.get(cell * slot + ele)) &
{
return cl_base.get(cell * slot + ele);
}
/*! \brief Get an element in the cell
*
* \param cell id of the cell
* \param ele element id in the cell
*
* \return the reference to the selected element
*
*/
inline auto get(size_t cell, size_t ele) const -> decltype(cl_base.get(cell * slot + ele)) &
{
return cl_base.get(cell * slot + ele);
}
/*! \brief Remove an element in the cell
*
* \param cell id of the cell
* \param ele element id to remove
*
*/
inline void remove(size_t cell, size_t ele)
{
cl_n.get(cell)--;
}
/*! \brief Get the number of elements in the cell
*
* \param cell_id id of the cell
*
* \return the number of elements in the cell
*
*/
inline size_t getNelements(const size_t cell_id) const
{
return cl_n.get(cell_id);
}
/*! \brief swap to Mem_fast object
*
* \param mem object to swap the memory with
*
*/
inline void swap(Mem_fast & mem)
{
cl_n.swap(mem.cl_n);
......@@ -134,6 +211,11 @@ protected:
slot = cl_slot_tmp;
}
/*! \brief swap to Mem_fast object
*
* \param mem object to swap the memory with
*
*/
inline void swap(Mem_fast && mem)
{
slot = mem.slot;
......@@ -142,22 +224,48 @@ protected:
cl_base.swap(mem.cl_base);
}
/*! \brief Delete all the elements in the Cell-list
*
*
*
*/
inline void clear()
{
for (size_t i = 0 ; i < cl_n.size() ; i++)
cl_n.get(i) = 0;
}
/*! \brief Get the first element of a cell (as reference)
*
* \param cell_id cell-id
*
* \return a reference to the first element
*
*/
inline const size_t & getStartId(size_t cell_id) const
{
return cl_base.get(cell_id*slot);
}
/*! \brief Get the last element of a cell (as reference)
*
* \param cell_id cell-id
*
* \return a reference to the last element
*
*/
inline const size_t & getStopId(size_t cell_id) const
{
return cl_base.get(cell_id*slot+cl_n.get(cell_id));
}
/*! \brief Just return the value pointed by part_id
*
* \param part_id
*
* \return the value pointed by part_id
*
*/
inline const size_t & get_lin(const size_t * part_id) const
{
return *part_id;
......@@ -165,10 +273,20 @@ protected:
public:
/*! \brief Constructor
*
* \param slot number of slot for each cell
*
*/
inline Mem_fast(size_t slot)
:slot(slot)
{}
/*! \brief Set the number of slot for each cell
*
* \param number of slot
*
*/
inline void set_slot(size_t slot)
{
this->slot = slot;
......
......@@ -30,7 +30,6 @@
* \tparam T type of the space float, double, complex
*
*/
template<unsigned int dim, typename T>
class Mem_mw
{
typedef openfpm::vector<size_t> base;
......@@ -45,10 +44,6 @@ class Mem_mw
public:
// Object type that the structure store
typedef T value_type;
inline void init_to_zero(size_t slot, size_t tot_n_cell)
{
}
......
......@@ -32,7 +32,7 @@ template<unsigned int dim,
unsigned int impl=FAST,
typename transform = no_transform<dim,T>,
typename local_index=local_index_,
typename CellListImpl = CellList<dim,T,Mem_fast<dim,T>,transform> >
typename CellListImpl = CellList<dim,T,Mem_fast,transform> >
class VerletList
{
};
......
......@@ -204,7 +204,18 @@ class PartItNN
{
public:
//! It return the particle iterator
/*! \brief It return the particle iterator
*
* \param pos vector with position of the particles
* \param dom list of cells with normal neighborhood
* \param anom list of cells with not-normal neighborhood
* \param cli Cell-list used for Verlet-list construction
* \param g_m ghost marker
* \param end final particle id
*
* \return the particle iterator
*
*/
static inline auto get(const vector & pos, const openfpm::vector<size_t> & dom, const openfpm::vector<subsub_lin<dim>> & anom, CellList & cli, size_t g_m, size_t & end) -> decltype(pos.getIteratorTo(0))
{
end = g_m;
......@@ -212,11 +223,29 @@ public:
}
};
/*! \brief In general different NN scheme like full symmetric or CRS require different
* iterators over particles this class select the proper one
*
* This is the CRS scheme
*
*/
template<unsigned int dim, typename vector, typename CellList>
class PartItNN<VL_CRS_SYMMETRIC,dim,vector,CellList>
{
public:
//! It return the particle iterator
/*! \brief It return the particle iterator
*
* \param pos vector with position of the particles
* \param dom list of cells with normal neighborhood
* \param anom list of cells with not-normal neighborhood
* \param cli Cell-list used for Verlet-list construction
* \param g_m ghost marker
* \param end final particle id
*
* \return the particle iterator
*
*/
static inline ParticleItCRS_Cells<dim,CellList> get(const vector & pos, const openfpm::vector<size_t> & dom, const openfpm::vector<subsub_lin<dim>> & anom, CellList & cli, size_t g_m, size_t & end)
{
end = pos.size();
......@@ -614,6 +643,8 @@ public:
* \param dom Processor domain
* \param pos vector of particle positions
* \param g_m ghost marker
* \param dom_c list of cells with normal neighborhood
* \param anom_c list of cells with anormal neighborhood
*
*/
void updateCrs(const Box<dim,T> & dom, T r_cut, openfpm::vector<Point<dim,T>> & pos, size_t & g_m, const openfpm::vector<size_t> & dom_c, const openfpm::vector<subsub_lin<dim>> & anom_c)
......
......@@ -182,7 +182,7 @@ template<unsigned int dim, typename T, typename VerS> void Verlet_list_s(SpaceBo
//! [Fill external cell list]
// Initialize an external cell-list
CellList<dim,T,Mem_fast<3,double>,shift<3,double>> cli;
CellList<dim,T,Mem_fast,shift<3,double>> cli;
Box<dim,T> bt = box;
// Calculate the divisions for the Cell-lists
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment