Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KSPSolveTranspose for PETSc #256

Merged
merged 4 commits into from
Feb 25, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions plugin/mpi/PETSc-code.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3407,6 +3407,10 @@ namespace PETSc {
: OneOperator(atype< long >( ), atype< Type* >( ), atype< Type* >( ),
atype< Type* >( )),
c(4) {}
LinearSolver(int, int, int, int, int)
: OneOperator(atype< long >( ), atype< Type* >( ), atype< KN< PetscScalar >* >( ),
atype< KN< PetscScalar >* >( )),
c(5) {}
};
template< class Type >
basicAC_F0::name_and_type LinearSolver< Type >::E_LinearSolver::name_param[] = {
Expand Down Expand Up @@ -3450,11 +3454,11 @@ namespace PETSc {
VecPlaceArray(y, *out);
PetscInt N, rbegin;
PetscScalar* tmpIn, *tmpOut;
if (c != 3)
if (c != 3 && c != 5)
KSPSolve(ptA->_ksp, x, y);
else {
ffassert(in != out);
VecConjugate(x);
if (c != 5) VecConjugate(x);
KSPSolveTranspose(ptA->_ksp, x, y);
VecConjugate(y);
cmd8 marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down Expand Up @@ -5001,6 +5005,7 @@ namespace PETSc {
if (!std::is_same< PetscScalar, PetscReal >::value)
Global.Add("KSPSolveHermitianTranspose", "(", new PETSc::LinearSolver< Dmat >(1, 1, 1));
Global.Add("KSPSolve", "(", new PETSc::LinearSolver< Dmat >(1, 1, 1, 1));
Global.Add("KSPSolveTranspose", "(", new PETSc::LinearSolver< Dmat >(1, 1, 1, 1, 1));
Global.Add("KSPGetConvergedReason", "(", new OneOperator1_< long, Dmat* >(PETSc::GetConvergedReason< Dmat >));
Global.Add("KSPGetIterationNumber", "(", new OneOperator1_< long, Dmat* >(PETSc::GetIterationNumber< Dmat >));
Global.Add("KSPSetResidualHistory", "(", new OneOperator2_< long, Dmat*, KN< double >* >(PETSc::SetResidualHistory< Dmat >));
Expand Down