public static Vector BasicMGM(MGM_in setup) { double h = setup.h; // Vector g = ((h * h) / 4d) * setup.b; Vector z = setup.z; double W = (h * h) / 4d; Vector d_temp;// = DifferenceEquations.multiplyD2U(z) - setup.b; if (setup.level == 0) { return(setup.z); //точное решение на грубой сетке } else { //ню базовых итераций for (int k = 0; k < setup.nu; k++) { d_temp = DifferentialEquation.multiplyD2U(z) - setup.b; z = z - W * d_temp; } //коррекция Vector d_2h = Proektor.basic_r(DifferentialEquation.multiplyD2U(z) - setup.b); Vector e_2h = new Vector(d_2h.Length); //Решакем Ае = d for (int i = 0; i < setup.gamma; i++) { MGM_in set = new MGM_in(setup.level - 1, e_2h, d_2h, setup.nu, 2d * h, setup.gamma); e_2h = BasicMGM(set); } //z = z - pe z = z - Resumption.basic_p(e_2h); //постсглаживание for (int k = 0; k < setup.nu; k++) { d_temp = DifferentialEquation.multiplyD2U(z) - setup.b; z = z - W * d_temp; } return(z); } }
public static Vector MGMFull(MGM_in setup) { Vector r = Vector.GetConstVector(1d, setup.N); Vector z = new Vector(); Vector.copy(ref setup.z, setup.b); while (r.Norm > 0.001d) { //MessageBox.Show("||r|| = " + r.Norm2SQ.ToString("0.0000000")); z = BasicMGM(setup); r = DifferentialEquation.multiplyD2U(z) - setup.b; Vector.copy(ref setup.z, z); } return(z); }