Skip to content

Commit

Permalink
directional derivative of grad(u) by u in direction v gives grad(v)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSchoeberl committed Dec 17, 2019
1 parent 247ee39 commit 3e36848
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions fem/symbolicintegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,21 +644,31 @@ namespace ngfem
return evaluator->DiffShape (const_cast<ProxyFunction*>(this)->shared_from_this(), dir);
else if (var == this)
return dir;
else

if (auto proxyvar = dynamic_cast<const ProxyFunction*> (var))
{
if (Dimension() == 1)
return make_shared<ConstantCoefficientFunction>(0);
else
// cout << "I am a proxy" << endl;
if (this == proxyvar->Deriv().get())
return dynamic_pointer_cast<ProxyFunction> (dir) -> Deriv();
if (this == proxyvar->Trace().get())
{
auto zero1 = make_shared<ConstantCoefficientFunction>(0);
Array<shared_ptr<CoefficientFunction>> 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<ProxyFunction> (dir) -> Trace();
}
}

if (Dimension() == 1)
return make_shared<ConstantCoefficientFunction>(0);
else
{
auto zero1 = make_shared<ConstantCoefficientFunction>(0);
Array<shared_ptr<CoefficientFunction>> zero_array(Dimension());
for (auto & z : zero_array)
z = zero1;
auto zerovec = MakeVectorialCoefficientFunction(move(zero_array));
zerovec->SetDimensions(Dimensions());
return zerovec;
}
}


Expand Down

0 comments on commit 3e36848

Please sign in to comment.