From c3f79407a06b90e7aa2e238b1061849c6c46b92d Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Fri, 17 May 2013 13:15:00 +0000
Subject: [PATCH] split of the initializeMatrix() function in the finite volume
 pressure models of impet schemes

   - This allows the use of the sparse matrix initializations of parent classes and the modification in derived classes
     -> once an end...()-function of the sparse matrix is called it can
     no longer be modified!

     -reviewed by Bernd



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10695 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/decoupled/common/fv/fvpressure.hh | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/dumux/decoupled/common/fv/fvpressure.hh b/dumux/decoupled/common/fv/fvpressure.hh
index 5e9a809217..cfa465d8e5 100644
--- a/dumux/decoupled/common/fv/fvpressure.hh
+++ b/dumux/decoupled/common/fv/fvpressure.hh
@@ -97,6 +97,9 @@ protected:
 
     //!Initialize the global matrix of the system of equations to solve
     void initializeMatrix();
+    void initializeMatrixRowSize();
+    void initializeMatrixIndices();
+
 
     /*!\brief Function which assembles the system of equations to be solved
      *
@@ -321,6 +324,16 @@ private:
 //!Initialize the global matrix of the system of equations to solve
 template<class TypeTag>
 void FVPressure<TypeTag>::initializeMatrix()
+{
+	initializeMatrixRowSize();
+    A_.endrowsizes();
+	initializeMatrixIndices();
+    A_.endindices();
+}
+
+//!Initialize the global matrix of the system of equations to solve
+template<class TypeTag>
+void FVPressure<TypeTag>::initializeMatrixRowSize()
 {
     // determine matrix row sizes
     ElementIterator eItEnd = problem_.gridView().template end<0>();
@@ -341,9 +354,16 @@ void FVPressure<TypeTag>::initializeMatrix()
         }
         A_.setrowsize(globalIdxI, rowSize);
     }
-    A_.endrowsizes();
 
+    return;
+}
+
+//!Initialize the global matrix of the system of equations to solve
+template<class TypeTag>
+void FVPressure<TypeTag>::initializeMatrixIndices()
+{
     // determine position of matrix entries
+    ElementIterator eItEnd = problem_.gridView().template end<0>();
     for (ElementIterator eIt = problem_.gridView().template begin<0>(); eIt != eItEnd; ++eIt)
     {
         // cell index
@@ -365,11 +385,11 @@ void FVPressure<TypeTag>::initializeMatrix()
                 A_.addindex(globalIdxI, globalIdxJ);
             }
     }
-    A_.endindices();
 
     return;
 }
 
+
 /*!\brief Function which assembles the system of equations to be solved
  *
  *  This function assembles the Matrix and the right hand side (RHS) vector to solve for
-- 
GitLab