From efb84aa7b7a1b1c5b77f24031ec41a9003fadc29 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@private-incardon-3.mpi-cbg.de> Date: Fri, 15 Apr 2016 16:33:26 +0200 Subject: [PATCH] Fixing examples --- example/SE/1_classes/Makefile | 2 +- example/Vector/2_molecular_dynamic/main.cpp | 24 ++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/example/SE/1_classes/Makefile b/example/SE/1_classes/Makefile index 172ffbd6..3cd88b49 100644 --- a/example/SE/1_classes/Makefile +++ b/example/SE/1_classes/Makefile @@ -7,7 +7,7 @@ LDIR = OBJ = main.o %.o: %.cpp - $(CC) -O0 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH) + $(CC) -O3 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH) se_classes: $(OBJ) $(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS) diff --git a/example/Vector/2_molecular_dynamic/main.cpp b/example/Vector/2_molecular_dynamic/main.cpp index c5ae6136..d07b0ffd 100644 --- a/example/Vector/2_molecular_dynamic/main.cpp +++ b/example/Vector/2_molecular_dynamic/main.cpp @@ -44,14 +44,14 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ce { auto p = it2.get(); - Point<3,double> xp = vd.getPos<0>(p); + Point<3,double> xp = vd.getPos(p); vd.template getProp<force>(p)[0] = 0.0; vd.template getProp<force>(p)[1] = 0.0; vd.template getProp<force>(p)[2] = 0.0; // For each neighborhood particle - auto Np = NN.template getNNIterator<NO_CHECK>(NN.getCell(vd.getPos<0>(p))); + auto Np = NN.template getNNIterator<NO_CHECK>(NN.getCell(vd.getPos(p))); while (Np.isNext()) { @@ -61,7 +61,7 @@ void calc_forces(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, Ce if (q == p.getKey()) {++Np; continue;}; // repulsive - Point<3,double> xq = vd.getPos<0>(q); + Point<3,double> xq = vd.getPos(q); Point<3,double> r = xp - xq; // take the norm, normalize @@ -109,14 +109,14 @@ double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, { auto p = it2.get(); - Point<3,double> xp = vd.getPos<0>(p); + Point<3,double> xp = vd.getPos(p); vd.template getProp<force>(p)[0] = 0.0; vd.template getProp<force>(p)[1] = 0.0; vd.template getProp<force>(p)[2] = 0.0; // For each neighborhood particle - auto Np = NN.template getNNIterator<NO_CHECK>(NN.getCell(vd.getPos<0>(p))); + auto Np = NN.template getNNIterator<NO_CHECK>(NN.getCell(vd.getPos(p))); while (Np.isNext()) { @@ -125,7 +125,7 @@ double calc_energy(vector_dist<3,double, aggregate<double[3],double[3]> > & vd, if (q == p.getKey()) {++Np; continue;}; - Point<3,double> xq = vd.getPos<0>(q); + Point<3,double> xq = vd.getPos(q); Point<3,double> r = xp - xq; // take the normalized direction @@ -253,9 +253,9 @@ int main(int argc, char* argv[]) auto key = it.get(); - vd.template getLastPos<0>()[0] = key.get(0) * it.getSpacing(0); - vd.template getLastPos<0>()[1] = key.get(1) * it.getSpacing(1); - vd.template getLastPos<0>()[2] = key.get(2) * it.getSpacing(2); + vd.getLastPos()[0] = key.get(0) * it.getSpacing(0); + vd.getLastPos()[1] = key.get(1) * it.getSpacing(1); + vd.getLastPos()[2] = key.get(2) * it.getSpacing(2); vd.template getLastProp<velocity>()[0] = 0.0; vd.template getLastProp<velocity>()[1] = 0.0; @@ -307,9 +307,9 @@ int main(int argc, char* argv[]) vd.template getProp<velocity>(p)[2] += 0.5*dt*vd.template getProp<force>(p)[2]; // here we calculate x(tn + 1) - vd.template getPos<0>(p)[0] += vd.template getProp<velocity>(p)[0]*dt; - vd.template getPos<0>(p)[1] += vd.template getProp<velocity>(p)[1]*dt; - vd.template getPos<0>(p)[2] += vd.template getProp<velocity>(p)[2]*dt; + vd.getPos(p)[0] += vd.template getProp<velocity>(p)[0]*dt; + vd.getPos(p)[1] += vd.template getProp<velocity>(p)[1]*dt; + vd.getPos(p)[2] += vd.template getProp<velocity>(p)[2]*dt; ++it3; } -- GitLab