message: adding DofTransformation objects to NonlinearForm Mult, GetGridFunctionEnergy, and GetGradient methods similar to those used in BilinearForm::Assemble and LinearForm::Assemble
diff: @@ -96,6 +96,8 @@ double NonlinearForm::GetGridFunctionEnergy(const Vector &x) const
  Vector el_x;
  const FiniteElement *fe;
  ElementTransformation *T;
  + DofTransformation *doftrans;
  +
  double energy = 0.0;
  if (dnfi.Size())
  @@ -103,9 +105,10 @@ double NonlinearForm::GetGridFunctionEnergy(const Vector &x) const
  for (int i = 0; i < fes->GetNE(); i++)
  {
  fe = fes->GetFE(i);
  - fes->GetElementVDofs(i, vdofs);
  + doftrans = fes->GetElementVDofs(i, vdofs);
  T = fes->GetElementTransformation(i);
  x.GetSubVector(vdofs, el_x);
  + if (doftrans) {doftrans->InvTransformPrimal(el_x); }
  for (int k = 0; k < dnfi.Size(); k++)
  {
  energy += dnfi[k]->GetElementEnergy(*fe, *T, el_x);
  @@ -166,6 +169,7 @@ void NonlinearForm::Mult(const Vector &x, Vector &y) const
  Vector el_x, el_y;
  const FiniteElement *fe;
  ElementTransformation *T;
  + DofTransformation *doftrans;
  Mesh *mesh = fes->GetMesh();
  py = 0.0;
  @@ -175,12 +179,14 @@ void NonlinearForm::Mult(const Vector &x, Vector &y) const
  for (int i = 0; i < fes->GetNE(); i++)
  {
  fe = fes->GetFE(i);
  - fes->GetElementVDofs(i, vdofs);
  + doftrans = fes->GetElementVDofs(i, vdofs);
  T = fes->GetElementTransformation(i);
  px.GetSubVector(vdofs, el_x);
  + if (doftrans) {doftrans->InvTransformPrimal(el_x); }
  for (int k = 0; k < dnfi.Size(); k++)
  {
  dnfi[k]->AssembleElementVector(*fe, *T, el_x, el_y);
  + if (doftrans) {doftrans->TransformDual(el_y); }
  py.AddElementVector(vdofs, el_y);
  }
  }
  @@ -302,6 +308,7 @@ Operator &NonlinearForm::GetGradient(const Vector &x) const
  DenseMatrix elmat;
  const FiniteElement *fe;
  ElementTransformation *T;
  + DofTransformation *doftrans;
  Mesh *mesh = fes->GetMesh();
  const Vector &px = Prolongate(x);
  @@ -319,12 +326,14 @@ Operator &NonlinearForm::GetGradient(const Vector &x) const
  for (int i = 0; i < fes->GetNE(); i++)
  {
  fe = fes->GetFE(i);
  - fes->GetElementVDofs(i, vdofs);
  + doftrans = fes->GetElementVDofs(i, vdofs);
  T = fes->GetElementTransformation(i);
  px.GetSubVector(vdofs, el_x);
  + if (doftrans) {doftrans->InvTransformPrimal(el_x); }
  for (int k = 0; k < dnfi.Size(); k++)
  {
  dnfi[k]->AssembleElementGrad(*fe, *T, el_x, elmat);
  + if (doftrans) { doftrans->TransformDual(elmat); }
  Grad->AddSubMatrix(vdofs, vdofs, elmat, skip_zeros);
  // Grad->AddSubMatrix(vdofs, vdofs, elmat, 1);
  }
  