mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixed: do not assert conditions guaranteed by unsigned
This commit is contained in:
parent
eab6faeea3
commit
44267fd206
@ -203,7 +203,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void globalPhaseStorage(EqVector& storage, unsigned phaseIdx)
|
void globalPhaseStorage(EqVector& storage, unsigned phaseIdx)
|
||||||
{
|
{
|
||||||
assert(0 <= phaseIdx && phaseIdx < numPhases);
|
assert(phaseIdx < numPhases);
|
||||||
|
|
||||||
storage = 0;
|
storage = 0;
|
||||||
|
|
||||||
|
@ -91,7 +91,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
int localToGlobalDof(unsigned localDofIdx) const
|
int localToGlobalDof(unsigned localDofIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= localDofIdx);
|
|
||||||
assert(localDofIdx < numDofs());
|
assert(localDofIdx < numDofs());
|
||||||
return dofOffset_ + localDofIdx;
|
return dofOffset_ + localDofIdx;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ public:
|
|||||||
const IntensiveQuantities& intensiveQuantities(unsigned dofIdx, unsigned timeIdx) const
|
const IntensiveQuantities& intensiveQuantities(unsigned dofIdx, unsigned timeIdx) const
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(timeIdx));
|
assert(dofIdx < numDof(timeIdx));
|
||||||
|
|
||||||
if (enableStorageCache_ && timeIdx != 0 && problem().recycleFirstIterationStorage())
|
if (enableStorageCache_ && timeIdx != 0 && problem().recycleFirstIterationStorage())
|
||||||
throw std::logic_error("If caching of the storage term is enabled, only the intensive quantities "
|
throw std::logic_error("If caching of the storage term is enabled, only the intensive quantities "
|
||||||
@ -429,7 +429,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const IntensiveQuantities *thermodynamicHint(unsigned dofIdx, unsigned timeIdx) const
|
const IntensiveQuantities *thermodynamicHint(unsigned dofIdx, unsigned timeIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(timeIdx));
|
assert(dofIdx < numDof(timeIdx));
|
||||||
return dofVars_[dofIdx].thermodynamicHint[timeIdx];
|
return dofVars_[dofIdx].thermodynamicHint[timeIdx];
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -437,7 +437,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
IntensiveQuantities& intensiveQuantities(unsigned dofIdx, unsigned timeIdx)
|
IntensiveQuantities& intensiveQuantities(unsigned dofIdx, unsigned timeIdx)
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(timeIdx));
|
assert(dofIdx < numDof(timeIdx));
|
||||||
return dofVars_[dofIdx].intensiveQuantities[timeIdx];
|
return dofVars_[dofIdx].intensiveQuantities[timeIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
PrimaryVariables& primaryVars(unsigned dofIdx, unsigned timeIdx)
|
PrimaryVariables& primaryVars(unsigned dofIdx, unsigned timeIdx)
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(timeIdx));
|
assert(dofIdx < numDof(timeIdx));
|
||||||
return dofVars_[dofIdx].priVars[timeIdx];
|
return dofVars_[dofIdx].priVars[timeIdx];
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -459,7 +459,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const PrimaryVariables& primaryVars(unsigned dofIdx, unsigned timeIdx) const
|
const PrimaryVariables& primaryVars(unsigned dofIdx, unsigned timeIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(timeIdx));
|
assert(dofIdx < numDof(timeIdx));
|
||||||
return dofVars_[dofIdx].priVars[timeIdx];
|
return dofVars_[dofIdx].priVars[timeIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void stashIntensiveQuantities(unsigned dofIdx)
|
void stashIntensiveQuantities(unsigned dofIdx)
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof(/*timeIdx=*/0));
|
assert(dofIdx < numDof(/*timeIdx=*/0));
|
||||||
|
|
||||||
intensiveQuantitiesStashed_ = dofVars_[dofIdx].intensiveQuantities[/*timeIdx=*/0];
|
intensiveQuantitiesStashed_ = dofVars_[dofIdx].intensiveQuantities[/*timeIdx=*/0];
|
||||||
priVarsStashed_ = dofVars_[dofIdx].priVars[/*timeIdx=*/0];
|
priVarsStashed_ = dofVars_[dofIdx].priVars[/*timeIdx=*/0];
|
||||||
|
@ -311,7 +311,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
unsigned globalSpaceIndex(unsigned dofIdx) const
|
unsigned globalSpaceIndex(unsigned dofIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof());
|
assert(dofIdx < numDof());
|
||||||
|
|
||||||
return static_cast<unsigned>(elementMapper_.index(element(dofIdx)));
|
return static_cast<unsigned>(elementMapper_.index(element(dofIdx)));
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const Element& element(unsigned dofIdx) const
|
const Element& element(unsigned dofIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof());
|
assert(dofIdx < numDof());
|
||||||
|
|
||||||
return elements_[dofIdx];
|
return elements_[dofIdx];
|
||||||
}
|
}
|
||||||
|
@ -1070,7 +1070,7 @@ public:
|
|||||||
|
|
||||||
const SubControlVolume& subControlVolume(unsigned scvIdx) const
|
const SubControlVolume& subControlVolume(unsigned scvIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= scvIdx && scvIdx < numDof());
|
assert(scvIdx < numDof());
|
||||||
return subContVol[scvIdx];
|
return subContVol[scvIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,7 +1092,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
unsigned globalSpaceIndex(unsigned dofIdx) const
|
unsigned globalSpaceIndex(unsigned dofIdx) const
|
||||||
{
|
{
|
||||||
assert(0 <= dofIdx && dofIdx < numDof());
|
assert(dofIdx < numDof());
|
||||||
|
|
||||||
return static_cast<unsigned>(vertexMapper_.subIndex(element_, static_cast<int>(dofIdx), /*codim=*/dim));
|
return static_cast<unsigned>(vertexMapper_.subIndex(element_, static_cast<int>(dofIdx), /*codim=*/dim));
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ public:
|
|||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
||||||
assert(0 <= compIdx && compIdx <= numPhases);
|
assert(compIdx <= numPhases);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make all kg equal
|
// make all kg equal
|
||||||
|
@ -400,7 +400,7 @@ public:
|
|||||||
else if (fugacity0Idx <= pvIdx && pvIdx < fugacity0Idx + numComponents) {
|
else if (fugacity0Idx <= pvIdx && pvIdx < fugacity0Idx + numComponents) {
|
||||||
// component fugacity
|
// component fugacity
|
||||||
unsigned compIdx = pvIdx - fugacity0Idx;
|
unsigned compIdx = pvIdx - fugacity0Idx;
|
||||||
assert(0 <= compIdx && compIdx <= numComponents);
|
assert(compIdx <= numComponents);
|
||||||
|
|
||||||
Opm::Valgrind::CheckDefined(minActivityCoeff_[globalDofIdx][compIdx]);
|
Opm::Valgrind::CheckDefined(minActivityCoeff_[globalDofIdx][compIdx]);
|
||||||
static const Scalar fugacityBaseWeight =
|
static const Scalar fugacityBaseWeight =
|
||||||
@ -414,7 +414,7 @@ public:
|
|||||||
else {
|
else {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
unsigned phaseIdx = pvIdx - saturation0Idx;
|
unsigned phaseIdx = pvIdx - saturation0Idx;
|
||||||
assert(0 <= phaseIdx && phaseIdx < numPhases - 1);
|
assert(phaseIdx < numPhases - 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// saturation
|
// saturation
|
||||||
@ -444,7 +444,7 @@ public:
|
|||||||
|
|
||||||
// a mass conservation equation
|
// a mass conservation equation
|
||||||
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
||||||
assert(0 <= compIdx && compIdx <= numComponents);
|
assert(compIdx <= numComponents);
|
||||||
|
|
||||||
// make all kg equal
|
// make all kg equal
|
||||||
return FluidSystem::molarMass(compIdx);
|
return FluidSystem::molarMass(compIdx);
|
||||||
|
@ -165,7 +165,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
DataType& operator[](size_t i)
|
DataType& operator[](size_t i)
|
||||||
{
|
{
|
||||||
assert(0 <= i && i < dataSize_);
|
assert(i < dataSize_);
|
||||||
return data_[i];
|
return data_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const DataType& operator[](size_t i) const
|
const DataType& operator[](size_t i) const
|
||||||
{
|
{
|
||||||
assert(0 <= i && i < dataSize_);
|
assert(i < dataSize_);
|
||||||
return data_[i];
|
return data_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ public:
|
|||||||
return tmp;
|
return tmp;
|
||||||
|
|
||||||
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
unsigned compIdx = eqIdx - Indices::conti0EqIdx;
|
||||||
assert(0 <= compIdx && compIdx <= numComponents);
|
assert(compIdx <= numComponents);
|
||||||
|
|
||||||
// make all kg equal
|
// make all kg equal
|
||||||
return FluidSystem::molarMass(compIdx);
|
return FluidSystem::molarMass(compIdx);
|
||||||
|
@ -347,7 +347,7 @@ public:
|
|||||||
Scalar eqWeight(unsigned globalDofIdx OPM_UNUSED, unsigned OPM_OPTIM_UNUSED eqIdx) const
|
Scalar eqWeight(unsigned globalDofIdx OPM_UNUSED, unsigned OPM_OPTIM_UNUSED eqIdx) const
|
||||||
{
|
{
|
||||||
unsigned OPM_OPTIM_UNUSED compIdx = eqIdx - Indices::contiEqIdx;
|
unsigned OPM_OPTIM_UNUSED compIdx = eqIdx - Indices::contiEqIdx;
|
||||||
assert(0 <= compIdx && compIdx <= FluidSystem::numPhases);
|
assert(compIdx <= FluidSystem::numPhases);
|
||||||
|
|
||||||
// make all kg equal
|
// make all kg equal
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user