PetscErrorCode SlepcEigenSolver<T>::_petsc_shell_matrix_mult(Mat mat, Vec arg, Vec dest) { /* Get the matrix context. */ int ierr=0; void* ctx; ierr = MatShellGetContext(mat,&ctx); CHKERRABORT(libMesh::COMM_WORLD,ierr); /* Get user shell matrix object. */ const ShellMatrix<T>& shell_matrix = *static_cast<const ShellMatrix<T>*>(ctx); /* Make \p NumericVector instances around the vectors. */ PetscVector<T> arg_global(arg); PetscVector<T> dest_global(dest); /* Call the user function. */ shell_matrix.vector_mult(dest_global,arg_global); return ierr; }
PetscErrorCode SlepcEigenSolver<T>::_petsc_shell_matrix_mult(Mat mat, Vec arg, Vec dest) { /* Get the matrix context. */ int ierr=0; void* ctx; ierr = MatShellGetContext(mat,&ctx); Parallel::communicator comm; PetscObjectGetComm((PetscObject)mat,&comm); CHKERRABORT(comm,ierr); /* Get user shell matrix object. */ const ShellMatrix<T>& shell_matrix = *static_cast<const ShellMatrix<T>*>(ctx); /* Make \p NumericVector instances around the vectors. */ PetscVector<T> arg_global(arg, shell_matrix.comm()); PetscVector<T> dest_global(dest, shell_matrix.comm()); /* Call the user function. */ shell_matrix.vector_mult(dest_global,arg_global); return ierr; }