20 #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_STENCILACCESSORS_HPP_
21 #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_STENCILACCESSORS_HPP_
24 #include "codingUtilities/traits.hpp"
25 #include "codingUtilities/Utilities.hpp"
37 template<
typename ... TRAITS >
46 template<
typename TRAIT >
47 auto get( TRAIT )
const
49 constexpr
std::size_t idx = traits::type_list_index< TRAIT, std::tuple< TRAITS ... > >;
50 static_assert( idx != std::tuple_size< std::tuple< TRAITS... > >::value,
"input trait/stencil does not match the available traits/stencils." );
51 return std::get< idx >(
m_accessors ).toNestedViewConst();
54 template<
typename TRAIT >
57 return get( TRAIT{} );
66 string const & solverName )
68 forEachArgInTuple( std::tuple< TRAITS ... >{}, [&](
auto t,
auto idx )
71 using TRAIT = TYPEOFREF( t );
75 acc.setName( solverName +
"/accessors/" + TRAIT::key() );
82 std::tuple< ElementRegionManager::ElementViewAccessor< traits::ViewTypeConst< typename TRAITS::type > > ... >
m_accessors;
96 template<
typename MATERIAL_TYPE,
typename ... TRAITS >
110 string const & solverName ):
113 forEachArgInTuple( std::tuple< TRAITS ... >{}, [&](
auto t,
auto idx )
116 using TRAIT = TYPEOFREF( t );
119 bool const allowMissingViews =
false;
121 acc.setName( solverName +
"/accessors/" + TRAIT::key() );
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructFieldAccessor(string const &neighborName=string()) const
This is a const function to construct a ElementViewAccessor to access the data registered on the mesh...
ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructMaterialFieldAccessor(arrayView1d< string const > const ®ionNames, arrayView1d< string const > const &materialNames, bool const allowMissingViews=false) const
This is a const function to construct a MaterialViewAccessor to access the material data for specifie...
A struct to automatically construct and store element view accessors.
StencilAccessors(ElementRegionManager const &elemManager, string const &solverName)
Constructor for the struct.
StencilAccessors()=default
Constructor for the struct.
std::tuple< ElementRegionManager::ElementViewAccessor< traits::ViewTypeConst< typename TRAITS::type > > ... > m_accessors
the tuple storing all the accessors
A struct to automatically construct and store element view accessors.
StencilMaterialAccessors(ElementRegionManager const &elemManager, string const &solverName)
Constructor for the struct.
std::size_t size_t
Unsigned size type.