sandbox/wmostert/multigrid-restore

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    
    /** 
    # 3D Multigrid restore with MPI
    
    This example produces a simple dump, using 3D multigrid and outputting a single scalar field, and then restores it. The bug is that the restore fails with the error "grid depth does not match."
    
    Files can be found *[here](dumper.c).
    
    */
    
    #include "grid/multigrid3D.h"
    #include "utils.h"
    /**
    The error is actually independent of level, which is different from what I thought initially. When I first encountered it, it seemed to occur only for refinement levels of 8 and higher.
    */
    #define LEVEL 7
    /** Define a single scalar field, although this isn't necessary for the bug to appear.*/
    scalar f[];
    
    int main()
    {
      /** Initialize the grid and set the scalar field.*/
      init_grid(1 << LEVEL);
      foreach()
        f[] = 1.0;
      /** Dump with a debug message.*/
      dump("test",{f});
      fprintf(ferr,"Dump complete.\n");
      return 1;
    }
    
    
    /** Now in a separate file we restore the dumped data:*/
    #include "grid/multigrid3D.h"
    #include "utils.h"
    
    #define LEVEL 7
    
    scalar f[];
    
    int main()
    {
      init_grid(1 << LEVEL);
      restore("test");
      return 1;
    }
    
    /**This produces the error.*/