https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CompileTimeDerivatives::CTIPow< B, E > Class Template Reference

Integer exponent power operator. More...

#include <CompileTimeDerivatives.h>

Inheritance diagram for CompileTimeDerivatives::CTIPow< B, E >:
[legend]

Public Types

typedef T::ResultType ResultType
 

Public Member Functions

 CTIPow (B base)
 
ResultType operator() () const
 
std::string print () const
 
template<CTTag dtag>
auto D () const
 
std::string printParens (const Self *, const std::string &op) const
 

Static Public Member Functions

static constexpr int precedence ()
 precedence should reflect C++ operator precedence exactly (higher is binding tighter)
 
static constexpr bool leftAssociative ()
 left/right associative property should reflect C++ operator properties exactly
 

Protected Attributes

const B _arg
 

Detailed Description

template<typename B, int E>
class CompileTimeDerivatives::CTIPow< B, E >

Integer exponent power operator.

Definition at line 731 of file CompileTimeDerivatives.h.

Member Typedef Documentation

◆ ResultType

typedef T::ResultType CompileTimeDerivatives::CTUnary< B >::ResultType
inherited

Definition at line 152 of file CompileTimeDerivatives.h.

Constructor & Destructor Documentation

◆ CTIPow()

template<typename B , int E>
CompileTimeDerivatives::CTIPow< B, E >::CTIPow ( B  base)
inline

Definition at line 734 of file CompileTimeDerivatives.h.

734: CTUnary<B>(base) {}

Member Function Documentation

◆ D()

template<typename B , int E>
template<CTTag dtag>
auto CompileTimeDerivatives::CTIPow< B, E >::D ( ) const
inline

Definition at line 757 of file CompileTimeDerivatives.h.

758 {
759 if constexpr (E == 1)
760 return _arg.template D<dtag>();
761
762 else if constexpr (E == 0)
763 return CTNull<ResultType>();
764
765 else
766 return pow<E - 1>(_arg) * E * _arg.template D<dtag>();
767 }
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template D< dtag >()/_arg) CT_SIMPLE_UNARY_FUNCTION(sin
auto pow(const B &base, const E &exp)
pow(base, exponent) function overload.

◆ leftAssociative()

static constexpr bool CompileTimeDerivatives::CTBase::leftAssociative ( )
inlinestaticconstexprinherited

left/right associative property should reflect C++ operator properties exactly

Definition at line 31 of file CompileTimeDerivatives.h.

31{ return false; }

◆ operator()()

template<typename B , int E>
ResultType CompileTimeDerivatives::CTIPow< B, E >::operator() ( ) const
inline

Definition at line 737 of file CompileTimeDerivatives.h.

738 {
739 if constexpr (std::is_base_of<CTNullBase, B>::value)
740 return ResultType(0);
741
742 else if constexpr (std::is_base_of<CTOneBase, B>::value || E == 0)
743 return ResultType(1);
744
745 else if constexpr (E == 1)
746 return _arg();
747
748 else if constexpr (E < 0)
749 return 1.0 / libMesh::Utility::pow<-E>(_arg());
750
751 else
752 return libMesh::Utility::pow<E>(_arg());
753 }

◆ precedence()

static constexpr int CompileTimeDerivatives::CTBase::precedence ( )
inlinestaticconstexprinherited

precedence should reflect C++ operator precedence exactly (higher is binding tighter)

Definition at line 29 of file CompileTimeDerivatives.h.

29{ return 0; }

◆ print()

template<typename B , int E>
std::string CompileTimeDerivatives::CTIPow< B, E >::print ( ) const
inline

Definition at line 754 of file CompileTimeDerivatives.h.

754{ return "pow<" + Moose::stringify(E) + ">(" + _arg.print() + ")"; }
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64

◆ printParens()

std::string CompileTimeDerivatives::CTUnary< B >::printParens ( const Self *  ,
const std::string &  op 
) const
inlineinherited

Definition at line 141 of file CompileTimeDerivatives.h.

142 {
143 std::string out = op;
144 if constexpr (T::precedence() > Self::precedence())
145 out += "(" + _arg.print() + ")";
146 else
147 out += _arg.print();
148
149 return out;
150 }
OStreamProxy out(std::cout)

Member Data Documentation

◆ _arg

const B CompileTimeDerivatives::CTUnary< B >::_arg
protectedinherited

Definition at line 155 of file CompileTimeDerivatives.h.


The documentation for this class was generated from the following file: