Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::ParserExecutor< N > Struct Template Reference

Callable wrapper around a compiled parser expression with N variables. More...

#include <AMReX_Parser.H>

Public Member Functions

template<int M = N, std::enable_if_t< M==0, int > = 0>
__host__ __device__ double operator() () const noexcept
 Evaluate the expression with no arguments.
 
template<typename... Ts>
__host__ __device__ std::enable_if_t< sizeof...(Ts)==N &&!amrex::Same< float, Ts... >::value, double > operator() (Ts... var) const noexcept
 Evaluate the expression with N double-compatible arguments.
 
template<typename... Ts>
__host__ __device__ std::enable_if_t< sizeof...(Ts)==N &&amrex::Same< float, Ts... >::value, float > operator() (Ts... var) const noexcept
 Evaluate the expression with N float arguments.
 
__host__ __device__ double operator() (GpuArray< double, N > const &var) const noexcept
 Evaluate the expression using an explicit array of inputs.
 
__host__ __device__ operator bool () const
 True when a compiled executor buffer is available.
 

Public Attributes

char * m_host_executor = nullptr
 Pointer to host-visible bytecode.
 
char * m_device_executor = nullptr
 Pointer to device-visible bytecode (if copied).
 

Detailed Description

template<int N>
struct amrex::ParserExecutor< N >

Callable wrapper around a compiled parser expression with N variables.

Instances are returned by Parser::compile() / Parser::compileHost() and may be invoked on host or device. Device execution is available only when AMREX_USE_GPU is enabled and a device executor buffer has been created.

Template Parameters
NNumber of variables referenced in the expression.

Member Function Documentation

◆ operator bool()

template<int N>
__host__ __device__ amrex::ParserExecutor< N >::operator bool ( ) const
inlineexplicit

True when a compiled executor buffer is available.

◆ operator()() [1/4]

template<int N>
template<int M = N, std::enable_if_t< M==0, int > = 0>
__host__ __device__ double amrex::ParserExecutor< N >::operator() ( ) const
inlinenoexcept

Evaluate the expression with no arguments.

Enabled only for constant expressions (N == 0).

Returns
Expression value as double precision.

◆ operator()() [2/4]

template<int N>
__host__ __device__ double amrex::ParserExecutor< N >::operator() ( GpuArray< double, N > const &  var) const
inlinenoexcept

Evaluate the expression using an explicit array of inputs.

Parameters
varArray storing the N variables in parser variable order.
Returns
Expression value promoted to double precision.

◆ operator()() [3/4]

template<int N>
template<typename... Ts>
__host__ __device__ std::enable_if_t< sizeof...(Ts)==N &&!amrex::Same< float, Ts... >::value, double > amrex::ParserExecutor< N >::operator() ( Ts...  var) const
inlinenoexcept

Evaluate the expression with N double-compatible arguments.

Parameters
varScalar arguments supplied in parser variable order.
Returns
Expression value promoted to double precision.

◆ operator()() [4/4]

template<int N>
template<typename... Ts>
__host__ __device__ std::enable_if_t< sizeof...(Ts)==N && amrex::Same< float, Ts... >::value, float > amrex::ParserExecutor< N >::operator() ( Ts...  var) const
inlinenoexcept

Evaluate the expression with N float arguments.

Returns a float when all inputs are float.

Parameters
varScalar arguments supplied in parser variable order.

Member Data Documentation

◆ m_device_executor

template<int N>
char* amrex::ParserExecutor< N >::m_device_executor = nullptr

Pointer to device-visible bytecode (if copied).

◆ m_host_executor

template<int N>
char* amrex::ParserExecutor< N >::m_host_executor = nullptr

Pointer to host-visible bytecode.


The documentation for this struct was generated from the following files: