Actual source code: clique.cxx
1: #include <../src/mat/impls/aij/mpi/clique/matcliqueimpl.h>
3: /*
4: MatConvertToSparseElemental: Convert Petsc aij matrix to sparse elemental matrix
6: input:
7: + A - matrix in seqaij or mpiaij format
8: - reuse - denotes if the destination matrix is to be created or reused.
9: Use MAT_INPLACE_MATRIX for inplace conversion, otherwise use MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX.
11: output:
12: . cliq - Clique context
13: */
14: PetscErrorCode MatConvertToSparseElemental(Mat, MatReuse, Mat_SparseElemental *)
15: {
16: PetscFunctionBegin;
17: PetscFunctionReturn(PETSC_SUCCESS);
18: }
20: PetscErrorCode MatView_SparseElemental(Mat A, PetscViewer viewer)
21: {
22: PetscBool iascii;
24: PetscFunctionBegin;
25: PetscCall(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERASCII, &iascii));
26: if (iascii) {
27: PetscViewerFormat format;
28: PetscCall(PetscViewerGetFormat(viewer, &format));
29: if (format == PETSC_VIEWER_ASCII_INFO) {
30: PetscCall(PetscViewerASCIIPrintf(viewer, "SparseElemental run parameters:\n"));
31: } else if (format == PETSC_VIEWER_DEFAULT) { /* matrix A is factored matrix, remove this block */
32: Mat Aaij;
33: PetscCall(PetscViewerASCIIUseTabs(viewer, PETSC_FALSE));
34: PetscCall(PetscViewerASCIIUseTabs(viewer, PETSC_TRUE));
35: PetscCall(PetscPrintf(PetscObjectComm((PetscObject)viewer), "SparseElemental matrix\n"));
36: PetscCall(MatComputeOperator(A, MATAIJ, &Aaij));
37: PetscCall(MatView(Aaij, viewer));
38: PetscCall(MatDestroy(&Aaij));
39: }
40: }
41: PetscFunctionReturn(PETSC_SUCCESS);
42: }
44: PetscErrorCode MatDestroy_SparseElemental(Mat A)
45: {
46: PetscFunctionBegin;
47: PetscCall(PetscObjectComposeFunction((PetscObject)A, "MatFactorGetSolverType_C", nullptr));
48: PetscFunctionReturn(PETSC_SUCCESS);
49: }
51: PetscErrorCode MatSolve_SparseElemental(Mat, Vec, Vec)
52: {
53: PetscFunctionBegin;
54: PetscFunctionReturn(PETSC_SUCCESS);
55: }
57: PetscErrorCode MatCholeskyFactorNumeric_SparseElemental(Mat, Mat, const MatFactorInfo *)
58: {
59: PetscFunctionBegin;
60: PetscFunctionReturn(PETSC_SUCCESS);
61: }
63: PetscErrorCode MatCholeskyFactorSymbolic_SparseElemental(Mat, Mat, IS, const MatFactorInfo *)
64: {
65: PetscFunctionBegin;
66: PetscFunctionReturn(PETSC_SUCCESS);
67: }
69: /*MC
70: MATSOLVERSPARSEELEMENTAL - A solver package providing direct solvers for sparse distributed
71: and sequential matrices via the external package Elemental
73: Use ./configure --download-elemental to have PETSc installed with Elemental
75: Use -pc_type lu -pc_factor_mat_solver_type sparseelemental to use this direct solver
77: This is currently not supported.
79: Developer Note:
80: Jed Brown made the interface for Clique when it was a standalone package. Later Jack Poulson merged and refactored Clique into
81: Elemental but since the Clique interface was not tested in PETSc the interface was not updated for the new Elemental interface. Later Barry Smith updated
82: all the boilerplate for the Clique interface to SparseElemental but since the solver interface changed dramatically he did not update the code
83: that actually calls the SparseElemental solvers. We are waiting on someone who has a need to complete the SparseElemental interface from PETSc.
85: Level: beginner
87: .seealso: [](ch_matrices), `Mat`, `PCFactorSetMatSolverType()`, `MatSolverType`
88: M*/
90: PetscErrorCode MatFactorGetSolverType_SparseElemental(Mat, MatSolverType *type)
91: {
92: PetscFunctionBegin;
93: *type = MATSOLVERSPARSEELEMENTAL;
94: PetscFunctionReturn(PETSC_SUCCESS);
95: }
97: static PetscErrorCode MatGetFactor_aij_sparseelemental(Mat, MatFactorType, Mat *)
98: {
99: PetscFunctionBegin;
100: PetscFunctionReturn(PETSC_SUCCESS);
101: }
103: PETSC_EXTERN PetscErrorCode MatSolverTypeRegister_SparseElemental(void)
104: {
105: PetscFunctionBegin;
106: PetscCall(MatSolverTypeRegister(MATSOLVERSPARSEELEMENTAL, MATMPIAIJ, MAT_FACTOR_LU, MatGetFactor_aij_sparseelemental));
107: PetscFunctionReturn(PETSC_SUCCESS);
108: }