diff --git a/dumux/common/typetraits/typetraits.hh b/dumux/common/typetraits/typetraits.hh index 0541fa12b3b6a2f453e6c0431b877444c2bbad67..f8efdf1df974b75c205b6604ce6971fb99db7f52 100644 --- a/dumux/common/typetraits/typetraits.hh +++ b/dumux/common/typetraits/typetraits.hh @@ -15,6 +15,7 @@ #include <type_traits> namespace Dumux { + /*! * \brief Template which always yields a false value * \tparam T Some type. @@ -22,5 +23,19 @@ namespace Dumux { template<typename T> struct AlwaysFalse : public std::false_type {}; +/*! + * \brief Function that performs no operation. + */ +inline constexpr auto noop = [] (auto...) {}; +using Noop = decltype(noop); + +/*! + * \brief Helper template to select type T if it is not void + * or fall back to the given default type otherwise. + */ +template<typename Default, typename T> +using NonVoidOr = std::conditional_t<!std::is_void_v<T>, T, Default>; + } // end namespace Dumux + #endif diff --git a/dumux/experimental/assembly/cclocalassembler.hh b/dumux/experimental/assembly/cclocalassembler.hh index 4b82b8e4d4ec4d46310c9e1d1cda153ed1b67fcf..d65358740a2295603521538b97613b1080f9508b 100644 --- a/dumux/experimental/assembly/cclocalassembler.hh +++ b/dumux/experimental/assembly/cclocalassembler.hh @@ -17,6 +17,7 @@ #include <dune/grid/common/gridenums.hh> // for GhostEntity #include <dune/istl/matrixindexset.hh> +#include <dumux/common/typetraits/typetraits.hh> #include <dumux/common/reservedblockvector.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> @@ -29,7 +30,6 @@ #include <dumux/discretization/fluxstencil.hh> #include <dumux/discretization/cellcentered/elementsolution.hh> -#include <dumux/experimental/common/typetraits/typetraits.hh> #include <dumux/experimental/assembly/fvlocalassemblerbase.hh> namespace Dumux::Experimental { diff --git a/dumux/experimental/assembly/cvfelocalassembler.hh b/dumux/experimental/assembly/cvfelocalassembler.hh index dcb0bb0b5282d52c52763bd092a21716195a2ec5..f2254d0b121a8d1dbf85d2890b9f86308a361c5d 100644 --- a/dumux/experimental/assembly/cvfelocalassembler.hh +++ b/dumux/experimental/assembly/cvfelocalassembler.hh @@ -20,13 +20,13 @@ #include <dune/istl/matrixindexset.hh> #include <dune/istl/bvector.hh> +#include <dumux/common/typetraits/typetraits.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/common/numericdifferentiation.hh> #include <dumux/assembly/numericepsilon.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/experimental/common/typetraits/typetraits.hh> #include <dumux/experimental/assembly/fvlocalassemblerbase.hh> #include <dumux/assembly/partialreassembler.hh> #include <dumux/assembly/entitycolor.hh> diff --git a/dumux/experimental/common/CMakeLists.txt b/dumux/experimental/common/CMakeLists.txt index e134777807bb244a5e5a3af91de08ee5a84bd996..48091bece4de4a1564c20630d6ec04c094ce7fa1 100644 --- a/dumux/experimental/common/CMakeLists.txt +++ b/dumux/experimental/common/CMakeLists.txt @@ -1,7 +1,6 @@ # SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder # SPDX-License-Identifier: GPL-3.0-or-later -add_subdirectory(typetraits) file(GLOB DUMUX_EXPERIMENTAL_COMMON_HEADERS *.hh *.inc) install(FILES ${DUMUX_EXPERIMENTAL_COMMON_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/experimental/common) diff --git a/dumux/experimental/common/typetraits/CMakeLists.txt b/dumux/experimental/common/typetraits/CMakeLists.txt deleted file mode 100644 index 2b74f53d1ec9cf84da9419e5d317128ba6c69935..0000000000000000000000000000000000000000 --- a/dumux/experimental/common/typetraits/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder -# SPDX-License-Identifier: GPL-3.0-or-later - -file(GLOB DUMUX_EXPERIMENTAL_COMMON_TYPETRAITS_HEADERS *.hh *.inc) -install(FILES ${DUMUX_EXPERIMENTAL_COMMON_TYPETRAITS_HEADERS} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/experimental/common/typetraits) diff --git a/dumux/experimental/common/typetraits/typetraits.hh b/dumux/experimental/common/typetraits/typetraits.hh deleted file mode 100644 index e9ab11bd8fcc049b423b2cd1d8eec2cc77795c0c..0000000000000000000000000000000000000000 --- a/dumux/experimental/common/typetraits/typetraits.hh +++ /dev/null @@ -1,34 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -// -// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder -// SPDX-License-Identifier: GPL-3.0-or-later -// -/*! - * \file - * \ingroup Typetraits - * \brief Type traits. - */ -#ifndef DUMUX_EXPERIMENTAL_TYPE_TRAITS_HH -#define DUMUX_EXPERIMENTAL_TYPE_TRAITS_HH - -#include <type_traits> - -namespace Dumux { - -/*! - * \brief Function that performs no operation. - */ -inline constexpr auto noop = [] (auto...) {}; -using Noop = decltype(noop); - -/*! - * \brief Helper template to select type T if it is not void - * or fall back to the given default type otherwise. - */ -template<typename Default, typename T> -using NonVoidOr = std::conditional_t<!std::is_void_v<T>, T, Default>; - -} // end namespace Dumux - -#endif