Skip to content
Snippets Groups Projects
Commit 88bfcb88 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Fixing example compilation

parent 83a98571
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment