23#include "Vector/vector_dist.hpp"
25int main(
int argc,
char* argv[])
86 openfpm_init(&argc,&argv);
92 size_t bc[2]={PERIODIC,PERIODIC};
98 constexpr int scalar = 0;
101 constexpr int vector = 1;
104 constexpr int point = 2;
107 constexpr int list = 3;
110 constexpr int listA = 4;
113 constexpr int listlist = 5;
142 vd(4096,domain,bc,g);
165 auto it = vd.getDomainIterator();
172 vd.getPos(p)[0] = (float)rand() / RAND_MAX;
175 vd.getPos(p)[1] = (float)rand() / RAND_MAX;
178 vd.getProp<scalar>(p) = 1.0;
180 vd.getProp<vector>(p)[0] = 1.0;
181 vd.getProp<vector>(p)[1] = 1.0;
182 vd.getProp<vector>(p)[2] = 1.0;
184 vd.getProp<point>(p).get(0) = 1.0;
185 vd.getProp<point>(p).get(1) = 1.0;
186 vd.getProp<point>(p).get(2) = 1.0;
188 size_t n_cp = (float)10.0 * rand()/RAND_MAX;
190 vd.getProp<listA>(p).resize(n_cp);
192 for (
size_t i = 0 ; i < n_cp ; i++)
194 vd.getProp<list>(p).add(i + 10);
195 vd.getProp<list>(p).add(i + 20);
196 vd.getProp<list>(p).add(i + 30);
198 vd.getProp<listA>(p).get(i) = A(i+10.0,i+20.0);
201 vd.getProp<listlist>(p).resize(2);
202 vd.getProp<listlist>(p).get(0).resize(2);
203 vd.getProp<listlist>(p).get(1).resize(2);
205 vd.getProp<listlist>(p).get(0).get(0) = 1.0;
206 vd.getProp<listlist>(p).get(0).get(1) = 2.0;
207 vd.getProp<listlist>(p).get(1).get(0) = 3.0;
208 vd.getProp<listlist>(p).get(1).get(1) = 4.0;
241 vd.map_list<scalar,vector,point,list,listA,listlist>();
244 vd.ghost_get<scalar,vector,point,listA,listlist>();
266 vd.write(
"particles");
285 size_t fg = vd.size_local();
290 for ( ; fg < vd.size_local()+4 ; fg++)
292 std::cout <<
"List of A" << std::endl;
293 for (
size_t i = 0 ; i < vd.getProp<listA>(fg).size() ; i++)
294 std::cout <<
"Element: " << i <<
" p1=" << vd.getProp<listA>(fg).get(i).p1 <<
" p2=" << vd.getProp<listA>(fg).get(i).p2 << std::endl;
296 std::cout <<
"List of list" << std::endl;
297 for (
size_t i = 0 ; i < vd.getProp<listlist>(fg).size() ; i++)
299 for (
size_t j = 0 ; j < vd.getProp<listlist>(fg).get(i).size() ; j++)
300 std::cout <<
"Element: " << i <<
" " << j <<
" " << vd.getProp<listlist>(fg).get(i).get(j) << std::endl;
This class represent an N-dimensional box.
This class implement the point shape in an N-dimensional space.
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Implementation of 1-D std::vector like structure.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...