📄 fillpatch.c
字号:
#include "redblack2d.h"void fillpatch(XArray1(Grid2(double))& U) { /* Get ghost cell values from all other grids. This is a doubly-nested loop: the outer for_all loop is a parallel loop which performs on every subgrid contained in Xarray U. The inner for() loop is a serial. It handles the copying from every other subgrid. Of course, LPARX doesn't perform a copy (or interprocessor communication) when there is no intersection. This is likely to occur frequently in localized computation, and so we can elimenate considerable overhead. The copy member function: X.copy(Y,Z) copies data from Y into X where region(X), region(Y), and Z intersect, where X and Y are grids and Z is a region. We intersect against a region (insie) to make sure that we copy only non-ghost cell data values into our ghost cell regions. This could also be accomplished by shrinking the region of U[i] by 1 and intersecting with this smaller region. For a static problem, intersecting each subgrid with every other subgrid incurs unnecessary overhead as compared to precomputing interaction lists and reusing the interaction lists. However, this overhead is minimal as compared to the cost of interprocessor communication. (For time-dependent applications, there is no reason to precompute interactions as dynamic problems provide little opportunity for schedule reuse.) */ for_all_1(i, U) Region2 inside = grow(U(i).region(), -1); for_1(j, U) U(j).copy(U(i), inside); end_for end_for_all }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -