KmlMgSolverSetPreconditioner
Set the preconditioner.
Interface Definition
C interface:
KmlMgStatus KmlMgSolverSetPreconditioner(KmlMgSolverH solver, const KmlMgPreconditionerOptions* options);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
solver |
KmlMgSolverH |
Solver handle created by KmlMgSolverCreate |
Input/Output |
options |
const KmlMgPreconditionerOptions* |
Preconditioner configuration information, that is, multigrid configuration information |
Input |
Return Value
Return Value |
Type |
Description |
|---|---|---|
KML_MG_OK |
int |
The execution is successful. |
KML_MG_ERR_INVALID_PARAM |
int |
The parameter is invalid. |
KML_MG_ERR_UNSUPPORTED |
int |
Unsupported feature. |
KML_MG_ERR_NO_MEMORY |
int |
Memory allocation failed. |
KML_MG_ERR_EXCEEDS_LIMIT |
int |
The parameter is out of the valid range. |
KML_MG_ERR_INCOMPATIBLE |
int |
Incompatible version. |
KML_MG_ERR_NO_REQUIRED_FIELD |
int |
Required field not set. |
KML_MG_ERR_UNKNOWN_TYPE |
int |
Unknown type. |
KML_MG_ERR_THIRD_PART |
int |
Internal third-party call error. |
KML_MG_ERR_INCONSISTENT |
int |
Inconsistent information transferred. |
KML_MG_ERR_UNEXPECTED_CALL_ORDER |
int |
Unexpected call order. |
KML_MG_ERR_MATRIX_VALUE_IS_NULL |
int |
The matrix value is null. |
KML_MG_ERR_NO_RESOURCE |
int |
Resources not ready. |
Structure Descriptions
KmlMgPreconditionerOptions
Field |
Type |
Description |
|---|---|---|
fieldMask |
uint64_t |
Mask that determines to which fields the configuration is applied. If a bit is set to 1, its corresponding field uses a specified value. If a bit is set to 0, its corresponding field uses the default value. See the individual field description for configurable mask bits. |
indexType |
KmlMgIndexType |
Coordinate type. The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_INDEX_TYPE |
kspValueType |
KmlMgValueType |
Value type of the input matrix. (Currently, it must match that of the kspValueType field in KmlMgSolverOptions. The supported precision combinations are as follows.)
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_KSP_VALUE_TYPE |
valueType |
KmlMgValueType |
Value type of the preconditioner (multigrid). The options are as follows: (Currently, it must match that of the pcValueType field in KmlMgSolverOptions.)
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_VALUE_TYPE |
calcType |
KmlMgValueType |
Calculation value type of the preconditioner (multigrid). The options are as follows: (Currently, it must match that of the pcCalcType field in KmlMgSolverOptions.)
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_CALC_TYPE |
numLevels |
int64_t |
Number of multigrid levels Mask bit: KML_MG_PRECONDITIONER_OPTIONS_NUM_LEVEL |
shiftLevelId |
int64_t |
ID of a level at which mixed precision shifts to single precision. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_SHIFT_LEVEL |
cycle |
KmlMgCycleType |
The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_CYCLE_TYPE |
gridSweep |
void* |
Sweep array for multigrid. The type is specified by indexType and the length is 2. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_SWEEP |
xpss |
void* |
XPSS array (X-Process Shrink Strides), indicating the stride of process shrinkage in the X direction. The type is specified by indexType, and the length equals the numLevels value. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_XPSS |
smoother |
KmlMgSmootherType* |
Array of smoother types for each grid level. The length equals the numLevels value. The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_SMOOTHER |
weight |
void* |
Smoother weight. The type is specified by calcType, and the length equals the numLevels value. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_WEIGHT |
coarsen |
KmlMgCoarsenType* |
Grid coarsening method. The length equals the numLevels value. The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_COARSEN |
rest |
KmlMgRestInteType* |
Restriction operator. The length equals the numLevels value. The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_RESTRICT |
interp |
KmlMgRestInteType* |
Interpolation operator. The length equals the numLevels value. The options are as follows:
Mask bit: KML_MG_PRECONDITIONER_OPTIONS_PROLONG |
alpha |
void* |
Galerkin operator scaling coefficient. The type is specified by calcType, and the length equals the numLevels value. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_ALPHA |
control |
bool* |
Controls whether the stencil of the coarsened grid is consistent with that of the previous level. If the value is true, the stencil is consistent with that of the previous level. If the value is false, the stencil may expand. The length equals the numLevels value. Mask bit: KML_MG_PRECONDITIONER_OPTIONS_CONTROL |
Using unsupported parameters will cause the program to exit abnormally.