

# OpenFPM Data






This module collect the implementation of nondistributed structures like vectors, Multi Array (Grid), Graph, CellLists and others






Folders:






* **Vector**: Implementation of vector structures



* **Grid**: Implementation of multi arrays



* **Graph**: Implementation of graph structures



* **NN** : Implementation of Nearest Neighbourhood search structure like CellList ...



* **data_type** : Definition of default data type



* **Space** : Definition of Ndimensional geometrical basic structures like Box, Hypercube, Sphere, Point, ...






## Overview






All the structures must






* Work on generic basic objects (We will referee at it with basic object )



* Abstract how they are represented on memory



* Use Memory objects to produce memory over they work






Specializations are allowed to be mapped or use internally STL, Boost, OpenFPM_data, or other structures



(consider anyway always to implement over already implemented structures inside OpenFPM_data, because they already implement the capabilities that we are going to describe)






<! [file: section: ] >






<! [end] >






### [Basic objects](Basicobjects)



### [Memory objects](Memoryobjects)



### [Memory mapping](Memorymappings)












### Iterators






Each class is strongly suggest to implement at least one iterator to explore the data, also consider to implement iterator to explore subset of your data. For example grid implement several iterator to explore



the full data or subgrid, Cell list implements iterator on nearest neighbourhood cell to explore near particle (under test). Two kind of iterator exist






* **Unstructured** It iterate through all the elements, but there is not information about the indexing, basically it work at memory level ignoring the memory mapping of the structure



* **Structured** It iterate over all the elements with the structure indexing






For example a 2D grid has 2 index i,j, but on memory i,j must be transformed (in some way), in 1D (mapping) k. Unstructured iterate through the valid index of k, Structured iterate through i,j









### Template parameter oder






Template parameters must follow an order, first come the specific template parameters, than the basic object the structure is storing in the following order, memory pool, ordering, implementation






Example






```cpp






/*!



*



* \brief This is an Ndimensional grid or an Ndimensional array working on CPU



*



* This is an NDimensional grid or an Ndimensional array working on CPU



*



* \param dim Dimensionality of the grid



* \param T type of object the grid store



* \param Mem interface used to allocate memory



*



*/






template<unsigned int dim, typename T, typename Mem = typename memory_traits_lin< typename T::type >::type >



class grid_cpu



{









```






The following is the class signature for multi array, first come the class specific parameters, in this case the dimensionality of the grid, than come the Generic object that store than the Memory pool and implementation detail (Ordering is not present, but is going to change) 


\ No newline at end of file 