diff --git a/example/Vector/0_simple/main.cpp b/example/Vector/0_simple/main.cpp index 0439d956ff99ca34b3c584cae83ae5ac8e28a7a8..bcb7903fee72d4ee890abc8642501512efa2140f 100644 --- a/example/Vector/0_simple/main.cpp +++ b/example/Vector/0_simple/main.cpp @@ -330,7 +330,7 @@ int main(int argc, char* argv[]) * generate a VTK file. VTK has two format one is the ASCII that is human readable but produce * bigger file the other is the binary that produce not-human readable files, but smaller * and more efficent files to read for Paraview. In order to create a Binary VTK file use the - * option VTK_ + * option VTK_WRITER in combination with FORMAT_BINARY * * \snippet Vector/0_simple/main.cpp vtk * @@ -346,8 +346,11 @@ int main(int argc, char* argv[]) //! \cond [vtk] \endcond + // save vtk format (vtk is always the default) vd.write("particles"); - vd.write("particles",VTK_WRITE_BINARY); + + // save in vtk binary format + vd.write("particles_bin",VTK_WRITER | FORMAT_BINARY); //! \cond [vtk] \endcond diff --git a/example/Vector/1_celllist/main.cpp b/example/Vector/1_celllist/main.cpp index 96aa95f7463ff4e30d7369746c8c17827e8130cb..28c4a6fe1cbc4912dad3a63aee98f31030f0df6a 100644 --- a/example/Vector/1_celllist/main.cpp +++ b/example/Vector/1_celllist/main.cpp @@ -310,26 +310,28 @@ int main(int argc, char* argv[]) //! \cond [verletlist] \endcond - openfpm::vector<openfpm::vector<size_t>> verlet; - vd.getVerletDeprecated(verlet,r_cut); + auto verlet = vd.getVerlet(r_cut); + + auto it3 = vd.getDomainIterator(); // For each particle i verlet.size() == Number of particles - for (size_t i = 0 ; i < verlet.size() ; i++) + while (it3.isNext()) { + auto p = it3.get(); // get the position of the particle i - Point<3,float> xp = vd.getPos(i); + Point<3,float> xp = vd.getPos(p); - // get the Neighborhood of i - openfpm::vector<size_t> & NN = verlet.get(i); + // get the Neighborhood of p + auto NNp = verlet.getNNIterator(p.getKey()); // for each neighborhood j of particle to i - for (size_t j = 0 ; j < NN.size() ; j++) + while (NNp.isNext()) { - size_t p = NN.get(j); + size_t q = NNp.get(); // Get the position of the particle neighborhood if i - Point<3,float> xq = vd.getPos(p); + Point<3,float> xq = vd.getPos(q); // Calculate the distance vector between p and q Point<3,float> f = (xp - xq); @@ -352,7 +354,11 @@ int main(int argc, char* argv[]) vd.template getProp<2>(p)[2][0] += (xp.get(2) - xq.get(2)) * (xp.get(0) - xq.get(0)); vd.template getProp<2>(p)[2][1] += (xp.get(2) - xq.get(2)) * (xp.get(1) - xq.get(1)); vd.template getProp<2>(p)[2][2] += (xp.get(2) - xq.get(2)) * (xp.get(2) - xq.get(2)); + + ++NNp; } + + ++it3; } //! \cond [verletlist] \endcond diff --git a/example/Vector/7_SPH_dlb/main.cpp b/example/Vector/7_SPH_dlb/main.cpp index 535912b444fbc966c3f6d0c9f22b8f86360abbd0..5adaa1235d97dc83b3de160a89f505ebb38b2a83 100644 --- a/example/Vector/7_SPH_dlb/main.cpp +++ b/example/Vector/7_SPH_dlb/main.cpp @@ -204,7 +204,10 @@ typedef vector_dist<3,double,aggregate<size_t,double, double, double, do struct ModelCustom { - template<typename Decomposition, typename vector> inline void addComputation(Decomposition & dec, const vector & vd, size_t v, size_t p) + template<typename Decomposition, typename vector> inline void addComputation(Decomposition & dec, + const vector & vd, + size_t v, + size_t p) { if (vd.template getProp<type>(p) == FLUID) dec.addComputationCost(v,4); @@ -216,6 +219,11 @@ struct ModelCustom { dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v) * dec.getSubSubDomainComputationCost(v)); } + + double distributionTol() + { + return 1.01; + } }; /*! \cond [model custom] \endcond */