Skip to content

Commit

Permalink
Correcting Spelling Error
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas02 committed Dec 18, 2024
1 parent 1a5a3ce commit 6d3f474
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/LinearSolvers/LinearSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export GMGLinearSolver
export BlockDiagonalSmoother
export SchurComplementSolver
export SchwarzLinearSolver
export RichadsonLinearSolver
export RichardsonLinearSolver

export CallbackSolver

Expand Down
34 changes: 17 additions & 17 deletions src/LinearSolvers/RichardsonLinearSolvers.jl
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
"""
struct RichadsonLinearSolver <: LinearSolver
struct RichardsonLinearSolver <: LinearSolver
...
end
RichadsonLinearSolver(ω,IterMax;Pl=nothing,rtol=1e-10,atol=1e-6,verbose=true,name = "RichardsonLinearSolver")
RichardsonLinearSolver(ω,IterMax;Pl=nothing,rtol=1e-10,atol=1e-6,verbose=true,name = "RichardsonLinearSolver")
Richardson Iteration, with an optional left preconditioners `Pl`.
The relaxation parameter (ω) can either be of type Float64 or Vector{Float64}.
This gives flexiblity in relaxation.
"""

struct RichadsonLinearSolver<:Gridap.Algebra.LinearSolver
struct RichardsonLinearSolver<:Gridap.Algebra.LinearSolver
ω::Union{Vector{Float64},Float64}
Pl::Union{Gridap.Algebra.LinearSolver,Nothing}
IterMax::Int64
log::ConvergenceLog{Float64}
end

function RichadsonLinearSolver(ω,IterMax;Pl=nothing,rtol=1e-10,atol=1e-6,verbose=true,name = "RichardsonLinearSolver")
function RichardsonLinearSolver(ω,IterMax;Pl=nothing,rtol=1e-10,atol=1e-6,verbose=true,name = "RichardsonLinearSolver")
tols = SolverTolerances{Float64}(maxiter=IterMax,atol=atol,rtol=rtol)
log = ConvergenceLog(name,tols,verbose=verbose)
return RichadsonLinearSolver(ω,Pl,IterMax,log)
return RichardsonLinearSolver(ω,Pl,IterMax,log)
end

struct RichadsonLinearSymbolicSetup<:Gridap.Algebra.SymbolicSetup
struct RichardsonLinearSymbolicSetup<:Gridap.Algebra.SymbolicSetup
solver
end

function Gridap.Algebra.symbolic_setup(solver::RichadsonLinearSolver,A::AbstractMatrix)
return RichadsonLinearSymbolicSetup(solver)
function Gridap.Algebra.symbolic_setup(solver::RichardsonLinearSolver,A::AbstractMatrix)
return RichardsonLinearSymbolicSetup(solver)
end

function get_solver_caches(solver::RichadsonLinearSolver, A::AbstractMatrix)
function get_solver_caches(solver::RichardsonLinearSolver, A::AbstractMatrix)
ω = solver.ω
return ω
end

mutable struct RichadsonLinearNumericalSetup<:Gridap.Algebra.NumericalSetup
mutable struct RichardsonLinearNumericalSetup<:Gridap.Algebra.NumericalSetup
solver
A
Pl_ns
caches
end

function Gridap.Algebra.numerical_setup(ss::RichadsonLinearSymbolicSetup, A::AbstractMatrix)
function Gridap.Algebra.numerical_setup(ss::RichardsonLinearSymbolicSetup, A::AbstractMatrix)
solver = ss.solver
Pl_ns = !isnothing(solver.Pl) ? numerical_setup(symbolic_setup(solver.Pl,A),A) : nothing
caches = get_solver_caches(solver,A)
return RichadsonLinearNumericalSetup(solver,A,Pl_ns,caches)
return RichardsonLinearNumericalSetup(solver,A,Pl_ns,caches)
end

function Gridap.Algebra.numerical_setup(ss::RichadsonLinearSymbolicSetup, A::AbstractMatrix, x::AbstractVector)
function Gridap.Algebra.numerical_setup(ss::RichardsonLinearSymbolicSetup, A::AbstractMatrix, x::AbstractVector)
solver = ss.solver
Pl_ns = !isnothing(solver.Pl) ? numerical_setup(symbolic_setup(solver.Pl,A,x),A,x) : nothing
caches = get_solver_caches(solver,A)
return RichadsonLinearNumericalSetup(solver,A,Pl_ns,caches)
return RichardsonLinearNumericalSetup(solver,A,Pl_ns,caches)
end

function Gridap.Algebra.numerical_setup!(ns::RichadsonLinearNumericalSetup, A::AbstractMatrix)
function Gridap.Algebra.numerical_setup!(ns::RichardsonLinearNumericalSetup, A::AbstractMatrix)
if !isa(ns.Pl_ns,Nothing)
numerical_setup!(ns.Pl_ns,A)
end
ns.A = A
return ns
end

function Gridap.Algebra.numerical_setup!(ns::RichadsonLinearNumericalSetup, A::AbstractMatrix, x::AbstractVector)
function Gridap.Algebra.numerical_setup!(ns::RichardsonLinearNumericalSetup, A::AbstractMatrix, x::AbstractVector)
if !isa(ns.Pl_ns,Nothing)
numerical_setup!(ns.Pl_ns,A,x)
end
ns.A = A
return ns
end

function Gridap.Algebra.solve!(x::AbstractVector, ns:: RichadsonLinearNumericalSetup, b::AbstractVector)
function Gridap.Algebra.solve!(x::AbstractVector, ns:: RichardsonLinearNumericalSetup, b::AbstractVector)
solver,A,Pl,caches = ns.solver,ns.A,ns.Pl_ns,ns.caches
ω = caches
log = solver.log
Expand Down

0 comments on commit 6d3f474

Please sign in to comment.