Commit 88bfcb88 authored by incardon's avatar incardon

Fixing example compilation

parent 83a98571
...@@ -330,7 +330,7 @@ int main(int argc, char* argv[]) ...@@ -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 * 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 * 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 * 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 * \snippet Vector/0_simple/main.cpp vtk
* *
...@@ -346,8 +346,11 @@ int main(int argc, char* argv[]) ...@@ -346,8 +346,11 @@ int main(int argc, char* argv[])
//! \cond [vtk] \endcond //! \cond [vtk] \endcond
// save vtk format (vtk is always the default)
vd.write("particles"); 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 //! \cond [vtk] \endcond
......
...@@ -310,26 +310,28 @@ int main(int argc, char* argv[]) ...@@ -310,26 +310,28 @@ int main(int argc, char* argv[])
//! \cond [verletlist] \endcond //! \cond [verletlist] \endcond
openfpm::vector<openfpm::vector<size_t>> verlet; auto verlet = vd.getVerlet(r_cut);
vd.getVerletDeprecated(verlet,r_cut);
auto it3 = vd.getDomainIterator();
// For each particle i verlet.size() == Number of particles // 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 // 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 // get the Neighborhood of p
openfpm::vector<size_t> & NN = verlet.get(i); auto NNp = verlet.getNNIterator(p.getKey());
// for each neighborhood j of particle to i // 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 // 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 // Calculate the distance vector between p and q
Point<3,float> f = (xp - xq); Point<3,float> f = (xp - xq);
...@@ -352,7 +354,11 @@ int main(int argc, char* argv[]) ...@@ -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][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][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)); vd.template getProp<2>(p)[2][2] += (xp.get(2) - xq.get(2)) * (xp.get(2) - xq.get(2));
++NNp;
} }
++it3;
} }
//! \cond [verletlist] \endcond //! \cond [verletlist] \endcond
......
...@@ -204,7 +204,10 @@ typedef vector_dist<3,double,aggregate<size_t,double, double, double, do ...@@ -204,7 +204,10 @@ typedef vector_dist<3,double,aggregate<size_t,double, double, double, do
struct ModelCustom 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) if (vd.template getProp<type>(p) == FLUID)
dec.addComputationCost(v,4); dec.addComputationCost(v,4);
...@@ -216,6 +219,11 @@ struct ModelCustom ...@@ -216,6 +219,11 @@ struct ModelCustom
{ {
dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v) * dec.getSubSubDomainComputationCost(v)); dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v) * dec.getSubSubDomainComputationCost(v));
} }
double distributionTol()
{
return 1.01;
}
}; };
/*! \cond [model custom] \endcond */ /*! \cond [model custom] \endcond */
......
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