mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3457 from akva2/janitoring
mark variables [[maybe_unused]]
This commit is contained in:
@@ -128,7 +128,7 @@ int checkZeroDiagonal(BridgeMatrix& mat) {
|
|||||||
int numZeros = 0;
|
int numZeros = 0;
|
||||||
const int dim = 3; // might be replaced with mat[0][0].N() or BridgeMatrix::block_type::size()
|
const int dim = 3; // might be replaced with mat[0][0].N() or BridgeMatrix::block_type::size()
|
||||||
const double zero_replace = 1e-15;
|
const double zero_replace = 1e-15;
|
||||||
if (diag_indices.size() == 0) {
|
if (diag_indices.empty()) {
|
||||||
int N = mat.N();
|
int N = mat.N();
|
||||||
diag_indices.reserve(N);
|
diag_indices.reserve(N);
|
||||||
for (typename BridgeMatrix::iterator r = mat.begin(); r != mat.end(); ++r) {
|
for (typename BridgeMatrix::iterator r = mat.begin(); r != mat.end(); ++r) {
|
||||||
@@ -169,7 +169,7 @@ void getSparsityPattern(BridgeMatrix& mat, std::vector<int> &h_rows, std::vector
|
|||||||
int sum_nnzs = 0;
|
int sum_nnzs = 0;
|
||||||
|
|
||||||
// convert colIndices and rowPointers
|
// convert colIndices and rowPointers
|
||||||
if (h_rows.size() == 0) {
|
if (h_rows.empty()) {
|
||||||
h_rows.emplace_back(0);
|
h_rows.emplace_back(0);
|
||||||
for (typename BridgeMatrix::const_iterator r = mat.begin(); r != mat.end(); ++r) {
|
for (typename BridgeMatrix::const_iterator r = mat.begin(); r != mat.end(); ++r) {
|
||||||
int size_row = 0;
|
int size_row = 0;
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ void findLevelScheduling(int *CSRColIndices, int *CSRRowPointers, int *CSCRowInd
|
|||||||
std::vector <int> rowsToStart;
|
std::vector <int> rowsToStart;
|
||||||
|
|
||||||
// since emplace_back() is used to fill, the vector must be empty
|
// since emplace_back() is used to fill, the vector must be empty
|
||||||
assert(rowsPerColor.size() == 0);
|
assert(rowsPerColor.empty());
|
||||||
|
|
||||||
// find starting rows: rows that are independent from all rows that come before them.
|
// find starting rows: rows that are independent from all rows that come before them.
|
||||||
for (thisRow = 0; thisRow < Nb; thisRow++) {
|
for (thisRow = 0; thisRow < Nb; thisRow++) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ openclSolverBackend<block_size>::openclSolverBackend(int verbosity_, int maxit_,
|
|||||||
try {
|
try {
|
||||||
std::vector<cl::Platform> platforms;
|
std::vector<cl::Platform> platforms;
|
||||||
cl::Platform::get(&platforms);
|
cl::Platform::get(&platforms);
|
||||||
if (platforms.size() == 0) {
|
if (platforms.empty()) {
|
||||||
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL platforms are found");
|
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL platforms are found");
|
||||||
}
|
}
|
||||||
out << "Found " << platforms.size() << " OpenCL platforms" << "\n";
|
out << "Found " << platforms.size() << " OpenCL platforms" << "\n";
|
||||||
@@ -89,7 +89,7 @@ openclSolverBackend<block_size>::openclSolverBackend(int verbosity_, int maxit_,
|
|||||||
|
|
||||||
platforms[platformID].getDevices(CL_DEVICE_TYPE_ALL, &devices);
|
platforms[platformID].getDevices(CL_DEVICE_TYPE_ALL, &devices);
|
||||||
|
|
||||||
if (devices.size() == 0){
|
if (devices.empty()) {
|
||||||
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL devices are found");
|
OPM_THROW(std::logic_error, "Error openclSolver is selected but no OpenCL devices are found");
|
||||||
}
|
}
|
||||||
out << "Found " << devices.size() << " OpenCL devices" << "\n";
|
out << "Found " << devices.size() << " OpenCL devices" << "\n";
|
||||||
|
|||||||
@@ -137,14 +137,14 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
|
|||||||
/// \brief return max step length used so far
|
/// \brief return max step length used so far
|
||||||
double AdaptiveSimulatorTimer::maxStepLength () const
|
double AdaptiveSimulatorTimer::maxStepLength () const
|
||||||
{
|
{
|
||||||
if( steps_.size() == 0 ) return 0.0;
|
if( steps_.empty() ) return 0.0;
|
||||||
return *(std::max_element( steps_.begin(), steps_.end() ));
|
return *(std::max_element( steps_.begin(), steps_.end() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief return min step length used so far
|
/// \brief return min step length used so far
|
||||||
double AdaptiveSimulatorTimer::minStepLength () const
|
double AdaptiveSimulatorTimer::minStepLength () const
|
||||||
{
|
{
|
||||||
if( steps_.size() == 0 ) return 0.0;
|
if( steps_.empty() ) return 0.0;
|
||||||
return *(std::min_element( steps_.begin(), steps_.end() ));
|
return *(std::min_element( steps_.begin(), steps_.end() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -705,11 +705,11 @@ GasLiftStage2::
|
|||||||
removeSurplusALQ_(const Group &group,
|
removeSurplusALQ_(const Group &group,
|
||||||
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
||||||
{
|
{
|
||||||
if (dec_grads.size() == 0) {
|
if (dec_grads.empty()) {
|
||||||
displayDebugMessage2B_("no wells to remove ALQ from. Skipping");
|
displayDebugMessage2B_("no wells to remove ALQ from. Skipping");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(dec_grads.size() > 0);
|
assert(!dec_grads.empty());
|
||||||
const auto &gl_group = this->glo_.group(group.name());
|
const auto &gl_group = this->glo_.group(group.name());
|
||||||
const auto &max_glift = gl_group.max_lift_gas();
|
const auto &max_glift = gl_group.max_lift_gas();
|
||||||
const auto controls = group.productionControls(this->summary_state_);
|
const auto controls = group.productionControls(this->summary_state_);
|
||||||
@@ -760,7 +760,7 @@ removeSurplusALQ_(const Group &group,
|
|||||||
// NOTE: recalculateGradientAndUpdateData_() will remove the current gradient
|
// NOTE: recalculateGradientAndUpdateData_() will remove the current gradient
|
||||||
// from dec_grads if it cannot calculate a new decremental gradient.
|
// from dec_grads if it cannot calculate a new decremental gradient.
|
||||||
// This will invalidate dec_grad_itr and well_name
|
// This will invalidate dec_grad_itr and well_name
|
||||||
if (dec_grads.size() == 0) stop_iteration = true;
|
if (dec_grads.empty()) stop_iteration = true;
|
||||||
++state.it;
|
++state.it;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -907,7 +907,7 @@ std::pair<std::optional<GasLiftStage2::GradPairItr>,
|
|||||||
GasLiftStage2::OptimizeState::
|
GasLiftStage2::OptimizeState::
|
||||||
getEcoGradients(std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
getEcoGradients(std::vector<GradPair> &inc_grads, std::vector<GradPair> &dec_grads)
|
||||||
{
|
{
|
||||||
if (inc_grads.size() > 0 && dec_grads.size() > 0) {
|
if (!inc_grads.empty() && !dec_grads.empty()) {
|
||||||
this->parent.sortGradients_(inc_grads);
|
this->parent.sortGradients_(inc_grads);
|
||||||
this->parent.sortGradients_(dec_grads);
|
this->parent.sortGradients_(dec_grads);
|
||||||
// The largest incremental gradient is the last element
|
// The largest incremental gradient is the last element
|
||||||
|
|||||||
@@ -716,14 +716,14 @@ template<class FluidSystem, class Indices, class Scalar>
|
|||||||
void
|
void
|
||||||
StandardWellEval<FluidSystem,Indices,Scalar>::
|
StandardWellEval<FluidSystem,Indices,Scalar>::
|
||||||
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
updatePrimaryVariablesNewton(const BVectorWell& dwells,
|
||||||
const double dFLimit,
|
[[maybe_unused]] const double dFLimit,
|
||||||
const double dBHPLimit) const
|
const double dBHPLimit) const
|
||||||
{
|
{
|
||||||
const std::vector<double> old_primary_variables = primary_variables_;
|
const std::vector<double> old_primary_variables = primary_variables_;
|
||||||
|
|
||||||
// for injectors, very typical one of the fractions will be one, and it is easy to get zero value
|
// for injectors, very typical one of the fractions will be one, and it is easy to get zero value
|
||||||
// fractions. not sure what is the best way to handle it yet, so we just use 1.0 here
|
// fractions. not sure what is the best way to handle it yet, so we just use 1.0 here
|
||||||
const double relaxation_factor_fractions =
|
[[maybe_unused]] const double relaxation_factor_fractions =
|
||||||
(baseif_.isProducer()) ? relaxationFactorFractionsProducer(old_primary_variables, dwells)
|
(baseif_.isProducer()) ? relaxationFactorFractionsProducer(old_primary_variables, dwells)
|
||||||
: 1.0;
|
: 1.0;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void WellState::base_init(const std::vector<double>& cellPressures,
|
|||||||
// Setup wellname -> well index mapping.
|
// Setup wellname -> well index mapping.
|
||||||
const int num_perf_this_well = well_perf_data[w].size();
|
const int num_perf_this_well = well_perf_data[w].size();
|
||||||
std::string name = well.name();
|
std::string name = well.name();
|
||||||
assert( name.size() > 0 );
|
assert( !name.empty() );
|
||||||
mapentry_t& wellMapEntry = wellMap_[name];
|
mapentry_t& wellMapEntry = wellMap_[name];
|
||||||
wellMapEntry[ 0 ] = w;
|
wellMapEntry[ 0 ] = w;
|
||||||
wellMapEntry[ 1 ] = connpos;
|
wellMapEntry[ 1 ] = connpos;
|
||||||
|
|||||||
Reference in New Issue
Block a user