diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ffe6d00e4d8057f0e861d7e2209d16b7f2b26fe6..59d0aaef3e1741211ad8274c17dc9f2b361b879b 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 0000000000000000000000000000000000000000..8752c88e3340ebfab4ade6bb188ca5c22e6510ae --- /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 5cac74fc91b389d6a6167b95e9fc8a58a0737dd7..613b418951cac5153a205002a4d124ca2dfac119 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 12334f0664a36eaf54b86aa1b83e2d607a5cd4d8..bec5f9929ecb96a0b66cbd4d8789bceaac9b8708 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 e9c7c6195b24fab12590f009f9c0b024d7009b59..bfd29991008150c8dad67eb5c776c7f0afee3e1e 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 49e9c58602b8dd5bcf05d4c2502746af42b14e54..c9fce5189786879fdd82a41e20221cc8e0150beb 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 d15216eb8f775819f037eba802772949dd369bbb..8f4c15bb34a20c955c82fb6424f8a001eb6c2847 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>