From df3e4d1e9cde659171deedf9ed155a38ef708031 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 6 Oct 2023 21:00:21 -0400 Subject: [PATCH] Return fix --- Grid/algorithms/iterative/AdefGeneric.h | 33 ++++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Grid/algorithms/iterative/AdefGeneric.h b/Grid/algorithms/iterative/AdefGeneric.h index 2088d1e1..2157dd5e 100644 --- a/Grid/algorithms/iterative/AdefGeneric.h +++ b/Grid/algorithms/iterative/AdefGeneric.h @@ -38,7 +38,6 @@ Author: Peter Boyle * Vstart = P^Tx + Qb * M1 = P^TM + Q * M2=M3=1 - * Vout = x */ NAMESPACE_BEGIN(Grid); @@ -68,14 +67,13 @@ class TwoLevelCG : public LinearFunction grid = fine; }; - virtual void operator() (const Field &src, Field &psi) + virtual void operator() (const Field &src, Field &x) { Field resid(grid); RealD f; RealD rtzp,rtz,a,d,b; RealD rptzp; - Field x(grid); Field p(grid); Field z(grid); Field tmp(grid); @@ -85,7 +83,6 @@ class TwoLevelCG : public LinearFunction Field rp (grid); //Initial residual computation & set up - RealD guess = norm2(psi); double tn; GridStopWatch HDCGTimer; @@ -165,14 +162,22 @@ class TwoLevelCG : public LinearFunction RealD srcnorm = sqrt(norm2(src)); RealD tmpnorm = sqrt(norm2(tmp)); RealD true_residual = tmpnorm/srcnorm; - std::cout< ///////////////////////////////////////////////////////////////////// // Only Def1 has non-trivial Vout. ///////////////////////////////////////////////////////////////////// - virtual void Vout (Field & in, Field & out,Field & src){ - out = in; - } }; @@ -221,13 +223,13 @@ class TwoLevelADEF2 : public TwoLevelCG // more most opertor functions TwoLevelADEF2(RealD tol, Integer maxit, - LinearOperatorBase &FineLinop, - LinearFunction &Smoother, + LinearOperatorBase &FineLinop, + LinearFunction &Smoother, LinearFunction &CoarseSolver, LinearFunction &CoarseSolverPrecise, Aggregation &Aggregates ) : - TwoLevelCG(tol,maxit,FineLinop,Smoother,Aggregates.FineGrid), + TwoLevelCG(tol,maxit,FineLinop,Smoother,Aggregates.FineGrid), _CoarseSolver(CoarseSolver), _CoarseSolverPrecise(CoarseSolverPrecise), _Aggregates(Aggregates) @@ -321,12 +323,13 @@ public: eval(_eval) {}; - // Can just inherit existing Vout // Can just inherit existing M2 // Can just inherit existing M3 // Simple vstart - do nothing - virtual void Vstart(Field & x,const Field & src){ x=src; }; + virtual void Vstart(Field & x,const Field & src){ + x=src; // Could apply Q + }; // Override PcgM1 virtual void PcgM1(Field & in, Field & out)