fix most pedantic compiler warnings in the basic infrastructure

i.e., using clang 3.8 to compile the test suite with the following
flags:

```
-Weverything
-Wno-documentation
-Wno-documentation-unknown-command
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-undef
-Wno-padded
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-weak-vtables
-Wno-float-equal
```

should not produce any warnings anymore. In my opinion the only flag
which would produce beneficial warnings is -Wdocumentation. This has
not been fixed in this patch because writing documentation is left for
another day (or, more likely, year).

note that this patch consists of a heavy dose of the OPM_UNUSED macro
and plenty of static_casts (to fix signedness issues). Fixing the
singedness issues were quite a nightmare and the fact that the Dune
API is quite inconsistent in that regard was not exactly helpful. :/

Finally this patch includes quite a few formatting changes (e.g., all
occurences of 'T &t' should be changed to `T& t`) and some fixes for
minor issues which I've found during the excercise.

I've made sure that all unit tests the test suite still pass
successfully and I've made sure that flow_ebos still works for Norne
and that it did not regress w.r.t. performance.

(Note that this patch does not fix compiler warnings triggered `ebos`
and `flow_ebos` but only those caused by the basic infrastructure or
the unit tests.)

v2: fix the warnings that occur if the dune-localfunctions module is
    not available. thanks to [at]atgeirr for testing.
v3: fix dune 2.3 build issue
This commit is contained in:
Andreas Lauser 2016-11-07 15:14:07 +01:00
parent f951947773
commit 67c978fe75
13 changed files with 126 additions and 107 deletions

View File

@ -162,7 +162,7 @@ protected:
void createGrids_()
{
const auto& gridProps = this->eclState()->get3DProperties();
const std::vector<double> &porv = gridProps.getDoubleGridProperty("PORV").getData();
const std::vector<double>& porv = gridProps.getDoubleGridProperty("PORV").getData();
// we use separate grid objects: one for the calculation of the initial condition
// via EQUIL and one for the actual simulation. The reason is that the EQUIL code

View File

@ -94,7 +94,7 @@ public:
* This is the file format used by the commercial ECLiPSE simulator. Usually it uses
* a cornerpoint description of the grid.
*/
EclBaseGridManager(Simulator &simulator)
EclBaseGridManager(Simulator& simulator)
: ParentType(simulator)
{
int myRank = 0;

View File

@ -160,7 +160,7 @@ protected:
void createGrids_()
{
const auto& gridProps = this->eclState()->get3DProperties();
const std::vector<double> &porv = gridProps.getDoubleGridProperty("PORV").getData();
const std::vector<double>& porv = gridProps.getDoubleGridProperty("PORV").getData();
grid_ = new Dune::CpGrid();
grid_->processEclipseFormat(this->eclState()->getInputGrid(),

View File

@ -30,6 +30,9 @@
#include <ewoms/disc/common/fvbaseproperties.hh>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/common/fvector.hh>
namespace Ewoms {
@ -60,42 +63,42 @@ public:
{ }
template <bool prepareValues = true, bool prepareGradients = true>
void prepare(const ElementContext &elemCtx, unsigned timeIdx)
void prepare(const ElementContext& elemCtx, unsigned timeIdx)
{ }
template <class QuantityCallback, class QuantityType = Scalar>
QuantityType calculateValue(const ElementContext &elemCtx,
QuantityType calculateValue(const ElementContext& elemCtx,
unsigned fapIdx,
const QuantityCallback &quantityCallback) const
const QuantityCallback& quantityCallback) const
{
OPM_THROW(std::logic_error,
"Generic values are not supported by the ECL black-oil simulator");
}
template <class QuantityCallback>
void calculateGradient(DimVector &quantityGrad,
const ElementContext &elemCtx,
void calculateGradient(DimVector& quantityGrad,
const ElementContext& elemCtx,
unsigned fapIdx,
const QuantityCallback &quantityCallback) const
const QuantityCallback& quantityCallback) const
{
OPM_THROW(std::logic_error,
"Generic gradients are not supported by the ECL black-oil simulator");
}
template <class QuantityCallback>
Scalar calculateBoundaryValue(const ElementContext &elemCtx,
Scalar calculateBoundaryValue(const ElementContext& elemCtx,
unsigned fapIdx,
const QuantityCallback &quantityCallback)
const QuantityCallback& quantityCallback)
{
OPM_THROW(std::logic_error,
"Generic boundary values are not supported by the ECL black-oil simulator");
}
template <class QuantityCallback>
void calculateBoundaryGradient(DimVector &quantityGrad,
const ElementContext &elemCtx,
void calculateBoundaryGradient(DimVector& quantityGrad,
const ElementContext& elemCtx,
unsigned fapIdx,
const QuantityCallback &quantityCallback) const
const QuantityCallback& quantityCallback) const
{
OPM_THROW(std::logic_error,
"Generic boundary gradients are not supported by the ECL black-oil simulator");

View File

@ -142,7 +142,7 @@ public:
initialFluidStates_.resize(numCartesianElems);
for (unsigned equilElemIdx = 0; equilElemIdx < numEquilElems; ++equilElemIdx) {
unsigned cartesianElemIdx = gridManager.equilCartesianIndex(equilElemIdx);
auto &fluidState = initialFluidStates_[cartesianElemIdx];
auto& fluidState = initialFluidStates_[cartesianElemIdx];
// get the PVT region index of the current element
unsigned regionIdx = simulator_.problem().pvtRegionIndex(equilElemIdx);

View File

@ -34,6 +34,10 @@
#include <ewoms/disc/common/fvbaseproperties.hh>
#include <ewoms/common/signum.hh>
#include <opm/material/common/Valgrind.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
@ -87,7 +91,7 @@ class EclTransIntensiveQuantities
{
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
protected:
void update_(const ElementContext &elemCtx, unsigned dofIdx, unsigned timeIdx)
void update_(const ElementContext& elemCtx, unsigned dofIdx, unsigned timeIdx)
{ }
};
@ -205,7 +209,7 @@ protected:
/*!
* \brief Update the required gradients for interior faces
*/
void calculateGradients_(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
void calculateGradients_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{
Valgrind::SetUndefined(*this);
@ -228,8 +232,8 @@ protected:
// acts into the downwards direction. (i.e., no centrifuge experiments, sorry.)
Scalar g = elemCtx.problem().gravity()[dimWorld - 1];
const auto &intQuantsIn = elemCtx.intensiveQuantities(interiorDofIdx_, timeIdx);
const auto &intQuantsEx = elemCtx.intensiveQuantities(exteriorDofIdx_, timeIdx);
const auto& intQuantsIn = elemCtx.intensiveQuantities(interiorDofIdx_, timeIdx);
const auto& intQuantsEx = elemCtx.intensiveQuantities(exteriorDofIdx_, timeIdx);
// this is quite hacky because the dune grid interface does not provide a
// cellCenterDepth() method (so we ask the problem to provide it). The "good"
@ -338,7 +342,7 @@ protected:
/*!
* \brief Update the volumetric fluxes for all fluid phases on the interior faces of the context
*/
void calculateFluxes_(const ElementContext &elemCtx, unsigned scvfIdx, unsigned timeIdx)
void calculateFluxes_(const ElementContext& elemCtx, unsigned scvfIdx, unsigned timeIdx)
{ }
// transmissibility [m^3 s]

View File

@ -31,10 +31,11 @@
#include "ecldeckunits.hh"
#include <ewoms/io/baseoutputmodule.hh>
#include <ewoms/common/propertysystem.hh>
#include <ewoms/common/parametersystem.hh>
#include <opm/material/common/Valgrind.hpp>
#include <dune/common/fvector.hh>
#include <type_traits>
@ -96,7 +97,7 @@ class EclOutputBlackOilModule : public BaseOutputModule<TypeTag>
typedef typename ParentType::ScalarBuffer ScalarBuffer;
public:
EclOutputBlackOilModule(const Simulator &simulator)
EclOutputBlackOilModule(const Simulator& simulator)
: ParentType(simulator)
{ }
@ -158,7 +159,7 @@ public:
* \brief Modify the internal buffers according to the intensive quanties relevant
* for an element
*/
void processElement(const ElementContext &elemCtx)
void processElement(const ElementContext& elemCtx)
{
if (!EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput))
return;
@ -169,7 +170,7 @@ public:
return;
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
const auto &fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState();
const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState();
typedef typename std::remove_const<typename std::remove_reference<decltype(fs)>::type>::type FluidState;
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
unsigned pvtRegionIdx = elemCtx.primaryVars(dofIdx, /*timeIdx=*/0).pvtRegionIndex();
@ -213,7 +214,7 @@ public:
/*!
* \brief Add all buffers to the VTK output writer.
*/
void commitBuffers(BaseOutputWriter &writer)
void commitBuffers(BaseOutputWriter& writer)
{
if (!std::is_same<Discretization, Ewoms::EcfvDiscretization<TypeTag> >::value)
return;

View File

@ -35,6 +35,9 @@
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/densead/Evaluation.hpp>
#include <opm/material/densead/Math.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/version.hh>
@ -240,7 +243,7 @@ public:
Shut
};
EclPeacemanWell(const Simulator &simulator)
EclPeacemanWell(const Simulator& simulator)
: simulator_(simulator)
{
// set the initial status of the well
@ -304,7 +307,7 @@ public:
// add the grid DOFs which are influenced by the well, and add the well dof to
// the ones neighboring the grid ones
auto wellDofIt = dofVariables_.begin();
const auto &wellDofEndIt = dofVariables_.end();
const auto& wellDofEndIt = dofVariables_.end();
for (; wellDofIt != wellDofEndIt; ++ wellDofIt) {
neighbors[wellGlobalDof].insert(wellDofIt->first);
neighbors[wellDofIt->first].insert(wellGlobalDof);
@ -316,7 +319,7 @@ public:
*/
virtual void applyInitial()
{
auto &sol = const_cast<SolutionVector&>(simulator_.model().solution(/*timeIdx=*/0));
auto& sol = const_cast<SolutionVector&>(simulator_.model().solution(/*timeIdx=*/0));
int wellGlobalDof = AuxModule::localToGlobalDof(/*localDofIdx=*/0);
sol[wellGlobalDof] = 0.0;
@ -332,7 +335,7 @@ public:
unsigned wellGlobalDofIdx = AuxModule::localToGlobalDof(/*localDofIdx=*/0);
residual[wellGlobalDofIdx] = 0.0;
auto &diagBlock = matrix[wellGlobalDofIdx][wellGlobalDofIdx];
auto& diagBlock = matrix[wellGlobalDofIdx][wellGlobalDofIdx];
diagBlock = 0.0;
for (unsigned i = 0; i < numModelEq; ++ i)
diagBlock[i][i] = 1.0;
@ -342,7 +345,7 @@ public:
// matrix: the main diagonal is already set to the identity matrix, the
// off-diagonal matrix entries must be set to 0.
auto wellDofIt = dofVariables_.begin();
const auto &wellDofEndIt = dofVariables_.end();
const auto& wellDofEndIt = dofVariables_.end();
for (; wellDofIt != wellDofEndIt; ++ wellDofIt) {
matrix[wellGlobalDofIdx][wellDofIt->first] = 0.0;
matrix[wellDofIt->first][wellGlobalDofIdx] = 0.0;
@ -357,18 +360,18 @@ public:
// account for the effect of the grid DOFs which are influenced by the well on
// the well equation and the effect of the well on the grid DOFs
auto wellDofIt = dofVariables_.begin();
const auto &wellDofEndIt = dofVariables_.end();
const auto& wellDofEndIt = dofVariables_.end();
ElementContext elemCtx(simulator_);
for (; wellDofIt != wellDofEndIt; ++ wellDofIt) {
unsigned gridDofIdx = wellDofIt->first;
const auto &dofVars = *dofVariables_[gridDofIdx];
const auto& dofVars = *dofVariables_[gridDofIdx];
DofVariables tmpDofVars(dofVars);
auto priVars(curSol[gridDofIdx]);
/////////////
// influence of grid on well
auto &curBlock = matrix[wellGlobalDofIdx][gridDofIdx];
auto& curBlock = matrix[wellGlobalDofIdx][gridDofIdx];
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
elemCtx.updateStencil(*dofVars.elementPtr);
#else
@ -439,7 +442,7 @@ public:
// of a problem...
assert(numModelEq == numComponents);
Valgrind::CheckDefined(q);
auto &matrixEntry = matrix[gridDofIdx][wellGlobalDofIdx];
auto& matrixEntry = matrix[gridDofIdx][wellGlobalDofIdx];
matrixEntry = 0.0;
for (unsigned eqIdx = 0; eqIdx < numModelEq; ++ eqIdx)
matrixEntry[eqIdx][0] = - Toolbox::value(q[eqIdx])/dofVars.totalVolume;
@ -573,31 +576,31 @@ public:
*
* Well, let's say "readable by some humans".
*/
const std::string &name() const
const std::string& name() const
{ return name_; }
/*!
* \brief Set the human-readable name of the well
*/
void setName(const std::string &newName)
void setName(const std::string& newName)
{ name_ = newName; }
/*!
* \brief Add a degree of freedom to the well.
*/
template <class Context>
void addDof(const Context &context, unsigned dofIdx)
void addDof(const Context& context, unsigned dofIdx)
{
unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
if (applies(globalDofIdx))
// we already have this DOF in the well!
return;
const auto &dofPos = context.pos(dofIdx, /*timeIdx=*/0);
const auto& dofPos = context.pos(dofIdx, /*timeIdx=*/0);
dofVarsStore_.push_back(DofVariables());
dofVariables_[globalDofIdx] = &dofVarsStore_.back();
DofVariables &dofVars = *dofVariables_[globalDofIdx];
DofVariables& dofVars = *dofVariables_[globalDofIdx];
wellTotalVolume_ += context.model().dofTotalVolume(globalDofIdx);
dofVars.elementPtr.reset(new ElementPointer(context.element()));
@ -616,15 +619,15 @@ public:
assert(context.element().template count</*codim=*/dimWorld>() == 8);
#endif
const auto &refElem = Dune::ReferenceElements<Scalar, /*dim=*/3>::cube();
const auto& refElem = Dune::ReferenceElements<Scalar, /*dim=*/3>::cube();
// determine the current element's effective size
const auto &elem = context.element();
const auto& elem = context.element();
unsigned faceIdx = 0;
unsigned numFaces = refElem.size(/*codim=*/1);
for (; faceIdx < numFaces; ++faceIdx) {
const auto &faceCenterLocal = refElem.position(faceIdx, /*codim=*/1);
const auto &faceCenter = elem.geometry().global(faceCenterLocal);
const auto& faceCenterLocal = refElem.position(faceIdx, /*codim=*/1);
const auto& faceCenter = elem.geometry().global(faceCenterLocal);
switch (faceIdx) {
case 0:
@ -716,7 +719,7 @@ public:
* \brief Set the connection transmissibility factor for a given degree of freedom.
*/
template <class Context>
void setConnectionTransmissibilityFactor(const Context &context, unsigned dofIdx, Scalar value)
void setConnectionTransmissibilityFactor(const Context& context, unsigned dofIdx, Scalar value)
{
unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
dofVariables_[globalDofIdx]->connectionTransmissibilityFactor = value;
@ -734,7 +737,7 @@ public:
* be called after setEffectivePermeability()!
*/
template <class Context>
void setEffectivePermeability(const Context &context, unsigned dofIdx, Scalar value)
void setEffectivePermeability(const Context& context, unsigned dofIdx, Scalar value)
{
unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
dofVariables_[globalDofIdx].effectivePermeability = value;
@ -898,7 +901,7 @@ public:
* be called after setSkinFactor()!
*/
template <class Context>
void setSkinFactor(const Context &context, unsigned dofIdx, Scalar value)
void setSkinFactor(const Context& context, unsigned dofIdx, Scalar value)
{
unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
dofVariables_[globalDofIdx].skinFactor = value;
@ -920,7 +923,7 @@ public:
* be called after setRadius()!
*/
template <class Context>
void setRadius(const Context &context, unsigned dofIdx, Scalar value)
void setRadius(const Context& context, unsigned dofIdx, Scalar value)
{
unsigned globalDofIdx = context.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
dofVariables_[globalDofIdx]->boreholeRadius = value;
@ -986,7 +989,7 @@ public:
* \brief Do the DOF specific part at the beginning of each iteration
*/
template <class Context>
void beginIterationAccumulate(Context &context, unsigned timeIdx)
void beginIterationAccumulate(Context& context, unsigned timeIdx)
{
if (wellStatus() == Shut)
return;
@ -996,7 +999,7 @@ public:
if (!applies(globalDofIdx))
continue;
DofVariables &dofVars = *dofVariables_.at(globalDofIdx);
DofVariables& dofVars = *dofVariables_.at(globalDofIdx);
const auto& intQuants = context.intensiveQuantities(dofIdx, timeIdx);
if (iterationIdx_ == 0)
@ -1017,7 +1020,7 @@ public:
if (wellStatus() == Shut)
return;
auto &sol = const_cast<SolutionVector&>(simulator_.model().solution(/*timeIdx=*/0));
auto& sol = const_cast<SolutionVector&>(simulator_.model().solution(/*timeIdx=*/0));
int wellGlobalDof = AuxModule::localToGlobalDof(/*localDofIdx=*/0);
// retrieve the bottom hole pressure from the global system of equations
@ -1088,8 +1091,8 @@ public:
* \brief Computes the source term for a degree of freedom.
*/
template <class Context>
void computeTotalRatesForDof(RateVector &q,
const Context &context,
void computeTotalRatesForDof(RateVector& q,
const Context& context,
unsigned dofIdx,
unsigned timeIdx) const
{
@ -1109,7 +1112,7 @@ public:
// convert to mass rates
RateVector modelRate;
const auto &intQuants = context.intensiveQuantities(dofIdx, timeIdx);
const auto& intQuants = context.intensiveQuantities(dofIdx, timeIdx);
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
modelRate.setVolumetricRate(intQuants.fluidState(), phaseIdx, volumetricRates[phaseIdx]);
for (unsigned eqIdx = 0; eqIdx < q.size(); ++eqIdx)
@ -1230,7 +1233,7 @@ protected:
* setVolumetricPhaseWeights()
*/
template <class Eval>
Eval computeWeightedRate_(const std::array<Eval, numPhases> &volRates) const
Eval computeWeightedRate_(const std::array<Eval, numPhases>& volRates) const
{
Eval result = 0;
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
@ -1245,8 +1248,8 @@ protected:
* thus the applicable fluid state.
*/
template <class Eval>
void computeSurfaceRates_(std::array<Eval, numPhases> &surfaceRates,
const std::array<Eval, numPhases> &reservoirRate,
void computeSurfaceRates_(std::array<Eval, numPhases>& surfaceRates,
const std::array<Eval, numPhases>& reservoirRate,
const DofVariables& dofVars) const
{
// the array for the surface rates and the one for the reservoir rates must not
@ -1315,7 +1318,7 @@ protected:
}
auto dofVarsIt = dofVariables_.begin();
const auto &dofVarsEndIt = dofVariables_.end();
const auto& dofVarsEndIt = dofVariables_.end();
for (; dofVarsIt != dofVarsEndIt; ++ dofVarsIt) {
std::array<Scalar, numPhases> volumetricReservoirRates;
const DofVariables *tmp;
@ -1344,7 +1347,7 @@ protected:
*/
Scalar computeOverallWeightedSurfaceRate_(Scalar bottomHolePressure,
std::array<Scalar, numPhases>& overallSurfaceRates,
const DofVariables &evalDofVars,
const DofVariables& evalDofVars,
int globalEvalDofIdx) const
{
@ -1445,7 +1448,7 @@ protected:
std::fill(totalSurfaceRates.begin(), totalSurfaceRates.end(), 0.0);
auto dofVarsIt = dofVariables_.begin();
const auto &dofVarsEndIt = dofVariables_.end();
const auto& dofVarsEndIt = dofVariables_.end();
for (; dofVarsIt != dofVarsEndIt; ++ dofVarsIt) {
std::array<BhpEval, numPhases> resvRates;
const DofVariables *dofVars = dofVarsIt->second;
@ -1510,7 +1513,7 @@ protected:
return scalingFactor*result;
}
const Simulator &simulator_;
const Simulator& simulator_;
std::string name_;

View File

@ -72,10 +72,12 @@
#include <opm/material/fluidsystems/blackoilpvt/DeadOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
@ -291,7 +293,7 @@ public:
/*!
* \copydoc Doxygen::defaultProblemConstructor
*/
EclProblem(Simulator &simulator)
EclProblem(Simulator& simulator)
: ParentType(simulator)
, transmissibilities_(simulator)
, thresholdPressures_(simulator)
@ -361,7 +363,7 @@ public:
* \param res The deserializer object
*/
template <class Restarter>
void deserialize(Restarter &res)
void deserialize(Restarter& res)
{
// reload the current episode/report step from the deck
beginEpisode(/*isOnRestart=*/true);
@ -375,7 +377,7 @@ public:
* to the harddisk.
*/
template <class Restarter>
void serialize(Restarter &res)
void serialize(Restarter& res)
{ wellManager_.serialize(res); }
/*!
@ -584,7 +586,7 @@ public:
* \copydoc FvBaseMultiPhaseProblem::intrinsicPermeability
*/
template <class Context>
const DimMatrix &intrinsicPermeability(const Context &context,
const DimMatrix& intrinsicPermeability(const Context& context,
unsigned spaceIdx,
unsigned timeIdx) const
{
@ -598,14 +600,14 @@ public:
*
* Its main (only?) usage is the ECL transmissibility calculation code...
*/
const DimMatrix &intrinsicPermeability(unsigned globalElemIdx) const
const DimMatrix& intrinsicPermeability(unsigned globalElemIdx) const
{ return intrinsicPermeability_[globalElemIdx]; }
/*!
* \copydoc BlackOilBaseProblem::transmissibility
*/
template <class Context>
Scalar transmissibility(const Context &context,
Scalar transmissibility(const Context& context,
unsigned fromDofLocalIdx,
unsigned toDofLocalIdx) const
{
@ -623,7 +625,7 @@ public:
* \copydoc FvBaseMultiPhaseProblem::porosity
*/
template <class Context>
Scalar porosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Scalar porosity(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return porosity_[globalSpaceIdx];
@ -636,7 +638,7 @@ public:
* thus slightly different from the depth of an element's centroid.
*/
template <class Context>
Scalar dofCenterDepth(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Scalar dofCenterDepth(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
return elementCenterDepth_[globalSpaceIdx];
@ -646,7 +648,7 @@ public:
* \copydoc BlackoilProblem::rockCompressibility
*/
template <class Context>
Scalar rockCompressibility(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Scalar rockCompressibility(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
if (rockParams_.empty())
return 0.0;
@ -664,7 +666,7 @@ public:
* \copydoc BlackoilProblem::rockReferencePressure
*/
template <class Context>
Scalar rockReferencePressure(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Scalar rockReferencePressure(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
if (rockParams_.empty())
return 1e5;
@ -682,7 +684,7 @@ public:
* \copydoc FvBaseMultiPhaseProblem::materialLawParams
*/
template <class Context>
const MaterialLawParams &materialLawParams(const Context &context,
const MaterialLawParams& materialLawParams(const Context& context,
unsigned spaceIdx, unsigned timeIdx) const
{
unsigned globalSpaceIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
@ -696,7 +698,7 @@ public:
* \brief Returns the index of the relevant region for thermodynmic properties
*/
template <class Context>
unsigned pvtRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
unsigned pvtRegionIndex(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{ return pvtRegionIndex(context.globalSpaceIndex(spaceIdx, timeIdx)); }
/*!
@ -720,7 +722,7 @@ public:
* \copydoc FvBaseMultiPhaseProblem::temperature
*/
template <class Context>
Scalar temperature(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Scalar temperature(const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
// use the temporally constant temperature, i.e. use the initial temperature of
// the DOF
@ -734,8 +736,8 @@ public:
* ECLiPSE uses no-flow conditions for all boundaries. \todo really?
*/
template <class Context>
void boundary(BoundaryRateVector &values,
const Context &context,
void boundary(BoundaryRateVector& values,
const Context& context,
unsigned spaceIdx,
unsigned timeIdx) const
{ values.setNoFlow(); }
@ -747,7 +749,7 @@ public:
* the whole domain.
*/
template <class Context>
void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
void initial(PrimaryVariables& values, const Context& context, unsigned spaceIdx, unsigned timeIdx) const
{
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
@ -785,8 +787,8 @@ public:
* For this problem, the source term of all components is 0 everywhere.
*/
template <class Context>
void source(RateVector &rate,
const Context &context,
void source(RateVector& rate,
const Context& context,
unsigned spaceIdx,
unsigned timeIdx) const
{
@ -913,7 +915,7 @@ private:
// provided by eclState are one-per-cell of "uncompressed" grid, whereas the
// opm-grid CpGrid object might remove a few elements...
if (props.hasDeckDoubleGridProperty("PERMX")) {
const std::vector<double> &permxData =
const std::vector<double>& permxData =
props.getDoubleGridProperty("PERMX").getData();
std::vector<double> permyData(permxData);
if (props.hasDeckDoubleGridProperty("PERMY"))
@ -966,9 +968,9 @@ private:
porosity_.resize(numDof);
const std::vector<double> &porvData =
const std::vector<double>& porvData =
props.getDoubleGridProperty("PORV").getData();
const std::vector<int> &actnumData =
const std::vector<int>& actnumData =
props.getIntGridProperty("ACTNUM").getData();
int nx = eclGrid.getNX();
@ -1046,7 +1048,7 @@ private:
size_t numElems = this->model().numGridDof();
initialFluidStates_.resize(numElems);
for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
auto &elemFluidState = initialFluidStates_[elemIdx];
auto& elemFluidState = initialFluidStates_[elemIdx];
elemFluidState.assign(equilInitializer.initialFluidState(elemIdx));
}
}
@ -1100,7 +1102,7 @@ private:
if (enableVapoil)
rvData = &deck->getKeyword("RV").getSIDoubleData();
// initial reservoir temperature
const std::vector<double> &tempiData =
const std::vector<double>& tempiData =
eclState->get3DProperties().getDoubleGridProperty("TEMPI").getData();
// make sure that the size of the data arrays is correct
@ -1118,7 +1120,7 @@ private:
// calculate the initial fluid states
for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
auto &dofFluidState = initialFluidStates_[dofIdx];
auto& dofFluidState = initialFluidStates_[dofIdx];
int pvtRegionIdx = pvtRegionIndex(dofIdx);
size_t cartesianDofIdx = gridManager.cartesianIndex(dofIdx);
@ -1278,7 +1280,7 @@ private:
// update the prefetch friendly data object
void updatePffDofData_()
{
const auto &distFn =
const auto& distFn =
[this](PffDofData_& dofData,
const Stencil& stencil,
unsigned localDofIdx)

View File

@ -38,6 +38,8 @@
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/grid/common/gridenums.hh>
#include <dune/common/version.hh>
@ -177,10 +179,10 @@ private:
continue;
elemCtx.updateAll(elem);
const auto &stencil = elemCtx.stencil(/*timeIdx=*/0);
const auto& stencil = elemCtx.stencil(/*timeIdx=*/0);
for (unsigned scvfIdx = 0; scvfIdx < stencil.numInteriorFaces(); ++ scvfIdx) {
const auto &face = stencil.interiorFace(scvfIdx);
const auto& face = stencil.interiorFace(scvfIdx);
unsigned i = face.interiorIndex();
unsigned j = face.exteriorIndex();

View File

@ -34,6 +34,8 @@
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
@ -303,7 +305,7 @@ private:
return x;
}
void applyMultipliers_(Scalar &trans, unsigned faceIdx, unsigned cartElemIdx,
void applyMultipliers_(Scalar& trans, unsigned faceIdx, unsigned cartElemIdx,
const Opm::TransMult& transMult) const
{
// apply multiplyer for the transmissibility of the face. (the
@ -333,7 +335,7 @@ private:
}
}
void applyNtg_(Scalar &trans, unsigned faceIdx, unsigned cartElemIdx,
void applyNtg_(Scalar& trans, unsigned faceIdx, unsigned cartElemIdx,
const std::vector<double>& ntg) const
{
// apply multiplyer for the transmissibility of the face. (the

View File

@ -39,6 +39,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <ewoms/common/propertysystem.hh>
#include <ewoms/parallel/threadedentityiterator.hh>
@ -84,7 +86,7 @@ class EclWellManager
typedef Dune::FieldVector<Evaluation, numEq> EvalEqVector;
public:
EclWellManager(Simulator &simulator)
EclWellManager(Simulator& simulator)
: simulator_(simulator)
{ }
@ -101,7 +103,7 @@ public:
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
{
const Opm::Well* deckWell = deckSchedule.getWells()[deckWellIdx];
const std::string &wellName = deckWell->name();
const std::string& wellName = deckWell->name();
// set the name of the well but not much else. (i.e., if it is not completed,
// the well primarily serves as a placeholder.) The big rest of the well is
@ -168,7 +170,7 @@ public:
if (deckWell->isInjector(episodeIdx)) {
well->setWellType(Well::Injector);
const Opm::WellInjectionProperties &injectProperties =
const Opm::WellInjectionProperties& injectProperties =
deckWell->getInjectionProperties(episodeIdx);
switch (injectProperties.injectorType) {
@ -244,7 +246,7 @@ public:
if (deckWell->isProducer(episodeIdx)) {
well->setWellType(Well::Producer);
const Opm::WellProductionProperties &producerProperties =
const Opm::WellProductionProperties& producerProperties =
deckWell->getProductionProperties(episodeIdx);
switch (producerProperties.controlMode) {
@ -321,7 +323,7 @@ public:
/*!
* \brief Return if a given well name is known to the wells manager
*/
bool hasWell(const std::string &wellName) const
bool hasWell(const std::string& wellName) const
{
return wellNameToIndex_.find( wellName ) != wellNameToIndex_.end();
}
@ -337,10 +339,10 @@ public:
*
* A std::runtime_error will be thrown if the well name is unknown.
*/
unsigned wellIndex(const std::string &wellName) const
unsigned wellIndex(const std::string& wellName) const
{
assert( hasWell( wellName ) );
const auto &it = wellNameToIndex_.find(wellName);
const auto& it = wellNameToIndex_.find(wellName);
if (it == wellNameToIndex_.end())
{
OPM_THROW(std::runtime_error,
@ -354,7 +356,7 @@ public:
*
* A std::runtime_error will be thrown if the well name is unknown.
*/
std::shared_ptr<const Well> well(const std::string &wellName) const
std::shared_ptr<const Well> well(const std::string& wellName) const
{ return wells_[wellIndex(wellName)]; }
/*!
@ -362,7 +364,7 @@ public:
*
* A std::runtime_error will be thrown if the well name is unknown.
*/
std::shared_ptr<Well> well(const std::string &wellName)
std::shared_ptr<Well> well(const std::string& wellName)
{ return wells_[wellIndex(wellName)]; }
/*!
@ -513,8 +515,8 @@ public:
* freedom.
*/
template <class Context>
void computeTotalRatesForDof(EvalEqVector &q,
const Context &context,
void computeTotalRatesForDof(EvalEqVector& q,
const Context& context,
unsigned dofIdx,
unsigned timeIdx) const
{
@ -540,7 +542,7 @@ public:
* to the hard disk.
*/
template <class Restarter>
void serialize(Restarter &res)
void serialize(Restarter& res)
{
/* do nothing: Everything which we need here is provided by the deck->.. */
}
@ -552,7 +554,7 @@ public:
* It is the inverse of the serialize() method.
*/
template <class Restarter>
void deserialize(Restarter &res)
void deserialize(Restarter& res)
{
// initialize the wells for the current episode
beginEpisode(simulator_.gridManager().eclState(), /*wasRestarted=*/true);
@ -791,7 +793,7 @@ protected:
}
}
Simulator &simulator_;
Simulator& simulator_;
std::vector<std::shared_ptr<Well> > wells_;
std::vector<bool> gridDofIsPenetrated_;

View File

@ -74,7 +74,7 @@ namespace Dune
typedef Dune::cpgrid::Entity< codim > EntityType;
typedef EntityType GridEntityType;
static const GridEntityType &gridEntity ( const EntityType &entity )
static const GridEntityType& gridEntity ( const EntityType& entity )
{
return entity;
}
@ -88,7 +88,7 @@ namespace Dune
#if HAVE_QUAD
template< class Traits >
inline OutStreamInterface< Traits > &
operator<< ( OutStreamInterface< Traits > &out,
operator<< ( OutStreamInterface< Traits >& out,
const __float128 value )
{
double val = double( value );
@ -98,7 +98,7 @@ namespace Dune
template< class Traits >
inline InStreamInterface< Traits > &
operator>> ( InStreamInterface< Traits > &in,
operator>> ( InStreamInterface< Traits >& in,
__float128& value )
{
double val;