Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mosaic/software/parallel-computing/openfpm/openfpm_pdata
  • argupta/openfpm_pdata
2 results
Show changes
Showing
with 0 additions and 1021 deletions
This Package contain the examples. In order to compile the examples go in the root folder where you installed
OpenFPM (example /usr/local/OpenFPM_install) and copy from there the file example.mk
compile the examples with
make
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O0 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
se_classes: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: se_classes
.PHONY: clean all
clean:
rm -f *.o *~ core se_classes
[pack]
files = main.cpp Makefile
/*
* ### WIKI 1 ###
*
* ## Security enhancement example
*
* This example show several basic functionalities of Security Enhancements
*
*/
#define SE_CLASS1
#define SE_CLASS2
#define SE_CLASS3
#define THROW_ON_ERROR
#include "Memleak_check.hpp"
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "Point_test.hpp"
/*
* ### WIKI END ###
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// With print_unalloc we can check how much memory has been allocated and which structure
// has been allocated, initially there are not
//
std::cout << "Allocated memory before initializing \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
//
// ### WIKI 3 ###
//
// Here we Initialize the library, than we create a uniform random generator between 0 and 1 to to generate particles
// randomly in the domain, we create a Box that define our domain, boundary conditions and ghost
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
typedef Point<2,float> s;
Box<2,float> box({0.0,0.0},{1.0,1.0});
size_t bc[2]={NON_PERIODIC,NON_PERIODIC};
Ghost<2,float> g(0.01);
//
// ### WIKI 4 ###
//
// Here we ask again for the used memory, as we can see Vcluster and several other structures encapsulated inside
// Vcluster register itself
//
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory after initialization \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 5 ###
//
// Here we are creating a distributed vector defined by the following parameters
//
// * Dimensionality of the space where the objects live 2D (1° template parameters)
// * Type of the space, float (2° template parameters)
// * Information stored by each object (3* template parameters), in this case a Point_test store 4 scalars
// 1 vector and an asymmetric tensor of rank 2
// * Strategy used to decompose the space
//
// The Constructor instead require:
//
// * Number of particles 4096 in this case
// * Domain where is defined this structure
//
// The following construct a vector where each processor has 4096 / N_proc (N_proc = number of processor)
// objects with an undefined position in space. This non-space decomposition is also called data-driven
// decomposition
//
{
vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> > vd(4096,box,bc,g);
//
// ### WIKI 6 ###
//
// we create a key that for sure overflow the local datastructure, 2048 with this program is started with more than 3
// processors, try and catch are optionals in case you want to recover from a buffer overflow
//
try
{
vect_dist_key_dx vt(5048);
auto it = vd.getPos<0>(vt);
}
catch (size_t e)
{
std::cerr << "Error notification of overflow \n";
}
}
//
// ### WIKI 7 ###
//
// At this point the vector went out of the scope and if destroyed
// we create, now two of them using new
//
vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> > * vd1 = new vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> >(4096,box,bc,g);
vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> > * vd2 = new vector_dist<2,float, Point_test<float>, CartDecomposition<2,float> >(4096,box,bc,g);
//
// ### WIKI 8 ###
//
// we can check that these two structure produce an explicit allocation checking
// for registered pointers and structures with print_alloc, in the list we see 2 additional
// entry for distributed vector in yellow, pdata to work use the data structures that register
// itself in magenta, the same things happen for the real memory allocation from devices in
// fully green
//
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 2 vectors \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 9 ###
//
// we can also ask to the structure to identify their-self in the list
//
std::cout << "Vector id: " << vd1->who() << "\n";
std::cout << "Vector id: " << vd2->who() << "\n";
//
// ### WIKI 10 ###
//
// delete vd1 and print allocated memory, one distributed vector disappear
//
delete vd1;
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 1 vector \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 11 ###
//
// delete vd2 and print allocated memory, all distributed vector de-register
//
delete vd2;
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory with 1 vector \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
//
// ### WIKI 12 ###
//
// Try to use a deleted object
//
try
{
vect_dist_key_dx vt(0);
auto it = vd1->getPos<0>(vt);
}
catch (size_t e)
{
std::cerr << "Error notification of invalid usage of deleted object \n";
}
//
// ### WIKI 13 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Allocated memory at the end \n";
print_alloc();
std::cout << "\n";
std::cout << "\n";
std::cout << "\n";
}
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O0 -g3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
se_classes: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: se_classes
.PHONY: clean all
clean:
rm -f *.o *~ core se_classes
[pack]
files = main.cpp Makefile
/*
* ### WIKI 1 ###
*
* ## Security enhancement example
*
* This example show how to see where an allocation or corruption happen offline and online.
* Every time an error occur, the library output where the detection happen filename and line,
* in order to debug, there is an online option and an offline option
*
* * online: put a breakpoint on the indicated line with your preferred debugger
* * offline: set ulimit -c unlimited to activate the core dump file and open the core dump with your debugger
*
*/
#define SE_CLASS1
#define SE_CLASS2
#define SE_CLASS3
#define THROW_ON_ERROR
#include "Memleak_check.hpp"
#include "data_type/scalar.hpp"
#include "Grid/grid_dist_id.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "Point_test.hpp"
/*
* ### WIKI END ###
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Here we Initialize the library,
// * message_on_allocation set a message to print when one allocation is reached, the filename and line number can be used to set a breakpoint and analyze the stacktrace.
// * throw_on_allocation throw when one allocation is reached, producing the termination of the program and a core dump (if no try catch is set-up)
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
throw_on_alloc(10);
// message_on_alloc(10);
//
// ### WIKI 3 ###
//
// Create several object needed later, in particular
// * A 3D box that define the domain
// * an array of 3 unsigned integer that define the size of the grid on each dimension
// * A Ghost object that will define the extension of the ghost part for each sub-domain in physical units
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
size_t sz[3];
sz[0] = 100;
sz[1] = 100;
sz[2] = 100;
// Ghost
Ghost<3,float> g(0.01);
//
// ### WIKI 4 ###
//
// Create a distributed grid in 3D (1° template parameter) defined in R^3 with float precision (2° template parameter)
// using a CartesianDecomposition strategy (3° parameter) (the parameter 1° and 2° inside CartDecomposition must match 1° and 2°
// of grid_dist_id)
//
// Constructor parameters:
//
// * sz: size of the grid on each dimension
// * domain: where the grid is defined
// * g: ghost extension
//
//
grid_dist_id<3, float, scalar<float[3]>, CartDecomposition<3,float>> * g_dist = new grid_dist_id<3, float, scalar<float[3]>, CartDecomposition<3,float>>(sz,domain,g);
//
// ### WIKI 6 ###
//
// print allocated structures
//
if (v_cl.getProcessUnitID() == 0)
print_alloc();
//
// ### WIKI 5 ###
//
// delete g_dist
//
delete g_dist;
//
// ### WIKI 6 ###
//
// On purpose we try to access a deleted object
//
g_dist->getGridInfo();
//
// ### WIKI 13 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
vcluster: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: vcluster
.PHONY: clean all
clean:
rm -f *.o *~ core vcluster
[pack]
files = main.cpp Makefile
#include "Grid/grid_dist_id.hpp"
#include "data_type/aggregate.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "VCluster.hpp"
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* This example show several basic functionalities of VCluster
*
* ### WIKI END ###
*
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Initialize the library and several objects
//
init_global_v_cluster(&argc,&argv);
//
// ### WIKI 3 ###
//
// Get the vcluster object and the number of processor
//
Vcluster & v_cl = *global_v_cluster;
size_t N_prc = v_cl.getProcessingUnits();
//
// ### WIKI 3 ###
//
// We find the maximum of the processors rank, that should be the Number of
// processora minus one, only processor 0 print on terminal
//
size_t id = v_cl.getProcessUnitID();
v_cl.max(id);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
std::cout << "Maximum processor rank: " << id << "\n";
//
// ### WIKI 4 ###
//
// We sum all the processor ranks the maximum, the result should be that should
// be $\frac{(n-1)n}{2}$, only processor 0 print on terminal
//
size_t id2 = v_cl.getProcessUnitID();
v_cl.sum(id2);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
std::cout << "Sum of all processors rank: " << id2 << "\n";
//
// ### WIKI 5 ###
//
// we can collect information from all processors using the function gather
//
size_t id3 = v_cl.getProcessUnitID();
openfpm::vector<size_t> v;
v_cl.allGather(id3,v);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Collected ids: ";
for(size_t i = 0 ; i < v.size() ; i++)
std::cout << " " << v.get(i) << " ";
std::cout << "\n";
}
//
// ### WIKI 5 ###
//
// we can also send messages to specific processors, with the condition that the receiving
// processors know we want to communicate with them, if you are searching for a more
// free way to communicate where the receiving processors does not know which one processor
// want to communicate with us, see the example 1_dsde
//
std::stringstream ss_message_1;
std::stringstream ss_message_2;
ss_message_1 << "Hello from " << std::setw(8) << v_cl.getProcessUnitID() << "\n";
ss_message_2 << "Hello from " << std::setw(8) << v_cl.getProcessUnitID() << "\n";
std::string message_1 = ss_message_1.str();
std::string message_2 = ss_message_2.str();
size_t msg_size = message_1.size();
// Processor 0 send to processors 1,2 , 1 to 2,1, 2 to 0,1
v_cl.send(((id3+1)%N_prc + N_prc)%N_prc,0,message_1.c_str(),msg_size);
v_cl.send(((id3+2)%N_prc + N_prc)%N_prc,0,message_2.c_str(),msg_size);
openfpm::vector<char> v_one;
v_one.resize(msg_size);
openfpm::vector<char> v_two(msg_size);
v_two.resize(msg_size);
v_cl.recv(((id3-1)%N_prc + N_prc)%N_prc,0,(void *)v_one.getPointer(),msg_size);
v_cl.recv(((id3-2)%N_prc + N_prc)%N_prc,0,(void *)v_two.getPointer(),msg_size);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
{
for (size_t i = 0 ; i < msg_size ; i++)
std::cout << v_one.get(i);
for (size_t i = 0 ; i < msg_size ; i++)
std::cout << v_two.get(i);
}
//
// ### WIKI 5 ###
//
// we can also do what we did before in one shot
//
id = v_cl.getProcessUnitID();
id2 = v_cl.getProcessUnitID();
id3 = v_cl.getProcessUnitID();
v.clear();
// convert the string into a vector
openfpm::vector<char> message_1_v(msg_size);
openfpm::vector<char> message_2_v(msg_size);
for (size_t i = 0 ; i < msg_size ; i++)
message_1_v.get(i) = message_1[i];
for (size_t i = 0 ; i < msg_size ; i++)
message_2_v.get(i) = message_2[i];
v_cl.max(id);
v_cl.sum(id2);
v_cl.allGather(id3,v);
// in the case of vector we have special functions that avoid to specify the size
v_cl.send(((id+1)%N_prc + N_prc)%N_prc,0,message_1_v);
v_cl.send(((id+2)%N_prc + N_prc)%N_prc,0,message_2_v);
v_cl.recv(((id-1)%N_prc + N_prc)%N_prc,0,v_one);
v_cl.recv(((id-2)%N_prc + N_prc)%N_prc,0,v_two);
v_cl.execute();
if (v_cl.getProcessUnitID() == 0)
{
std::cout << "Maximum processor rank: " << id << "\n";
std::cout << "Sum of all processors rank: " << id << "\n";
std::cout << "Collected ids: ";
for(size_t i = 0 ; i < v.size() ; i++)
std::cout << " " << v.get(i) << " ";
std::cout << "\n";
for (size_t i = 0 ; i < msg_size ; i++)
std::cout << v_one.get(i);
for (size_t i = 0 ; i < msg_size ; i++)
std::cout << v_two.get(i);
}
delete_global_v_cluster();
}
SUBDIRS := $(wildcard */.)
all clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@; \
done
clean: $(SUBDIRS)
.PHONY: all clean $(SUBDIRS)
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
vect: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: vect
.PHONY: clean all
clean:
rm -f *.o *~ core vect
[pack]
files = main.cpp Makefile
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* This example show several basic functionalities of the distributed vector
*
* ### WIKI END ###
*
*/
/*
* ### WIKI 2 ###
*
* We define a particle structure it contain 4 scalars one vector with 3 components
* and a tensor of rank 2 3x3
*
* ### WIKI END ###
*
*/
template<typename T> class Particle
{
public:
typedef boost::fusion::vector<T,T[3],T[3][3]> type;
type data;
static const unsigned int s = 0;
static const unsigned int v = 1;
static const unsigned int t = 2;
static const unsigned int max_prop = 3;
};
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Here we Initialize the library, than we create a uniform random generator between 0 and 1 to to generate particles
// randomly in the domain, we create a Box that define our domain, boundary conditions, and ghost
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
typedef Point<2,float> s;
// set the seed
// create the random generator engine
std::srand(v_cl.getProcessUnitID());
std::default_random_engine eg;
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
Box<2,float> domain({0.0,0.0},{1.0,1.0});
size_t bc[2]={PERIODIC,PERIODIC};
Ghost<2,float> g(0.01);
//
// ### WIKI 3 ###
//
// Here we are creating a distributed vector defined by the following parameters
//
// * Dimensionality of the space where the objects live 2D (1° template parameters)
// * Type of the space, float (2° template parameters)
// * Information stored by each object (3* template parameters), in this case a Point_test store 4 scalars
// 1 vector and an asymmetric tensor of rank 2
// * Strategy used to decompose the space
//
// Constructor instead require:
//
// * Number of particles 4096 in this case
// * Domain where is defined this structure
//
// The following construct a vector where each processor has 4096 / N_proc (N_proc = number of processor)
// objects with an undefined position in space. This non-space decomposition is also called data-driven
// decomposition
//
vector_dist<2,float, Particle<float>, CartDecomposition<2,float> > vd(4096,domain,bc,g);
//
// ### WIKI 5 ###
//
// Get an iterator that go through the particles, in an undefined position state and define its position
//
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.template getPos<s::x>(key)[0] = ud(eg);
vd.template getPos<s::x>(key)[1] = ud(eg);
++it;
}
//
// ### WIKI 6 ###
//
// Once we define the position, we distribute them according to the default decomposition
// The default decomposition is created even before assigning the position to the object
// (This will probably change in future)
//
vd.map();
//
// ### WIKI 7 ###
//
// We get the object that store the decomposition, than we iterate again across all the objects, we count them
// and we confirm that all the particles are local
//
size_t cnt = 0;
auto & ct = vd.getDecomposition();
it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
// The template parameter is unuseful and will probably disappear
if (ct.isLocal(vd.template getPos<0>(key)) == false)
std::cerr << "Error particle is not local" << "\n";
// set the all the properties to 0.0
// scalar
vd.template getProp<0>(key) = 0.0;
vd.template getProp<1>(key)[0] = 0.0;
vd.template getProp<1>(key)[1] = 0.0;
vd.template getProp<1>(key)[2] = 0.0;
vd.template getProp<2>(key)[0][0] = 0.0;
vd.template getProp<2>(key)[0][1] = 0.0;
vd.template getProp<2>(key)[0][2] = 0.0;
vd.template getProp<2>(key)[1][0] = 0.0;
vd.template getProp<2>(key)[1][1] = 0.0;
vd.template getProp<2>(key)[1][2] = 0.0;
vd.template getProp<2>(key)[2][0] = 0.0;
vd.template getProp<2>(key)[2][1] = 0.0;
vd.template getProp<2>(key)[2][2] = 0.0;
cnt++;
++it;
}
//
// ### WIKI 8 ###
//
// cnt contain the number of object the local processor contain, if we are interested to count the total number across the processor
// we can use the function add, to sum across processors. First we have to get an instance of Vcluster, queue an operation of add with
// the variable count and finaly execute. All the operations are asynchronous, execute work like a barrier and ensure that all the
// queued operations are executed
//
v_cl.sum(cnt);
v_cl.execute();
//
// ### WIKI 9 ###
//
// Output the particle position for each processor
//
vd.write("output");
//
// ### WIKI 10 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
cell: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: cell
.PHONY: clean all
clean:
rm -f *.o *~ core cell
[pack]
files = main.cpp Makefile
#include "Vector/vector_dist.hpp"
#include "Decomposition/CartDecomposition.hpp"
#include "data_type/aggregate.hpp"
/*
* ### WIKI 1 ###
*
* ## Simple example
*
* This example show cell lists for the distributed vector
*
* ### WIKI END ###
*
*/
int main(int argc, char* argv[])
{
//
// ### WIKI 2 ###
//
// Here we Initialize the library, we create a Box that define our domain, boundary conditions, ghost
// and the grid size
//
init_global_v_cluster(&argc,&argv);
Vcluster & v_cl = *global_v_cluster;
// we create a 128x128x128 Grid iterator
size_t sz[3] = {128,128,128};
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
// ghost, big enough to contain the interaction radius
Ghost<3,float> ghost(1.0/(128-2));
//
// ### WIKI 3 ###
//
// Here we define a distributed vector in 3D, containing 3 properties, a
// scalar double, a vector double[3], and a tensor or rank 2 double[3][3].
// In this case the vector contain 0 particles in total
//
vector_dist<3,float, aggregate<double,double[3],double[3][3]>, CartDecomposition<3,float> > vd(0,box,bc,ghost);
//
// ### WIKI 4 ###
//
// We define a grid iterator, to create particles on a grid like way.
// An important note is that the grid iterator, iterator only on the
// local nodes for each processor for example suppose to have a domain like
// the one in figure
//
// +---------+
// |* * *|* *|
// | 2 | |
// |* * *|* *|
// | --- |
// |* *|* * *|
// | | |
// |* *|* * *|
// | | 1 |
// |* *|* * *|
// +---------+
//
// divided in 2 processors, the processor 1 will iterate only on the points
// inside the portion of space marked with one. A note grid iterator follow the
// boundary condition specified in vector. For a perdiodic 2D 5x5 grid we have
//
// +---------+
// * * * * * |
// | |
// * * * * * |
// | |
// * * * * * |
// | |
// * * * * * |
// | |
// *-*-*-*-*-+
//
// Because the right border is equivalent to the left border, while for a non periodic we have the
// following distribution of points
//
// *-*-*-*-*
// | |
// * * * * *
// | |
// * * * * *
// | |
// * * * * *
// | |
// *-*-*-*-*
//
// So in this loop each processor will place particles on a grid
//
auto it = vd.getGridIterator(sz);
while (it.isNext())
{
vd.add();
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);
++it;
}
//
// ### WIKI 5 ###
//
// we synchronize the ghost, the scalar property, the vector, and the rank 2 tensor
// (just for fun)
vd.ghost_get<0,1,2>();
//
// ### WIKI 6 ###
//
// If the particle does not move, or does not move that much we can create a verlet list
// for each particle, it internally use CellList to find the neighborhood but it is still
// an expensive operation
//
float r_cut = 1.0/(128-2);
auto NN = vd.getCellList(r_cut);
auto it2 = vd.getDomainIterator();
while (it2.isNext())
{
auto p = it2.get();
Point<3,float> xp = vd.getPos<0>(p);
auto Np = NN.getIterator(NN.getCell(vd.getPos<0>(p)));
while (Np.isNext())
{
auto q = Np.get();
// repulsive
Point<3,float> xq = vd.getPos<0>(q);
Point<3,float> f = (xp - xq);
// we sum the distance of all the particles
vd.template getProp<0>(p) += f.norm();;
// we sum the distance of all the particles
vd.template getProp<1>(p)[0] += f.get(0);
vd.template getProp<1>(p)[1] += f.get(0);
vd.template getProp<1>(p.getKey())[2] += f.get(0);
vd.template getProp<2>(p)[0][0] += xp.get(0) - xq.get(0);
vd.template getProp<2>(p)[0][1] += xp.get(0) - xq.get(1);
vd.template getProp<2>(p)[0][2] += xp.get(0) - xq.get(2);
vd.template getProp<2>(p)[1][0] += xp.get(1) - xq.get(0);
vd.template getProp<2>(p)[1][1] += xp.get(1) - xq.get(1);
vd.template getProp<2>(p)[1][2] += xp.get(1) - xq.get(2);
vd.template getProp<2>(p)[2][0] += xp.get(2) - xq.get(0);
vd.template getProp<2>(p)[2][1] += xp.get(2) - xq.get(1);
vd.template getProp<2>(p)[2][2] += xp.get(2) - xq.get(2);
}
++it2;
}
//
// ### WIKI 10 ###
//
// Deinitialize the library
//
delete_global_v_cluster();
}
include ../../example.mk
CC=mpic++
LDIR =
OBJ = main.o
%.o: %.cpp
$(CC) -O3 -c --std=c++11 -o $@ $< $(INCLUDE_PATH)
verlet: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS_PATH) $(LIBS)
all: vect
.PHONY: clean all
clean:
rm -f *.o *~ core verlet
[pack]
files = main.cpp Makefile