Research Article

Finite Element Assembly Using an Embedded Domain Specific Language

Listing 12

Loop over nodes, setting a temperature field.
()  // Terminal that refers to the temperature
()  FieldVariable<0, ScalarField> T("T", "temperature_field");
()  // Create a new action, as a child component of parent
()  Handle<ProtoAction> action = parent.create_component<ProtoAction>("Action");
()  // Set an expression to loop over nodes
()  action->set_expression(nodes_expression(T = 288.));
()  // Execute the action
()  action->execute();