Actual source code: ex227.c
1: static char help[] = "Test MatNullSpaceTest() with options prefixes.\n\n";
3: #include <petscmat.h>
5: int main(int argc, char **argv)
6: {
7: Mat mat;
8: MatNullSpace nsp;
9: PetscBool prefix = PETSC_FALSE, flg;
10: PetscInt zero = 0;
11: PetscScalar value = 0;
12: PetscInitialize(&argc, &argv, NULL, help);
14: PetscOptionsGetBool(NULL, NULL, "-with_prefix",&prefix,NULL);
15: MatCreateDense(PETSC_COMM_WORLD, 1, 1, 1, 1, NULL, &mat);
16: MatSetOptionsPrefix(mat, prefix ? "prefix_" : NULL);
17: MatSetUp(mat);
18: MatSetValues(mat, 1, &zero, 1, &zero, &value, INSERT_VALUES);
19: MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);
20: MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);
21: MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, NULL, &nsp);
22: MatNullSpaceTest(nsp, mat, &flg);
24: MatNullSpaceDestroy(&nsp);
25: MatDestroy(&mat);
26: PetscFinalize();
27: return 0;
28: }
30: /*TEST
32: test:
33: suffix: no_prefix
34: output_file: output/ex227_no_prefix.out
35: args: -mat_null_space_test_view -mat_view
37: test:
38: suffix: prefix
39: output_file: output/ex227_prefix.out
40: args: -prefix_mat_null_space_test_view -with_prefix -prefix_mat_view
42: TEST*/