Commit 683cf06c authored by incardon's avatar incardon
Browse files

Last fix

parent 293c299b
......@@ -36,6 +36,12 @@ public:
grid_key_dx()
{}
//! Constructor from an other key
grid_key_dx(const grid_key_dx<dim> & key)
:grid_key_dx(key.k)
{
}
//! Constructor from buffer reference
grid_key_dx(const size_t (&k)[dim])
{
......@@ -43,6 +49,13 @@ public:
this->k[i] = k[i];
}
//! Constructor from buffer reference
grid_key_dx(const long int (&k)[dim])
{
for (int i = 0 ; i < dim ; i++)
this->k[i] = k[i];
}
//! Construct a grid key from a list of numbers
template<typename ...T> grid_key_dx(const size_t v,const T...t)
{
......
......@@ -51,6 +51,16 @@ protected:
public:
/*! \brief Return the underlying grid information of the cell list
*
* \return the grid infos
*
*/
grid_sm<dim,void> & getGrid()
{
return gr_cell;
}
/*! \brief Get the cell-id
*
* Convert the point coordinates into the cell id
......
......@@ -115,6 +115,16 @@ public:
// Object type that the structure store
typedef T value_type;
/*! \brief Return the underlying grid information of the cell list
*
* \return the grid infos
*
*/
grid_sm<dim,void> & getGrid()
{
CellDecomposer_sm<dim,T>::getGrid();
}
/*! Initialize the cell list
*
* \param box Domain where this cell list is living
......@@ -246,18 +256,15 @@ public:
Initialize(box,div,orig,slot);
}
/*! \brief Add an element in the cell list
/*! \brief Add to the cell
*
* \param pos array that contain the coordinate
* \param ele element to store
* \param cell_id Cell id where to add
* \param ele element to add
*
*/
void add(const T (& pos)[dim], typename base::value_type ele)
inline void addCell(size_t cell_id, typename base::value_type ele)
{
// calculate the Cell id
size_t cell_id = this->getCell(pos);
// Get the number of element the cell is storing
size_t nl = getNelements(cell_id);
......@@ -279,25 +286,32 @@ public:
* \param ele element to store
*
*/
void add(const Point<dim,T> & pos, typename base::value_type ele)
inline void add(const T (& pos)[dim], typename base::value_type ele)
{
// calculate the Cell id
size_t cell_id = this->getCell(pos);
// Get the number of element the cell is storing
// add the element to the cell
size_t nl = getNelements(cell_id);
addCell(cell_id,ele);
}
if (nl + 1 >= slot)
{
realloc();
}
/*! \brief Add an element in the cell list
*
* \param pos array that contain the coordinate
* \param ele element to store
*
*/
inline void add(const Point<dim,T> & pos, typename base::value_type ele)
{
// calculate the Cell id
// we have enough slot to store another neighbor element
size_t cell_id = this->getCell(pos);
cl_base.get(slot * cell_id + cl_n.get(cell_id)) = ele;
cl_n.get(cell_id)++;
// add the element to the cell
addCell(cell_id,ele);
}
/*! \brief remove an element from the cell
......@@ -306,7 +320,7 @@ public:
* \param ele element id
*
*/
void remove(size_t cell, size_t ele)
inline void remove(size_t cell, size_t ele)
{
cl_n.get(cell)--;
}
......@@ -318,7 +332,7 @@ public:
* \return number of elements in the cell
*
*/
size_t getNelements(size_t cell_id)
inline size_t getNelements(size_t cell_id)
{
return cl_n.get(cell_id);
}
......@@ -333,7 +347,7 @@ public:
* \return The element value
*
*/
auto get(size_t cell, size_t ele) -> decltype(cl_base.get(cell * slot + ele))
inline auto get(size_t cell, size_t ele) -> decltype(cl_base.get(cell * slot + ele))
{
return cl_base.get(cell * slot + ele);
}
......@@ -348,7 +362,7 @@ public:
* \return The element value
*
*/
template<unsigned int i> auto get(size_t cell, size_t ele) -> decltype(cl_base.get(cell * slot + ele))
template<unsigned int i> inline auto get(size_t cell, size_t ele) -> decltype(cl_base.get(cell * slot + ele))
{
return cl_base.template get<i>(cell * slot + ele);
}
......@@ -358,7 +372,7 @@ public:
* \param cl Cell list with witch you swap the memory
*
*/
void swap(CellList<dim,T,FAST,base> & cl)
inline void swap(CellList<dim,T,FAST,base> & cl)
{
cl_n.swap(cl.cl_n);
cl_base.swap(cl.cl_base);
......@@ -369,21 +383,21 @@ public:
* \param cell cell id
*
*/
template<unsigned int impl> CellNNIterator<dim,CellList<dim,T,FAST,base>,FULL,impl> getNNIterator(size_t cell)
template<unsigned int impl> inline CellNNIterator<dim,CellList<dim,T,FAST,base>,FULL,impl> getNNIterator(size_t cell)
{
CellNNIterator<dim,CellList<dim,T,FAST,base>,FULL,impl> cln(cell,NNc_full,*this);
return cln;
}
template<unsigned int impl> CellNNIterator<dim,CellList<dim,T,FAST,base>,SYM,impl> getNNIteratorSym(size_t cell)
template<unsigned int impl> inline CellNNIterator<dim,CellList<dim,T,FAST,base>,SYM,impl> getNNIteratorSym(size_t cell)
{
CellNNIterator<dim,CellList<dim,T,FAST,base>,SYM,impl> cln(cell,NNc_sym,*this);
return cln;
}
template<unsigned int impl> CellNNIterator<dim,CellList<dim,T,FAST,base>,CRS,impl> getNNIteratorCross(size_t cell)
template<unsigned int impl> inline CellNNIterator<dim,CellList<dim,T,FAST,base>,CRS,impl> getNNIteratorCross(size_t cell)
{
CellNNIterator<dim,CellList<dim,T,FAST,base>,CRS,impl> cln(cell,NNc_cr,*this);
......
......@@ -63,7 +63,7 @@ public:
{
// check if p1 of b is smaller than
for (size_t i ; i < dim ; i++)
for (size_t i = 0 ; i < dim ; i++)
{
if (getLow(i) < b.getLow(i))
{
......@@ -313,6 +313,23 @@ public:
}
}
/*! \brief Box constructor from ecapsulated box
*
* \param box_data fusion vector from which to construct the vector
*
*/
template<typename Mem> Box(const encapc<1,Box<dim,T>,Mem> & b)
{
// we copy the data
for (int i = 0 ; i < dim ; i++)
{
boost::fusion::at_c<p1>(data)[i] = b.template get<p1>()[i];
boost::fusion::at_c<p2>(data)[i] = b.template get<p2>()[i];
}
}
/*! \brief set the low interval of the box
*
* set the low interval of the box
......
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