]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test for long double
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 May 1999 11:34:28 +0000 (11:34 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 May 1999 11:34:28 +0000 (11:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@1273 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/mg.cc
tests/lac/testmatrix.cc

index 3520dc113a70077d6b6a025798f91e3e732a75e9..85807b480d286ad30e2f7c62c21ba66fd76c517b 100644 (file)
@@ -17,6 +17,9 @@
 #include <lac/precondition.h>
 #include <lac/mgbase.h>
 
+#define TYPE  long double
+#define ACCURACY 1.e-19
+
 template<class VECTOR>
 void print_vector(ostream& s, const VECTOR& v)
 {
@@ -52,8 +55,8 @@ class FDMG
                                 const Vector<FLOAT>& src,
                                 const Vector<FLOAT>& rhs);
 
-    void copy_to_mg(const Vector<double>& rhs);
-    void copy_from_mg(Vector<double>& lsg);
+    void copy_to_mg(const Vector<TYPE>& rhs);
+    void copy_from_mg(Vector<TYPE>& lsg);
 };
 
 class MGSmootherLAC
@@ -89,7 +92,7 @@ class MGPrecondition
       {}
     
     
-    void operator () (Vector<double>& dst, const Vector<double>& src) const
+    void operator () (Vector<TYPE>& dst, const Vector<TYPE>& src) const
       {
 //     print_vector(cout, src);
        
@@ -107,8 +110,8 @@ main()
   ofstream logfile("mg.output");
   deallog.attach(logfile);
   
-  PrimitiveVectorMemory<Vector<double>  > mem;
-  SolverControl control(100, 1.e-14, true);
+  PrimitiveVectorMemory<Vector<TYPE>  > mem;
+  SolverControl control(100, ACCURACY, true);
 
   const unsigned int base = 3;
   const unsigned int maxlevel = 8;
@@ -162,13 +165,14 @@ main()
       MGSmootherLAC smoother(A);
 //      MGSmootherIdentity smoother;
 
-      MGPrecondition precondition(multigrid, smoother, coarsegrid);
+      PreconditionMG<FDMG, Vector<TYPE> >
+       precondition(multigrid, smoother, smoother, coarsegrid);
 
-//      SolverRichardson<SparseMatrix<FLOAT> , Vector<double> > solver(control, mem);
-      SolverCG<SparseMatrix<FLOAT> , Vector<double> > solver(control, mem);
+//      SolverRichardson<SparseMatrix<FLOAT> , Vector<TYPE> > solver(control, mem);
+      SolverCG<SparseMatrix<FLOAT> , Vector<TYPE> > solver(control, mem);
 
-      Vector<double> u(dim);
-      Vector<double> f(dim);
+      Vector<TYPE> u(dim);
+      Vector<TYPE> f(dim);
       u = 0.;
       f = 1.;//(size*size);
 
@@ -202,13 +206,13 @@ FDMG::level_residual (unsigned int level,
 }
 
 void
-FDMG::copy_to_mg(const Vector<double>& v)
+FDMG::copy_to_mg(const Vector<TYPE>& v)
 {
   d[maxlevel] = v;
 }
 
 void
-FDMG::copy_from_mg(Vector<double>& v)
+FDMG::copy_from_mg(Vector<TYPE>& v)
 {
   v = s[maxlevel];
 }
index 53eeee5063c91473a8e2da683759613b821fc786..f3a0245b1359ed4b2d45d7b9bfef23d47d121e39 100644 (file)
@@ -232,8 +232,10 @@ FDMGTransfer::restrict (const unsigned int   from_level,
 }
 
 
+template void FDMatrix::laplacian(SparseMatrix<long double>&) const;
 template void FDMatrix::laplacian(SparseMatrix<double>&) const;
 template void FDMatrix::laplacian(SparseMatrix<float>&) const;
+template void FDMatrix::gnuplot_print(ostream& s, const Vector<long double>& V) const;
 template void FDMatrix::gnuplot_print(ostream& s, const Vector<double>& V) const;
 template void FDMatrix::gnuplot_print(ostream& s, const Vector<float>& V) const;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.