message: Adding unit tests for H(curl) and H(div) diagonal partial assembly.
diff: @@ -197,4 +197,83 @@ TEST_CASE("Vector Diffusion Diagonal PA",
  }
  }
  +TEST_CASE("Hcurl/Hdiv diagonal PA")
  +{
  + for (int dimension = 2; dimension < 4; ++dimension)
  + {
  + for (int spaceType = 0; spaceType < 2; ++spaceType)
  + for (int integrator = 0; integrator < 2; ++integrator)
  + {
  + for (int ne = 1; ne < 3; ++ne)
  + {
  + if (spaceType == 0)
  + std::cout << "Testing " << dimension <<
  + "D partial assembly H(curl) diagonal for integrator " << integrator << ": "
  + << std::pow(ne, dimension) << " elements." << std::endl;
  + else
  + std::cout << "Testing " << dimension <<
  + "D partial assembly H(div) diagonal for integrator " << integrator << ": "
  + << std::pow(ne, dimension) << " elements." << std::endl;
  +
  + for (int order = 1; order < 4; ++order)
  + {
  + Mesh * mesh;
  + if (dimension == 2)
  + {
  + mesh = new Mesh(ne, ne, Element::QUADRILATERAL, 1, 1.0, 1.0);
  + }
  + else
  + {
  + mesh = new Mesh(ne, ne, ne, Element::HEXAHEDRON, 1, 1.0, 1.0, 1.0);
  + }
  +
  + FiniteElementCollection* fec = (spaceType == 0) ?
  + (FiniteElementCollection*) new ND_FECollection(order, dimension) :
  + (FiniteElementCollection*) new RT_FECollection(order, dimension);
  +
  + FiniteElementSpace fespace(mesh, fec);
  + BilinearForm paform(&fespace);
  + BilinearForm faform(&fespace);
  + ConstantCoefficient one(1.0);
  + paform.SetAssemblyLevel(AssemblyLevel::PARTIAL);
  + if (integrator == 0)
  + {
  + paform.AddDomainIntegrator(new VectorFEMassIntegrator(one));
  + faform.AddDomainIntegrator(new VectorFEMassIntegrator(one));
  + }
  + else
  + {
  + if (spaceType == 0)
  + {
  + paform.AddDomainIntegrator(new CurlCurlIntegrator(one));
  + faform.AddDomainIntegrator(new CurlCurlIntegrator(one));
  + }
  + else
  + {
  + paform.AddDomainIntegrator(new DivDivIntegrator(one));
  + faform.AddDomainIntegrator(new DivDivIntegrator(one));
  + }
  + }
  + paform.Assemble();
  + Vector pa_diag(fespace.GetVSize());
  + paform.AssembleDiagonal(pa_diag);
  +
  + faform.Assemble();
  + faform.Finalize();
  + Vector assembly_diag(fespace.GetVSize());
  + faform.SpMat().GetDiag(assembly_diag);
  +
  + assembly_diag -= pa_diag;
  + double error = assembly_diag.Norml2();
  + std::cout << " order: " << order << ", error norm: " << error << std::endl;
  + REQUIRE(assembly_diag.Norml2() < 1.e-12);
  +
  + delete mesh;
  + delete fec;
  + }
  + }
  + }
  + }
  +}
  +
  } // namespace assemblediagonalpa
  