From d57eda0182c94033aedc2ee542c27bd1fd914e09 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <i-bird@localhost.localdomain>
Date: Thu, 14 Apr 2016 00:40:59 +0200
Subject: [PATCH] Fixing examples

---
 example/Grid/0_simple/main.cpp     |  4 ++--
 example/Grid/1_stencil/main.cpp    |  4 ++--
 example/SE/0_classes/main.cpp      | 15 +++------------
 example/SE/1_classes/main.cpp      |  6 +++---
 example/Vector/0_simple/main.cpp   |  6 +++---
 example/Vector/1_celllist/main.cpp |  6 +++---
 example/Vector/1_verlet/main.cpp   |  6 +++---
 7 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/example/Grid/0_simple/main.cpp b/example/Grid/0_simple/main.cpp
index 489690be..5d456b63 100644
--- a/example/Grid/0_simple/main.cpp
+++ b/example/Grid/0_simple/main.cpp
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
 	//
 	// Initialize the library and several objects 
 	//
-	init_global_v_cluster(&argc,&argv);
+	openfpm_init(&argc,&argv);
 	
 	//
 	// ### WIKI 3 ###
@@ -152,5 +152,5 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
diff --git a/example/Grid/1_stencil/main.cpp b/example/Grid/1_stencil/main.cpp
index ee585409..e4d7fe12 100644
--- a/example/Grid/1_stencil/main.cpp
+++ b/example/Grid/1_stencil/main.cpp
@@ -37,7 +37,7 @@ int main(int argc, char* argv[])
 	//
 	// Initialize the library and several objects
 	//
-	init_global_v_cluster(&argc,&argv);
+	openfpm_init(&argc,&argv);
 
 	//
 	// ### WIKI 4 ###
@@ -159,5 +159,5 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
diff --git a/example/SE/0_classes/main.cpp b/example/SE/0_classes/main.cpp
index 640c5572..952adf16 100644
--- a/example/SE/0_classes/main.cpp
+++ b/example/SE/0_classes/main.cpp
@@ -42,8 +42,8 @@ int main(int argc, char* argv[])
 	// 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;
+	openfpm_init(&argc,&argv);
+	Vcluster & v_cl = create_vcluster();
 	
 	typedef Point<2,float> s;
 
@@ -197,15 +197,6 @@ int main(int argc, char* argv[])
 	//
 	// 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";
-	}
+	openfpm_finalize();
 }
 
diff --git a/example/SE/1_classes/main.cpp b/example/SE/1_classes/main.cpp
index 13721c7f..1662be01 100644
--- a/example/SE/1_classes/main.cpp
+++ b/example/SE/1_classes/main.cpp
@@ -36,8 +36,8 @@ int main(int argc, char* argv[])
 	// * 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;
+	openfpm_init(&argc,&argv);
+	Vcluster & v_cl = create_vcluster();
 
 	throw_on_alloc(10);
 	// message_on_alloc(10);
@@ -104,6 +104,6 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
 
diff --git a/example/Vector/0_simple/main.cpp b/example/Vector/0_simple/main.cpp
index fa568cfa..9f26e5fc 100644
--- a/example/Vector/0_simple/main.cpp
+++ b/example/Vector/0_simple/main.cpp
@@ -44,8 +44,8 @@ int main(int argc, char* argv[])
 	// 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;
+	openfpm_init(&argc,&argv);
+	Vcluster & v_cl = create_vcluster();
 	
 	typedef Point<2,float> s;
 
@@ -172,5 +172,5 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
diff --git a/example/Vector/1_celllist/main.cpp b/example/Vector/1_celllist/main.cpp
index f59df049..45d1e56b 100644
--- a/example/Vector/1_celllist/main.cpp
+++ b/example/Vector/1_celllist/main.cpp
@@ -22,8 +22,8 @@ int main(int argc, char* argv[])
 	// 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;
+	openfpm_init(&argc,&argv);
+	Vcluster & v_cl = create_vcluster();
 
 	// we create a 128x128x128 Grid iterator
 	size_t sz[3] = {128,128,128};
@@ -173,7 +173,7 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
 
 
diff --git a/example/Vector/1_verlet/main.cpp b/example/Vector/1_verlet/main.cpp
index 637363b6..b9dae2ad 100644
--- a/example/Vector/1_verlet/main.cpp
+++ b/example/Vector/1_verlet/main.cpp
@@ -21,8 +21,8 @@ int main(int argc, char* argv[])
 	// 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;
+	openfpm_init(&argc,&argv);
+	Vcluster & v_cl = create_vcluster();
 
 	// we create a 128x128x128 Grid iterator
 	size_t sz[3] = {128,128,128};
@@ -174,6 +174,6 @@ int main(int argc, char* argv[])
 	//
 	// Deinitialize the library
 	//
-	delete_global_v_cluster();
+	openfpm_finalize();
 }
 
-- 
GitLab