]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test for psor added and disabled
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 30 May 2003 19:19:16 +0000 (19:19 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 30 May 2003 19:19:16 +0000 (19:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@7691 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/solver.cc
tests/lac/testmatrix.cc
tests/lac/testmatrix.h

index 0dd3b17fab7dc9e192b0da0f75740bd6a18a409a..dab73b01c2aca5f2f2dfd1261f695558eb3b4b92 100644 (file)
@@ -190,28 +190,22 @@ int main()
          
          deallog.push("psor");
 
-         if(false)
-           {
-             
          check_Tsolve(rich,A,u,f,prec_psor);
          check_solve(rich,A,u,f,prec_psor);
          check_solve(cg,A,u,f,prec_psor);
          check_solve(bicgstab,A,u,f,prec_psor);
          check_solve(gmres,A,u,f,prec_psor);
          check_solve(gmresright,A,u,f,prec_psor);
-           }
          
          deallog.pop();
        }
       catch (std::exception& e)
        {
-         std::cerr << e.what() << std::endl;
+         std::cerr << "Exception: " << e.what() << std::endl;
        }
     };
 
                                   // Solve advection problem
-
-                                  // Disabled for the time being
   for (unsigned int size=4; size <= 3; size *= 3)
     {
       unsigned int dim = (size-1)*(size-1);
index c6ee0f897aa3336221c08aa366c6a10e3620f2e0..ad5ff5f51caa13f8bde21b16d760f94bdb6dc21b 100644 (file)
@@ -207,6 +207,27 @@ FDMatrix::five_point(MATRIX& A, bool nonsymmetric) const
     } 
 }
 
+template<typename MATRIX>
+void
+FDMatrix::upwind(MATRIX& A, bool back) const
+{
+   for(unsigned int i=0;i<=ny-2;i++)
+    {
+      for(unsigned int j=0;j<=nx-2; j++)
+       {
+                                          // Number of the row to be entered
+         unsigned int row = j+(nx-1)*i;
+         A.set(row, row, 3.);
+
+         if (j>0 && !back)
+           A.set(row, row-1, -1.);
+
+         if (j<nx-2 && back)
+             A.set(row, row+1, -1.);
+       }
+    } 
+}
+
 template<typename number>
 void
 FDMatrix::gnuplot_print(std::ostream& s, const Vector<number>& V) const
@@ -234,6 +255,10 @@ template void FDMatrix::nine_point(SparseMatrix<long double>&, bool) const;
 template void FDMatrix::nine_point(SparseMatrix<double>&, bool) const;
 template void FDMatrix::nine_point(SparseMatrixEZ<double>&, bool) const;
 template void FDMatrix::nine_point(SparseMatrix<float>&, bool) const;
+template void FDMatrix::upwind(SparseMatrix<long double>&, bool) const;
+template void FDMatrix::upwind(SparseMatrix<double>&, bool) const;
+template void FDMatrix::upwind(SparseMatrixEZ<double>&, bool) const;
+template void FDMatrix::upwind(SparseMatrix<float>&, bool) const;
 template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<long double>& V) const;
 template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<double>& V) const;
 template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<float>& V) const;
index 5dacd3f07b4d52fcf9f4a0eb24da578814840c30..0a42e96271e6599a735980bb0a5a4bf41104da08 100644 (file)
@@ -41,6 +41,12 @@ class FDMatrix
     template <typename MATRIX>
     void nine_point(MATRIX&, bool nonsymmetric = false) const;
 
+                                    /**
+                                     * Fill the matrix with values.
+                                     */
+    template <typename MATRIX>
+    void upwind(MATRIX&, bool back = false) const;
+
     template <typename number>
     void gnuplot_print(std::ostream&, const Vector<number>&) 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.