Research Article

Finite Element Assembly Using an Embedded Domain Specific Language

Listing 4

Functor to evaluate the shape functions.
()  struct eval_shape_func: proto::callable
()  {
()   // C++ result_of declaration
()   template<typename Signature>
()   struct result;
()  
()   // C++ result_of implementation
()   template<class ThisT, typename DataT>
()   struct result<ThisT(DataT)>
() {
()   typedef const typename
()    boost::remove_reference<DataT>::type::element_t::shape_func_t& type;
() };
()  
() template<typename DataT>
() const typename DataT::element_t::shape_func_t& operator()(DataT& data) const
() {
()   // Return a reference to the result, stored in data
()   return data.shape_func;
() }
()  };