diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
new file mode 100644
index 0000000..ee3d39c
--- /dev/null
+++ b/samples/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(ctest)
+add_subdirectory(cpptest)
+add_subdirectory(mpitest)
diff --git a/samples/cpptest/CMakeLists.txt b/samples/cpptest/CMakeLists.txt
index ac2395c..4782bda 100644
--- a/samples/cpptest/CMakeLists.txt
+++ b/samples/cpptest/CMakeLists.txt
@@ -6,6 +6,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wall -Wextra -Werror -Wdouble-promotion -Wfloat-conversion -Wshadow)
## Compile and link
-add_executable(ac_simulate simulation.cc)
-target_link_libraries(ac_simulate PRIVATE astaroth_core astaroth_utils)
-add_definitions(-DAC_DEFAULT_CONFIG="${CMAKE_SOURCE_DIR}/config/astaroth.conf")
+add_executable(cpptest main.cc)
+target_link_libraries(cpptest PRIVATE astaroth_core astaroth_utils)
diff --git a/samples/cpptest/main.cc b/samples/cpptest/main.cc
new file mode 100644
index 0000000..e5387fd
--- /dev/null
+++ b/samples/cpptest/main.cc
@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala.
+
+ This file is part of Astaroth.
+
+ Astaroth is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Astaroth is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Astaroth. If not, see .
+*/
+#include
+#include
+#include
+
+#include "astaroth.h"
+
+// From Astaroth Utils
+#include "src/utils/config_loader.h"
+#include "src/utils/memory.h"
+#include "src/utils/verification.h"
+
+int
+main(void)
+{
+ AcMeshInfo info;
+ acLoadConfig(AC_DEFAULT_CONFIG, &info);
+
+ // Alloc
+ AcMesh model, candidate;
+ acMeshCreate(info, &model);
+ acMeshCreate(info, &candidate);
+
+ // Init
+ acMeshRandomize(&model);
+ acMeshApplyPeriodicBounds(&model);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ acInit(info);
+ acLoad(model);
+ acStore(&candidate);
+ acQuit();
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+
+ // Verify and destroy
+ acVerifyMesh(model, candidate);
+ acMeshDestroy(&model);
+ acMeshDestroy(&candidate);
+
+ return EXIT_SUCCESS;
+}
diff --git a/samples/cpptest/simulation.cc b/samples/cpptest/simulation.cc
deleted file mode 100644
index 90b0230..0000000
--- a/samples/cpptest/simulation.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala.
-
- This file is part of Astaroth.
-
- Astaroth is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Astaroth is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Astaroth. If not, see .
-*/
-#include "src/utils/config_loader.h"
-#include "src/utils/memory.h"
-
-#include
-#include
-#include
-
-int
-run_simulation(const char* config_path)
-{
- AcMeshInfo info;
- acLoadConfig(config_path, &info);
-
- AcMesh mesh;
- acMeshCreate(info, &mesh);
- acMeshClear(&mesh);
-
- acInit(info);
- acLoad(mesh);
-
- const size_t num_steps = 10;
- for (size_t i = 0; i < num_steps; ++i) {
- const AcReal dt = 1; // JP: TODO! Set timestep here!
-
- // JP: TODO! Make sure that AcMeshInfo parameters are properly initialized before calling
- // acIntegrate()
- // NANs indicate that either dt is too large or something was uninitalized
- acIntegrate(dt);
- }
- for (int i = 0; i < NUM_VTXBUF_HANDLES; ++i) {
- printf("%s:\n", vtxbuf_names[i]);
- printf("\tmax: %g\n", (double)acReduceScal(RTYPE_MAX, VertexBufferHandle(i)));
- printf("\tmin: %g\n", (double)acReduceScal(RTYPE_MIN, VertexBufferHandle(i)));
- printf("\trms: %g\n", (double)acReduceScal(RTYPE_RMS, VertexBufferHandle(i)));
- printf("\texp rms: %g\n", (double)acReduceScal(RTYPE_RMS_EXP, VertexBufferHandle(i)));
- }
- acStore(&mesh);
- acQuit();
-
- acMeshDestroy(&mesh);
- return EXIT_SUCCESS;
-}
-
-int
-main(int argc, char* argv[])
-{
- printf("Args: \n");
- for (int i = 0; i < argc; ++i)
- printf("%d: %s\n", i, argv[i]);
-
- char* config_path;
- (argc == 3) ? config_path = strdup(argv[2]) : config_path = strdup(AC_DEFAULT_CONFIG);
-
- printf("Config path: %s\n", config_path);
- assert(config_path);
- run_simulation(config_path);
- free(config_path);
- return EXIT_SUCCESS;
-}
diff --git a/samples/ctest/main.c b/samples/ctest/main.c
index 5ff3fe3..4b6bfc9 100644
--- a/samples/ctest/main.c
+++ b/samples/ctest/main.c
@@ -41,7 +41,6 @@ main(void)
acMeshRandomize(&model);
acMeshApplyPeriodicBounds(&model);
- // TODO load to candidate
////////////////////////////////////////////////////////////////////////////////////////////////
acInit(info);
acLoad(model);
diff --git a/samples/mpitest/CMakeLists.txt b/samples/mpitest/CMakeLists.txt
index d5f4f68..3a606db 100644
--- a/samples/mpitest/CMakeLists.txt
+++ b/samples/mpitest/CMakeLists.txt
@@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(mpitest main.cc)
-target_link_libraries(mpitest astaroth_core)
+target_link_libraries(mpitest astaroth_core astaroth_utils)
diff --git a/samples/mpitest/README.txt b/samples/mpitest/README.txt
index 1547b08..cb6a21b 100644
--- a/samples/mpitest/README.txt
+++ b/samples/mpitest/README.txt
@@ -1 +1,11 @@
This directory is used to test MPI with Astaroth.
+
+Building (in the base astaroth directory):
+cmake -DBUILD_SAMPLES=ON -DMPI_ENABLED=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) .. && make -j
+
+Running:
+mpirun -np ./mpitest
+or
+srun ./mpitest # With slurm
+or
+a batch script of your choice