message: Adding testing of standalone DoF transformation functions
diff: @@ -121,4 +121,97 @@ TEST_CASE("DoF Transformation Classes"
  }
  }
  +TEST_CASE("DoF Transformation Functions"
  + "TransformPrimal"
  + "TransformDual")
  +{
  + int p = 3, q = 4;
  + int seed = 123;
  +
  + double tol = 1e-13;
  +
  + ND_TetDofTransformation Tp(p);
  + ND_TetDofTransformation Tq(q);
  +
  + Array<int> ori(4);
  + ori[0] = 1;
  + ori[1] = 3;
  + ori[2] = 5;
  + ori[3] = 1;
  +
  + Tp.SetFaceOrientations(ori);
  + Tq.SetFaceOrientations(ori);
  +
  + DenseMatrix A(Tp.Width(), Tq.Width());
  + {
  + Vector Ac;
  + for (int i=0; i<A.Width(); i++)
  + {
  + A.GetColumnReference(i, Ac);
  + Ac.Randomize(seed+i);
  + }
  + }
  +
  + SECTION("TransformPrimal")
  + {
  + Vector v(Tq.Width());
  + Vector f(Tp.Width());
  + Vector vt;
  + Vector ft;
  +
  + v.Randomize(seed);
  + f.Randomize(seed+1);
  +
  + Tq.TransformPrimal(v, vt);
  + Tp.TransformDual(f, ft);
  +
  + DenseMatrix nAn;
  + DenseMatrix tA;
  + DenseMatrix At;
  + DenseMatrix tAt;
  +
  + TransformPrimal(NULL, NULL, A, nAn);
  + TransformPrimal(NULL, &Tq, A, At);
  + TransformPrimal( &Tp, NULL, A, tA);
  + TransformPrimal( &Tp, &Tq, A, tAt);
  +
  + double fAv = A.InnerProduct(v, f);
  +
  + REQUIRE(fabs(fAv - nAn.InnerProduct(v , f )) < tol * fabs(fAv));
  + REQUIRE(fabs(fAv - At.InnerProduct(vt, f )) < tol * fabs(fAv));
  + REQUIRE(fabs(fAv - tA.InnerProduct(v , ft)) < tol * fabs(fAv));
  + REQUIRE(fabs(fAv - tAt.InnerProduct(vt, ft)) < tol * fabs(fAv));
  + }
  + SECTION("TransformDual")
  + {
  +
  + Vector u(Tp.Width());
  + Vector v(Tq.Width());
  + Vector ut;
  + Vector vt;
  +
  + u.Randomize(seed);
  + v.Randomize(seed+1);
  +
  + Tp.TransformPrimal(u, ut);
  + Tq.TransformPrimal(v, vt);
  +
  + DenseMatrix nAn;
  + DenseMatrix tA;
  + DenseMatrix At;
  + DenseMatrix tAt;
  +
  + TransformDual(NULL, NULL, A, nAn);
  + TransformDual(NULL, &Tq, A, At);
  + TransformDual( &Tp, NULL, A, tA);
  + TransformDual( &Tp, &Tq, A, tAt);
  +
  + double uAv = A.InnerProduct(v, u);
  +
  + REQUIRE(fabs(uAv - nAn.InnerProduct(v , u )) < tol * fabs(uAv));
  + REQUIRE(fabs(uAv - At.InnerProduct(vt, u )) < tol * fabs(uAv));
  + REQUIRE(fabs(uAv - tA.InnerProduct(v , ut)) < tol * fabs(uAv));
  + REQUIRE(fabs(uAv - tAt.InnerProduct(vt, ut)) < tol * fabs(uAv));
  + }
  +}
  } // namespace doftrans
  