]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
FLOAT macro removed
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 6 May 1999 12:49:19 +0000 (12:49 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 6 May 1999 12:49:19 +0000 (12:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@1288 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 85807b480d286ad30e2f7c62c21ba66fd76c517b..a8df6709d660cce5e03d81f70658bba4a98f3315 100644 (file)
@@ -18,7 +18,7 @@
 #include <lac/mgbase.h>
 
 #define TYPE  long double
-#define ACCURACY 1.e-19
+#define ACCURACY 1.e-18
 
 template<class VECTOR>
 void print_vector(ostream& s, const VECTOR& v)
@@ -29,7 +29,7 @@ void print_vector(ostream& s, const VECTOR& v)
   for (unsigned int i=0;i<n;++i)
     {
       for (unsigned int j=0;j<n;++j)
-//     s << ((FLOAT)i)/n << '\t' << ((FLOAT)j)/n << '\t' << v(k++) << endl;
+//     s << ((float)i)/n << '\t' << ((float)j)/n << '\t' << v(k++) << endl;
        s << '\t' << v(k++);
       s << endl;
     }
@@ -44,16 +44,16 @@ class FDMG
                                     /**
                                      * Pointer to the level matrices.
                                      */
-    SmartPointer<MGMatrix<SparseMatrix<FLOAT> > >matrices;
+    SmartPointer<MGMatrix<SparseMatrix<float> > >matrices;
   public:
-    FDMG(unsigned int maxlevel, MGMatrix<SparseMatrix<FLOAT> >& matrices,
+    FDMG(unsigned int maxlevel, MGMatrix<SparseMatrix<float> >& matrices,
         FDMGTransfer& transfer);
     
     
     virtual void level_residual (unsigned int level,
-                                Vector<FLOAT>& dst,
-                                const Vector<FLOAT>& src,
-                                const Vector<FLOAT>& rhs);
+                                Vector<float>& dst,
+                                const Vector<float>& src,
+                                const Vector<float>& rhs);
 
     void copy_to_mg(const Vector<TYPE>& rhs);
     void copy_from_mg(Vector<TYPE>& lsg);
@@ -64,46 +64,21 @@ class MGSmootherLAC
   public MGSmootherBase
 {
   private:
-    SmartPointer<MGMatrix<SparseMatrix<FLOAT> > >matrices;
+    SmartPointer<MGMatrix<SparseMatrix<float> > >matrices;
   public:
-    MGSmootherLAC(MGMatrix<SparseMatrix<FLOAT> >&);
+    MGSmootherLAC(MGMatrix<SparseMatrix<float> >&);
     
     virtual void smooth (const unsigned int level,
-                        Vector<FLOAT> &u,
-                        const Vector<FLOAT> &rhs) const;
+                        Vector<float> &u,
+                        const Vector<float> &rhs) const;
     
 };
 
-typedef MGCoarseGridLACIteration<SolverCG<SparseMatrix<FLOAT> , Vector<FLOAT>  >,
-SparseMatrix<FLOAT>, /*PreconditionRelaxation<SparseMatrix<FLOAT> ,*/
-  PreconditionIdentity<Vector<FLOAT> > >
+typedef MGCoarseGridLACIteration<SolverCG<SparseMatrix<float> , Vector<float>  >,
+SparseMatrix<float>, /*PreconditionRelaxation<SparseMatrix<float> ,*/
+  PreconditionIdentity<Vector<float> > >
 Coarse;
 
-class MGPrecondition
-{
-  private:
-    FDMG& mg;
-    MGSmootherBase& smooth;
-    Coarse& coarse;
-  public:
-    MGPrecondition(FDMG& m, MGSmootherBase& s, Coarse& c)
-                   :
-                   mg(m), smooth(s), coarse(c)
-      {}
-    
-    
-    void operator () (Vector<TYPE>& dst, const Vector<TYPE>& src) const
-      {
-//     print_vector(cout, src);
-       
-       mg.copy_to_mg(src);
-       mg.vcycle(smooth,smooth,coarse);
-       mg.copy_from_mg(dst);
-      }
-    
-    
-};
-
 
 main()
 {
@@ -122,9 +97,9 @@ main()
   FDMGTransfer transfer(maxsize, maxsize, maxlevel);
 
                                   // coarse grid solver
-  PrimitiveVectorMemory<Vector<FLOAT> > cgmem;
+  PrimitiveVectorMemory<Vector<float> > cgmem;
   ReductionControl cgcontrol(100, 1.e-30, 1.e-2, false, false);
-  SolverCG<SparseMatrix<FLOAT> , Vector<FLOAT> > cgcg(cgcontrol,cgmem);
+  SolverCG<SparseMatrix<float> , Vector<float> > cgcg(cgcontrol,cgmem);
 
   
   for (unsigned int level = 0; level <= maxlevel; ++level)
@@ -138,7 +113,7 @@ main()
 
                                       // Make matrix
       vector<SparseMatrixStruct >  structure(maxlevel+1);
-      MGMatrix<SparseMatrix<FLOAT> > A(minlevel,maxlevel);
+      MGMatrix<SparseMatrix<float> > A(minlevel,maxlevel);
 
       FDMatrix testproblem(size, size);
 
@@ -156,9 +131,9 @@ main()
       
       FDMG multigrid(level, A, transfer);
 
-//      PreconditionRelaxation<SparseMatrix<FLOAT> , Vector<FLOAT> >
-      PreconditionIdentity<Vector<FLOAT> >
-       cgprec;//(A[minlevel], &SparseMatrix<FLOAT> ::template precondition_SSOR<FLOAT>, 1.2);
+//      PreconditionRelaxation<SparseMatrix<float> , Vector<float> >
+      PreconditionIdentity<Vector<float> >
+       cgprec;//(A[minlevel], &SparseMatrix<float> ::template precondition_SSOR<float>, 1.2);
       
       Coarse coarsegrid(cgcg, A[minlevel], cgprec);
       
@@ -168,8 +143,8 @@ main()
       PreconditionMG<FDMG, Vector<TYPE> >
        precondition(multigrid, smoother, smoother, coarsegrid);
 
-//      SolverRichardson<SparseMatrix<FLOAT> , Vector<TYPE> > solver(control, mem);
-      SolverCG<SparseMatrix<FLOAT> , Vector<TYPE> > solver(control, mem);
+//      SolverRichardson<SparseMatrix<float> , Vector<TYPE> > solver(control, mem);
+      SolverCG<SparseMatrix<float> , Vector<TYPE> > solver(control, mem);
 
       Vector<TYPE> u(dim);
       Vector<TYPE> f(dim);
@@ -182,7 +157,7 @@ main()
     }
 }
 
-FDMG::FDMG(unsigned int maxlevel, MGMatrix<SparseMatrix<FLOAT> >& matrices,
+FDMG::FDMG(unsigned int maxlevel, MGMatrix<SparseMatrix<float> >& matrices,
           FDMGTransfer& transfer)
                :
                MGBase(transfer, maxlevel, 0),
@@ -198,9 +173,9 @@ FDMG::FDMG(unsigned int maxlevel, MGMatrix<SparseMatrix<FLOAT> >& matrices,
 
 void
 FDMG::level_residual (unsigned int level,
-                     Vector<FLOAT>& dst,
-                     const Vector<FLOAT>& src,
-                     const Vector<FLOAT>& rhs)
+                     Vector<float>& dst,
+                     const Vector<float>& src,
+                     const Vector<float>& rhs)
 {
   (*matrices)[level].residual(dst, src, rhs);
 }
@@ -218,7 +193,7 @@ FDMG::copy_from_mg(Vector<TYPE>& v)
 }
 
 
-MGSmootherLAC::MGSmootherLAC(MGMatrix<SparseMatrix<FLOAT> >& matrix)
+MGSmootherLAC::MGSmootherLAC(MGMatrix<SparseMatrix<float> >& matrix)
                :
                matrices(&matrix)
 {}
@@ -226,14 +201,14 @@ MGSmootherLAC::MGSmootherLAC(MGMatrix<SparseMatrix<FLOAT> >& matrix)
 
 void
 MGSmootherLAC::smooth (const unsigned int level,
-                      Vector<FLOAT> &u,
-                      const Vector<FLOAT> &rhs) const
+                      Vector<float> &u,
+                      const Vector<float> &rhs) const
 {
   SolverControl control(1,1.e-300,false,false);
-  PrimitiveVectorMemory<Vector<FLOAT> > mem;
-  SolverRichardson<SparseMatrix<FLOAT> , Vector<FLOAT>  > rich(control, mem);
-  PreconditionRelaxation<SparseMatrix<FLOAT> , Vector<FLOAT> >
-    prec((*matrices)[level], &SparseMatrix<FLOAT> ::template precondition_SSOR<FLOAT>, 1.);
+  PrimitiveVectorMemory<Vector<float> > mem;
+  SolverRichardson<SparseMatrix<float> , Vector<float>  > rich(control, mem);
+  PreconditionRelaxation<SparseMatrix<float> , Vector<float> >
+    prec((*matrices)[level], &SparseMatrix<float> ::template precondition_SSOR<float>, 1.);
 
   rich.solve((*matrices)[level], u, rhs, prec);
 }
index f3a0245b1359ed4b2d45d7b9bfef23d47d121e39..5100cbe8d786ed8c7840bf19891e9e7328364c59 100644 (file)
@@ -118,7 +118,7 @@ FDMGTransfer::FDMGTransfer(unsigned int nx, unsigned int ny,
 
 void
 FDMGTransfer::build_matrix(unsigned int nx, unsigned int ny,
-                          SparseMatrixStruct& structure, SparseMatrix<FLOAT>& matrix)
+                          SparseMatrixStruct& structure, SparseMatrix<float>& matrix)
 {
   structure.reinit((nx-1)*(ny-1),(2*nx-1)*(2*ny-1),9);
   
@@ -210,8 +210,8 @@ FDMGTransfer::build_matrix(unsigned int nx, unsigned int ny,
 
 void
 FDMGTransfer::prolongate (const unsigned int   to_level,
-                         Vector<FLOAT>       &dst,
-                         const Vector<FLOAT> &src) const
+                         Vector<float>       &dst,
+                         const Vector<float> &src) const
 {
   Assert((to_level>0) && (to_level<=matrices.size()),
         ExcIndexRange(to_level, 0, matrices.size()+1));
@@ -222,8 +222,8 @@ FDMGTransfer::prolongate (const unsigned int   to_level,
 
 void
 FDMGTransfer::restrict (const unsigned int   from_level,
-                       Vector<FLOAT>       &dst,
-                       const Vector<FLOAT> &src) const
+                       Vector<float>       &dst,
+                       const Vector<float> &src) const
 {
   Assert((from_level>0) && (from_level<=matrices.size()),
         ExcIndexRange(from_level, 0, matrices.size()+1));
index 659ab397527cf4f76e913ddf45aeab806909aca9..8099555feea2ffbcbcc21cce71b5a9f44fc5cefa 100644 (file)
@@ -66,16 +66,16 @@ class FDMGTransfer
                                      * function in #MGTranferBase#.
                                      */
     virtual void prolongate (const unsigned int   to_level,
-                            Vector<FLOAT>       &dst,
-                            const Vector<FLOAT> &src) const;
+                            Vector<float>       &dst,
+                            const Vector<float> &src) const;
 
                                     /**
                                      * Implementation of abstract
                                      * function in #MGTranferBase#.
                                      */
     virtual void restrict (const unsigned int   from_level,
-                          Vector<FLOAT>       &dst,
-                          const Vector<FLOAT> &src) const;
+                          Vector<float>       &dst,
+                          const Vector<float> &src) const;
 
                                     /**
                                      * Exception.
@@ -91,7 +91,7 @@ class FDMGTransfer
                                     /**
                                      * Prolongation matrices.
                                      */
-    vector<SparseMatrix<FLOAT> > matrices;
+    vector<SparseMatrix<float> > matrices;
 
                                     /**
                                      * Matrix generator.
@@ -101,5 +101,5 @@ class FDMGTransfer
                                      * fine to coarse (#vmult#).
                                      */
     void build_matrix(unsigned int nx, unsigned int ny,
-                     SparseMatrixStruct&, SparseMatrix<FLOAT>&);
+                     SparseMatrixStruct&, SparseMatrix<float>&);
 };

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.