Skip to content
Snippets Groups Projects
Commit b36a435a authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix compilation if HDF5 is not present

parent d8118c48
No related branches found
No related tags found
1 merge request!176Add HDF5 support
......@@ -227,7 +227,7 @@ set(PUGS_ENABLE_HDF5 AUTO CACHE STRING
if (PUGS_ENABLE_HDF5 MATCHES "^(AUTO|ON)$")
# May be risky. (make to show pugs build options)
find_package(HDF5)
if (HDF5_FOUND)
# HighFive
set(HIGHFIVE_USE_BOOST OFF) # no Boost
set(HIGHFIVE_BUILD_DOCS OFF) # no doc
......@@ -236,9 +236,11 @@ if (PUGS_ENABLE_HDF5 MATCHES "^(AUTO|ON)$")
set(HIGHFIVE_EXAMPLES OFF) # no examples
set(HIGHFIVE_PARALLEL_HDF5 ON) # activate parallel HDF5
add_subdirectory(${PUGS_SOURCE_DIR}/packages/HighFive/)
set(HIGHFIVE_TARGET HighFive)
endif()
set(PUGS_HAS_HDF5 ${HDF5_FOUND})
else()
unset(HIGHFIVE_TARGET)
unset(PUGS_HAS_HDF5)
endif()
......@@ -615,7 +617,7 @@ target_link_libraries(
${KOKKOS_CXX_FLAGS}
${OPENMP_LINK_FLAGS}
${PUGS_STD_LINK_FLAGS}
HighFive
${HIGHFIVE_TARGET}
stdc++fs
)
......
......@@ -11,4 +11,5 @@ target_link_libraries(
PugsAlgebra
${PETSC_LIBRARIES}
${SLEPC_LIBRARIES}
${HIGHFIVE_TARGET}
)
......@@ -12,6 +12,11 @@ add_library(
TetrahedronGaussQuadrature.cpp
TriangleGaussQuadrature.cpp)
target_link_libraries(
PugsAnalysis
${HIGHFIVE_TARGET}
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0.0"))
# Deactivated since it produces false positive warning in this file only ...
......
......@@ -7,5 +7,5 @@ add_library(
target_link_libraries(
PugsDevUtils
HighFive
${HIGHFIVE_TARGET}
)
#ifndef PARALLEL_CHECKER_HPP
#define PARALLEL_CHECKER_HPP
#include <utils/pugs_config.hpp>
#ifdef PUGS_HAS_HDF5
#include <highfive/H5File.hpp>
#endif // PUGS_HAS_HDF5
#include <mesh/Connectivity.hpp>
#include <mesh/ItemArrayVariant.hpp>
#include <mesh/ItemValueVariant.hpp>
......@@ -33,7 +37,17 @@ class ParallelChecker
write
};
#ifdef PUGS_HAS_HDF5
private:
static ParallelChecker* m_instance;
Mode m_mode = Mode::automatic;
size_t m_tag = 0;
std::string m_filename = "testme/parallel_checker.h5";
ParallelChecker() = default;
public:
template <typename DataType, ItemType item_type, typename ConnectivityPtr>
friend void parallel_check(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value,
const std::string& name,
......@@ -44,6 +58,7 @@ class ParallelChecker
const std::string& name,
const SourceLocation& source_location);
#ifdef PUGS_HAS_HDF5
private:
template <typename T>
struct TinyVectorDataType;
......@@ -73,15 +88,6 @@ class ParallelChecker
}
};
static ParallelChecker* m_instance;
Mode m_mode = Mode::automatic;
size_t m_tag = 0;
std::string m_filename = "testme/parallel_checker.h5";
ParallelChecker() = default;
HighFive::File
_createOrOpenFileRW() const
{
......@@ -332,6 +338,7 @@ class ParallelChecker
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
this->_printHeader(name, source_location);
try {
......@@ -368,6 +375,7 @@ class ParallelChecker
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
this->_printHeader(name, source_location);
try {
......@@ -404,6 +412,7 @@ class ParallelChecker
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
this->_printHeader(name, source_location);
try {
......@@ -524,6 +533,7 @@ class ParallelChecker
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
this->_printHeader(name, source_location);
try {
......@@ -709,7 +719,6 @@ parallel_check(const ItemArray<DataType, item_type, ConnectivityPtr>& item_array
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
if (ParallelChecker::instance().isWriting()) {
ParallelChecker::instance().write(item_array, name, source_location);
} else {
......@@ -723,7 +732,6 @@ parallel_check(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value
const std::string& name,
const SourceLocation& source_location)
{
HighFive::SilenceHDF5 m_silence_hdf5{true};
if (ParallelChecker::instance().isWriting()) {
ParallelChecker::instance().write(item_value, name, source_location);
} else {
......
......@@ -19,7 +19,7 @@ add_library(
target_link_libraries(
PugsLanguageModules
HighFive
${HIGHFIVE_TARGET}
)
add_dependencies(
......
......@@ -48,5 +48,5 @@ add_dependencies(PugsLanguageUtils
target_link_libraries(
PugsLanguageUtils
HighFive
${HIGHFIVE_TARGET}
)
......@@ -45,5 +45,5 @@ add_library(
target_link_libraries(
PugsMesh
HighFive
${HIGHFIVE_TARGET}
)
......@@ -9,5 +9,5 @@ add_library(
target_link_libraries(
PugsOutput
HighFive
${HIGHFIVE_TARGET}
)
......@@ -14,5 +14,5 @@ add_library(
target_link_libraries(
PugsScheme
HighFive
${HIGHFIVE_TARGET}
)
......@@ -24,7 +24,7 @@ target_link_libraries(
PugsUtils
${PETSC_LIBRARIES}
${SLEPC_LIBRARIES}
HighFive
${HIGHFIVE_TARGET}
)
# --------------- get git revision info ---------------
......
......@@ -232,7 +232,7 @@ target_link_libraries (unit_tests
${PETSC_LIBRARIES}
Catch2
${PUGS_STD_LINK_FLAGS}
HighFive
${HIGHFIVE_TARGET}
stdc++fs
)
......@@ -261,7 +261,7 @@ target_link_libraries (mpi_unit_tests
${PETSC_LIBRARIES}
Catch2
${PUGS_STD_LINK_FLAGS}
HighFive
${HIGHFIVE_TARGET}
stdc++fs
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment