From 4366ff29cd8e0f32b6652e8e516cbed1c5f9844c Mon Sep 17 00:00:00 2001 From: Norbert Podhorszki <pnorbert@ornl.gov> Date: Mon, 3 Apr 2017 13:31:39 -0400 Subject: [PATCH] Add heatTransfer to the cmake build. Only the adios2 version yet. --- examples/CMakeLists.txt | 1 + examples/heatTransfer/CMakeLists.txt | 21 +++++++++++++++++++++ examples/heatTransfer/HeatTransfer.cpp | 1 - examples/heatTransfer/HeatTransfer.h | 3 +++ examples/heatTransfer/IO.h | 3 +++ examples/heatTransfer/IO_adios2.cpp | 10 ++++++++-- examples/heatTransfer/main.cpp | 2 ++ 7 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 examples/heatTransfer/CMakeLists.txt diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ffe6d00e4..59d0aaef3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,3 +4,4 @@ #------------------------------------------------------------------------------# add_subdirectory(hello) +add_subdirectory(heatTransfer) diff --git a/examples/heatTransfer/CMakeLists.txt b/examples/heatTransfer/CMakeLists.txt new file mode 100644 index 000000000..8752c88e3 --- /dev/null +++ b/examples/heatTransfer/CMakeLists.txt @@ -0,0 +1,21 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +add_executable(heatTransfer_adios main.cpp HeatTransfer.cpp Settings.cpp IO_adios2.cpp) + +if(ADIOS_USE_MPI) + find_package(MPI COMPONENTS C REQUIRED) + target_include_directories(heatTransfer_adios PRIVATE ${MPI_C_INCLUDE_PATH}) + target_link_libraries(heatTransfer_adios adios2 ${MPI_C_LIBRARIES}) +else(ADIOS_USE_MPI) + add_executable(heatTransfer_adios main.cpp HeatTransfer.cpp Settings.cpp IO_adios2.cpp) + target_link_libraries(heatTransfer_adios adios2) +endif() + +if(ADIOS_USE_ADIOS1) + add_executable(heatTransfer_adios1 main.cpp HeatTransfer.cpp Settings.cpp IO_adios1.cpp) +endif() + +#add_subdirectory(read) diff --git a/examples/heatTransfer/HeatTransfer.cpp b/examples/heatTransfer/HeatTransfer.cpp index 5cac74fc9..613b41895 100644 --- a/examples/heatTransfer/HeatTransfer.cpp +++ b/examples/heatTransfer/HeatTransfer.cpp @@ -10,7 +10,6 @@ * Author: Norbert Podhorszki * */ -#include <mpi.h> #include <iomanip> #include <iostream> diff --git a/examples/heatTransfer/HeatTransfer.h b/examples/heatTransfer/HeatTransfer.h index 12334f066..bec5f9929 100644 --- a/examples/heatTransfer/HeatTransfer.h +++ b/examples/heatTransfer/HeatTransfer.h @@ -11,7 +11,10 @@ #ifndef HEATTRANSFER_H_ #define HEATTRANSFER_H_ +#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings #include <mpi.h> +#undef OMPI_SKIP_MPICXX + #include <vector> #include "Settings.h" diff --git a/examples/heatTransfer/IO.h b/examples/heatTransfer/IO.h index e9c7c6195..bfd299910 100644 --- a/examples/heatTransfer/IO.h +++ b/examples/heatTransfer/IO.h @@ -13,7 +13,10 @@ #include "HeatTransfer.h" #include "Settings.h" + +#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings #include <mpi.h> +#undef OMPI_SKIP_MPICXX class IO { diff --git a/examples/heatTransfer/IO_adios2.cpp b/examples/heatTransfer/IO_adios2.cpp index 49e9c5860..c9fce5189 100644 --- a/examples/heatTransfer/IO_adios2.cpp +++ b/examples/heatTransfer/IO_adios2.cpp @@ -69,13 +69,17 @@ IO::~IO() delete ad; } -void /*IO::*/ old_style_write(int step, const HeatTransfer &ht, - const Settings &s, MPI_Comm comm) +#if 1 + +void IO::write(int step, const HeatTransfer &ht, + const Settings &s, MPI_Comm comm) { bpWriter->Write<double>(*varT, ht.data_noghost().data()); bpWriter->Advance(); } +#else + void IO::write(int step, const HeatTransfer &ht, const Settings &s, MPI_Comm comm) { @@ -107,3 +111,5 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s, bpWriter->Write<double>(*varT, ht.data()); bpWriter->Advance(); } + +#endif // 1 diff --git a/examples/heatTransfer/main.cpp b/examples/heatTransfer/main.cpp index d15216eb8..8f4c15bb3 100644 --- a/examples/heatTransfer/main.cpp +++ b/examples/heatTransfer/main.cpp @@ -10,7 +10,9 @@ * Author: Norbert Podhorszki * */ +#define OMPI_SKIP_MPICXX 1 // workaround for OpenMPI forcing C++ bindings #include <mpi.h> +#undef OMPI_SKIP_MPICXX #include <iostream> #include <memory> -- GitLab