From 2afc31a8a60e856abb75698532fffce075902899 Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Thu, 2 Aug 2012 09:24:24 +0000
Subject: [PATCH] some clean-up

   - moved some stuff from constructor into initialization method to avoid initialization bugs



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8790 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../2p/diffusion/mimetic/mimeticpressure2p.hh       | 13 ++++++-------
 dumux/decoupled/common/fv/fvpressure.hh             |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh
index 7f2daf193b..984ffae108 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh
@@ -118,7 +118,8 @@ template<class TypeTag> class MimeticPressure2P
     ///@endcond
 
     typedef typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix) Matrix;
-    typedef typename GET_PROP_TYPE(TypeTag, PressureRHSVector) Vector;
+    typedef typename GET_PROP_TYPE(TypeTag, PressureRHSVector) RHSVector;
+    typedef typename GET_PROP_TYPE(TypeTag, PressureSolutionVector) PressureSolution;
 
     //initializes the matrix to store the system of equations
     void initializeMatrix();
@@ -172,9 +173,11 @@ public:
         f_.resize(problem_.gridView().size(1));//resize to make sure the final grid size (after the problem was completely built) is used!
         pressure_.resize(problem_.gridView().size(0));
         pressTrace_.resize(problem_.gridView().size(1));
+        normalVelocity_.resize(problem_.gridView().size(0)),
         pressure_ = 0;
         pressTrace_ = 0;
         f_ = 0;
+        normalVelocity_ = 0.0;
         assemble(true);
         solve();
         postprocess();
@@ -276,10 +279,6 @@ public:
      */
     MimeticPressure2P(Problem& problem) :
     problem_(problem),
-    pressure_(problem.gridView().size(0)),
-    pressTrace_(problem.gridView().size(1)),
-    normalVelocity_(problem.gridView().size(0)),
-    f_(problem.gridView().size(1)),
     A_(problem.gridView())
     {
         if (pressureType != pglobal)
@@ -307,9 +306,9 @@ public:
 private:
     Problem& problem_;
     ScalarSolution pressure_;
-    TraceType pressTrace_; //!< vector of pressure traces
+    PressureSolution pressTrace_; //!< vector of pressure traces
     NormalVelType normalVelocity_;
-    TraceType f_;
+    RHSVector f_;
     OperatorAssembler A_;
 
     Scalar density_[numPhases];
diff --git a/dumux/decoupled/common/fv/fvpressure.hh b/dumux/decoupled/common/fv/fvpressure.hh
index 75e1a82463..667c540856 100644
--- a/dumux/decoupled/common/fv/fvpressure.hh
+++ b/dumux/decoupled/common/fv/fvpressure.hh
@@ -181,6 +181,7 @@ public:
     {
         size_ = problem_.gridView().size(0);//resize to make sure the final grid size (after the problem was completely built) is used!
         A_.setSize(size_, size_);
+        A_.setBuildMode(Matrix::random);
         f_.resize(size_);
         pressure_.resize(size_);
         asImp_().initializeMatrix();// initialize sparse matrix
@@ -259,7 +260,6 @@ public:
      */
     FVPressure(Problem& problem) :
     problem_(problem), size_(problem.gridView().size(0)),
-    pressure_(size_), A_(size_, size_, Matrix::random), f_(size_),
     fixPressureAtIndex_(0),
     idxFixPressureAtIndex_(0),
     hasFixPressureAtIndex_(false)
-- 
GitLab