I have a solution, far from ideal, but it gets the job done. Please fetch Adds buildMatEdgeRecursiveWithPartitioning. · FreeFem/FreeFem-sources@57d5ad4 · GitHub.
Then, the following code works and always returns a volume of 1.
diff --git a/examples/hpddm/maxwell-mg-3d-PETSc-complex.edp b/examples/hpddm/maxwell-mg-3d-PETSc-complex.edp
index a70f15b8..c1a872ba 100644
--- a/examples/hpddm/maxwell-mg-3d-PETSc-complex.edp
+++ b/examples/hpddm/maxwell-mg-3d-PETSc-complex.edp
@@ -28,3 +28,25 @@ func Pk = Edge03d;
func PkPart = Edge03ds0;
-buildMatEdgeRecursive(Th, s, level, P, MG, Pk, mpiCommWorld, PkPart, defPart, initPart);
+fespace PhFine(Th[0], P0);
+PhFine partFine;
+{
+ fespace PhCoarse(Th[level - 1], P0);
+ PhCoarse part;
+ partitionerSeq(part[], Th[level - 1], mpisize);
+ partitionerPar(part[], Th[level - 1], mpiCommSelf, mpisize);
+ buildMatEdgeRecursiveWithPartitioning(Th, part[], s, level, P, MG, Pk, mpiCommWorld, PkPart, defPart, initPart);
+ part = part;
+ partFine = part;
+}
+
+{
+ // volume of a unit cube
+ mesh3 ThNo = trunc(Th[0], abs(partFine-mpirank) < 1e-2);
+ fespace VhP1(ThNo, P1);
+ VhP1 volint = 1.0;
+ real val = int3d(ThNo)(volint);
+ real valG;
+ mpiAllReduce(val, valG, mpiCommWorld, mpiSUM);
+ if(mpirank==0)
+ cout << "valG = " << valG << endl;
+}
The idea is to let you store the partitioning, so that you can get a nonoverlapping decomposition on the fine level, so that you can integrate properly any variable without duplicated unknowns. Let me know if something is not clear to you.