diff --git a/dumux/boxmodels/common/boxassembler.hh b/dumux/boxmodels/common/boxassembler.hh index f4f7a6c7b4d078c59c31c61fdfab8767e20ab380..3bb3f08e3edfa852ca8a32a0ab2ddab10cf3480a 100644 --- a/dumux/boxmodels/common/boxassembler.hh +++ b/dumux/boxmodels/common/boxassembler.hh @@ -113,9 +113,6 @@ public: BoxAssembler() { - enableJacobianRecycling_ = GET_PARAM(TypeTag, bool, EnableJacobianRecycling); - enablePartialReassemble_ = GET_PARAM(TypeTag, bool, EnablePartialReassemble); - problemPtr_ = 0; matrix_ = 0; @@ -159,7 +156,7 @@ public: // initialize the storage part of the Jacobian matrix. Since // we only need this if Jacobian matrix recycling is enabled, // we do not waste space if it is disabled - if (enableJacobianRecycling_) { + if (enableJacobianRecycling_()) { storageJacobian_.resize(numVerts); storageTerm_.resize(numVerts); } @@ -167,7 +164,7 @@ public: totalElems_ = gridView_().comm().sum(numElems); // initialize data needed for partial reassembly - if (enablePartialReassemble_) { + if (enablePartialReassemble_()) { vertexColor_.resize(numVerts); vertexDelta_.resize(numVerts); elementColor_.resize(numElems); @@ -176,14 +173,14 @@ public: } /*! - * \brief Assemble the local jacobian of the problem. + * \brief Assemble the global Jacobian of the residual and the residual for the current solution. * * The current state of affairs (esp. the previous and the current * solutions) is represented by the model object. */ void assemble() { - bool printReassembleStatistics = enablePartialReassemble_ && !reuseMatrix_; + bool printReassembleStatistics = enablePartialReassemble_() && !reuseMatrix_; int succeeded; try { assemble_(); @@ -231,7 +228,7 @@ public: */ void setMatrixReuseable(bool yesno = true) { - if (enableJacobianRecycling_) + if (enableJacobianRecycling_()) reuseMatrix_ = yesno; } @@ -247,7 +244,7 @@ public: // do not use partial reassembly for the next iteration nextReassembleAccuracy_ = 0.0; - if (enablePartialReassemble_) { + if (enablePartialReassemble_()) { std::fill(vertexColor_.begin(), vertexColor_.end(), Red); @@ -283,7 +280,7 @@ public: void updateDiscrepancy(const SolutionVector &u, const SolutionVector &uDelta) { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return; // update the vector with the distances of the current @@ -342,7 +339,7 @@ public: */ void computeColors(Scalar relTol) { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return; ElementIterator elemIt = gridView_().template begin<0>(); @@ -486,7 +483,7 @@ public: */ int vertexColor(const Element &element, int vertIdx) const { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return Red; // reassemble unconditionally! int globalIdx = vertexMapper_().map(element, vertIdx, dim); @@ -500,7 +497,7 @@ public: */ int vertexColor(int globalVertIdx) const { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return Red; // reassemble unconditionally! return vertexColor_[globalVertIdx]; } @@ -512,7 +509,7 @@ public: */ int elementColor(const Element &element) const { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return Red; // reassemble unconditionally! int globalIdx = elementMapper_().map(element); @@ -526,7 +523,7 @@ public: */ int elementColor(int globalElementIdx) const { - if (!enablePartialReassemble_) + if (!enablePartialReassemble_()) return Red; // reassemble unconditionally! return elementColor_[globalElementIdx]; } @@ -543,8 +540,12 @@ public: const SolutionVector& residual() const { return residual_; } - private: + static bool enableJacobianRecycling_() + { return GET_PARAM(TypeTag, bool, EnableJacobianRecycling); } + static bool enablePartialReassemble_() + { return GET_PARAM(TypeTag, bool, EnablePartialReassemble); } + // Construct the BCRS matrix for the global jacobian void createMatrix_() { @@ -623,7 +624,7 @@ private: // always reset the right hand side. residual_ = 0.0; - if (!enablePartialReassemble_) { + if (!enablePartialReassemble_()) { // If partial reassembly of the jacobian is not enabled, // we can just reset everything! (*matrix_) = 0; @@ -827,9 +828,6 @@ private: Scalar nextReassembleAccuracy_; Scalar reassembleAccuracy_; - - bool enableJacobianRecycling_; - bool enablePartialReassemble_; }; } // namespace Dumux