File variant.hxx#
Defines
-
__VARIANT_HXX__#
Variant utilities
All in namespace bout::utils variant visit holds_alternative get
variantEqualTo variantStaticCastOrThrow variantToString
Internal implementation in bout::utils::details
-
namespace bout
Provides access to the Hypre library, handling initialisation and finalisation.
Usage
#include <bout/hyprelib.hxx>
class MyClass { public:
private: HypreLib lib; };
This will then automatically initialise Hypre the first time an object is created, and finalise it when the last object is destroyed.
Copyright 2012 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
Contact: Ben Dudson, bd512@york.ac.uk
This file is part of BOUT++.
BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
BOUT++ 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.
Explicit inversion of a 3x3 matrix
aIf the matrix is singular (ill conditioned), the determinant is return. Otherwise, an empty
std::optionalis returnSNB model
-
namespace utils
Functions
-
template<typename Variant, typename T>
bool variantEqualTo(const Variant &v, const T &t)# Return true only if the given variant
vhas the same type and value astNote: Handles the case that
tis not of a type whichvcan hold.
-
template<typename T, typename ...ALL_T>
struct isVariantMember<T, variant<ALL_T...>> : public bout::utils::details::disjunction<std::is_same<T, ALL_T>...># - #include <variant.hxx>
Is type
Ta member of variantvariant<ALL_T>?
-
namespace details#
-
template<typename T, typename U>
struct CompareTypes# - #include <variant.hxx>
Compare two values. Different types -> false
-
template<typename T>
struct CompareTypes<T, T># - #include <variant.hxx>
Compare two values Same type -> use
==operator to compare
-
template<typename T>
struct IsEqual# - #include <variant.hxx>
A visitor for std::variant which compares the value stored in the variant with a given value using CompareTypes
Public Functions
-
template<class...>
struct disjunction : public std::false_type# - #include <variant.hxx>
Backport of std::disjunction.
-
template<class B1, class ...Bn>
struct disjunction<B1, Bn...> : public std::conditional_t<bool(B1::value), B1, disjunction<Bn...>>#
-
template<typename Target>
struct StaticCastOrThrow# - #include <variant.hxx>
Functor to perform static casting with std::visit If the Target cannot be constructed from the Source then an exception (std::bad_cast) will be thrown at run time.
Note: This needs to be at runtime because the particular type which a variant is holding is only known at runtime.
-
struct ToString#
-
template<typename T, typename U>
-
template<typename Variant, typename T>
-
namespace utils