KmlIssPcStructilu0Setup
分析并分解矩阵,计算ilu0预条件;创建并返回求解器句柄。
接口定义
C Interface:
int KmlIssPcStructilu0Setup(KmlIssPsStructilu0Handle *gSmoother, float *v, const int *xl, const int *xr, const int *yl, const int *yr, const int *zl, const int *zr);
参数
参数名 |
类型 |
描述 |
输入/输出 |
|---|---|---|---|
gSmoother |
KmlIssPsStructilu0Handle * |
求解器句柄。 |
输出 |
v |
float * |
待求解的19对角矩阵v,使用(l,k,i,j)格式数组存储;其中,l=1:19为对角线元素,k,i,j为空间位置。 |
输入 |
xl |
const int * |
求解空间x方向起始位置。 |
输入 |
xr |
const int * |
求解空间x方向结束位置。 |
输入 |
yl |
const int * |
求解空间y方向起始位置。 |
输入 |
yr |
const int * |
求解空间y方向结束位置。 |
输入 |
zl |
const int * |
求解空间z方向起始位置。 |
输入 |
zr |
const int * |
求解空间z方向结束位置。 |
输入 |
返回值
返回值 |
类型 |
描述 |
|---|---|---|
KMLSS_NO_ERROR |
int |
正常执行。 |
KMLSS_NULL_ARGUMENT |
int |
输入中存在空指针。 |
KMLSS_BAD_DATA |
int |
求解空间相关参数为无效参数。 |
依赖
#include "kml_struct_ilu.h"
示例
C Interface:
int xl = 5;
int yl = 5;
int zl = 5;
int xr = 6;
int yr = 6;
int zr = 6;
int ybegin = 5;
int yend = 6;
int zbegin = 5;
int zend = 6;
float *v = (float*)malloc(sizeof(float) * 171);
float *b = (float*)malloc(sizeof(float) * 9);
for (int i=0; i<171; i++) {
v[i] = rand();
}
for (int i=0; i<9; i++) {
b[i] = rand();
}
KmlIssPsStructilu0Handle gSmoother;
KmlIssPcStructilu0Setup(&gSmoother, v, &xl, &xr, &yl, &yr, &zl, &zr);
父主题: PRECOND