diff --git a/fem/symbolicintegrator.cpp b/fem/symbolicintegrator.cpp index d3da20c26..1ac407e72 100644 --- a/fem/symbolicintegrator.cpp +++ b/fem/symbolicintegrator.cpp @@ -644,21 +644,31 @@ namespace ngfem return evaluator->DiffShape (const_cast(this)->shared_from_this(), dir); else if (var == this) return dir; - else + + if (auto proxyvar = dynamic_cast (var)) { - if (Dimension() == 1) - return make_shared(0); - else + // cout << "I am a proxy" << endl; + if (this == proxyvar->Deriv().get()) + return dynamic_pointer_cast (dir) -> Deriv(); + if (this == proxyvar->Trace().get()) { - auto zero1 = make_shared(0); - Array> zero_array(Dimension()); - for (auto & z : zero_array) - z = zero1; - auto zerovec = MakeVectorialCoefficientFunction(move(zero_array)); - zerovec->SetDimensions(Dimensions()); - return zerovec; + // cout << "I am the trace" << endl; + return dynamic_pointer_cast (dir) -> Trace(); } } + + if (Dimension() == 1) + return make_shared(0); + else + { + auto zero1 = make_shared(0); + Array> zero_array(Dimension()); + for (auto & z : zero_array) + z = zero1; + auto zerovec = MakeVectorialCoefficientFunction(move(zero_array)); + zerovec->SetDimensions(Dimensions()); + return zerovec; + } }