Research Article
Finite Element Assembly Using an Embedded Domain Specific Language
Listing 3
Grammar capable of parsing a simple expression for interpolating coordinates using a shape function.
() struct fem_grammar: | () // Match the following rules in order: | () proto::or_ | () < | () // Evaluate shape functions using the eval_shape_func transform | () proto::when | () < | () proto::terminal<shape_func_tag>, | () eval_shape_func(proto::_data) | () >, | (1) // Evaluate transpose expressions using eval_transpose | (2) proto::when | (3) < | (4) proto::function<proto::terminal<transpose_tag>, fem_grammar >, | (5) eval_transpose(fem_grammar(proto::_child1)) | (6) >, | (7) // Evaluate element_quadrature using eval_element_quadrature | (8) proto::when | (9) < | () proto::function< proto::terminal<element_quadrature_tag>, proto::plus_assign<proto:: | terminal<Eigen::MatrixXd>, fem_grammar> >, | () eval_element_quadrature(proto::_value(proto::_left(proto::_child1)), | proto::_right(proto::_child1), proto::_data) | () >, | () // On any other expression: perform the default C++ action | () proto::_default<fem_grammar> | () > | () { | () }; |
|