Skip to content

Commit

Permalink
Use inherited hypre variables for solve
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Jan 22, 2024
1 parent 170dfad commit 7528d62
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions grid/src/Cabana_Grid_HypreStructuredSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ class HypreStructuredSolver
checkHypreError( error );

// Solve the problem
this->solveImpl( _A, _b, _x );
this->solveImpl();

// Extract the solution from the LHS
error = HYPRE_StructVectorGetBoxValues(
Expand Down Expand Up @@ -451,8 +451,7 @@ class HypreStructuredSolver
virtual void setupImpl() = 0;

//! Solver implementation.
virtual void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) = 0;
virtual void solveImpl() = 0;

//! Get the number of iterations taken on the last solve.
virtual int getNumIterImpl() = 0;
Expand Down Expand Up @@ -587,10 +586,9 @@ class HypreStructPCG
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructPCGSolve( _solver, A, b, x );
auto error = HYPRE_StructPCGSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -713,10 +711,9 @@ class HypreStructGMRES
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructGMRESSolve( _solver, A, b, x );
auto error = HYPRE_StructGMRESSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -832,10 +829,9 @@ class HypreStructBiCGSTAB
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructBiCGSTABSolve( _solver, A, b, x );
auto error = HYPRE_StructBiCGSTABSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -1022,10 +1018,9 @@ class HypreStructPFMG
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructPFMGSolve( _solver, A, b, x );
auto error = HYPRE_StructPFMGSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -1154,10 +1149,9 @@ class HypreStructSMG
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructSMGSolve( _solver, A, b, x );
auto error = HYPRE_StructSMGSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -1254,10 +1248,9 @@ class HypreStructJacobi
this->checkHypreError( error );
}

void solveImpl( HYPRE_StructMatrix A, HYPRE_StructVector b,
HYPRE_StructVector x ) override
void solveImpl() override
{
auto error = HYPRE_StructJacobiSolve( _solver, A, b, x );
auto error = HYPRE_StructJacobiSolve( _solver, _A, _b, _x );
this->checkHypreError( error );
}

Expand Down Expand Up @@ -1347,8 +1340,7 @@ class HypreStructDiagonal
"Diagonal preconditioner cannot be used as a solver" );
}

void solveImpl( HYPRE_StructMatrix, HYPRE_StructVector,
HYPRE_StructVector ) override
void solveImpl() override
{
throw std::logic_error(
"Diagonal preconditioner cannot be used as a solver" );
Expand Down

0 comments on commit 7528d62

Please sign in to comment.