Closed vincentchabannes closed 3 years ago
In the assembly of stabilization term with generic toolbox, there is a lot of case, and it's quite heavy to implement and the compilation times increase tremulously. In order to facilitate the implementation, I defined a new kind of expression called exprOptionalConcat
(for now ). I write this kind of code (it's still more complex in my case):
auto myexpr1 = expr( expr<2,1>( "{1,2}" ) );
auto myexpr2 = expr( "3" );
using expr_convection_test_type = std::decay_t<decltype( grad(u)*myexpr1 )>;
using expr_reaction_test_type = std::decay_t<decltype( myexpr2*id(u) )>;
using expr_diffusion_test_type = std::decay_t<decltype( myexpr2*laplacian(u) )>;
auto the_stab_test = exprOptionalConcat<expr_convection_test_type,expr_reaction_test_type,expr_diffusion_test_type>();
if ( hasConvection )
the_stab_test.expression().template set<0>( grad(u)*myexpr1 );
if ( hasRection )
the_stab_test.expression().template set<1>( myexpr2*id(u) );
if ( hasDiffusion)
the_stab_test.expression().template set<2>( myexpr2*laplacian(u) );
form1(_test=Vh ) +=
integrate(_range=elements(mesh),_expr=the_stab_test);
The issue is the expression nammed the_stab_test
contains has the context (for the test function) of all subexpr, and I want to have only the context really used.
It's enough understandable @prudhomm ?
Some kind of expression that includes test/trial function does not have a context define at compilation time (this is the case with the new expr called exprOptionalConcat). The dynamic context has been implemented in GeoMap but not in PolynomialSet::Context. To optimize the time assembly, t's necessary to have this feature.