<s> import mesh . patch as patch <EOL> import numpy <EOL> myg = patch . Grid2d ( <NUM_LIT:4> , <NUM_LIT:8> , ng = <NUM_LIT:1> ) <EOL> myd = patch . CellCenterData2d ( myg ) <EOL> bc = patch . BCObject ( ) <EOL> myd . register_var ( "<STR_LIT:a>" , bc ) <EOL> myd . create ( ) <EOL> a = myd . get_var ( "<STR_LIT:a>" ) <EOL> a . d [ myg . ilo : myg . ihi + <NUM_LIT:1> , myg . jlo : myg . jhi + <NUM_LIT:1> ] . flat = numpy . arange ( myg . nx * myg . ny ) <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> myd . pretty_print ( "<STR_LIT:a>" ) <EOL> print "<STR_LIT:U+0020>" <EOL> print "<STR_LIT>" <EOL> cg = patch . Grid2d ( <NUM_LIT:2> , <NUM_LIT:4> , ng = <NUM_LIT:1> ) <EOL> cd = patch . CellCenterData2d ( cg ) <EOL> cd . register_var ( "<STR_LIT:a>" , bc ) <EOL> cd . create ( ) <EOL> a_coarse = cd . get_var ( "<STR_LIT:a>" ) <EOL> a_coarse . d [ : , : ] = myd . restrict ( "<STR_LIT:a>" ) . d [ : , : ] <EOL> cd . pretty_print ( "<STR_LIT:a>" ) <EOL> print "<STR_LIT:U+0020>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> a_coarse . d [ : , : ] . flat = numpy . arange ( cg . qx * cg . qy ) <EOL> cd . pretty_print ( "<STR_LIT:a>" ) <EOL> print "<STR_LIT:U+0020>" <EOL> print "<STR_LIT>" <EOL> fg = patch . Grid2d ( <NUM_LIT:4> , <NUM_LIT:8> , ng = <NUM_LIT:1> ) <EOL> fd = patch . CellCenterData2d ( fg ) <EOL> fd . register_var ( "<STR_LIT:a>" , bc ) <EOL> fd . create ( ) <EOL> a_fine = fd . get_var ( "<STR_LIT:a>" ) <EOL> a_fine . d [ : , : ] = cd . prolong ( "<STR_LIT:a>" ) . d [ : , : ] <EOL> fd . pretty_print ( "<STR_LIT:a>" ) </s>
