Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Classes | Namespaces | Typedefs | Functions
variant.hpp File Reference

This file contains the declaration of a two-element variant type. More...

#include <memory>
#include <type_traits>
Include dependency graph for variant.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  serac::detail::variant_storage< T0, T1, SFINAE >
 Storage abstraction to provide trivial destructor when both variant types are trivially destructible. More...
 
struct  serac::detail::variant_storage< T0, T1, std::enable_if_t< std::is_trivially_destructible_v< T0 > &&std::is_trivially_destructible_v< T1 > > >
 
struct  serac::detail::is_variant_assignable< T, T0, T1 >
 Determines if T can be assigned to a variant<T0, T1> More...
 
struct  serac::variant_alternative< 0, T0, T1 >
 Obtains the type at index 0 of a variant<T0, T1> More...
 
struct  serac::variant_alternative< 1, T0, T1 >
 Obtains the type at index 1 of a variant<T0, T1> More...
 
struct  serac::variant< T0, T1 >
 A simple variant type that supports only two elements. More...
 

Namespaces

 serac
 Accelerator functionality.
 

Typedefs

template<typename T >
using serac::detail::MaybeOwningPointer = variant< T *, std::unique_ptr< T > >
 A helper type for uniform semantics over owning/non-owning pointers. More...
 

Functions

template<typename T , typename T0 , typename T1 >
constexpr T & serac::get (variant< T0, T1 > &v)
 Returns the variant member of specified type. More...
 
template<typename T , typename T0 , typename T1 >
constexpr const T & serac::get (const variant< T0, T1 > &v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename Visitor , typename Variant >
constexpr decltype(auto) serac::visit (Visitor visitor, Variant &&v)
 Applies a functor to the active variant element. More...
 
template<typename T , typename T0 , typename T1 >
bool serac::holds_alternative (const variant< T0, T1 > &v)
 Checks whether a variant's active member is of a certain type. More...
 
template<typename T , typename T0 , typename T1 >
T * serac::get_if (variant< T0, T1 > *v)
 Returns the member of requested type if it's active, otherwise nullptr. More...
 
template<typename T , typename T0 , typename T1 >
const T * serac::get_if (const variant< T0, T1 > *v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Detailed Description

This file contains the declaration of a two-element variant type.

This is necessary to work around an issue reported to LC in April 2021 regarding the use of the GCC 8 libstdc++ variant header with NVCC 11. As of July 2021 this has not been fixed. Additionally, the non-recursive implementation here should reduce compile times, though this effect may be limited for a variant with only two alternatives.

Definition in file variant.hpp.

Typedef Documentation

◆ MaybeOwningPointer

template<typename T >
using serac::detail::MaybeOwningPointer = typedef variant<T*, std::unique_ptr<T> >

A helper type for uniform semantics over owning/non-owning pointers.

This logic is needed to integrate with the mesh and field reconstruction logic provided by Sidre's MFEMSidreDataCollection. When a Serac restart occurs, the saved data is used to construct fully functional mfem::(Par)Mesh and mfem::(Par)GridFunction objects. The FiniteElementCollection and (Par)FiniteElementSpace objects are intermediates in the construction of these objects and are therefore owned by the MFEMSidreDataCollection in the case of a restart/reconstruction. In a normal run, Serac constructs the mesh and fields, so these FEColl and FESpace objects are owned by Serac. In both cases, the MFEMSidreDataCollection maintains ownership of the mesh and field objects themselves.

Definition at line 436 of file variant.hpp.