//  run with MPI:  ff-mpirun -np 4 script.edp
// NBPROC 4

load "PETSc"

int[int] n2oSaved;
int[int] n2oLoaded;
{
    macro dimension()3//
    include "macro_ddm.idp"
    mesh3 Th = cube(getARGV("-global", 10), getARGV("-global", 10), getARGV("-global", 10), [x, y, z]);
    Mat A;
    macro ThN2O()n2oSaved//
    MatCreate(Th, A, P1);
    DmeshSave(Th, "dump-3d");
}
{
    include "macro_ddm.idp"
    mesh Th = square(40, 40);
    Mat A;
    MatCreate(Th, A, P1);
    DmeshSave(Th, "dump-2d");
}
{
    macro dimension()3//
    include "macro_ddm.idp"
    mesh3 Th;
    Mat A;
    macro ThN2O()n2oLoaded//
    DmeshLoad(Th, "dump-3d");
    MatCreate(Th, A, P2);
}
{
    include "macro_ddm.idp"
    mesh Th;
    Mat A;
    DmeshLoad(Th, "dump-2d");
    MatCreate(Th, A, P0);
}
if(mpisize > 1) {
    n2oLoaded -= n2oSaved;
    assert(n2oLoaded.linfty < 1.0e-12);
}
