From a9df179b775fa3f7813965fd1a12899a51d7d15d Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 19 Sep 2010 16:56:02 +0000 Subject: [PATCH] Remove another such file. git-svn-id: https://svn.dealii.org/trunk@22062 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/mg.cc | 240 ------------------------------------------------ 1 file changed, 240 deletions(-) delete mode 100644 tests/lac/mg.cc diff --git a/tests/lac/mg.cc b/tests/lac/mg.cc deleted file mode 100644 index 17170d3e33..0000000000 --- a/tests/lac/mg.cc +++ /dev/null @@ -1,240 +0,0 @@ -//---------------------------- mg.cc --------------------------- -// $Id$ -// Version: $Name$ -// -// Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005 by the deal.II authors -// -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//---------------------------- mg.cc --------------------------- - - -#include "../tests.h" -#include -#include -#include -#include "testmatrix.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define TYPE double -#define ACCURACY 1.e-5 - -// template -// void print_vector(std::ostream& s, const VECTOR& v) -// { -// const unsigned int n = (unsigned int)(sqrt(v.size())+.3); -// unsigned int k=0; - -// for (unsigned int i=0;i > >matrices; - public: - FDMG(unsigned int maxlevel, MGLevelObject >& matrices, - FDMGTransfer& transfer); - - -virtual void level_vmult (unsigned int level, - Vector& dst, - const Vector& src, - const Vector& rhs); - - void copy_to_mg(const Vector& rhs); - void copy_from_mg(Vector& lsg); - virtual void print_vector(unsigned int, - const Vector &, - const char *) const; - -}; - -class MGSmootherLAC - : - public MGSmootherBase -{ - private: - SmartPointer > >matrices; - public: - MGSmootherLAC(MGLevelObject >&); - - virtual void smooth (const unsigned int level, - Vector &u, - const Vector &rhs) const; - -}; - -typedef MGCoarseGridLACIteration, - SparseMatrix, - PreconditionIdentity > Coarse; - - -int main() -{ - std::ofstream logfile("mg/output"); - deallog.attach(logfile); - deallog.depth_console(0); - deallog.threshold_double(1.e-10); - - PrimitiveVectorMemory > mem; - SolverControl control(10000, ACCURACY); - - const unsigned int base = 3; - const unsigned int maxlevel = 5; - - const unsigned int maxsize = base * (1 << maxlevel); - - // grid transfer - FDMGTransfer transfer(maxsize, maxsize, maxlevel); - - // coarse grid solver - PrimitiveVectorMemory<> cgmem; - ReductionControl cgcontrol(100, 1.e-30, 1.e-2, false, false); - SolverCG<> cgcg(cgcontrol,cgmem); - - -for (unsigned int level = 0; level <= maxlevel; ++level) - { - const unsigned int minlevel = 0; - - const unsigned int size = base * (1 << level); - - const unsigned int dim = (size-1)*(size-1); - deallog << "Level " << level << " size " << size << std::endl; - - // Make matrix - std::vector structure(maxlevel+1); - MGLevelObject > A(minlevel,maxlevel); - - FDMatrix testproblem(size, size); - - for(unsigned ll = minlevel; ll <= level; ++ll) - { - const unsigned int size = base * (1 << ll); - const unsigned int dim = (size-1)*(size-1); - FDMatrix testproblem(size, size); - structure[ll].reinit(dim, dim, 5); - testproblem.build_structure(structure[ll]); - structure[ll].compress(); - A[ll].reinit(structure[ll]); - testproblem.laplacian(A[ll]); - } - - FDMG multigrid(level, A, transfer); - -// PreconditionRelaxation<> - PreconditionIdentity - cgprec;//(A[minlevel], &SparseMatrix ::template precondition_SSOR, 1.2); - - Coarse coarsegrid(cgcg, A[minlevel], cgprec); - - MGSmootherLAC smoother(A); -// MGSmootherIdentity smoother; - - PreconditionMG > - precondition(multigrid, smoother, smoother, coarsegrid); - -// SolverRichardson > solver(control, mem); - SolverCG > solver(control, mem); - - Vector u(dim); - Vector f(dim); - u = 0.; - f = 1.;//(size*size); - - solver.solve(A[level], u, f, precondition); - std::ofstream out("T"); - testproblem.gnuplot_print(out,u); - } -} - -FDMG::FDMG(unsigned int maxlevel, MGLevelObject >& matrices, - FDMGTransfer& transfer) - : - MGBase(transfer, 0, maxlevel), - matrices(&matrices) -{ - for (unsigned int level = minlevel; level<=maxlevel ; ++level) - { - solution[level].reinit(matrices[level].m()); - defect[level].reinit(matrices[level].m()); - } -} - - -void -FDMG::level_vmult (unsigned int level, - Vector& dst, - const Vector& src, - const Vector&) -{ - (*matrices)[level].vmult(dst, src); -} - -void -FDMG::copy_to_mg(const Vector& v) -{ - defect[maxlevel] = v; -} - -void -FDMG::copy_from_mg(Vector& v) -{ - v = solution[maxlevel]; -} - -void -FDMG::print_vector(unsigned int, - const Vector &, - const char *) const -{} - - - -MGSmootherLAC::MGSmootherLAC(MGLevelObject >& matrix) - : - matrices(&matrix) -{} - - -void -MGSmootherLAC::smooth (const unsigned int level, - Vector &u, - const Vector &rhs) const -{ - SolverControl control(1,1.e-300,false,false); - PrimitiveVectorMemory<> mem; - SolverRichardson<> rich(control, mem); - PreconditionSSOR<> prec; - prec.initialize((*matrices)[level], 1.); - - rich.solve((*matrices)[level], u, rhs, prec); -} -- 2.39.5