From e18386c9d23825d9c0febe459fd4667490e5669c Mon Sep 17 00:00:00 2001 From: Andreas Lauser <and@poware.org> Date: Mon, 27 Jun 2011 16:41:17 +0000 Subject: [PATCH] remove trailing white space git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6080 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/boxmodels/1p2c/1p2clocalresidual.hh | 4 +- dumux/boxmodels/1p2c/1p2cvolumevariables.hh | 10 +-- dumux/boxmodels/2p2c/2p2cmodel.hh | 2 +- dumux/boxmodels/2p2c/2p2cvolumevariables.hh | 2 +- dumux/boxmodels/common/boxassembler.hh | 38 +++++------ dumux/boxmodels/common/boxlocaljacobian.hh | 8 +-- dumux/boxmodels/common/boxlocalresidual.hh | 6 +- dumux/boxmodels/common/boxmodel.hh | 26 +++---- dumux/boxmodels/common/boxproblem.hh | 4 +- dumux/boxmodels/common/boxproperties.hh | 2 +- dumux/boxmodels/common/boxvolumevariables.hh | 2 +- dumux/boxmodels/pdelab/pdelabadapter.hh | 4 +- dumux/common/fixedlengthspline_.hh | 26 +++---- dumux/common/math.hh | 6 +- dumux/common/spline.hh | 8 +-- dumux/common/splinecommon_.hh | 6 +- dumux/common/timemanager.hh | 2 +- dumux/common/variablelengthspline_.hh | 34 +++++----- .../decoupled/2p/diffusion/fv/fvpressure2p.hh | 2 +- dumux/decoupled/common/impetproblem.hh | 4 +- dumux/io/vtkmultiwriter.hh | 30 ++++---- dumux/io/vtknestedfunction.hh | 16 ++--- dumux/linear/borderindex.hh | 2 +- dumux/linear/boxlinearsolver.hh | 6 +- dumux/linear/domesticoverlapfrombcrsmatrix.hh | 54 +++++++-------- dumux/linear/elementborderlistfromgrid.hh | 26 +++---- dumux/linear/foreignoverlapfrombcrsmatrix.hh | 66 +++++++++--------- dumux/linear/globalindices.hh | 52 +++++++------- dumux/linear/impetbicgstabilu0solver.hh | 20 +++--- dumux/linear/overlappingbcrsmatrix.hh | 68 +++++++++---------- dumux/linear/overlappingblockvector.hh | 24 +++---- dumux/linear/overlappingoperator.hh | 2 +- dumux/linear/overlappingpreconditioner.hh | 14 ++-- dumux/linear/overlappingscalarproduct.hh | 10 +-- dumux/linear/vertexborderlistfromgrid.hh | 28 ++++---- dumux/material/constants.hh | 8 +-- .../2p/regularizedvangenuchten.hh | 6 +- .../fluidsystems/simplefluidsystem.hh | 34 +++++----- dumux/nonlinear/newtoncontroller.hh | 12 ++-- dumux/parallel/elementhandles.hh | 14 ++-- dumux/parallel/mpibuffer.hh | 26 +++---- dumux/parallel/vertexhandles.hh | 28 ++++---- test/boxmodels/2p/lensproblem.hh | 2 +- test/boxmodels/2p/test_2p.cc | 6 +- .../boxmodels/richards/richardslensproblem.hh | 2 +- test/decoupled/2p/test_impes.cc | 2 +- tutorial/tutorialproblem_coupled.hh | 2 +- 47 files changed, 378 insertions(+), 378 deletions(-) diff --git a/dumux/boxmodels/1p2c/1p2clocalresidual.hh b/dumux/boxmodels/1p2c/1p2clocalresidual.hh index 9816ab01c6..8e60d5af41 100644 --- a/dumux/boxmodels/1p2c/1p2clocalresidual.hh +++ b/dumux/boxmodels/1p2c/1p2clocalresidual.hh @@ -135,7 +135,7 @@ public: else { // storage term of continuity equation- molefractions - //careful: molarDensity changes with moleFrac! + //careful: molarDensity changes with moleFrac! result[contiEqIdx] += volVars.molarDensity()*volVars.porosity(); // storage term of the transport equation - molefractions result[transEqIdx] += @@ -270,7 +270,7 @@ public: this->fvElemGeom_(), localVertexIdx); } - + void evalBoundary_() { ParentType::evalBoundary_(); diff --git a/dumux/boxmodels/1p2c/1p2cvolumevariables.hh b/dumux/boxmodels/1p2c/1p2cvolumevariables.hh index 605ad88d97..ecdc163445 100644 --- a/dumux/boxmodels/1p2c/1p2cvolumevariables.hh +++ b/dumux/boxmodels/1p2c/1p2cvolumevariables.hh @@ -92,15 +92,15 @@ public: bool isOldSol) { ParentType::update(priVars, problem, element, elemGeom, scvIdx, isOldSol); - + asImp().updateTemperature_(priVars, element, elemGeom, scvIdx, problem); - + fluidState_.update(priVars, temperature_); - + porosity_ = problem.spatialParameters().porosity(element, elemGeom, scvIdx); tortuosity_ = problem.spatialParameters().tortuosity(element, elemGeom, scvIdx); dispersivity_ = problem.spatialParameters().dispersivity(element, elemGeom, scvIdx); @@ -109,7 +109,7 @@ public: temperature_, pressure(), fluidState_); - + diffCoeff_ = FluidSystem::diffCoeff(phaseIdx, comp0Idx, comp1Idx, @@ -230,7 +230,7 @@ protected: Vector dispersivity_; Scalar diffCoeff_; FluidState fluidState_; - + private: Implementation &asImp() { return *static_cast<Implementation*>(this); } diff --git a/dumux/boxmodels/2p2c/2p2cmodel.hh b/dumux/boxmodels/2p2c/2p2cmodel.hh index d0ddeb0df4..4ea2a3c312 100644 --- a/dumux/boxmodels/2p2c/2p2cmodel.hh +++ b/dumux/boxmodels/2p2c/2p2cmodel.hh @@ -570,7 +570,7 @@ public: if (primaryVarSwitch_(curGlobalSol, volVars, globalIdx, - global)) + global)) { this->jacobianAssembler().markVertexRed(globalIdx); wasSwitched = true; diff --git a/dumux/boxmodels/2p2c/2p2cvolumevariables.hh b/dumux/boxmodels/2p2c/2p2cvolumevariables.hh index ee3b462ece..30734db34e 100644 --- a/dumux/boxmodels/2p2c/2p2cvolumevariables.hh +++ b/dumux/boxmodels/2p2c/2p2cvolumevariables.hh @@ -135,7 +135,7 @@ public: kr = MaterialLaw::krn(materialParams, saturation(lPhaseIdx)); mobility_[phaseIdx] = kr / mu; Valgrind::CheckDefined(mobility_[phaseIdx]); - + // binary diffusion coefficents diffCoeff_[phaseIdx] = FluidSystem::diffCoeff(phaseIdx, diff --git a/dumux/boxmodels/common/boxassembler.hh b/dumux/boxmodels/common/boxassembler.hh index b92de09047..6db568d57e 100644 --- a/dumux/boxmodels/common/boxassembler.hh +++ b/dumux/boxmodels/common/boxassembler.hh @@ -200,7 +200,7 @@ public: } if (!succeeded) { - DUNE_THROW(NumericalProblem, + DUNE_THROW(NumericalProblem, "A process did not succeed in linearizing the system"); }; @@ -208,20 +208,20 @@ public: { greenElems_ = gridView_().comm().sum(greenElems_); reassembleAccuracy_ = gridView_().comm().max(nextReassembleAccuracy_); - + problem_().newtonController().endIterMsg() << ", reassembled " << totalElems_ - greenElems_ << "/" << totalElems_ << " (" << 100*Scalar(totalElems_ - greenElems_)/totalElems_ << "%) elems @accuracy=" << reassembleAccuracy_; } - + // reset all vertex colors to green for (int i = 0; i < vertexColor_.size(); ++i) { vertexColor_[i] = Green; } } - + /*! * \brief If Jacobian matrix recycling is enabled, this method * specifies whether the next call to assemble() just @@ -303,7 +303,7 @@ public: } } - + /*! * \brief Force to reassemble a given vertex next time the * assemble() method is called. @@ -354,7 +354,7 @@ public: // the relative tolerance vertexColor_[i] = Red; else - nextReassembleAccuracy_ = + nextReassembleAccuracy_ = std::max(nextReassembleAccuracy_, vertexDelta_[i]); }; @@ -405,10 +405,10 @@ public: // the red vertex for yellow border vertices VertexHandleMin<EntityColor, std::vector<EntityColor>, VertexMapper> minHandle(vertexColor_, vertexMapper_()); - gridView_().communicate(minHandle, + gridView_().communicate(minHandle, Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); - + // Mark yellow elements elemIt = gridView_().template begin<0>(); for (; elemIt != elemEndIt; ++elemIt) { @@ -455,7 +455,7 @@ public: VertexHandleMax<EntityColor, std::vector<EntityColor>, VertexMapper> maxHandle(vertexColor_, vertexMapper_()); - gridView_().communicate(maxHandle, + gridView_().communicate(maxHandle, Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); @@ -559,11 +559,11 @@ private: for (; eIt != eEndIt; ++eIt) { const Element &elem = *eIt; int n = elem.template count<dim>(); - + // if the element is not in the interior or the process // border, all dofs just contain main-diagonal entries if (elem.partitionType() != Dune::InteriorEntity && - elem.partitionType() != Dune::BorderEntity) + elem.partitionType() != Dune::BorderEntity) { for (int i = 0; i < n; ++i) { int globalI = vertexMapper_().map(*eIt, i, dim); @@ -633,7 +633,7 @@ private: storageTerm_[i] = 0; }; } - + return; } @@ -663,7 +663,7 @@ private: void assemble_() { resetSystem_(); - + // if we can "recycle" the current linearization, we do it // here and be done with it... Scalar curDt = problem_().timeManager().timeStepSize(); @@ -672,7 +672,7 @@ private: for (int i = 0; i < numVertices; ++i) { // rescale the mass term of the jacobian matrix MatrixBlock &J_i_i = (*matrix_)[i][i]; - + J_i_i -= storageJacobian_[i]; storageJacobian_[i] *= oldDt_/curDt; J_i_i += storageJacobian_[i]; @@ -687,7 +687,7 @@ private: residual_[i] = storageTerm_[i]; residual_[i] *= -1; }; - + reuseMatrix_ = false; oldDt_ = curDt; return; @@ -695,7 +695,7 @@ private: oldDt_ = curDt; greenElems_ = 0; - + // reassemble the elements... ElementIterator elemIt = gridView_().template begin<0>(); ElementIterator elemEndIt = gridView_().template end<0>(); @@ -762,7 +762,7 @@ private: int n = elem.template count<dim>(); for (int i=0; i < n; ++i) { const VertexPointer vp = elem.template subEntity<dim>(i); - + if (vp->partitionType() == Dune::InteriorEntity || vp->partitionType() == Dune::BorderEntity) { @@ -807,7 +807,7 @@ private: // attributes required for jacobian matrix recycling bool reuseMatrix_; - // The storage part of the local Jacobian + // The storage part of the local Jacobian std::vector<MatrixBlock> storageJacobian_; std::vector<VectorBlock> storageTerm_; // time step size of last assembly @@ -821,7 +821,7 @@ private: int totalElems_; int greenElems_; - + Scalar nextReassembleAccuracy_; Scalar reassembleAccuracy_; }; diff --git a/dumux/boxmodels/common/boxlocaljacobian.hh b/dumux/boxmodels/common/boxlocaljacobian.hh index 29ea005636..2a24af992b 100644 --- a/dumux/boxmodels/common/boxlocaljacobian.hh +++ b/dumux/boxmodels/common/boxlocaljacobian.hh @@ -173,14 +173,14 @@ public: // set the hints for the volume variables model_().setHints(element, prevVolVars_, curVolVars_); - + // update the secondary variables for the element at the last // and the current time levels prevVolVars_.update(problem_(), elem_(), fvElemGeom_, true /* isOldSol? */); - + curVolVars_.update(problem_(), elem_(), fvElemGeom_, @@ -209,7 +209,7 @@ public: storageDeriv, j, pvIdx); - + // update the local stiffness matrix with the current partial // derivatives updateLocalJacobian_(j, @@ -531,7 +531,7 @@ protected: // levels ElementVolumeVariables prevVolVars_; ElementVolumeVariables curVolVars_; - + LocalResidual localResidual_; LocalBlockMatrix A_; diff --git a/dumux/boxmodels/common/boxlocalresidual.hh b/dumux/boxmodels/common/boxlocalresidual.hh index 100d8b24c5..3d55363fc2 100644 --- a/dumux/boxmodels/common/boxlocalresidual.hh +++ b/dumux/boxmodels/common/boxlocalresidual.hh @@ -291,7 +291,7 @@ public: int numVerts = fvElemGeom_().numVertices; residual_.resize(numVerts); storageTerm_.resize(numVerts); - + residual_ = 0.0; storageTerm_ = 0.0; @@ -345,7 +345,7 @@ public: protected: Implementation &asImp_() - { + { assert(static_cast<Implementation*>(this) != 0); return *static_cast<Implementation*>(this); } @@ -398,7 +398,7 @@ protected: Valgrind::CheckDefined(pvIdx); Valgrind::CheckDefined(curPrimaryVar_(i, pvIdx)); Valgrind::CheckDefined(tmp[pvIdx]); - + this->residual_[i][eqIdx] = curPrimaryVar_(i, pvIdx) - tmp[pvIdx]; diff --git a/dumux/boxmodels/common/boxmodel.hh b/dumux/boxmodels/common/boxmodel.hh index b332565a3c..d8145e4f46 100644 --- a/dumux/boxmodels/common/boxmodel.hh +++ b/dumux/boxmodels/common/boxmodel.hh @@ -145,7 +145,7 @@ public: curHints_.resize(nVerts); prevHints_.resize(nVerts); hintsUsable_.resize(nVerts); - std::fill(hintsUsable_.begin(), + std::fill(hintsUsable_.begin(), hintsUsable_.end(), false); } @@ -156,9 +156,9 @@ public: } void setHints(const Element &elem, - ElementVolumeVariables &prevVolVars, + ElementVolumeVariables &prevVolVars, ElementVolumeVariables &curVolVars) const - { + { if (!enableHints) return; @@ -167,7 +167,7 @@ public: curVolVars.resize(n); for (int i = 0; i < n; ++i) { int globalIdx = problem_().vertexMapper().map(elem, i, dim); - + if (!hintsUsable_[globalIdx]) { curVolVars[i].setHint(NULL); prevVolVars[i].setHint(NULL); @@ -181,7 +181,7 @@ public: void setHints(const Element &elem, ElementVolumeVariables &curVolVars) const - { + { if (!enableHints) return; @@ -189,7 +189,7 @@ public: curVolVars.resize(n); for (int i = 0; i < n; ++i) { int globalIdx = problem_().vertexMapper().map(elem, i, dim); - + if (!hintsUsable_[globalIdx]) curVolVars[i].setHint(NULL); else @@ -205,7 +205,7 @@ public: prevHints_ = curHints_; }; - void updateCurHints(const Element &elem, + void updateCurHints(const Element &elem, const ElementVolumeVariables &ev) const { if (!enableHints) @@ -265,9 +265,9 @@ public: // add up the residuals on the process borders if (gridView().comm().size() > 1) { - VertexHandleSum<PrimaryVariables, SolutionVector, VertexMapper> + VertexHandleSum<PrimaryVariables, SolutionVector, VertexMapper> sumHandle(dest, vertexMapper()); - gridView().communicate(sumHandle, + gridView().communicate(sumHandle, Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); } @@ -499,7 +499,7 @@ public: // make the current solution the previous one. uPrev_ = uCur_; prevHints_ = curHints_; - + updatePrevHints(); } @@ -825,14 +825,14 @@ protected: // add up the primary variables and the volumes of the boxes // which cross process borders if (gridView().comm().size() > 1) { - VertexHandleSum<Dune::FieldVector<Scalar, 1>, + VertexHandleSum<Dune::FieldVector<Scalar, 1>, Dune::BlockVector<Dune::FieldVector<Scalar, 1> >, VertexMapper> sumVolumeHandle(boxVolume_, vertexMapper()); - gridView().communicate(sumVolumeHandle, + gridView().communicate(sumVolumeHandle, Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); - VertexHandleSum<PrimaryVariables, SolutionVector, VertexMapper> + VertexHandleSum<PrimaryVariables, SolutionVector, VertexMapper> sumPVHandle(uCur_, vertexMapper()); gridView().communicate(sumPVHandle, Dune::InteriorBorder_InteriorBorder_Interface, diff --git a/dumux/boxmodels/common/boxproblem.hh b/dumux/boxmodels/common/boxproblem.hh index 1468bdb109..0f8427c6aa 100644 --- a/dumux/boxmodels/common/boxproblem.hh +++ b/dumux/boxmodels/common/boxproblem.hh @@ -144,7 +144,7 @@ public: * * By default this the time step size is unrestricted. */ - Scalar maxTimeStepSize() const + Scalar maxTimeStepSize() const { return std::numeric_limits<Scalar>::infinity(); } /*! @@ -772,7 +772,7 @@ private: void createResultWriter_() { if (!resultWriter_) resultWriter_ = new VtkMultiWriter(gridView_, asImp_().name()); }; - std::string simName_; + std::string simName_; const GridView gridView_; GlobalPosition bboxMin_; diff --git a/dumux/boxmodels/common/boxproperties.hh b/dumux/boxmodels/common/boxproperties.hh index 652f7eb170..9278bf6f48 100644 --- a/dumux/boxmodels/common/boxproperties.hh +++ b/dumux/boxmodels/common/boxproperties.hh @@ -106,7 +106,7 @@ NEW_PROP_TAG(EnableTimeStepRampUp); NEW_PROP_TAG(NumericDifferenceMethod); /*! - * \brief Specify whether to use the already calculated solutions as + * \brief Specify whether to use the already calculated solutions as * starting values of the volume variables. * * This only makes sense if the calculation of the volume variables is diff --git a/dumux/boxmodels/common/boxvolumevariables.hh b/dumux/boxmodels/common/boxvolumevariables.hh index 42b3dc18ec..4881568f07 100644 --- a/dumux/boxmodels/common/boxvolumevariables.hh +++ b/dumux/boxmodels/common/boxvolumevariables.hh @@ -138,7 +138,7 @@ public: * \param pvIdx The index of the primary variable of interest */ Scalar primaryVar(int pvIdx) const - { + { return primaryVars_[pvIdx]; } diff --git a/dumux/boxmodels/pdelab/pdelabadapter.hh b/dumux/boxmodels/pdelab/pdelabadapter.hh index 63f73c3760..eac494bb23 100644 --- a/dumux/boxmodels/pdelab/pdelabadapter.hh +++ b/dumux/boxmodels/pdelab/pdelabadapter.hh @@ -20,7 +20,7 @@ /*! * \file * - * \brief This file provides wrappers which allow the Dumux box models to + * \brief This file provides wrappers which allow the Dumux box models to * be used with dune pdelab */ #ifndef DUMUX_PDELAB_ADAPTER_HH @@ -120,7 +120,7 @@ public: }; // set the local operator used for submodels -SET_PROP(BoxPDELab, LocalOperator) +SET_PROP(BoxPDELab, LocalOperator) { typedef Dumux::PDELab::BoxLocalOperator<TypeTag> type; }; // set the grid operator space used for submodels diff --git a/dumux/common/fixedlengthspline_.hh b/dumux/common/fixedlengthspline_.hh index 8275bfc224..a6fea356b2 100644 --- a/dumux/common/fixedlengthspline_.hh +++ b/dumux/common/fixedlengthspline_.hh @@ -98,7 +98,7 @@ public: DUNE_DEPRECATED // use setXYArrays void set(const ScalarContainer &x, const ScalarContainer &y, - Scalar m0, + Scalar m0, Scalar m1) { setXYArrays(numSamples(), x, y, m0, m1); } @@ -107,7 +107,7 @@ public: void set(int numberSamples, const ScalarArray &x, const ScalarArray &y, - Scalar m0, + Scalar m0, Scalar m1) { setXYArrays(numberSamples, x, y, m0, m1); } @@ -134,7 +134,7 @@ public: std::copy(y.begin(), y.end(), yPos_.begin()); makeFullSpline_(m0, m1); } - + /*! * \brief Set the sampling points and the boundary slopes of a * full spline using a C-style array. @@ -148,9 +148,9 @@ public: * the number of sampling points must be larger than 1. */ template <class PointArray> - void setArrayOfPoints(int numberSamples, + void setArrayOfPoints(int numberSamples, const PointArray &points, - Scalar m0, + Scalar m0, Scalar m1) { // a spline with no or just one sampling points? what an @@ -167,7 +167,7 @@ public: template <class XYContainer> DUNE_DEPRECATED // use setArrayOfPoints instead void set(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { setArrayOfPoints(numSamples(), points, m0, m1); } @@ -186,7 +186,7 @@ public: */ template <class XYContainer> void setContainerOfPoints(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { assert(points.size() == numSamples()); @@ -219,7 +219,7 @@ public: */ template <class XYContainer> void setContainerOfTuples(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { assert(points.size() == numSamples()); @@ -234,7 +234,7 @@ public: // make a full spline makeFullSpline_(m0, m1); } - + /////////////////////////////////////// /////////////////////////////////////// /////////////////////////////////////// @@ -263,7 +263,7 @@ public: xPos_[i] = x[i]; yPos_[i] = y[i]; } - + makeNaturalSpline_(); } @@ -303,8 +303,8 @@ public: std::copy(y.begin(), y.end(), yPos_.begin()); makeNaturalSpline_(); } - - + + /*! * \brief Set the sampling points of a natural spline using a * C-style array. @@ -318,7 +318,7 @@ public: * the number of sampling points must be larger than 1. */ template <class PointArray> - void setArrayOfPoints(int numberSamples, + void setArrayOfPoints(int numberSamples, const PointArray &points) { assert(numberSamples == numSamples()); diff --git a/dumux/common/math.hh b/dumux/common/math.hh index c055f7b0c9..6215e328c4 100644 --- a/dumux/common/math.hh +++ b/dumux/common/math.hh @@ -349,14 +349,14 @@ void invertCubicPolynomialPostProcess_(SolContainer &sol, for (int i = 0; i < numSol; ++i) { Scalar x = sol[i]; Scalar fOld = d + x*(c + x*(b + x*a)); - + Scalar fPrime = c + x*(2*b + x*3*a); if (fPrime == 0.0) continue; x -= fOld/fPrime; - + Scalar fNew = d + x*(c + x*(b + x*a)); - if (std::abs(fNew) < std::abs(fOld)) + if (std::abs(fNew) < std::abs(fOld)) sol[i] = x; }; }; diff --git a/dumux/common/spline.hh b/dumux/common/spline.hh index fd0baa76db..dd8ae56cf9 100644 --- a/dumux/common/spline.hh +++ b/dumux/common/spline.hh @@ -423,7 +423,7 @@ public: * \param m1 The slope of the spline at \f$x_1\f$ */ template <class PointArray> - void setArrayOfPoints(int nSamples, + void setArrayOfPoints(int nSamples, const PointArray &points, Scalar m0, Scalar m1) @@ -433,7 +433,7 @@ public: set(points[0][0], points[1][0], points[0][1], - points[1][1], + points[1][1], m0, m1); } @@ -464,7 +464,7 @@ public: typename PointContainer::const_iterator it0 = points.begin(); typename PointContainer::const_iterator it1 = it0; ++it1; - + set((*it0)[0], (*it0)[1], (*it1)[0], @@ -490,7 +490,7 @@ public: typename TupleContainer::const_iterator it0 = tuples.begin(); typename TupleContainer::const_iterator it1 = it0; ++it1; - + set(std::get<0>(*it0), std::get<1>(*it0), std::get<0>(*it1), diff --git a/dumux/common/splinecommon_.hh b/dumux/common/splinecommon_.hh index 608e90c3ee..f6cfcf22c0 100644 --- a/dumux/common/splinecommon_.hh +++ b/dumux/common/splinecommon_.hh @@ -180,10 +180,10 @@ public: else if (x > xMax()) evalDerivative_(xMax(), numSamples_() - 1); } - + return evalDerivative_(x, segmentIdx_(x)); } - + /*! * \brief Find the intersections of the spline with a cubic * polynomial in the whole intervall, throws @@ -360,7 +360,7 @@ protected: int numSamples) { assert(numSamples >= 2); - + // copy sample points, make sure that the first x value is // smaller than the last one diff --git a/dumux/common/timemanager.hh b/dumux/common/timemanager.hh index 22ae1aabf9..26b584fa0f 100644 --- a/dumux/common/timemanager.hh +++ b/dumux/common/timemanager.hh @@ -400,7 +400,7 @@ public: if (verbose_) { int numProcesses = Dune::MPIHelper::getCollectiveCommunication().size(); - std::cout << "Simulation took " << timer.elapsed() <<" seconds on " + std::cout << "Simulation took " << timer.elapsed() <<" seconds on " << numProcesses << " processes.\n" << "The cumulative CPU time was " << timer.elapsed()*numProcesses << " seconds.\n" << "We hope that you enjoyed simulating with us\n" diff --git a/dumux/common/variablelengthspline_.hh b/dumux/common/variablelengthspline_.hh index 592b24b1ef..d0f9a7d5c8 100644 --- a/dumux/common/variablelengthspline_.hh +++ b/dumux/common/variablelengthspline_.hh @@ -55,7 +55,7 @@ public: int numSamples() const { return xPos_.size(); } - + /////////////////////////////////////// /////////////////////////////////////// /////////////////////////////////////// @@ -96,7 +96,7 @@ public: void set(int nSamples, const ScalarArray &x, const ScalarArray &y, - Scalar m0, + Scalar m0, Scalar m1) { setXYArrays(nSamples, x, y, m0, m1); } @@ -124,16 +124,16 @@ public: std::copy(y.begin(), y.end(), yPos_.begin()); makeFullSpline_(m0, m1); } - + template <class ScalarContainer> DUNE_DEPRECATED // use setXYContainers void set(const ScalarContainer &x, const ScalarContainer &y, - Scalar m0, + Scalar m0, Scalar m1) { setXYContainers(x, y, m0, m1); } - + /*! * \brief Set the sampling points and the boundary slopes of a * full spline using a C-style array. @@ -147,9 +147,9 @@ public: * the number of sampling points must be larger than 1. */ template <class PointArray> - void setArrayOfPoints(int nSamples, + void setArrayOfPoints(int nSamples, const PointArray &points, - Scalar m0, + Scalar m0, Scalar m1) { // a spline with no or just one sampling points? what an @@ -168,7 +168,7 @@ public: DUNE_DEPRECATED // use setArrayOfPoints instead void set(int nSamples, const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { setArrayOfPoints(nSamples, points, m0, m1); } @@ -187,7 +187,7 @@ public: */ template <class XYContainer> void setContainerOfPoints(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { // a spline with no or just one sampling points? what an @@ -209,7 +209,7 @@ public: template <class XYContainer> DUNE_DEPRECATED // use setContainerOfPoints() instead void set(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { setContainerOfPoints(points, m0, m1); } @@ -230,7 +230,7 @@ public: */ template <class XYContainer> void setContainerOfTuples(const XYContainer &points, - Scalar m0, + Scalar m0, Scalar m1) { // resize internal arrays @@ -245,7 +245,7 @@ public: // make a full spline makeFullSpline_(m0, m1); } - + /////////////////////////////////////// /////////////////////////////////////// /////////////////////////////////////// @@ -275,7 +275,7 @@ public: xPos_[i] = x[i]; yPos_[i] = y[i]; } - + makeNaturalSpline_(); } @@ -309,14 +309,14 @@ public: std::copy(y.begin(), y.end(), yPos_.begin()); makeNaturalSpline_(); } - + template <class ScalarContainer> DUNE_DEPRECATED // use setXYContainers void set(const ScalarContainer &x, const ScalarContainer &y) { setXYContainers(x, y); } - + /*! * \brief Set the sampling points of a natural spline using a * C-style array. @@ -330,7 +330,7 @@ public: * the number of sampling points must be larger than 1. */ template <class PointArray> - void setArrayOfPoints(int nSamples, + void setArrayOfPoints(int nSamples, const PointArray &points) { // a spline with no or just one sampling points? what an @@ -416,7 +416,7 @@ public: // make a natural spline makeNaturalSpline_(); } - + protected: /*! * \brief Resizes the internal vectors to store the sample points. diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh index cccc6d789e..7d4f9dc503 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh @@ -882,7 +882,7 @@ void FVPressure2P<TypeTag>::updateMaterialLaws() problem_.variables().capillaryPressure(globalIdx) = MaterialLaw::pC( problem_.spatialParameters().materialLawParams(globalPos, *eIt), satW); - + //determine phase pressures from primary pressure variable Scalar pressW = 0; Scalar pressNW = 0; diff --git a/dumux/decoupled/common/impetproblem.hh b/dumux/decoupled/common/impetproblem.hh index f1983273e2..d41877001f 100644 --- a/dumux/decoupled/common/impetproblem.hh +++ b/dumux/decoupled/common/impetproblem.hh @@ -358,7 +358,7 @@ public: * \brief Returns the current grid which used by the problem. */ Grid &grid() - { + { if (grid_) { return *grid_; @@ -369,7 +369,7 @@ public: } /*! * \brief Specifies the grid from outside the problem. - * \param grid The grid used by the problem. + * \param grid The grid used by the problem. */ void setGrid(Grid &grid) { diff --git a/dumux/io/vtkmultiwriter.hh b/dumux/io/vtkmultiwriter.hh index 9b0ff0f7c6..8501f3b0f5 100644 --- a/dumux/io/vtkmultiwriter.hh +++ b/dumux/io/vtkmultiwriter.hh @@ -73,7 +73,7 @@ class VtkMultiWriter struct ElementLayout { bool contains (Dune::GeometryType gt) const { return gt.dim() == dim; } }; - + typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, VertexLayout> VertexMapper; typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, ElementLayout> ElementMapper; #endif @@ -81,14 +81,14 @@ class VtkMultiWriter // this constructor won't work anymore. Please use the variant // below which also includes the GridView as an argument. DUNE_DEPRECATED - VtkMultiWriter(const std::string &simName = "", + VtkMultiWriter(const std::string &simName = "", std::string multiFileName = "") {} public: typedef Dune::VTKWriter<GridView> VtkWriter; - VtkMultiWriter(const GridView &gridView, - const std::string &simName = "", + VtkMultiWriter(const GridView &gridView, + const std::string &simName = "", std::string multiFileName = "") : gridView_(gridView) , elementMapper_(gridView) @@ -150,7 +150,7 @@ public: curTime_ = t; curOutFileName_ = fileName_(); } - + void beginTimestep(double t, const GridView &gridView) DUNE_DEPRECATED // use beginWrite() { gridChanged(); beginWrite(t); } @@ -165,7 +165,7 @@ public: Dune::BlockVector<Dune::FieldVector<Scalar, nComp> > *allocateManagedBuffer(int nEntities) { typedef Dune::BlockVector<Dune::FieldVector<Scalar, nComp> > VectorField; - + ManagedVectorField_<VectorField> *vfs = new ManagedVectorField_<VectorField>(nEntities); managedObjects_.push_back(vfs); @@ -179,17 +179,17 @@ public: /*! * \brief Add a finished vertex centered vector field to the - * output. - * \brief Add a vertex-centered quantity to the output. + * output. + * \brief Add a vertex-centered quantity to the output. * * If the buffer is managed by the VtkMultiWriter, it must have * been created using createField() and may not be used by * anywhere after calling this method. After the data is written - * to disk, it will be deleted automatically. + * to disk, it will be deleted automatically. * * If the buffer is not managed by the MultiWriter, the buffer * must exist at least until the call to endWrite() - * finishes. + * finishes. * * In both cases, modifying the buffer between the call to this * method and endWrite() results in _undefined behaviour_. @@ -221,18 +221,18 @@ public: * If the buffer is managed by the VtkMultiWriter, it must have * been created using createField() and may not be used by * anywhere after calling this method. After the data is written - * to disk, it will be deleted automatically. + * to disk, it will be deleted automatically. * * If the buffer is not managed by the MultiWriter, the buffer * must exist at least until the call to endWrite() - * finishes. + * finishes. * * In both cases, modifying the buffer between the call to this * method and endWrite() results in _undefined behaviour_. */ template <class DataBuffer> void attachCellData(DataBuffer &buf, const char *name, int nComps = 1) - { + { typedef typename VtkWriter::VTKFunctionPtr FunctionPtr; typedef Dumux::VtkNestedFunction<Grid, ElementMapper, DataBuffer> VtkFn; FunctionPtr fnPtr(new VtkFn(name, @@ -352,7 +352,7 @@ public: { res.deserializeSectionBegin("VTKMultiWriter"); res.deserializeStream() >> curWriterNum_; - + if (commRank_ == 0) { std::string dummy; std::getline(res.deserializeStream(), dummy); @@ -452,7 +452,7 @@ private: // set values which are too small to 0 to avoid // problems with paraview - if (std::abs(b[i][j]) + if (std::abs(b[i][j]) < std::numeric_limits<float>::min()) { b[i][j] = 0.0; diff --git a/dumux/io/vtknestedfunction.hh b/dumux/io/vtknestedfunction.hh index 36fdcb7637..551f6cc7c3 100644 --- a/dumux/io/vtknestedfunction.hh +++ b/dumux/io/vtknestedfunction.hh @@ -19,8 +19,8 @@ *****************************************************************************/ /*! * \file - * \brief Provides a vector-valued function using Dune::FieldVectors - * as elements. + * \brief Provides a vector-valued function using Dune::FieldVectors + * as elements. */ #ifndef VTK_NESTED_FUNCTION_HH #define VTK_NESTED_FUNCTION_HH @@ -40,8 +40,8 @@ namespace Dumux { /*! - * \brief Provides a vector-valued function using Dune::FieldVectors - * as elements. + * \brief Provides a vector-valued function using Dune::FieldVectors + * as elements. */ template <class Grid, class Mapper, class Buffer> class VtkNestedFunction : public Dune::VTKFunction<Grid> @@ -70,10 +70,10 @@ public: virtual std::string name () const { return name_; }; - virtual int ncomps() const + virtual int ncomps() const { return numComp_; } - virtual double evaluate(int mycomp, + virtual double evaluate(int mycomp, const Element &e, const Dune::FieldVector< ctype, dim > &xi) const { @@ -101,7 +101,7 @@ public: imin = i; } } - + // map vertex to an index idx = mapper_.map(e, imin, codim_); } @@ -109,7 +109,7 @@ public: DUNE_THROW(Dune::InvalidStateException, "Only element and vertex based vector " " fields are supported so far."); - + double val = buf_[idx][mycomp]; if (std::abs(val) < std::numeric_limits<float>::min()) val = 0; diff --git a/dumux/linear/borderindex.hh b/dumux/linear/borderindex.hh index 8646a130da..8ad5e373cc 100644 --- a/dumux/linear/borderindex.hh +++ b/dumux/linear/borderindex.hh @@ -38,7 +38,7 @@ struct BorderIndex //! Rank of the peer process int peerRank; - + //! Distance to the process border for the peer (in hops) int borderDistance; diff --git a/dumux/linear/boxlinearsolver.hh b/dumux/linear/boxlinearsolver.hh index 446f692b95..b92f17de1e 100644 --- a/dumux/linear/boxlinearsolver.hh +++ b/dumux/linear/boxlinearsolver.hh @@ -146,7 +146,7 @@ public: /*! * \brief Set the structure of the linear system of equations to be solved. - * + * * This method allocates space an does the necessary * communication before actually calling the solve() method. As * long as the structure of the linear system does not change, the @@ -159,12 +159,12 @@ public: }; /*! - * \brief Actually solve the linear system of equations. + * \brief Actually solve the linear system of equations. * * \return true if the residual reduction could be achieved, else false. */ template <class PrecBackend, class SolverBackend> - bool solve(const Matrix &M, + bool solve(const Matrix &M, Vector &x, const Vector &b) { diff --git a/dumux/linear/domesticoverlapfrombcrsmatrix.hh b/dumux/linear/domesticoverlapfrombcrsmatrix.hh index 0224cf9bb4..2728de0caa 100644 --- a/dumux/linear/domesticoverlapfrombcrsmatrix.hh +++ b/dumux/linear/domesticoverlapfrombcrsmatrix.hh @@ -56,7 +56,7 @@ class DomesticOverlapFromBCRSMatrix typedef Dumux::ForeignOverlapFromBCRSMatrix<BCRSMatrix> ForeignOverlap; typedef Dumux::GlobalIndices<ForeignOverlap> GlobalIndices; - + public: typedef int ProcessRank; typedef int BorderDistance; @@ -107,13 +107,13 @@ public: */ const BorderList& borderList() const { return foreignOverlap_.borderList(); }; - + /*! * \brief Returns true iff a domestic index is a border index. */ bool isBorder(int domesticIdx) const - { + { return isLocal(domesticIdx) && foreignOverlap_.isBorder(domesticIdx); }; @@ -135,13 +135,13 @@ public: * for a given peer process. */ int isFrontFor(int peerRank, int domesticIdx) const - { + { typedef std::map<ProcessRank, BorderDistance>::const_iterator iterator; iterator it = domesticOverlapByIndex_[domesticIdx].find(peerRank); if (it == domesticOverlapByIndex_[domesticIdx].end()) return false; // not seen by the process - return it->second == foreignOverlap_.overlapSize(); + return it->second == foreignOverlap_.overlapSize(); }; /*! @@ -149,7 +149,7 @@ public: * index and for which the index is not on the front. */ int numNonFrontProcesses(int domesticIdx) const - { + { int result = 0; if (!isFront(domesticIdx)) ++result; @@ -161,7 +161,7 @@ public: if (it->second < overlapSize()) ++result; } - + return result; }; @@ -177,7 +177,7 @@ public: */ const PeerSet &peerSet() const { return peerSet_; } - + /*! * \brief Returns the foreign overlap @@ -251,7 +251,7 @@ public: * given domestic index. */ bool iAmMasterOf(int domesticIdx) const - { + { if (!isLocal(domesticIdx)) return false; return foreignOverlap_.masterOf(domesticIdx) == myRank_; @@ -261,7 +261,7 @@ public: * \brief Return true iff a given index is shared by more than one process */ bool isShared(int domesticIdx) const - { + { if (!isLocal(domesticIdx)) return false; return foreignOverlap_.isShared(domesticIdx); @@ -272,11 +272,11 @@ public: * domestic index. */ bool isMasterOf(int peerRank, int domesticIdx) const - { + { if (isLocal(domesticIdx)) { return foreignOverlap_.masterOf(domesticIdx) == peerRank; }; - + // if the local index is a border index, loop over all ranks // for which this index is also a border index. the lowest // rank wins! @@ -303,7 +303,7 @@ public: * \brief Returns a domestic index given a global one */ Index globalToDomestic(Index globalIdx) const - { + { return globalIndices_.globalToDomestic(globalIdx); } @@ -311,10 +311,10 @@ public: * \brief Returns a global index given a domestic one */ Index domesticToGlobal(Index domIdx) const - { + { return globalIndices_.domesticToGlobal(domIdx); } - + protected: void buildDomesticOverlap_(const BCRSMatrix &A) { @@ -344,7 +344,7 @@ protected: PeerSet::const_iterator peerIt; PeerSet::const_iterator peerEndIt = foreignOverlap_.peerSet().end(); - // send the overlap indices to all peer processes + // send the overlap indices to all peer processes peerIt = foreignOverlap_.peerSet().begin(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; @@ -357,7 +357,7 @@ protected: int peerRank = *peerIt; receiveIndicesFromPeer_(peerRank); }; - + // receive our overlap from the processes to all peer processes peerIt = foreignOverlap_.peerSet().begin(); for (; peerIt != peerEndIt; ++peerIt) { @@ -367,7 +367,7 @@ protected: }; void sendIndicesToPeer_(int peerRank) - { + { #if HAVE_MPI const ForeignOverlapWithPeer &foreignOverlap = foreignOverlap_.foreignOverlapWithPeer(peerRank); @@ -382,7 +382,7 @@ protected: // create MPI buffers indicesSendBuff_[peerRank] = new MpiBuffer<IndexDistanceNpeers>(numIndices); - + // then send the additional indices themselfs ForeignOverlapWithPeer::const_iterator overlapIt = foreignOverlap.begin(); ForeignOverlapWithPeer::const_iterator overlapEndIt = foreignOverlap.end(); @@ -399,15 +399,15 @@ protected: IndexDistanceNpeers(globalIndices_.domesticToGlobal(localIdx), borderDistance, numPeers); - + // send all peer ranks which see the given index peersSendBuff_[peerRank].push_back(new MpiBuffer<int>(2*numPeers)); typename std::map<ProcessRank, BorderDistance>::const_iterator it = foreignIndexOverlap.begin(); typename std::map<ProcessRank, BorderDistance>::const_iterator endIt = foreignIndexOverlap.end(); for (int j = 0; it != endIt; ++it, ++j) - { - (*peersSendBuff_[peerRank][i])[2*j + 0] = it->first; - (*peersSendBuff_[peerRank][i])[2*j + 1] = it->second; + { + (*peersSendBuff_[peerRank][i])[2*j + 0] = it->first; + (*peersSendBuff_[peerRank][i])[2*j + 1] = it->second; }; }; @@ -464,7 +464,7 @@ protected: domesticIdx = globalIndices_.numDomestic(); borderDistance_.resize(domesticIdx + 1, std::numeric_limits<int>::max()); domesticOverlapByIndex_.resize(domesticIdx + 1); - + globalIndices_.addIndex(domesticIdx, globalIdx); domesticOverlapByIndex_[domesticIdx][peerRank] = borderDistance; domesticOverlapWithPeer_[peerRank].insert(domesticIdx); @@ -473,10 +473,10 @@ protected: domesticIdx = globalIndices_.globalToDomestic(globalIdx); } } - else + else // border index domesticIdx = globalIndices_.globalToDomestic(globalIdx); - + borderDistance_[domesticIdx] = std::min(borderDistance, borderDistance_[domesticIdx]); // receive the peer ranks which see this index @@ -501,7 +501,7 @@ protected: DomesticOverlapByRank domesticOverlapWithPeer_; DomesticOverlapByIndex domesticOverlapByIndex_; std::vector<int> borderDistance_; - + std::map<ProcessRank, MpiBuffer<int>* > numIndicesSendBuff_; std::map<ProcessRank, MpiBuffer<IndexDistanceNpeers>* > indicesSendBuff_; std::map<ProcessRank, std::vector<MpiBuffer<int>*> > peersSendBuff_; diff --git a/dumux/linear/elementborderlistfromgrid.hh b/dumux/linear/elementborderlistfromgrid.hh index cc4351ca4a..a4b67f9cf1 100644 --- a/dumux/linear/elementborderlistfromgrid.hh +++ b/dumux/linear/elementborderlistfromgrid.hh @@ -68,12 +68,12 @@ public: : gv_(gv), map_(map) { forwardComm_ = true; - gv.communicate(*this, + gv.communicate(*this, Dune::InteriorBorder_All_Interface, Dune::ForwardCommunication); forwardComm_ = false; - gv.communicate(*this, + gv.communicate(*this, Dune::InteriorBorder_All_Interface, Dune::BackwardCommunication); }; @@ -81,26 +81,26 @@ public: // data handle methods bool contains (int dim, int codim) const { return codim == 0; } - + bool fixedsize(int dim, int codim) const { return true; } - - template<class EntityType> + + template<class EntityType> size_t size(const EntityType &e) const { return 2; }; - template<class MessageBufferImp, class EntityType> - void gather(MessageBufferImp &buff, const EntityType &e) const - { - buff.write(gv_.comm().rank()); - buff.write(map_.map(e)); + template<class MessageBufferImp, class EntityType> + void gather(MessageBufferImp &buff, const EntityType &e) const + { + buff.write(gv_.comm().rank()); + buff.write(map_.map(e)); }; - template<class MessageBufferImp, class EntityType> + template<class MessageBufferImp, class EntityType> void scatter(MessageBufferImp &buff, const EntityType &e, size_t n) { BorderIndex bIdx; - + bIdx.localIdx = map_.map(e); buff.read(bIdx.peerRank); buff.read(bIdx.peerIdx); @@ -121,7 +121,7 @@ public: foreignBorderList_.push_back(bIdx); } }; - + // Access to the initial border list. const BorderList &foreignBorderList() const { return foreignBorderList_; } diff --git a/dumux/linear/foreignoverlapfrombcrsmatrix.hh b/dumux/linear/foreignoverlapfrombcrsmatrix.hh index 35912369d5..1f5cc6a2d3 100644 --- a/dumux/linear/foreignoverlapfrombcrsmatrix.hh +++ b/dumux/linear/foreignoverlapfrombcrsmatrix.hh @@ -95,10 +95,10 @@ public: myRank_ = 0; #if HAVE_MPI MPI_Comm_rank(MPI_COMM_WORLD, &myRank_); -#endif - +#endif + numLocal_ = A.N(); - + // calculate the border list. From this, create an initial // seed list of indices which are in the overlap. SeedList initialSeedList; @@ -113,11 +113,11 @@ public: // i.e. find the distance of each row from the seed set. foreignOverlapByIndex_.resize(A.N()); extendForeignOverlap_(A, initialSeedList, overlapSize); - + updateMasterRanks_(foreignBorderList, domesticBorderList); // group foreign overlap by peer process rank - groupForeignOverlapByRank_(); + groupForeignOverlapByRank_(); } /*! @@ -164,7 +164,7 @@ public: * for a peer. */ bool isDomesticIndexFor(ProcessRank peerRank, Index localIdx) const - { + { if (!isLocal(localIdx)) // our own remote indices do not count! return false; @@ -178,14 +178,14 @@ public: // the index is seen by the peer return true; }; - + /*! * \brief Return the list of (local indices, border distance, * number of processes) triples which are in the overlap of * a given peer rank. */ - const ForeignOverlapWithPeer &foreignOverlapWithPeer(int peerRank) const - { + const ForeignOverlapWithPeer &foreignOverlapWithPeer(int peerRank) const + { assert(foreignOverlapByRank_.find(peerRank) != foreignOverlapByRank_.end()); return foreignOverlapByRank_.find(peerRank)->second; } @@ -193,8 +193,8 @@ public: /*! * \brief Return the map of (peer rank, border distance) for a given local index. */ - const std::map<ProcessRank, BorderDistance> &foreignOverlapByIndex(int localIdx) const - { + const std::map<ProcessRank, BorderDistance> &foreignOverlapByIndex(int localIdx) const + { assert(isLocal(localIdx)); return foreignOverlapByIndex_[localIdx]; } @@ -205,7 +205,7 @@ public: */ const PeerSet &peerSet() const { return peerSet_; } - + /*! * \brief Returns the number local indices */ @@ -216,7 +216,7 @@ public: * \brief Returns true iff a domestic index is local */ bool isLocal(int domesticIdx) const - { + { return domesticIdx < numLocal(); }; @@ -248,7 +248,7 @@ public: ForeignOverlapByRank::const_iterator endIt = foreignOverlapByRank_.end(); for (; it != endIt; ++it) { std::cout << "Overlap rows(distance) for rank " << it->first << ": "; - + ForeignOverlapWithPeer::const_iterator rowIt = it->second.begin(); ForeignOverlapWithPeer::const_iterator rowEndIt = it->second.end(); for (; rowIt != rowEndIt; ++rowIt) { @@ -257,7 +257,7 @@ public: std::cout << "\n"; } }; - + protected: // Calculate the set of peer processes from the initial seed list. void seedListToPeerSet_(const SeedList &seedList) @@ -267,14 +267,14 @@ protected: for (; it != endIt; ++it) peerSet_.insert(std::get<1>(*it)); } - + // calculate the local border indices given the initial seed list void borderListToSeedList_(SeedList &initialSeedList, const BorderList &borderList) { BorderList::const_iterator it = borderList.begin(); BorderList::const_iterator endIt = borderList.end(); for (; it != endIt; ++it) { - initialSeedList.push_back(IndexRankDist(it->localIdx, + initialSeedList.push_back(IndexRankDist(it->localIdx, it->peerRank, it->borderDistance)); borderIndices_.insert(it->localIdx); @@ -307,7 +307,7 @@ protected: } masterRank_[localIdx] = masterRank; } - + // overwrite the master rank of the non-shared border indices isShared_.resize(numLocal_, false); BorderList::const_iterator it = foreignBorderList.begin(); @@ -315,7 +315,7 @@ protected: for (; it != endIt; ++it) { if (!it->isShared) masterRank_[it->localIdx] = myRank_; - else + else isShared_[it->localIdx] = true; }; @@ -350,11 +350,11 @@ protected: foreignOverlapByIndex_[localIdx][peerRank] = distance; } else { - foreignOverlapByIndex_[localIdx][peerRank] = + foreignOverlapByIndex_[localIdx][peerRank] = std::min(distance, foreignOverlapByIndex_[localIdx][peerRank]); - } - + } + minOverlapDistance = std::min(minOverlapDistance, distance); } @@ -362,7 +362,7 @@ protected: // finished and break the recursion if (minOverlapDistance >= overlapSize) return; - + // find the seed list for the next overlap level using the // seed set for the current level SeedList nextSeedList; @@ -371,7 +371,7 @@ protected: int rowIdx = std::get<0>(*it); int peerRank = std::get<1>(*it); int borderDist = std::get<2>(*it); - + // find all column indies in the row. The indices of the // columns are the additional indices of the overlap which // we would like to add @@ -380,19 +380,19 @@ protected: ColIterator colEndIt = A[rowIdx].end(); for (; colIt != colEndIt; ++colIt) { int newIdx = colIt.index(); - + // if the process is already is in the overlap of the // column index, ignore this column index! if (foreignOverlapByIndex_[newIdx].count(peerRank) > 0) continue; - + // check whether the new index is already in the overlap bool hasIndex = false; typename SeedList::iterator sIt = nextSeedList.begin(); typename SeedList::iterator sEndIt = nextSeedList.end(); for (; sIt != sEndIt; ++sIt) { - if (std::get<0>(*sIt) == newIdx && + if (std::get<0>(*sIt) == newIdx && std::get<1>(*sIt) == peerRank) { hasIndex = true; @@ -409,13 +409,13 @@ protected: nextSeedList.push_back(newTuple); } } - + // clear the old seed list to save some memory seedList.clear(); - + // Perform the same excercise for the next overlap distance extendForeignOverlap_(A, - nextSeedList, + nextSeedList, overlapSize); }; @@ -430,9 +430,9 @@ protected: for (int i = 0; i < nIndices; ++i) { // loop over the list of processes for the current index - std::map<ProcessRank, BorderDistance>::const_iterator it = + std::map<ProcessRank, BorderDistance>::const_iterator it = foreignOverlapByIndex_[i].begin(); - std::map<ProcessRank, BorderDistance>::const_iterator endIt = + std::map<ProcessRank, BorderDistance>::const_iterator endIt = foreignOverlapByIndex_[i].end(); int nRanks = foreignOverlapByIndex_[i].size(); for (; it != endIt; ++it) { @@ -468,7 +468,7 @@ protected: // stores a list of foreign overlap indices for each rank ForeignOverlapByRank foreignOverlapByRank_; - + // extend of the overlap region int overlapSize_; diff --git a/dumux/linear/globalindices.hh b/dumux/linear/globalindices.hh index 872c6b17a3..1160f193b5 100644 --- a/dumux/linear/globalindices.hh +++ b/dumux/linear/globalindices.hh @@ -101,14 +101,14 @@ public: // This requires communication via MPI. buildGlobalIndices_(); } - + /*! * \brief Converts a domestic index to a global one. */ int domesticToGlobal(int domesticIdx) const { assert(domesticToGlobal_.find(domesticIdx) != domesticToGlobal_.end()); - + return domesticToGlobal_.find(domesticIdx)->second; } @@ -123,7 +123,7 @@ public: }; /*! - * \brief Returns the number of indices which are in the interior or + * \brief Returns the number of indices which are in the interior or * on the border of the current rank. */ int numLocal() const @@ -136,7 +136,7 @@ public: * plus its copies of indices in the overlap regions */ int numDomestic() const - { + { return numDomestic_; } @@ -146,12 +146,12 @@ public: void addIndex(int domesticIdx, int globalIdx) { domesticToGlobal_[domesticIdx] = globalIdx; - globalToDomestic_[globalIdx] = domesticIdx; + globalToDomestic_[globalIdx] = domesticIdx; numDomestic_ = domesticToGlobal_.size(); assert(domesticToGlobal_.size() == globalToDomestic_.size()); }; - + /*! * \brief Send a border index to a remote process. */ @@ -164,7 +164,7 @@ public: MPI_Send(sendBuff, // buff 2, // count MPI_INT, // data type - peerRank, + peerRank, 0, // tag MPI_COMM_WORLD); // communicator #endif // HAVE_MPI @@ -181,7 +181,7 @@ public: MPI_Recv(recvBuff, // buff 2, // count MPI_INT, // data type - peerRank, + peerRank, 0, // tag MPI_COMM_WORLD, // communicator MPI_STATUS_IGNORE); // status @@ -199,12 +199,12 @@ public: { return globalToDomestic_.find(globalIdx) != globalToDomestic_.end(); }; /*! - * \brief Prints the global indices of all domestic indices + * \brief Prints the global indices of all domestic indices * for debugging purposes. */ void print() const { - std::cout << "(domestic index, global index, domestic->global->domestic) list for rank " << + std::cout << "(domestic index, global index, domestic->global->domestic) list for rank " << myRank_ << "\n"; for (int domIdx = 0; domIdx < domesticToGlobal_.size(); ++ domIdx) { @@ -215,15 +215,15 @@ public: }; std::cout << "\n"; }; - -protected: + +protected: // retrieve the offset for the indices where we are master in the // global index list - void buildGlobalIndices_() + void buildGlobalIndices_() { #if HAVE_MPI numDomestic_ = 0; -#else +#else numDomestic_ = foreignOverlap_.numLocal(); #endif @@ -238,7 +238,7 @@ protected: MPI_Recv(&domesticOffset_, // buffer 1, // count MPI_INT, // data type - myRank_ - 1, + myRank_ - 1, 0, // tag MPI_COMM_WORLD, // communicator MPI_STATUS_IGNORE); @@ -250,11 +250,11 @@ protected: if (!foreignOverlap_.iAmMasterOf(i)) { continue; } - + addIndex(i, domesticOffset_ + numMaster); ++ numMaster; } - + if (myRank_ < mpiSize_ - 1) { // send the domestic offset plus the number of master // indices to the process which is one rank higher @@ -268,7 +268,7 @@ protected: 0, // tag MPI_COMM_WORLD); // communicator }; - + typename PeerSet::const_iterator peerIt; typename PeerSet::const_iterator peerEndIt = peerSet_().end(); // receive the border indices from the lower ranks @@ -300,7 +300,7 @@ protected: } #endif // HAVE_MPI } - + void sendBorderTo_(ProcessRank peerRank) { #if HAVE_MPI @@ -311,7 +311,7 @@ protected: for (; borderIt != borderEndIt; ++borderIt) { int borderPeer = borderIt->peerRank; if (borderPeer != peerRank) - continue; + continue; int localIdx = borderIt->localIdx; int peerIdx = borderIt->peerIdx; @@ -323,7 +323,7 @@ protected: } void receiveBorderFrom_(ProcessRank peerRank) - { + { #if HAVE_MPI // retrieve the global indices for which we are not master // from the processes with lower rank @@ -333,7 +333,7 @@ protected: int borderPeer = borderIt->peerRank; if (borderPeer != peerRank) continue; - + if (foreignOverlap_.masterOf(borderIt->localIdx) == borderPeer) { receiveBorderIndex(borderPeer); } @@ -350,16 +350,16 @@ protected: const BorderList &domesticBorderList_() const { return foreignOverlap_.domesticBorderList(); } - + int myRank_; int mpiSize_; int domesticOffset_; int numDomestic_; const ForeignOverlap &foreignOverlap_; - - GlobalToDomesticMap globalToDomestic_; - DomesticToGlobalMap domesticToGlobal_; + + GlobalToDomesticMap globalToDomestic_; + DomesticToGlobalMap domesticToGlobal_; }; } // namespace Dumux diff --git a/dumux/linear/impetbicgstabilu0solver.hh b/dumux/linear/impetbicgstabilu0solver.hh index 0320347368..ca20405f72 100644 --- a/dumux/linear/impetbicgstabilu0solver.hh +++ b/dumux/linear/impetbicgstabilu0solver.hh @@ -67,7 +67,7 @@ class IMPETBiCGStabILU0Solver typedef typename GET_PROP(TypeTag, PTAG(SolutionTypes)) SolutionTypes; typedef typename SolutionTypes::ElementMapper ElementMapper; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; - + typedef Dumux::OverlappingBCRSMatrix<Matrix> OverlappingMatrix; typedef typename OverlappingMatrix::Overlap Overlap; typedef Dumux::OverlappingBlockVector<typename Vector::block_type, Overlap> OverlappingVector; @@ -93,7 +93,7 @@ public: /*! * \brief Set the structure of the linear system of equations to be solved. - * + * * This method allocates space an does the necessary * communication before actually calling the solve() method. As * long as the structure of the linear system does not change, the @@ -106,11 +106,11 @@ public: }; /*! - * \brief Actually solve the linear system of equations. + * \brief Actually solve the linear system of equations. * * \return true if the residual reduction could be achieved, else false. */ - bool solve(const Matrix &M, + bool solve(const Matrix &M, Vector &x, const Vector &b) { @@ -131,7 +131,7 @@ public: overlapMatrix_->assignCopy(M); overlapb_->assignAdd(b); (*overlapx_) = 0.0; - + /* overlapMatrix_->print(); overlapb_->print(); @@ -148,20 +148,20 @@ public: OverlappingOperator opA(*overlapMatrix_); // create the actual solver - Solver solver(opA, + Solver solver(opA, scalarProd, - preCond, + preCond, residReduction, maxIter , verbosityLevel); - + // run the solver Dune::InverseOperatorResult result; solver.apply(*overlapx_, *overlapb_, result); // copy the result back to the non-overlapping vector overlapx_->assignTo(x); - + // return the result of the solver return result.converged; }; @@ -174,7 +174,7 @@ private: // create the overlapping Jacobian matrix overlapMatrix_ = new OverlappingMatrix (M, - borderListCreator.foreignBorderList(), + borderListCreator.foreignBorderList(), borderListCreator.domesticBorderList(), overlapSize_); diff --git a/dumux/linear/overlappingbcrsmatrix.hh b/dumux/linear/overlappingbcrsmatrix.hh index 5c90d020ab..bf98e2f668 100644 --- a/dumux/linear/overlappingbcrsmatrix.hh +++ b/dumux/linear/overlappingbcrsmatrix.hh @@ -47,7 +47,7 @@ class OverlappingBCRSMatrix : public BCRSMatrix public: typedef Dumux::DomesticOverlapFromBCRSMatrix<BCRSMatrix> Overlap; - + private: typedef typename Overlap::Index Index; typedef typename Overlap::Index RowIndex; @@ -76,9 +76,9 @@ public: { }; - OverlappingBCRSMatrix(const BCRSMatrix &M, - const BorderList &foreignBorderList, - const BorderList &domesticBorderList, + OverlappingBCRSMatrix(const BCRSMatrix &M, + const BorderList &foreignBorderList, + const BorderList &domesticBorderList, int overlapSize) { overlap_ = std::shared_ptr<Overlap>(new Overlap(M, foreignBorderList, domesticBorderList, overlapSize)); @@ -103,12 +103,12 @@ public: typename PeerSet::const_iterator peerEndIt = peerSet.end(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + delete rowSizesRecvBuff_[peerRank]; delete rowIndicesRecvBuff_[peerRank]; delete entryIndicesRecvBuff_[peerRank]; delete entryValuesRecvBuff_[peerRank]; - + delete numRowsSendBuff_[peerRank]; delete rowSizesSendBuff_[peerRank]; delete rowIndicesSendBuff_[peerRank]; @@ -116,7 +116,7 @@ public: delete entryValuesSendBuff_[peerRank]; } } - + /*! * \brief Returns the domestic overlap for the process. */ @@ -145,11 +145,11 @@ public: ++ myColIt; } assert(myColIt.index() == colIt.index()); - + (*myColIt) = *colIt; } } - + // communicate and add the contents of overlapping rows syncAdd_(); } @@ -178,7 +178,7 @@ public: ++ myColIt; } assert(myColIt.index() == colIt.index()); - + (*myColIt) = *colIt; } } @@ -187,22 +187,22 @@ public: syncCopy_(); } - void print() const + void print() const { overlap_->print(); - + for (int i = 0; i < this->N(); ++i) { if (overlap_->isLocal(i)) std::cout << " "; - else + else std::cout << "*"; std::cout << "row " << i << " "; - + typedef typename BCRSMatrix::ConstColIterator ColIt; ColIt colIt = (*this)[i].begin(); ColIt colEndIt = (*this)[i].end(); for (int j = 0; j < this->M(); ++j) { - if (colIt != colEndIt && j == colIt.index()) { + if (colIt != colEndIt && j == colIt.index()) { ++colIt; if (overlap_->isBorder(j)) std::cout << "|"; @@ -223,11 +223,11 @@ private: void build_(const BCRSMatrix &M) { int numDomestic = overlap_->numDomestic(); - + // allocate the rows this->setSize(numDomestic, numDomestic); this->setBuildMode(ParentType::random); - + // communicate the entries buildIndices_(M); } @@ -260,7 +260,7 @@ private: entries_[rowIdx].insert(colIt.index()); } } - + ///////// // add the indices for all additional entries ///////// @@ -280,7 +280,7 @@ private: int peerRank = *peerIt; receiveRowIndices_(peerRank); } - + // wait until all send operations are completed peerIt = peerSet.begin(); for (; peerIt != peerEndIt; ++peerIt) { @@ -318,7 +318,7 @@ private: this->addindex(rowIdx, *colIdxIt); } this->endindices(); - + // free the memory occupied by the array of the matrix entries entries_.resize(0); } @@ -329,18 +329,18 @@ private: #if HAVE_MPI // send the number of non-border entries in the matrix const ForeignOverlapWithPeer &peerOverlap = overlap_->foreignOverlapWithPeer(peerRank); - + // send size of foreign overlap to peer int numOverlapRows = peerOverlap.size(); numRowsSendBuff_[peerRank] = new MpiBuffer<int>(1); (*numRowsSendBuff_[peerRank])[0] = numOverlapRows; numRowsSendBuff_[peerRank]->send(peerRank); - + rowSizesSendBuff_[peerRank] = new MpiBuffer<Index>(numOverlapRows); rowIndicesSendBuff_[peerRank] = new MpiBuffer<Index>(numOverlapRows); // create the row size MPI buffer - int numEntries = 0; + int numEntries = 0; typename ForeignOverlapWithPeer::const_iterator it = peerOverlap.begin(); typename ForeignOverlapWithPeer::const_iterator endIt = peerOverlap.end(); int i = 0; @@ -357,7 +357,7 @@ private: ++ j; } } - + (*rowSizesSendBuff_[peerRank])[i] = j; (*rowIndicesSendBuff_[peerRank])[i] = overlap_->domesticToGlobal(rowIdx); numEntries += j; @@ -386,7 +386,7 @@ private: } } } - entryIndicesSendBuff_[peerRank]->send(peerRank); + entryIndicesSendBuff_[peerRank]->send(peerRank); // create the send buffers for the values of the matrix // entries @@ -403,7 +403,7 @@ private: MpiBuffer<int> numRowsRecvBuff(1); numRowsRecvBuff.receive(peerRank); numOverlapRows = numRowsRecvBuff[0]; - + // create receive buffer for the row sizes and receive them // from the peer rowIndicesRecvBuff_[peerRank] = new MpiBuffer<Index>(numOverlapRows); @@ -417,7 +417,7 @@ private: for (int i = 0; i < numOverlapRows; ++ i) { totalIndices += (*rowSizesRecvBuff_[peerRank])[i]; } - + // create the buffer to store the column indices of the matrix entries entryIndicesRecvBuff_[peerRank] = new MpiBuffer<Index>(totalIndices); entryValuesRecvBuff_[peerRank] = new MpiBuffer<block_type>(totalIndices); @@ -429,7 +429,7 @@ private: // domestic ones globalToDomesticBuff_(*rowIndicesRecvBuff_[peerRank]); globalToDomesticBuff_(*entryIndicesRecvBuff_[peerRank]); - + // add the entries to the global entry map int k = 0; for (int i = 0; i < numOverlapRows; ++ i) { @@ -452,7 +452,7 @@ private: typename PeerSet::const_iterator peerEndIt = peerSet.end(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + sendEntries_(peerRank); } @@ -460,7 +460,7 @@ private: peerIt = peerSet.begin(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + receiveAddEntries_(peerRank); } @@ -483,7 +483,7 @@ private: typename PeerSet::const_iterator peerEndIt = peerSet.end(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + sendEntries_(peerRank); } @@ -491,7 +491,7 @@ private: peerIt = peerSet.begin(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + receiveCopyEntries_(peerRank); } @@ -517,7 +517,7 @@ private: int k = 0; for (int i = 0; i < mpiRowIndicesSendBuff.size(); ++i) { Index domRowIdx = mpiRowIndicesSendBuff[i]; - + typedef typename ParentType::ConstColIterator ColIt; ColIt colIt = (*this)[domRowIdx].begin(); for (int j = 0; j < mpiRowSizesSendBuff[i]; ++j) { @@ -578,7 +578,7 @@ private: for (int j = 0; j < mpiRowSizesRecvBuff[i]; ++j) { Index domColIdx = mpiColIndicesRecvBuff[k]; - if (!overlap_->iAmMasterOf(domRowIdx) || + if (!overlap_->iAmMasterOf(domRowIdx) || !overlap_->iAmMasterOf(domColIdx)) { (*this)[domRowIdx][domColIdx] = mpiRecvBuff[k]; diff --git a/dumux/linear/overlappingblockvector.hh b/dumux/linear/overlappingblockvector.hh index 69819df71a..cae14218d0 100644 --- a/dumux/linear/overlappingblockvector.hh +++ b/dumux/linear/overlappingblockvector.hh @@ -74,7 +74,7 @@ public: ~OverlappingBlockVector() { } - + /*! * \brief Assign an overlapping block vector from a * non-overlapping one, border entries are added. @@ -139,7 +139,7 @@ public: int peerRank = *peerIt; receiveAddEntries_(peerRank); } - + // wait until we have send everything waitSendFinished_(); }; @@ -184,7 +184,7 @@ public: for (int i = 0; i < numDomestic; ++i) { (*this)[i] /= overlap_->numNonFrontProcesses(i); } - + // wait until we have send everything waitSendFinished_(); }; @@ -215,7 +215,7 @@ public: int peerRank = *peerIt; receiveFrontFromMaster_(peerRank); } - + // wait until we have send everything waitSendFinished_(); }; @@ -230,7 +230,7 @@ public: overlap_ = obv.overlap_; return *this; } - + /*! * \brief Syncronize an overlapping block vector and take the * arthmetic mean of the entry values of all processes. @@ -269,7 +269,7 @@ public: }; } - void print() const + void print() const { for (int i = 0; i < this->size(); ++i) { std::cout << "row " << i << (overlap_->isLocal(i)?" ":"*") << ": " << (*this)[i] << "\n"; @@ -283,10 +283,10 @@ private: // create array for the front indices int numDomestic = overlap_->numDomestic(); frontMaster_ = std::shared_ptr<std::vector<ProcessRank> >(new std::vector<ProcessRank>(numDomestic, -1)); - + typename PeerSet::const_iterator peerIt; typename PeerSet::const_iterator peerEndIt = overlap_->peerSet().end(); - + // send all indices to the peers peerIt = overlap_->peerSet().begin(); for (; peerIt != peerEndIt; ++peerIt) { @@ -297,7 +297,7 @@ private: numIndicesSendBuff_[peerRank] = std::shared_ptr<MpiBuffer<int> >(new MpiBuffer<int>(1)); indicesSendBuff_[peerRank] = std::shared_ptr<MpiBuffer<RowIndex> >(new MpiBuffer<RowIndex>(numEntries)); valuesSendBuff_[peerRank] = std::shared_ptr<MpiBuffer<FieldVector> >(new MpiBuffer<FieldVector>(numEntries)); - + // fill the indices buffer with global indices MpiBuffer<RowIndex> &indicesSendBuff = *indicesSendBuff_[peerRank]; typename DomesticOverlapWithPeer::const_iterator domIt = domesticOverlap.begin(); @@ -319,7 +319,7 @@ private: peerIt = overlap_->peerSet().begin(); for (; peerIt != peerEndIt; ++peerIt) { int peerRank = *peerIt; - + // receive size of overlap to peer int numRows; MpiBuffer<int> numRowsRecvBuff(1); @@ -340,7 +340,7 @@ private: int domRowIdx = overlap_->globalToDomestic(globalRowIdx); indicesRecvBuff[i] = domRowIdx; - if (overlap_->isFront(domRowIdx) && + if (overlap_->isFront(domRowIdx) && overlap_->isMasterOf(peerRank, domRowIdx)) { (*frontMaster_)[domRowIdx] = peerRank; @@ -416,7 +416,7 @@ private: int domRowIdx = indices[j]; if ((*frontMaster_)[domRowIdx] != peerRank) continue; - + (*this)[domRowIdx] = values[j]; } } diff --git a/dumux/linear/overlappingoperator.hh b/dumux/linear/overlappingoperator.hh index 4d8bfaa95d..97324f2b3a 100644 --- a/dumux/linear/overlappingoperator.hh +++ b/dumux/linear/overlappingoperator.hh @@ -29,7 +29,7 @@ namespace Dumux { // operator that resets result to zero at constrained DOFS template<class OverlappingMatrix, class DomainVector, class RangeVector> -class OverlappingOperator : +class OverlappingOperator : public Dune::AssembledLinearOperator<OverlappingMatrix, DomainVector, RangeVector> diff --git a/dumux/linear/overlappingpreconditioner.hh b/dumux/linear/overlappingpreconditioner.hh index a86cc07894..0115b87c15 100644 --- a/dumux/linear/overlappingpreconditioner.hh +++ b/dumux/linear/overlappingpreconditioner.hh @@ -30,8 +30,8 @@ namespace Dumux { template <class SeqPreCond, class Overlap> -class OverlappingPreconditioner : - public Dune::Preconditioner<typename SeqPreCond::domain_type, +class OverlappingPreconditioner : + public Dune::Preconditioner<typename SeqPreCond::domain_type, typename SeqPreCond::range_type> { public: @@ -79,7 +79,7 @@ public: MPI_SHORT, // data type MPI_MIN, // operation MPI_COMM_WORLD); // communicator - } + } catch (const Dune::Exception &e) { std::cout << "Process " << overlap_->myRank() << " threw exception in sequential preconditioner: " << e.what() << "\n"; @@ -98,16 +98,16 @@ public: DUNE_THROW(NumericalProblem, "Preconditioner threw an exception on some process."); } - else + else #endif // HAVE_MPI seqPreCond_.apply(x, d); }; - + void post(domain_type &x) - { + { seqPreCond_.post(x); }; - + private: SeqPreCond seqPreCond_; const Overlap *overlap_; diff --git a/dumux/linear/overlappingscalarproduct.hh b/dumux/linear/overlappingscalarproduct.hh index 82f3f5a50e..abfdfb392d 100644 --- a/dumux/linear/overlappingscalarproduct.hh +++ b/dumux/linear/overlappingscalarproduct.hh @@ -35,20 +35,20 @@ public: typedef OverlappingBlockVector domain_type; enum { category = Dune::SolverCategory::overlapping }; - + OverlappingScalarProduct(const Overlap &overlap) : overlap_(overlap) {}; - + field_type dot(const OverlappingBlockVector &x, const OverlappingBlockVector &y) - { + { field_type sum = 0; int n = overlap_.numLocal(); for (int i = 0; i < n; ++i) { if (overlap_.iAmMasterOf(i)) sum += x[i]*y[i]; }; - + // compute the global sum field_type sumGlobal = 0.0; #if HAVE_MPI @@ -66,7 +66,7 @@ public: }; field_type norm(const OverlappingBlockVector &x) - { + { field_type tmp = dot(x, x); return std::sqrt(tmp); }; diff --git a/dumux/linear/vertexborderlistfromgrid.hh b/dumux/linear/vertexborderlistfromgrid.hh index 53e3d7b58c..e1c670503d 100644 --- a/dumux/linear/vertexborderlistfromgrid.hh +++ b/dumux/linear/vertexborderlistfromgrid.hh @@ -61,38 +61,38 @@ class VertexBorderListFromGrid : public Dune::CommDataHandleIF<VertexBorderListF typedef std::list<BorderIndex> BorderList; public: - VertexBorderListFromGrid(const GridView &gv, + VertexBorderListFromGrid(const GridView &gv, const VertexMapper &map) : gv_(gv), map_(map) { - gv.communicate(*this, - Dune::InteriorBorder_InteriorBorder_Interface, + gv.communicate(*this, + Dune::InteriorBorder_InteriorBorder_Interface, Dune::ForwardCommunication); }; // data handle methods bool contains (int dim, int codim) const { return dim == codim; } - + bool fixedsize(int dim, int codim) const { return true; } - - template<class EntityType> + + template<class EntityType> size_t size(const EntityType &e) const { return 2; }; - template<class MessageBufferImp, class EntityType> - void gather(MessageBufferImp &buff, const EntityType &e) const - { - buff.write(gv_.comm().rank()); - buff.write(map_.map(e)); + template<class MessageBufferImp, class EntityType> + void gather(MessageBufferImp &buff, const EntityType &e) const + { + buff.write(gv_.comm().rank()); + buff.write(map_.map(e)); }; - template<class MessageBufferImp, class EntityType> + template<class MessageBufferImp, class EntityType> void scatter(MessageBufferImp &buff, const EntityType &e, size_t n) { BorderIndex bIdx; - + bIdx.localIdx = map_.map(e); buff.read(bIdx.peerRank); buff.read(bIdx.peerIdx); @@ -103,7 +103,7 @@ public: borderList_.push_back(bIdx); }; - + // Access to the foreign border list. const BorderList &foreignBorderList() const { return borderList_; } diff --git a/dumux/material/constants.hh b/dumux/material/constants.hh index 2195717cad..e886668d49 100644 --- a/dumux/material/constants.hh +++ b/dumux/material/constants.hh @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \file - * + * \file + * * \brief A central place for various physical constants occuring in * some equations. */ @@ -42,12 +42,12 @@ class Constants * \brief The ideal gas constant [J/(mol K)] */ static constexpr Scalar R = 8.314472; - + /*! * \brief The Avogadro constant [1/mol] */ static constexpr Scalar Na = 6.02214179e23; - + /*! * \brief The Boltzmann constant [J/K] */ diff --git a/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh b/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh index 78b5fd80da..615812d494 100644 --- a/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh +++ b/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh @@ -109,7 +109,7 @@ public: { Scalar yTh = VanGenuchten::pC(params, SwThHigh); Scalar m1 = (0.0 - yTh)/(1.0 - SwThHigh)*2; - + if (Swe < 1.0) { // use spline between threshold Swe and 1.0 Scalar mTh = VanGenuchten::dpC_dSw(params, SwThHigh); @@ -117,7 +117,7 @@ public: yTh, 0, // m0, m1 mTh, m1); // m0, m1 return sp.eval(Swe); - } + } else { // straight line for Swe > 1.0 return m1*(Swe - 1.0) + 0.0; @@ -173,7 +173,7 @@ public: { Scalar yTh = VanGenuchten::pC(params, SwThHigh); Scalar m1 = (0.0 - yTh)/(1.0 - SwThHigh)*2; - + // invert spline between threshold Swe and 1.0 Scalar mTh = VanGenuchten::dpC_dSw(params, SwThHigh); Spline<Scalar> sp(SwThHigh, 1.0, // x0, x1 diff --git a/dumux/material/fluidsystems/simplefluidsystem.hh b/dumux/material/fluidsystems/simplefluidsystem.hh index 6c78ff610d..95fc8162be 100644 --- a/dumux/material/fluidsystems/simplefluidsystem.hh +++ b/dumux/material/fluidsystems/simplefluidsystem.hh @@ -76,20 +76,20 @@ public: }; static Scalar computePureFugacity(const MutableParameters ¶ms, - int phaseIdx, + int phaseIdx, int compIdx) { const FluidState &fs = params.fluidState(); Scalar T = fs.temperature(phaseIdx); switch (phaseIdx) { - case SP::lPhaseIdx: + case SP::lPhaseIdx: switch (compIdx) { case SP::H2OIdx: return SP::H2O::vaporPressure(T); case SP::N2Idx: return BinaryCoeff::H2O_N2::henry(T); }; case SP::gPhaseIdx: { switch (compIdx) { - case SP::H2OIdx: + case SP::H2OIdx: SP::H2O::vaporPressure(T); case SP::N2Idx: // ideal gas @@ -114,7 +114,7 @@ public: * pressure and temperature. */ static Scalar computeFugacity(const MutableParameters ¶ms, - int phaseIdx, + int phaseIdx, int compIdx) { const FluidState &fs = params.fluidState(); @@ -135,7 +135,7 @@ public: * \f[ f_\kappa = \phi_\kappa * x_{\kappa} \f] */ static Scalar computeFugacityCoeff(const MutableParameters ¶ms, - int phaseIdx, + int phaseIdx, int compIdx) { assert(0 <= phaseIdx && phaseIdx <= SP::numPhases); @@ -146,7 +146,7 @@ public: Scalar T = fs.temperature(phaseIdx); Scalar p = fs.pressure(phaseIdx); switch (phaseIdx) { - case SP::lPhaseIdx: + case SP::lPhaseIdx: switch (compIdx) { case SP::H2OIdx: return SP::H2O::vaporPressure(T)/p; case SP::N2Idx: return BinaryCoeff::H2O_N2::henry(T)/p; @@ -157,7 +157,7 @@ public: DUNE_THROW(Dune::InvalidStateException, "Unhandled phase or component index"); } - + /*! * \brief Calculate the dynamic viscosity of a fluid phase [Pa*s] */ @@ -177,7 +177,7 @@ public: // assume pure water for the gas phase return SP::N2::gasViscosity(T, p); } - + DUNE_THROW(Dune::InvalidStateException, "Unhandled phase index " << phaseIdx); }; @@ -188,7 +188,7 @@ public: * Molecular diffusion of a compoent $\kappa$ is caused by a * gradient of the chemical potential and follows the law * - * \f[ J = - D \grad mu_\kappa \f] + * \f[ J = - D \grad mu_\kappa \f] * * where \f$\mu_\kappa\$ is the component's chemical potential, * \f$D\f$ is the diffusion coefficient and \f$J\f$ is the @@ -200,7 +200,7 @@ public: * where \f$p_\alpha\f$ and \f$T_\alpha\f$ are the fluid phase' * pressure and temperature. */ - static Scalar computeDiffusionCoeff(const MutableParameters ¶ms, + static Scalar computeDiffusionCoeff(const MutableParameters ¶ms, int phaseIdx, int compIdx) { @@ -214,11 +214,11 @@ public: * \f$i\f$ and \f$j\f$ in this phase. */ template <class FluidState> - static Scalar binaryDiffCoeff(const MutableParameters ¶ms, + static Scalar binaryDiffCoeff(const MutableParameters ¶ms, int phaseIdx, int compIIdx, int compJIdx) - + { if (compIIdx > compJIdx) std::swap(compIIdx, compJIdx); @@ -237,7 +237,7 @@ public: const FluidState &fs = params.fluidState(); Scalar T = fs.temperature(phaseIdx); - Scalar p = fs.pressure(phaseIdx); + Scalar p = fs.pressure(phaseIdx); switch (phaseIdx) { case SP::lPhaseIdx: @@ -270,7 +270,7 @@ public: * \brief Given a phase's composition, temperature, pressure and * density, calculate its specific enthalpy [J/kg]. */ - static Scalar computeEnthalpy(const MutableParameters ¶ms, + static Scalar computeEnthalpy(const MutableParameters ¶ms, int phaseIdx) { const FluidState &fs = params.fluidState(); @@ -297,13 +297,13 @@ public: else { Scalar cH2O = fs.molarity(SP::gPhaseIdx, SP::H2OIdx); Scalar cN2 = fs.molarity(SP::gPhaseIdx, SP::N2Idx); - + // assume ideal gas Scalar pH2O = SP::H2O::gasPressure(T, cH2O*SP::H2O::molarMass()); Scalar pN2 = SP::N2::gasPressure(T, cN2*SP::H2O::molarMass()); Scalar XH2O = fs.massFrac(SP::lPhaseIdx, SP::H2OIdx); - Scalar XN2 = fs.massFrac(SP::lPhaseIdx, SP::N2Idx); + Scalar XN2 = fs.massFrac(SP::lPhaseIdx, SP::N2Idx); Scalar result = 0; result += SP::H2O::gasEnthalpy(T, pH2O) * @@ -321,7 +321,7 @@ public: * \brief Given a phase's composition, temperature, pressure and * density, calculate its specific internal energy [J/kg]. */ - static Scalar internalEnergy(const MutableParameters ¶ms, + static Scalar internalEnergy(const MutableParameters ¶ms, int phaseIdx) { const FluidState &fs = params.fluidState(); diff --git a/dumux/nonlinear/newtoncontroller.hh b/dumux/nonlinear/newtoncontroller.hh index 3f458d2e2f..8864b2b0f1 100644 --- a/dumux/nonlinear/newtoncontroller.hh +++ b/dumux/nonlinear/newtoncontroller.hh @@ -171,7 +171,7 @@ struct NewtonConvergenceWriter<TypeTag, false> typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; typedef typename GET_PROP_TYPE(TypeTag, PTAG(NewtonController)) NewtonController; typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector)) SolutionVector; - + typedef Dumux::VtkMultiWriter<GridView> VtkMultiWriter; NewtonConvergenceWriter(NewtonController &ctl) @@ -224,13 +224,13 @@ class NewtonController enum { enablePartialReassemble = GET_PROP_VALUE(TypeTag, PTAG(EnablePartialReassemble)) }; enum { enableJacobianRecycling = GET_PROP_VALUE(TypeTag, PTAG(EnableJacobianRecycling)) }; enum { newtonWriteConvergence = GET_PROP_VALUE(TypeTag, PTAG(NewtonWriteConvergence)) }; - + typedef NewtonConvergenceWriter<TypeTag, newtonWriteConvergence> ConvergenceWriter; typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) LinearSolver; public: /*! - * \brief + * \brief */ NewtonController(const Problem &problem) : endIterMsgStream_(std::ostringstream::out) @@ -408,7 +408,7 @@ public: uLastIter[i], uNewI); error_ = std::max(error_, vertError); - + } error_ = gridView_().comm().max(error_); @@ -556,7 +556,7 @@ public: * This method is called _after_ newtonEnd() */ void newtonSucceed() - { + { if (enableJacobianRecycling) model_().jacobianAssembler().setMatrixReuseable(true); else @@ -593,7 +593,7 @@ public: return oldTimeStep*(1 + percent); */ Scalar percent = (targetSteps_ - n)/targetSteps_; - return std::min(oldTimeStep*(1.0 + percent/1.2), + return std::min(oldTimeStep*(1.0 + percent/1.2), this->problem_().maxTimeStepSize()); } } diff --git a/dumux/parallel/elementhandles.hh b/dumux/parallel/elementhandles.hh index 3cc3504e4a..594a9e4003 100644 --- a/dumux/parallel/elementhandles.hh +++ b/dumux/parallel/elementhandles.hh @@ -18,14 +18,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \file - * - * \brief Provides data handles for parallel communication which + * \file + * + * \brief Provides data handles for parallel communication which * operate on elements */ #ifndef DUMUX_CELL_HANDLES_HH #define DUMUX_CELL_HANDLES_HH - + #include <dune/grid/common/datahandleif.hh> namespace Dumux @@ -119,7 +119,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } @@ -177,7 +177,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } @@ -236,7 +236,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } diff --git a/dumux/parallel/mpibuffer.hh b/dumux/parallel/mpibuffer.hh index 9f107569d5..a30ee9347c 100644 --- a/dumux/parallel/mpibuffer.hh +++ b/dumux/parallel/mpibuffer.hh @@ -18,13 +18,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \file - * + * \file + * * \brief Simplifies handling of buffers to be used in conjunction with MPI */ #ifndef DUMUX_MPI_BUFFER_HH #define DUMUX_MPI_BUFFER_HH - + #if HAVE_MPI #include <mpi.h> #endif @@ -41,7 +41,7 @@ class MpiBuffer { public: MpiBuffer(int size) - { + { data_ = new DataType[size]; dataSize_ = size; @@ -69,7 +69,7 @@ public: mpiDataType_ = MPI_BYTE; mpiDataSize_ *= sizeof(DataType); } -#endif // HAVE_MPI +#endif // HAVE_MPI }; ~MpiBuffer() @@ -122,29 +122,29 @@ public: #if HAVE_MPI /*! - * \brief Returns the current MPI_Request object. + * \brief Returns the current MPI_Request object. * * This object is only well defined after the send() method. */ MPI_Request &request() { return mpiRequest_; } /*! - * \brief Returns the current MPI_Request object. + * \brief Returns the current MPI_Request object. * * This object is only well defined after the send() method. */ const MPI_Request &request() const { return mpiRequest_; } - + /*! - * \brief Returns the current MPI_Status object. + * \brief Returns the current MPI_Status object. * * This object is only well defined after the receive() and wait() methods. */ MPI_Status &status() { return mpiStatus_; } /*! - * \brief Returns the current MPI_Status object. + * \brief Returns the current MPI_Status object. * * This object is only well defined after the receive() and wait() methods. */ @@ -158,12 +158,12 @@ public: */ int size() const { return dataSize_; } - + /*! * \brief Provide access to the buffer data. */ DataType &operator[](int i) - { + { assert(0 <= i && i < dataSize_); return data_[i]; } @@ -172,7 +172,7 @@ public: * \brief Provide access to the buffer data. */ const DataType &operator[](int i) const - { + { assert(0 <= i && i < dataSize_); return data_[i]; } diff --git a/dumux/parallel/vertexhandles.hh b/dumux/parallel/vertexhandles.hh index b32feb6d63..da4bd8ac5b 100644 --- a/dumux/parallel/vertexhandles.hh +++ b/dumux/parallel/vertexhandles.hh @@ -18,14 +18,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \file - * - * \brief Provides data handles for parallel communication which + * \file + * + * \brief Provides data handles for parallel communication which * operate on vertices */ #ifndef DUMUX_VERTEX_HANDLES_HH #define DUMUX_VERTEX_HANDLES_HH - + #include <dune/grid/common/datahandleif.hh> namespace Dumux @@ -35,12 +35,12 @@ namespace Dumux * values are attached to vertices */ template <class FieldType, class Container, class VertexMapper> -class VertexHandleSum - : public Dune::CommDataHandleIF< VertexHandleSum<FieldType, Container, VertexMapper>, +class VertexHandleSum + : public Dune::CommDataHandleIF< VertexHandleSum<FieldType, Container, VertexMapper>, FieldType > { public: - VertexHandleSum(Container &container, + VertexHandleSum(Container &container, const VertexMapper &mapper) : mapper_(mapper) , container_(container) @@ -61,7 +61,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } @@ -94,11 +94,11 @@ private: */ template <class FieldType, class Container, class VertexMapper> class VertexHandleMax - : public Dune::CommDataHandleIF< VertexHandleMax<FieldType, Container, VertexMapper>, + : public Dune::CommDataHandleIF< VertexHandleMax<FieldType, Container, VertexMapper>, FieldType > { public: - VertexHandleMax(Container &container, + VertexHandleMax(Container &container, const VertexMapper &mapper) : mapper_(mapper) , container_(container) @@ -119,7 +119,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } @@ -153,11 +153,11 @@ private: */ template <class FieldType, class Container, class VertexMapper> class VertexHandleMin - : public Dune::CommDataHandleIF< VertexHandleMin<FieldType, Container, VertexMapper>, + : public Dune::CommDataHandleIF< VertexHandleMin<FieldType, Container, VertexMapper>, FieldType > { public: - VertexHandleMin(Container &container, + VertexHandleMin(Container &container, const VertexMapper &mapper) : mapper_(mapper) , container_(container) @@ -178,7 +178,7 @@ public: template<class EntityType> size_t size (const EntityType &e) const - { + { // communicate a field type per entity return 1; } diff --git a/test/boxmodels/2p/lensproblem.hh b/test/boxmodels/2p/lensproblem.hh index f8c65c0a29..a3f6dca4c6 100644 --- a/test/boxmodels/2p/lensproblem.hh +++ b/test/boxmodels/2p/lensproblem.hh @@ -382,7 +382,7 @@ public: wPhaseIdx, temperature_, 1e5); - + // hydrostatic pressure values[pwIdx] = 1e5 - densityW*this->gravity()[1]*depth; values[SnIdx] = 0.0; diff --git a/test/boxmodels/2p/test_2p.cc b/test/boxmodels/2p/test_2p.cc index 26a76755e0..ed71669351 100644 --- a/test/boxmodels/2p/test_2p.cc +++ b/test/boxmodels/2p/test_2p.cc @@ -211,17 +211,17 @@ int main(int argc, char** argv) res[0] = 48; res[1] = 32; - + /* res[0] = 24; res[1] = 16; */ - + /* res[0] = 6; res[1] = 4; */ - + /* res[0] = 1; res[1] = 2; diff --git a/test/boxmodels/richards/richardslensproblem.hh b/test/boxmodels/richards/richardslensproblem.hh index 211c2d94b5..dad113bda3 100644 --- a/test/boxmodels/richards/richardslensproblem.hh +++ b/test/boxmodels/richards/richardslensproblem.hh @@ -247,7 +247,7 @@ public: * For this method, the \a values parameter stores primary variables. */ using ParentType::dirichlet; - void dirichlet(PrimaryVariables &values, + void dirichlet(PrimaryVariables &values, const GlobalPosition &globalPos) const { // use initial values as boundary conditions diff --git a/test/decoupled/2p/test_impes.cc b/test/decoupled/2p/test_impes.cc index ce29586618..15faa88e81 100644 --- a/test/decoupled/2p/test_impes.cc +++ b/test/decoupled/2p/test_impes.cc @@ -90,7 +90,7 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// // create the grid //////////////////////////////////////////////////////////// - Dune::FieldVector<int,dim> numCells; + Dune::FieldVector<int,dim> numCells; numCells[0] = 30; numCells[1] = 6; Dune::FieldVector<double,dim> lowerLeft; diff --git a/tutorial/tutorialproblem_coupled.hh b/tutorial/tutorialproblem_coupled.hh index 37f3e2ee22..77149bef23 100644 --- a/tutorial/tutorialproblem_coupled.hh +++ b/tutorial/tutorialproblem_coupled.hh @@ -154,7 +154,7 @@ public: */ bool shouldWriteOutput() const /*@\label{tutorial-coupled:output}@*/ { - return + return this->timeManager().timeStepIndex() > 0 && (this->timeManager().timeStepIndex() % 1 == 0); } -- GitLab