// Types type range Range2D; type partition PartRange2D [PartNP]; type mpartition MPartRange2D [PartNP]; type swap SwapRange2D [PartNP]; type data Int, Config, File; type data Vector2Dreal [PartRange2D, MPartRange2D]; // Init Data const PartRange2D cell[ALLn], cell2[ALLn], halom[ALLn], halo[ALLn], fullone[ALLn]; const MPartRange2D boundary[ALLn], border[ALLn]; const SwapRange2D sw_chm[PPEn], sw_ca[PPEn]; const Config cfg[ALL1], File fout[ALL1]; // Decomposition Rules part cell2 < cell < halom < halo; part boundary < halo; part border < cell; part halo = boundary + halom; part cell = cell2 + border; part sw_ca : cell -> fullone; part sw_chm : cell -> halom; // Declarations function ftcs_step (cfg, A, halo, cell -> B) Vector2Dreal A[halo], B[cell], Range2D cell, halo, Config cfg; function matrix_read (cfg, cell, halo -> A, B) Vector2Dreal A[cell], B[halo], Config cfg, Range2D cell, halo; function check_sym (A, ra) Vector2Dreal A[ra], Range2D ra; function econd (cfg, idx -> cond) Int idx, cond, Config cfg; // Parallel Computations function foo () [gen] { // initialization matrix_read (cfg, cell, halo -> A, BD); // main iteration, 2 steps loop ( idx, cond ; A [cell] -> C [cell] ) [clock:MAIN] { copy ( BD[boundary] -> A[boundary] ); copy ( BD[boundary] -> B[boundary] ); ftcs_step ( cfg, A[cell] -> B[cell2] ); ftcs_step ( cfg, A[halo] -> B[border] ); ftcs_step ( cfg, B[cell] -> C[cell2] ); ftcs_step ( cfg, B[halo] -> C[border] ); econd (cfg, idx -> cond); } print (fout, C[fullone]); check_sym (C[fullone]); }