24 #include "Vector/vector_dist.hpp" 28 int main(
int argc,
char* argv[])
50 openfpm_init(&argc,&argv);
56 size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
112 auto it = vd.getDomainIterator();
119 vd.getPos(key)[0] = 22.0*((float)rand() / RAND_MAX);
122 vd.getPos(key)[1] = 5.0*((float)rand() / RAND_MAX);
125 vd.getPos(key)[1] = 5.0*((float)rand() / RAND_MAX);
170 it = vd.getDomainIterator();
180 vd.template getProp<0>(p)[0] = 1.0;
181 vd.template getProp<0>(p)[1] = 1.0;
182 vd.template getProp<0>(p)[2] = 1.0;
184 vd.template getProp<1>(p)[0] = 2.0;
185 vd.template getProp<1>(p)[1] = 2.0;
186 vd.template getProp<1>(p)[2] = 2.0;
188 vd.template getProp<2>(p)[0] = 3.0;
189 vd.template getProp<2>(p)[1] = 3.0;
190 vd.template getProp<2>(p)[2] = 3.0;
192 vd.template getProp<3>(p)[0] = 4.0;
193 vd.template getProp<3>(p)[1] = 4.0;
194 vd.template getProp<3>(p)[2] = 4.0;
196 vd.template getProp<4>(p)[0] = 5.0;
197 vd.template getProp<4>(p)[1] = 5.0;
198 vd.template getProp<4>(p)[2] = 5.0;
232 vd.save(
"particles_save.hdf5");
267 vd2.
load(
"particles_save.hdf5");
297 float magn_vort = sqrt(vd2.getProp<0>(p)[0]*vd2.getProp<0>(p)[0] +
298 vd2.getProp<0>(p)[1]*vd2.getProp<0>(p)[1] +
299 vd2.getProp<0>(p)[2]*vd2.getProp<0>(p)[2]);
309 vd3.getLastPos()[0] = vd2.getPos(p)[0];
310 vd3.getLastPos()[1] = vd2.getPos(p)[1];
311 vd3.getLastPos()[2] = vd2.getPos(p)[2];
313 vd3.template getLastProp<0>() = magn_vort;
319 vd3.
write(
"output", VTK_WRITER | FORMAT_BINARY );
320 vd3.save(
"particles_post_process_2");
bool write(std::string out, int opt=VTK_WRITER)
Output particle position and properties.
void add()
Add local particle.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
void load(const std::string &filename)
Load the distributed vector from an HDF5 file.