initdata.c

来自「LPARX is a C++ class library for for imp」· C语言 代码 · 共 33 行

C
33
字号
#include "redblack2d.h"//// Initialize the boundary region with random data and// the interior with zero//void initData(XArray1(Grid2(double))& solution)  {   /*     The for_all_1 loop is a parallel loop which executes iteration     i on the processor which owns the ith element of an XArray.     There is an implicit barrier synchronization at the end of the     for_all loop. This can be overridden by the macro      end_for_all_no_sync.  This form must be used carefully.  Note     that the for_all loop implicitly extracts the bounding box      of the last argument (the XArray).     The for_2 loop is a serial loop, which also implicitly extracts     the bounding box of the last argument.   */   for_all_1(i, solution)      for_2(j, k, solution(i))         solution(i)(j,k) = drand48();      end_for      Region2 inside = grow(solution(i).region(), -1);      for_2(j, k, inside);         solution(i)(j,k) = 0.0;      end_for   end_for_all  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?