Skip to content
Snippets Groups Projects
Select Git revision
  • b1ba8be6f514e92a4f0beb89f1b31fc4adf5ace6
  • develop default protected
  • feature/advection
  • feature/composite-scheme-other-fluxes
  • origin/stage/bouguettaia
  • save_clemence
  • feature/local-dt-fsi
  • feature/variational-hydro
  • feature/gmsh-reader
  • feature/reconstruction
  • feature/kinetic-schemes
  • feature/composite-scheme-sources
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

ReadItemValueVariant.cpp

Blame
  • UnaryExpressionProcessor.hpp 1011 B
    #ifndef UNARY_EXPRESSION_PROCESSOR_HPP
    #define UNARY_EXPRESSION_PROCESSOR_HPP
    
    #include <node_processor/INodeProcessor.hpp>
    
    #include <SymbolTable.hpp>
    
    template <typename Op>
    struct UnaryOp;
    
    template <>
    struct UnaryOp<language::unary_minus>
    {
      template <typename A>
      PUGS_INLINE A
      eval(const A& a)
      {
        return -a;
      }
    };
    
    template <>
    struct UnaryOp<language::unary_not>
    {
      template <typename A>
      PUGS_INLINE bool
      eval(const A& a)
      {
        return not a;
      }
    };
    
    template <typename UnaryOpT, typename ValueT, typename DataT>
    class UnaryExpressionProcessor final : public INodeProcessor
    {
     private:
      ASTNode& m_node;
    
      PUGS_INLINE ValueT
      _eval(const DataVariant& a)
      {
        return UnaryOp<UnaryOpT>().eval(static_cast<ValueT>(std::get<DataT>(a)));
      }
    
     public:
      DataVariant
      execute(ExecutionPolicy& exec_policy)
      {
        return this->_eval(m_node.children[0]->execute(exec_policy));
      }
    
      UnaryExpressionProcessor(ASTNode& node) : m_node{node} {}
    };
    
    #endif   // UNARY_EXPRESSION_PROCESSOR_HPP