https://mooseframework.inl.gov
Namespaces | Classes | Functions
CompileTimeDerivativesMaterialInternal Namespace Reference

Namespaces

 details
 

Classes

struct  type_identity
 

Functions

template<std::size_t first, std::size_t second, std::size_t... tail>
constexpr bool is_sorted (std::index_sequence< first, second, tail... >)
 Check if the given index sequence is sorted. More...
 
template<std::size_t first>
constexpr bool is_sorted (std::index_sequence< first >)
 A sequence of size 1 is always sorted. More...
 
template<std::size_t N, std::size_t M>
constexpr std::size_t total_derivatives ()
 Compute the total number of distinct derivatives for all orders 1 through N. More...
 
template<typename T , std::size_t... Ns>
constexpr auto make_tuple_array (std::index_sequence< Ns... >)
 Create a tuple with sizeof...(Ns) entries, containing CTArrayRefs with tags given by the Ns... More...
 
template<std::size_t N>
constexpr auto zeroes ()
 Create an index sequence containing N zeroes. More...
 
template<typename T , std::size_t first, std::size_t... tags>
auto take_derivatives (const T &expression, std::index_sequence< first, tags... >)
 Take all derivatives of expression listed in the index sequence. More...
 

Function Documentation

◆ is_sorted() [1/2]

template<std::size_t first, std::size_t second, std::size_t... tail>
constexpr bool CompileTimeDerivativesMaterialInternal::is_sorted ( std::index_sequence< first, second, tail... >  )

Check if the given index sequence is sorted.

Definition at line 119 of file CompileTimeDerivativesMaterialInternal.h.

120 {
121  return details::is_sorted<first, second, tail...>();
122 }
constexpr bool is_sorted(std::index_sequence< first >)
A sequence of size 1 is always sorted.

◆ is_sorted() [2/2]

template<std::size_t first>
constexpr bool CompileTimeDerivativesMaterialInternal::is_sorted ( std::index_sequence< first >  )

A sequence of size 1 is always sorted.

Definition at line 129 of file CompileTimeDerivativesMaterialInternal.h.

130 {
131  return true;
132 }

◆ make_tuple_array()

template<typename T , std::size_t... Ns>
constexpr auto CompileTimeDerivativesMaterialInternal::make_tuple_array ( std::index_sequence< Ns... >  )

Create a tuple with sizeof...(Ns) entries, containing CTArrayRefs with tags given by the Ns...

Definition at line 158 of file CompileTimeDerivativesMaterialInternal.h.

159 {
160  // we cannot default construct the tuple, so we wrap it in the type_identity template
161  return type_identity<std::tuple<CompileTimeDerivatives::CTArrayRef<Ns, T, unsigned int>...>>{};
162 }

◆ take_derivatives()

template<typename T , std::size_t first, std::size_t... tags>
auto CompileTimeDerivativesMaterialInternal::take_derivatives ( const T &  expression,
std::index_sequence< first, tags... >   
)

Take all derivatives of expression listed in the index sequence.

Definition at line 179 of file CompileTimeDerivativesMaterialInternal.h.

Referenced by CompileTimeDerivativesMaterial< N, is_ad, MaxD >::loopEvaluate().

180 {
181  if constexpr (sizeof...(tags) == 0)
182  return expression.template D<static_cast<CompileTimeDerivatives::CTTag>(first)>();
183  else
184  return take_derivatives(
185  expression.template D<static_cast<CompileTimeDerivatives::CTTag>(first)>(),
186  std::index_sequence<tags...>{});
187 }
auto take_derivatives(const T &expression, std::index_sequence< first, tags... >)
Take all derivatives of expression listed in the index sequence.
int CTTag
Operators representing variable values need to be tagged.

◆ total_derivatives()

template<std::size_t N, std::size_t M>
constexpr std::size_t CompileTimeDerivativesMaterialInternal::total_derivatives ( )

Compute the total number of distinct derivatives for all orders 1 through N.

Definition at line 139 of file CompileTimeDerivativesMaterialInternal.h.

140 {
141  // we compute derivatives of orders 0 up to and including N, and subtract 1 for
142  // the 0th order derivative (underived original function)
143  return details::total_derivatives<M>(std::make_index_sequence<N + 1>{}) - 1;
144 }

◆ zeroes()

template<std::size_t N>
constexpr auto CompileTimeDerivativesMaterialInternal::zeroes ( )

Create an index sequence containing N zeroes.

Definition at line 169 of file CompileTimeDerivativesMaterialInternal.h.

170 {
171  return details::zeroes(std::make_index_sequence<N>{});
172 }
constexpr auto zeroes()
Create an index sequence containing N zeroes.