]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
function for element access added
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Jun 2003 16:46:59 +0000 (16:46 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Jun 2003 16:46:59 +0000 (16:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@7793 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/precondition_block.h

index 949b6ef8c07856908a4b66bbd092479fef262dd5..9f18bdb88b5d0ed92ac584a57eb04d89e977a6fd 100644 (file)
@@ -82,6 +82,11 @@ class PreconditionBlock : public virtual Subscriptor
                                      * Define number type of matrix.
                                      */
     typedef typename MATRIX::value_type number;
+
+                                    /**
+                                     * Value type for inverse matrices.
+                                     */
+    typedef inverse_type value_type;
     
   public:
                                     /**
@@ -165,6 +170,15 @@ class PreconditionBlock : public virtual Subscriptor
                                      */
     bool empty () const;
 
+                                    /**
+                                     * Read-only access to entries.
+                                     * This function is only possible
+                                     * if the inverse diagonal blocks
+                                     * are stored.
+                                     */
+    value_type el(unsigned int i,
+                 unsigned int j) const;
+    
                                     /**
                                      * Use only the inverse of the
                                      * first diagonal block to save
@@ -369,6 +383,11 @@ class PreconditionBlockJacobi : public virtual Subscriptor,
                                      */
     PreconditionBlock<MATRIX, inverse_type>::empty;
 
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    PreconditionBlock<MATRIX, inverse_type>::el;
+
                                     /**
                                      * Make function of base class public again.
                                      */
@@ -474,6 +493,11 @@ class PreconditionBlockSOR : public virtual Subscriptor,
                                      * Make function of base class public again.
                                      */
     PreconditionBlock<MATRIX, inverse_type>::empty;
+    
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    PreconditionBlock<MATRIX, inverse_type>::el;
 
                                     /**
                                      * Make function of base class public again.
@@ -630,6 +654,11 @@ class PreconditionBlockSSOR : public virtual Subscriptor,
                                      */
     PreconditionBlockSOR<MATRIX, inverse_type>::empty;
 
+                                    /**
+                                     * Make function of base class public again.
+                                     */
+    PreconditionBlockSOR<MATRIX, inverse_type>::el;
+
                                     /**
                                      * Make function of base class public again.
                                      */
@@ -688,4 +717,27 @@ PreconditionBlock<MATRIX, inverse_type>::empty () const
   return A->empty();
 }
 
+
+template<class MATRIX, typename inverse_type>
+inline inverse_type
+PreconditionBlock<MATRIX, inverse_type>::el (
+  unsigned int i,
+  unsigned int j) const
+{
+  const unsigned int bs = blocksize;
+  const unsigned int nb = i/bs;
+  
+  const FullMatrix<inverse_type>& B = inverse(nb);
+
+  const unsigned int ib = i % bs;
+  const unsigned int jb = j % bs;
+
+  if (jb +nb != j)
+    {
+      return 0.;
+    }
+  
+  return B(ib, jb);
+}
+
 #endif

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.