FreePOOMA  2.4.1
Static Public Member Functions
KernelEvaluator< InlineKernelTag > Struct Template Reference

The point of this class is to input an expression with the 'evaluate' member function and evaluate it by looping over the whole domain. More...

#include <InlineEvaluator.h>

List of all members.

Static Public Member Functions

template<class LHS , class Op , class RHS , class Domain >
static POOMA_ATTRIBUTE_LEAFIFY void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain)
 Evaluate an expression on a given domain.
template<class LHS , class Op , class RHS >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs)
 Input an expression and cause it to be evaluated.
evaluate(expression,domain,domain_dimension)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 1 >)
 This is the function both of the above functions call.
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 2 >)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 3 >)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 4 >)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 5 >)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 6 >)
template<class LHS , class Op , class RHS , class Domain >
static void evaluate (const LHS &lhs, const Op &op, const RHS &rhs, const Domain &domain, WrappedInt< 7 >)

Detailed Description

template<>
struct KernelEvaluator< InlineKernelTag >

The point of this class is to input an expression with the 'evaluate' member function and evaluate it by looping over the whole domain.

This is the simplest possible evaluator. It makes a number of simplifying assumptions about the expressions it tries to evaluate and the context in which they are evaluated. These assumptions let it do some things very efficiently, but limit the contexts in which it can be used.

These assumptions are:

  1. There are no where blocks. That means that the InlineEvaluator does not need to have any state.
  2. The expression passed in can handle random access to all of its elements efficiently. That basically means that it can only be used with BrickEngine or its equivalent.

Member Function Documentation

template<class LHS , class Op , class RHS , class Domain >
static POOMA_ATTRIBUTE_LEAFIFY void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain 
) [inline, static]

Evaluate an expression on a given domain.

This function must be specialized for particular domain types. The expectation is that it will just loop over the domain and use random access in the expression to evaluate it.

References CTAssert, PAssert, and POOMA_INCREMENT_STATISTIC.

template<class LHS , class Op , class RHS >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs 
) [inline, static]

Input an expression and cause it to be evaluated.

All this template function does is extract the domain from the expression and call evaluate on that.

template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 1 >   
) [inline, static]

This is the function both of the above functions call.

It adds a third argument which is a tag class templated on the dimension of the domain.

This parameter lets us specialize the function based on that dimension.

Some day, we will figure out how to specialize template member functions outside the class declaration...

These functions are all inline for efficiency. That means that if they are being used at the user level we will get the optimization of recognizing multiple uses of a single Array on the right hand side.

There are seven specializations here, for dimension 1 through 7. Rather than use template metaprograms for these seven cases we simply enumerate them explicitly. This is done to reduce the burden on the compiler, which would otherwise have to jump through a bunch of hoops to get the code that is here.

For each of the specializations it builds a nested loop for each dimension. Each loop is constructed with last() from the appropriate dimension of the zero-based domain.

NOTE: These loops assume that the domain passed in is a unit-stride domain starting at 0. Assertions are made to make sure this is true in the dispatching evaluate above.

template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 2 >   
) [inline, static]
template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 3 >   
) [inline, static]
template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 4 >   
) [inline, static]
template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 5 >   
) [inline, static]
template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 6 >   
) [inline, static]
template<class LHS , class Op , class RHS , class Domain >
static void KernelEvaluator< InlineKernelTag >::evaluate ( const LHS &  lhs,
const Op &  op,
const RHS &  rhs,
const Domain domain,
WrappedInt< 7 >   
) [inline, static]

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