diff --git a/ebos/alucartesianindexmapper.hh b/ebos/alucartesianindexmapper.hh index 12abcfe85..25111cf81 100644 --- a/ebos/alucartesianindexmapper.hh +++ b/ebos/alucartesianindexmapper.hh @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -122,7 +123,7 @@ public: //! \brief loop over all internal data handlers and call scatter for //! given entity template - void scatter(MessageBufferImp& buff, const EntityType& element, size_t /* n */) + void scatter(MessageBufferImp& buff, const EntityType& element, std::size_t /* n */) { int globalIdx = -1; buff.read(globalIdx); @@ -136,7 +137,7 @@ public: //! \brief loop over all internal data handlers and return sum of data //! size of given entity template - size_t size(const EntityType& /* en */) const + std::size_t size(const EntityType& /* en */) const { return 1; } protected: diff --git a/ebos/collecttoiorank.hh b/ebos/collecttoiorank.hh index 85b9590ed..be5156d48 100644 --- a/ebos/collecttoiorank.hh +++ b/ebos/collecttoiorank.hh @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -133,7 +134,7 @@ public: bool doesNeedReordering() const { return needsReordering;} - size_t numCells () const + std::size_t numCells () const { return globalCartesianIndex_.size(); } const std::vector& globalRanks() const diff --git a/ebos/collecttoiorank_impl.hh b/ebos/collecttoiorank_impl.hh index f179b9c39..f94b1f75b 100644 --- a/ebos/collecttoiorank_impl.hh +++ b/ebos/collecttoiorank_impl.hh @@ -105,10 +105,10 @@ public: , recv_(recv) , ranks_(ranks) { - size_t size = globalIndex.size(); + std::size_t size = globalIndex.size(); // create mapping globalIndex --> localIndex if ( isIORank ) // ioRank - for (size_t index = 0; index < size; ++index) + for (std::size_t index = 0; index < size; ++index) globalPosition_.insert(std::make_pair(globalIndex[index], index)); // we need to create a mapping from local to global @@ -117,9 +117,9 @@ public: ranks_.resize(size, -1); // for the ioRank create a localIndex to index in global state map IndexMapType& indexMap = indexMaps_.back(); - size_t localSize = localIndexMap_.size(); + std::size_t localSize = localIndexMap_.size(); indexMap.resize(localSize); - for (size_t i=0; ileafGridView().size(0); + const std::size_t globalSize = equilGrid->leafGridView().size(0); globalCartesianIndex_.resize(globalSize, -1); const EquilGridView equilGridView = equilGrid->leafGridView(); @@ -926,7 +926,7 @@ CollectDataToIORank(const Grid& grid, const EquilGrid* equilGrid, } localIndexMap_.clear(); - const size_t gridSize = grid.size(0); + const std::size_t gridSize = grid.size(0); localIndexMap_.reserve(gridSize); // store the local Cartesian index diff --git a/ebos/eclalugridvanguard.hh b/ebos/eclalugridvanguard.hh index b30e91380..e78ed3fb4 100644 --- a/ebos/eclalugridvanguard.hh +++ b/ebos/eclalugridvanguard.hh @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -331,7 +332,7 @@ protected: grid_ = factory_->convert(*equilGrid_, cartesianCellId_, ordering_); OpmLog::warning("Space Filling Curve Ordering is not yet supported: DISABLE_ALUGRID_SFC_ORDERING is enabled"); equilGridToGrid_.resize(ordering_.size()); - for (size_t index = 0; index #include +#include #include #include #include @@ -503,7 +504,7 @@ protected: void updateCartesianToCompressedMapping_() { - size_t num_cells = asImp_().grid().leafGridView().size(0); + std::size_t num_cells = asImp_().grid().leafGridView().size(0); is_interior_.resize(num_cells); ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout()); diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index e31555bfc..1cff1d3b3 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -223,7 +223,7 @@ EclGenericOutputBlackoilModule:: template void EclGenericOutputBlackoilModule:: -outputCumLog(size_t reportStepNum, const bool substep, bool forceDisableCumOutput) +outputCumLog(std::size_t reportStepNum, const bool substep, bool forceDisableCumOutput) { if (!substep && !forceDisableCumOutput) { logOutput_.cumulative(reportStepNum, @@ -234,7 +234,7 @@ outputCumLog(size_t reportStepNum, const bool substep, bool forceDisableCumOutpu template void EclGenericOutputBlackoilModule:: -outputProdLog(size_t reportStepNum, +outputProdLog(std::size_t reportStepNum, const bool substep, bool forceDisableProdOutput) { @@ -247,7 +247,7 @@ outputProdLog(size_t reportStepNum, template void EclGenericOutputBlackoilModule:: -outputInjLog(size_t reportStepNum, const bool substep, bool forceDisableInjOutput) +outputInjLog(std::size_t reportStepNum, const bool substep, bool forceDisableInjOutput) { if (!substep && !forceDisableInjOutput) { logOutput_.injection(reportStepNum, @@ -302,7 +302,7 @@ outputFipresvLog(std::map& miscSummaryData, template void EclGenericOutputBlackoilModule:: -addRftDataToWells(data::Wells& wellDatas, size_t reportStepNum) +addRftDataToWells(data::Wells& wellDatas, std::size_t reportStepNum) { const auto& rft_config = schedule_[reportStepNum].rft_config(); for (const auto& well: schedule_.getWells(reportStepNum)) { @@ -320,13 +320,13 @@ addRftDataToWells(data::Wells& wellDatas, size_t reportStepNum) continue; wellData.connections.resize(well.getConnections().size()); - size_t count = 0; + std::size_t count = 0; for (const auto& connection: well.getConnections()) { - const size_t i = size_t(connection.getI()); - const size_t j = size_t(connection.getJ()); - const size_t k = size_t(connection.getK()); + const std::size_t i = std::size_t(connection.getI()); + const std::size_t j = std::size_t(connection.getJ()); + const std::size_t k = std::size_t(connection.getK()); - const size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); + const std::size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); auto& connectionData = wellData.connections[count]; connectionData.index = index; count++; @@ -617,7 +617,7 @@ typename EclGenericOutputBlackoilModule::ScalarBuffer EclGenericOutputBlackoilModule:: regionSum(const ScalarBuffer& property, const std::vector& regionId, - size_t maxNumberOfRegions, + std::size_t maxNumberOfRegions, const Parallel::Communication& comm) { ScalarBuffer totals(maxNumberOfRegions, 0.0); @@ -626,7 +626,7 @@ regionSum(const ScalarBuffer& property, return totals; assert(regionId.size() == property.size()); - for (size_t j = 0; j < regionId.size(); ++j) { + for (std::size_t j = 0; j < regionId.size(); ++j) { const int regionIdx = regionId[j] - 1; // the cell is not attributed to any region. ignore it! if (regionIdx < 0) @@ -636,7 +636,7 @@ regionSum(const ScalarBuffer& property, totals[regionIdx] += property[j]; } - for (size_t i = 0; i < maxNumberOfRegions; ++i) + for (std::size_t i = 0; i < maxNumberOfRegions; ++i) totals[i] = comm.sum(totals[i]); return totals; @@ -721,10 +721,10 @@ doAllocBuffers(unsigned bufferSize, continue; for (const auto& connection: well.getConnections()) { - const size_t i = size_t(connection.getI()); - const size_t j = size_t(connection.getJ()); - const size_t k = size_t(connection.getK()); - const size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); + const std::size_t i = std::size_t(connection.getI()); + const std::size_t j = std::size_t(connection.getJ()); + const std::size_t k = std::size_t(connection.getK()); + const std::size_t index = eclState_.gridDims().getGlobalIndex(i, j, k); if (FluidSystem::phaseIsActive(oilPhaseIdx)) oilConnectionPressures_.emplace(std::make_pair(index, 0.0)); diff --git a/ebos/eclgenericoutputblackoilmodule.hh b/ebos/eclgenericoutputblackoilmodule.hh index fbdd9343c..316504e6a 100644 --- a/ebos/eclgenericoutputblackoilmodule.hh +++ b/ebos/eclgenericoutputblackoilmodule.hh @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -62,17 +63,17 @@ public: }; // write cumulative production and injection reports to output - void outputCumLog(size_t reportStepNum, + void outputCumLog(std::size_t reportStepNum, const bool substep, bool forceDisableCumOutput); // write production report to output - void outputProdLog(size_t reportStepNum, + void outputProdLog(std::size_t reportStepNum, const bool substep, bool forceDisableProdOutput); // write injection report to output - void outputInjLog(size_t reportStepNum, + void outputInjLog(std::size_t reportStepNum, const bool substep, bool forceDisableInjOutput); @@ -93,7 +94,7 @@ public: void outputErrorLog(const Parallel::Communication& comm) const; void addRftDataToWells(data::Wells& wellDatas, - size_t reportStepNum); + std::size_t reportStepNum); /*! * \brief Move all buffers to data::Solution. @@ -445,9 +446,9 @@ protected: std::array, ScalarBuffer>>, 3> floresn_; std::array, ScalarBuffer>>, 3> flowsn_; - std::map oilConnectionPressures_; - std::map waterConnectionSaturations_; - std::map gasConnectionSaturations_; + std::map oilConnectionPressures_; + std::map waterConnectionSaturations_; + std::map gasConnectionSaturations_; std::map, double> blockData_; std::optional initialInplace_; diff --git a/ebos/eclgenericproblem.hh b/ebos/eclgenericproblem.hh index 2f80bd615..f22803c4e 100644 --- a/ebos/eclgenericproblem.hh +++ b/ebos/eclgenericproblem.hh @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -327,7 +328,7 @@ protected: std::function(const unsigned)> ijkIndex); void readRockCompactionParameters_(); - void readBlackoilExtentionsInitialConditions_(size_t numDof, + void readBlackoilExtentionsInitialConditions_(std::size_t numDof, bool enableSolvent, bool enablePolymer, bool enablePolymerMolarWeight, @@ -389,7 +390,7 @@ protected: private: template - void updateNum(const std::string& name, std::vector& numbers, size_t num_regions); + void updateNum(const std::string& name, std::vector& numbers, std::size_t num_regions); }; } // namespace Opm diff --git a/ebos/eclgenericproblem_impl.hh b/ebos/eclgenericproblem_impl.hh index a897fb391..f7edb38a6 100644 --- a/ebos/eclgenericproblem_impl.hh +++ b/ebos/eclgenericproblem_impl.hh @@ -54,7 +54,7 @@ int eclPositionalParameter(Dune::ParameterTree& tree, int paramIdx) { std::string param = argv[paramIdx]; - size_t i = param.find('='); + std::size_t i = param.find('='); if (i != std::string::npos) { std::string oldParamName = param.substr(0, i); std::string oldParamValue = param.substr(i+1); @@ -167,7 +167,7 @@ readRockParameters_(const std::vector& cellCenterDepths, if (eclState_.fieldProps().has_int(rock_config.rocknum_property())) { rockTableIdx_.resize(numElem); const auto& num = eclState_.fieldProps().get_int(rock_config.rocknum_property()); - for (size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { + for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { rockTableIdx_[elemIdx] = num[elemIdx] - 1; auto fmtError = [&num,elemIdx,&ijkIndex,&rock_config](const char* type, std::size_t size) @@ -194,18 +194,18 @@ readRockParameters_(const std::vector& cellCenterDepths, const auto& overburdTables = eclState_.getTableManager().getOverburdTables(); if (!overburdTables.empty()) { overburdenPressure_.resize(numElem,0.0); - size_t numRocktabTables = rock_config.num_rock_tables(); + std::size_t numRocktabTables = rock_config.num_rock_tables(); if (overburdTables.size() != numRocktabTables) throw std::runtime_error(std::to_string(numRocktabTables) +" OVERBURD tables is expected, but " + std::to_string(overburdTables.size()) +" is provided"); std::vector> overburdenTables(numRocktabTables); - for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { + for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { const OverburdTable& overburdTable = overburdTables.template getTable(regionIdx); overburdenTables[regionIdx].setXYContainers(overburdTable.getDepthColumn(),overburdTable.getOverburdenPressureColumn()); } - for (size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { + for (std::size_t elemIdx = 0; elemIdx < numElem; ++ elemIdx) { unsigned tableIdx = 0; if (!rockTableIdx_.empty()) { tableIdx = rockTableIdx_[elemIdx]; @@ -237,7 +237,7 @@ readRockCompactionParameters_() throw std::runtime_error("Not support ROCKOMP hysteresis option "); } - size_t numRocktabTables = rock_config.num_rock_tables(); + std::size_t numRocktabTables = rock_config.num_rock_tables(); bool waterCompaction = rock_config.water_compaction(); if (!waterCompaction) { @@ -248,7 +248,7 @@ readRockCompactionParameters_() rockCompPoroMult_.resize(numRocktabTables); rockCompTransMult_.resize(numRocktabTables); - for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { + for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { const auto& rocktabTable = rocktabTables.template getTable(regionIdx); const auto& pressureColumn = rocktabTable.getPressureColumn(); const auto& poroColumn = rocktabTable.getPoreVolumeMultiplierColumn(); @@ -271,16 +271,16 @@ readRockCompactionParameters_() +" ROCKWNOD tables is expected, but " + std::to_string(rockwnodTables.size()) +" is provided"); //TODO check size match rockCompPoroMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical)); - for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { + for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { const RockwnodTable& rockwnodTable = rockwnodTables.template getTable(regionIdx); const auto& rock2dTable = rock2dTables[regionIdx]; if (rockwnodTable.getSaturationColumn().size() != rock2dTable.sizeMultValues()) throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2D needs to match."); - for (size_t xIdx = 0; xIdx < rock2dTable.size(); ++xIdx) { + for (std::size_t xIdx = 0; xIdx < rock2dTable.size(); ++xIdx) { rockCompPoroMultWc_[regionIdx].appendXPos(rock2dTable.getPressureValue(xIdx)); - for (size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) + for (std::size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) rockCompPoroMultWc_[regionIdx].appendSamplePoint(xIdx, rockwnodTable.getSaturationColumn()[yIdx], rock2dTable.getPvmultValue(xIdx, yIdx)); @@ -289,16 +289,16 @@ readRockCompactionParameters_() if (!rock2dtrTables.empty()) { rockCompTransMultWc_.resize(numRocktabTables, TabulatedTwoDFunction(TabulatedTwoDFunction::InterpolationPolicy::Vertical)); - for (size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { + for (std::size_t regionIdx = 0; regionIdx < numRocktabTables; ++regionIdx) { const RockwnodTable& rockwnodTable = rockwnodTables.template getTable(regionIdx); const auto& rock2dtrTable = rock2dtrTables[regionIdx]; if (rockwnodTable.getSaturationColumn().size() != rock2dtrTable.sizeMultValues()) throw std::runtime_error("Number of entries in ROCKWNOD and ROCK2DTR needs to match."); - for (size_t xIdx = 0; xIdx < rock2dtrTable.size(); ++xIdx) { + for (std::size_t xIdx = 0; xIdx < rock2dtrTable.size(); ++xIdx) { rockCompTransMultWc_[regionIdx].appendXPos(rock2dtrTable.getPressureValue(xIdx)); - for (size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) + for (std::size_t yIdx = 0; yIdx < rockwnodTable.getSaturationColumn().size(); ++yIdx) rockCompTransMultWc_[regionIdx].appendSamplePoint(xIdx, rockwnodTable.getSaturationColumn()[yIdx], rock2dtrTable.getTransMultValue(xIdx, yIdx)); @@ -360,7 +360,7 @@ rockFraction(unsigned elementIdx, unsigned timeIdx) const template template void EclGenericProblem:: -updateNum(const std::string& name, std::vector& numbers, size_t num_regions) +updateNum(const std::string& name, std::vector& numbers, std::size_t num_regions) { if (!eclState_.fieldProps().has_int(name)) return; @@ -517,7 +517,7 @@ initFluidSystem_() template void EclGenericProblem:: -readBlackoilExtentionsInitialConditions_(size_t numDof, +readBlackoilExtentionsInitialConditions_(std::size_t numDof, bool enableSolvent, bool enablePolymer, bool enablePolymerMolarWeight, diff --git a/ebos/eclgenericthresholdpressure_impl.hh b/ebos/eclgenericthresholdpressure_impl.hh index bd9ac1d33..16afaea1c 100644 --- a/ebos/eclgenericthresholdpressure_impl.hh +++ b/ebos/eclgenericthresholdpressure_impl.hh @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -217,13 +218,13 @@ configureThpresft_() int numCartesianElem = eclState_.getInputGrid().getCartesianSize(); thpresftValues_.resize(numFaults, -1.0); cartElemFaultIdx_.resize(numCartesianElem, -1); - for (size_t faultIdx = 0; faultIdx < faults.size(); faultIdx++) { + for (std::size_t faultIdx = 0; faultIdx < faults.size(); faultIdx++) { auto& fault = faults.getFault(faultIdx); thpresftValues_[faultIdx] = thpres.getThresholdPressureFault(faultIdx); for (const FaultFace& face : fault) // "face" is a misnomer because the object describes a set of cell // indices, but we go with the conventions of the parser here... - for (size_t cartElemIdx : face) + for (std::size_t cartElemIdx : face) cartElemFaultIdx_[cartElemIdx] = faultIdx; } } diff --git a/ebos/eclgenerictracermodel.hh b/ebos/eclgenerictracermodel.hh index 5b358c6e8..e22701e00 100644 --- a/ebos/eclgenerictracermodel.hh +++ b/ebos/eclgenerictracermodel.hh @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -97,10 +98,10 @@ protected: * \brief Initialize all internal data structures needed by the tracer module */ void doInit(bool rst, - size_t numGridDof, - size_t gasPhaseIdx, - size_t oilPhaseIdx, - size_t waterPhaseIdx); + std::size_t numGridDof, + std::size_t gasPhaseIdx, + std::size_t oilPhaseIdx, + std::size_t waterPhaseIdx); bool linearSolve_(const TracerMatrix& M, TracerVector& x, TracerVector& b); diff --git a/ebos/eclgenerictracermodel_impl.hh b/ebos/eclgenerictracermodel_impl.hh index 798ba1484..29f050f50 100644 --- a/ebos/eclgenerictracermodel_impl.hh +++ b/ebos/eclgenerictracermodel_impl.hh @@ -161,8 +161,8 @@ name(int tracerIdx) const template void EclGenericTracerModel:: -doInit(bool rst, size_t numGridDof, - size_t gasPhaseIdx, size_t oilPhaseIdx, size_t waterPhaseIdx) +doInit(bool rst, std::size_t numGridDof, + std::size_t gasPhaseIdx, std::size_t oilPhaseIdx, std::size_t waterPhaseIdx) { const auto& tracers = eclState_.tracer(); @@ -170,13 +170,13 @@ doInit(bool rst, size_t numGridDof, return; // tracer treatment is supposed to be disabled // retrieve the number of tracers from the deck - const size_t numTracers = tracers.size(); + const std::size_t numTracers = tracers.size(); tracerConcentration_.resize(numTracers); storageOfTimeIndex1_.resize(numTracers); // the phase where the tracer is tracerPhaseIdx_.resize(numTracers); - for (size_t tracerIdx = 0; tracerIdx < numTracers; tracerIdx++) { + for (std::size_t tracerIdx = 0; tracerIdx < numTracers; tracerIdx++) { const auto& tracer = tracers[tracerIdx]; if (tracer.phase == Phase::WATER) @@ -200,7 +200,7 @@ doInit(bool rst, size_t numGridDof, if (tblkDatasize < cartMapper_.cartesianSize()){ throw std::runtime_error("Wrong size of TBLK for" + tracer.name); } - for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){ + for (std::size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx) { int cartDofIdx = cartMapper_.cartesianIndex(globalDofIdx); tracerConcentration_[tracerIdx][globalDofIdx] = free_concentration[cartDofIdx]; } @@ -208,7 +208,7 @@ doInit(bool rst, size_t numGridDof, //TVDPF keyword else if (tracer.free_tvdp.has_value()) { const auto& free_tvdp = tracer.free_tvdp.value(); - for (size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx){ + for (std::size_t globalDofIdx = 0; globalDofIdx < numGridDof; ++globalDofIdx) { tracerConcentration_[tracerIdx][globalDofIdx] = free_tvdp.evaluate("TRACER_CONCENTRATION", centroids_(globalDofIdx)[2]); @@ -339,7 +339,7 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector& x, std:: createParallelFlexibleSolver(gridView_.grid(), M, prm); (void) tracerOperator; bool converged = true; - for (size_t nrhs =0; nrhs < b.size(); ++nrhs) { + for (std::size_t nrhs = 0; nrhs < b.size(); ++nrhs) { x[nrhs] = 0.0; Dune::InverseOperatorResult result; solver->apply(x[nrhs], b[nrhs], result); @@ -364,7 +364,7 @@ linearSolveBatchwise_(const TracerMatrix& M, std::vector& x, std:: verbosity); bool converged = true; - for (size_t nrhs =0; nrhs < b.size(); ++nrhs) { + for (std::size_t nrhs = 0; nrhs < b.size(); ++nrhs) { x[nrhs] = 0.0; Dune::InverseOperatorResult result; solver.apply(x[nrhs], b[nrhs], result); diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index a3980edaa..5d23095bb 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -1241,7 +1241,7 @@ private: void createLocalRegion_(std::vector& region) { - size_t elemIdx = 0; + std::size_t elemIdx = 0; for (const auto& elem : elements(simulator_.gridView())) { if (elem.partitionType() != Dune::InteriorEntity) region[elemIdx] = 0; diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index b9c72ba3b..35d347eb5 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -1679,7 +1679,7 @@ protected: const auto& model = this->simulator().model(); const auto& primaryVars = model.solution(/*timeIdx*/0); const auto& vanguard = this->simulator().vanguard(); - size_t numGridDof = primaryVars.size(); + std::size_t numGridDof = primaryVars.size(); OPM_BEGIN_PARALLEL_TRY_CATCH(); #ifdef _OPENMP #pragma omp parallel for @@ -1869,14 +1869,14 @@ protected: const auto& vanguard = simulator.vanguard(); const auto& eclState = vanguard.eclState(); - size_t numDof = this->model().numGridDof(); + std::size_t numDof = this->model().numGridDof(); this->referencePorosity_[/*timeIdx=*/0].resize(numDof); const auto& fp = eclState.fieldProps(); const std::vector porvData = fp.porv(false); const std::vector actnumData = fp.actnum(); - for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) { + for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) { Scalar poreVolume = porvData[dofIdx]; // we define the porosity as the accumulated pore volume divided by the @@ -1907,8 +1907,8 @@ protected: enableMICP); //initialize min/max values - size_t numElems = this->model().numGridDof(); - for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { + std::size_t numElems = this->model().numGridDof(); + for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { const auto& fs = initialFluidStates_[elemIdx]; if (!this->maxWaterSaturation_.empty()) this->maxWaterSaturation_[elemIdx] = std::max(this->maxWaterSaturation_[elemIdx], fs.saturation(waterPhaseIdx)); @@ -1929,9 +1929,9 @@ protected: using EquilInitializer = EclEquilInitializer; EquilInitializer equilInitializer(simulator, *materialLawManager_); - size_t numElems = this->model().numGridDof(); + std::size_t numElems = this->model().numGridDof(); initialFluidStates_.resize(numElems); - for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { + for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { auto& elemFluidState = initialFluidStates_[elemIdx]; elemFluidState.assign(equilInitializer.initialFluidState(elemIdx)); } @@ -1958,7 +1958,7 @@ protected: Scalar dt = std::min(eclWriter_->restartTimeStepSize(), simulator.episodeLength()); simulator.setTimeStepSize(dt); - size_t numElems = this->model().numGridDof(); + std::size_t numElems = this->model().numGridDof(); initialFluidStates_.resize(numElems); if constexpr (enableSolvent) this->solventSaturation_.resize(numElems, 0.0); @@ -1978,7 +1978,7 @@ protected: this->micp_.resize(numElems); } - for (size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { + for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { auto& elemFluidState = initialFluidStates_[elemIdx]; elemFluidState.setPvtRegionIndex(pvtRegionIndex(elemIdx)); eclWriter_->eclOutputModule().initHysteresisParams(simulator, elemIdx); @@ -2046,7 +2046,7 @@ protected: // this is used to recover some RESTART running with the defaulted single-precision format const Scalar smallSaturationTolerance = 1.e-6; Scalar sumSaturation = 0.0; - for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (std::size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { if (FluidSystem::phaseIsActive(phaseIdx)) { if (elemFluidState.saturation(phaseIdx) < smallSaturationTolerance) elemFluidState.setSaturation(phaseIdx, 0.0); @@ -2064,7 +2064,7 @@ protected: assert(sumSaturation > 0.0); - for (size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (std::size_t phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { if (FluidSystem::phaseIsActive(phaseIdx)) { const Scalar saturation = elemFluidState.saturation(phaseIdx) / sumSaturation; elemFluidState.setSaturation(phaseIdx, saturation); @@ -2118,7 +2118,7 @@ protected: throw std::runtime_error("The ECL input file requires the SALTP keyword to be present if" " salt precipitation is enabled and the model is initialized explicitly"); - size_t numDof = this->model().numGridDof(); + std::size_t numDof = this->model().numGridDof(); initialFluidStates_.resize(numDof); @@ -2164,7 +2164,7 @@ protected: saltpData = fp.get_double("SALTP"); // calculate the initial fluid states - for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) { + for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) { auto& dofFluidState = initialFluidStates_[dofIdx]; dofFluidState.setPvtRegionIndex(pvtRegionIndex(dofIdx)); @@ -2359,7 +2359,7 @@ private: if (bcconfig.size() > 0) { nonTrivialBoundaryConditions_ = true; - size_t numCartDof = vanguard.cartesianSize(); + std::size_t numCartDof = vanguard.cartesianSize(); unsigned numElems = vanguard.gridView().size(/*codim=*/0); std::vector cartesianToCompressedElemIdx(numCartDof, -1); @@ -2450,7 +2450,7 @@ private: } } - size_t numDof = this->model().numGridDof(); + std::size_t numDof = this->model().numGridDof(); const auto& comm = this->simulator().vanguard().grid().comm(); comm.sum(sumInvB.data(),sumInvB.size()); Scalar numTotalDof = comm.sum(numDof); @@ -2495,7 +2495,7 @@ private: { std::array,6> data; - void resize(size_t size, T defVal) + void resize(std::size_t size, T defVal) { for (auto& d : data) d.resize(size, defVal); diff --git a/ebos/ecltracermodel.hh b/ebos/ecltracermodel.hh index 2651fd77e..d5ca5d356 100644 --- a/ebos/ecltracermodel.hh +++ b/ebos/ecltracermodel.hh @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -132,7 +133,7 @@ public: void prepareTracerBatches() { - for (size_t tracerIdx=0; tracerIdxtracerPhaseIdx_.size(); ++tracerIdx) { + for (std::size_t tracerIdx = 0; tracerIdx < this->tracerPhaseIdx_.size(); ++tracerIdx) { if (this->tracerPhaseIdx_[tracerIdx] == FluidSystem::waterPhaseIdx) { if (! FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)){ throw std::runtime_error("Water tracer specified for non-water fluid system:" + this->name(tracerIdx)); @@ -394,7 +395,7 @@ protected: for (const auto& elem : elements(simulator_.gridView())) { elemCtx.updateStencil(elem); - size_t I = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/0); + std::size_t I = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/0); if (elem.partitionType() != Dune::InteriorEntity) { @@ -418,13 +419,13 @@ protected: * extrusionFactor; Scalar dt = elemCtx.simulator().timeStepSize(); - size_t I1 = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/1); + std::size_t I1 = elemCtx.globalSpaceIndex(/*dofIdx=*/ 0, /*timeIdx=*/1); for (auto& tr : tbatch) { this->assembleTracerEquationVolume(tr, elemCtx, scvVolume, dt, I, I1); } - size_t numInteriorFaces = elemCtx.numInteriorFaces(/*timIdx=*/0); + std::size_t numInteriorFaces = elemCtx.numInteriorFaces(/*timIdx=*/0); for (unsigned scvfIdx = 0; scvfIdx < numInteriorFaces; scvfIdx++) { const auto& face = elemCtx.stencil(0).interiorFace(scvfIdx); unsigned j = face.exteriorIndex(); diff --git a/ebos/ecltransmissibility_impl.hh b/ebos/ecltransmissibility_impl.hh index 2a55fb09d..58a6d9c72 100644 --- a/ebos/ecltransmissibility_impl.hh +++ b/ebos/ecltransmissibility_impl.hh @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -499,7 +500,7 @@ extractPermeability_() else permzData = permxData; - for (size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { + for (std::size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { permeability_[dofIdx] = 0.0; permeability_[dofIdx][0][0] = permxData[dofIdx]; permeability_[dofIdx][1][1] = permyData[dofIdx]; @@ -541,9 +542,9 @@ extractPermeability_(const std::function& map) else permzData = permxData; - for (size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { + for (std::size_t dofIdx = 0; dofIdx < numElem; ++ dofIdx) { permeability_[dofIdx] = 0.0; - size_t inputDofIdx = map(dofIdx); + std::size_t inputDofIdx = map(dofIdx); permeability_[dofIdx][0][0] = permxData[inputDofIdx]; permeability_[dofIdx][1][1] = permyData[inputDofIdx]; permeability_[dofIdx][2][2] = permzData[inputDofIdx]; diff --git a/ebos/equil/initstateequil.cc b/ebos/equil/initstateequil.cc index 5fa13fe7f..984b3f058 100644 --- a/ebos/equil/initstateequil.cc +++ b/ebos/equil/initstateequil.cc @@ -86,7 +86,7 @@ namespace Details { using MatLaw = EclMaterialLawManager>; template class PhaseSaturations, - EquilReg,size_t>; + EquilReg,std::size_t>; template std::pair cellZMinMax(const Dune::cpgrid::Entity<0>& element); } diff --git a/ebos/equil/initstateequil_impl.hh b/ebos/equil/initstateequil_impl.hh index 7d4a98807..cc5b340ad 100644 --- a/ebos/equil/initstateequil_impl.hh +++ b/ebos/equil/initstateequil_impl.hh @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -1336,7 +1337,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager, // Create Rs functions. rsFunc_.reserve(rec.size()); if (FluidSystem::enableDissolvedGas()) { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { if (eqlmap.cells(i).empty()) { rsFunc_.push_back(std::shared_ptr>()); continue; @@ -1377,14 +1378,14 @@ InitialStateComputer(MaterialLawManager& materialLawManager, } } else { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { rsFunc_.push_back(std::make_shared()); } } rvFunc_.reserve(rec.size()); if (FluidSystem::enableVaporizedOil()) { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { if (eqlmap.cells(i).empty()) { rvFunc_.push_back(std::shared_ptr>()); continue; @@ -1424,14 +1425,14 @@ InitialStateComputer(MaterialLawManager& materialLawManager, } } else { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { rvFunc_.push_back(std::make_shared()); } } rvwFunc_.reserve(rec.size()); if (FluidSystem::enableVaporizedWater()) { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { if (eqlmap.cells(i).empty()) { rvwFunc_.push_back(std::shared_ptr>()); continue; @@ -1487,7 +1488,7 @@ InitialStateComputer(MaterialLawManager& materialLawManager, } } else { - for (size_t i = 0; i < rec.size(); ++i) { + for (std::size_t i = 0; i < rec.size(); ++i) { rvwFunc_.push_back(std::make_shared()); } } @@ -1554,7 +1555,7 @@ updateInitialSaltConcentration_(const EclipseState& eclState, const RMap& reg) table.setXYContainers(x, y); } } else { - for (size_t i = 0; i < saltvdTables.size(); ++i) { + for (std::size_t i = 0; i < saltvdTables.size(); ++i) { const SaltvdTable& saltvdTable = saltvdTables.getTable(i); saltVdTable_[i].setXYContainers(saltvdTable.getDepthColumn(), saltvdTable.getSaltColumn()); @@ -1585,7 +1586,7 @@ updateInitialSaltSaturation_(const EclipseState& eclState, const RMap& reg) const auto& tables = eclState.getTableManager(); const TableContainer& saltpvdTables = tables.getSaltpvdTables(); - for (size_t i = 0; i < saltpvdTables.size(); ++i) { + for (std::size_t i = 0; i < saltpvdTables.size(); ++i) { const SaltpvdTable& saltpvdTable = saltpvdTables.getTable(i); saltpVdTable_[i].setXYContainers(saltpvdTable.getDepthColumn(), saltpvdTable.getSaltpColumn()); @@ -1756,7 +1757,7 @@ calcPressSatRsRv(const RMap& reg, auto vspan = std::array{}; std::vector regionIsEmpty(rec.size(), 0); - for (size_t r = 0; r < rec.size(); ++r) { + for (std::size_t r = 0; r < rec.size(); ++r) { const auto& cells = reg.cells(r); Details::verticalExtent(cells, cellZMinMax_, comm, vspan); @@ -1802,7 +1803,7 @@ calcPressSatRsRv(const RMap& reg, } comm.min(regionIsEmpty.data(),regionIsEmpty.size()); if (comm.rank() == 0) { - for (size_t r = 0; r < rec.size(); ++r) { + for (std::size_t r = 0; r < rec.size(); ++r) { if (regionIsEmpty[r]) //region is empty on all partitions OpmLog::warning("Equilibration region " + std::to_string(r + 1) + " has no active cells"); diff --git a/ebos/vtkecltracermodule.hh b/ebos/vtkecltracermodule.hh index e0a5bc004..6fde65884 100644 --- a/ebos/vtkecltracermodule.hh +++ b/ebos/vtkecltracermodule.hh @@ -109,7 +109,7 @@ namespace Opm { if (eclTracerConcentrationOutput_()){ const auto& tracerModel = this->simulator_.problem().tracerModel(); eclTracerConcentration_.resize(tracerModel.numTracers()); - for(size_t tracerIdx=0; tracerIdxresizeScalarBuffer_(eclTracerConcentration_[tracerIdx]); } @@ -132,7 +132,7 @@ namespace Opm { unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0); if (eclTracerConcentrationOutput_()){ - for(size_t tracerIdx=0; tracerIdxsimulator_.problem().tracerModel(); - for(size_t tracerIdx=0; tracerIdxcommitScalarBuffer_(baseWriter,tmp.c_str(), eclTracerConcentration_[tracerIdx]); } diff --git a/opm/simulators/aquifers/AquiferNumerical.hpp b/opm/simulators/aquifers/AquiferNumerical.hpp index 5b2065ca3..7cca1176a 100644 --- a/opm/simulators/aquifers/AquiferNumerical.hpp +++ b/opm/simulators/aquifers/AquiferNumerical.hpp @@ -225,7 +225,7 @@ private: for (const auto& elem : elements(gridView, Dune::Partitions::interior)) { elem_ctx.updatePrimaryStencil(elem); - const size_t cell_index = elem_ctx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); + const std::size_t cell_index = elem_ctx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); const int idx = this->cell_to_aquifer_cell_idx_[cell_index]; if (idx < 0) { continue; @@ -300,7 +300,7 @@ private: const std::size_t i = face.interiorIndex(); const std::size_t j = face.exteriorIndex(); // compressed index - // const size_t I = stencil.globalSpaceIndex(i); + // const std::size_t I = stencil.globalSpaceIndex(i); const std::size_t J = stencil.globalSpaceIndex(j); assert(stencil.globalSpaceIndex(i) == cell_index); diff --git a/opm/simulators/flow/FlowMainEbos.hpp b/opm/simulators/flow/FlowMainEbos.hpp index a9975c798..d03c5be92 100644 --- a/opm/simulators/flow/FlowMainEbos.hpp +++ b/opm/simulators/flow/FlowMainEbos.hpp @@ -37,6 +37,7 @@ #include #endif +#include #include #include @@ -526,7 +527,7 @@ void handleExtraConvergenceOutput(SimulatorReport& report, // initialize variables const auto& initConfig = eclState().getInitConfig(); - simtimer_->init(schedule, (size_t)initConfig.getRestartStep()); + simtimer_->init(schedule, static_cast(initConfig.getRestartStep())); if (this->output_cout_) { std::ostringstream oss; diff --git a/opm/simulators/flow/KeywordValidation.cpp b/opm/simulators/flow/KeywordValidation.cpp index 4fa3df6a3..ec39470a1 100644 --- a/opm/simulators/flow/KeywordValidation.cpp +++ b/opm/simulators/flow/KeywordValidation.cpp @@ -154,9 +154,9 @@ namespace KeywordValidation const auto& keyword_properties = partially_supported_items.find(keyword.name()); if (keyword_properties != partially_supported_items.end()) { // If this keyworcs has partially supported items, iterate over all of them. - for (size_t record_index = 0; record_index < keyword.size(); record_index++) { + for (std::size_t record_index = 0; record_index < keyword.size(); record_index++) { const auto& record = keyword.getRecord(record_index); - for (size_t item_index = 0; item_index < record.size(); item_index++) { + for (std::size_t item_index = 0; item_index < record.size(); item_index++) { const auto& item = record.getItem(item_index); // Find the index number, which starts counting at one, so item_index + 1 const auto& item_properties = keyword_properties->second.find(item_index + 1); @@ -182,8 +182,8 @@ namespace KeywordValidation void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword, const PartiallySupportedKeywordProperties& properties, const bool multiple_records, - const size_t record_index, - const size_t item_index, + const std::size_t record_index, + const std::size_t item_index, const T& item_value, std::vector& errors) const { diff --git a/opm/simulators/flow/KeywordValidation.hpp b/opm/simulators/flow/KeywordValidation.hpp index e78df09ed..0085fbc14 100644 --- a/opm/simulators/flow/KeywordValidation.hpp +++ b/opm/simulators/flow/KeywordValidation.hpp @@ -22,6 +22,7 @@ #include +#include #include #include #include @@ -59,7 +60,7 @@ namespace KeywordValidation // This is used to list the partially supported items of a keyword: template - using PartiallySupportedKeywordItems = std::map>; + using PartiallySupportedKeywordItems = std::map>; // This is used to list the keywords that have partially supported items: template @@ -71,8 +72,8 @@ namespace KeywordValidation struct ValidationError { bool critical; // Determines if the encountered problem should be an error or a warning KeywordLocation location; // Location information (keyword name, file and line number) - size_t record_number; // Number of the offending record - std::optional item_number; // Number of the offending item + std::size_t record_number; // Number of the offending record + std::optional item_number; // Number of the offending item std::optional item_value; // The offending value of a problematic item std::optional user_message; // An optional message to show if a problem is encountered }; @@ -127,8 +128,8 @@ namespace KeywordValidation void validateKeywordItem(const DeckKeyword& keyword, const PartiallySupportedKeywordProperties& properties, const bool multiple_records, - const size_t record_number, - const size_t item_number, + const std::size_t record_number, + const std::size_t item_number, const T& item_value, std::vector& errors) const; diff --git a/opm/simulators/flow/LogOutputHelper.cpp b/opm/simulators/flow/LogOutputHelper.cpp index 9272240b6..7443a0f1e 100644 --- a/opm/simulators/flow/LogOutputHelper.cpp +++ b/opm/simulators/flow/LogOutputHelper.cpp @@ -331,7 +331,7 @@ fipResv(const Inplace& inplace) const this->outputResvFluidInPlace_(current_values, 0); } - for (size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { + for (std::size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { std::unordered_map current_values; for (const auto& phase : Inplace::phases()) { diff --git a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.cpp b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.cpp index e2c8df1b7..044cd3422 100644 --- a/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.cpp +++ b/opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.cpp @@ -96,7 +96,7 @@ void checkSerializedCmdLine(const std::string& current, std::vector only_stored, only_curr; if (!difference.empty()) { - for (size_t i = 0; i < difference.size(); ) { + for (std::size_t i = 0; i < difference.size(); ) { auto stored_it = std::find(stored_strings.begin(), stored_strings.end(), difference[i]); auto pos = difference[i].find_first_of('='); diff --git a/opm/simulators/flow/partitionCells.cpp b/opm/simulators/flow/partitionCells.cpp index f3e2d71aa..07845c5de 100644 --- a/opm/simulators/flow/partitionCells.cpp +++ b/opm/simulators/flow/partitionCells.cpp @@ -106,7 +106,7 @@ std::pair, int> partitionCellsFromFile(const std::string& filen // Read file into single vector. std::ifstream is(filename); const std::vector cellpart{std::istream_iterator(is), std::istream_iterator()}; - if (cellpart.size() != size_t(num_cells)) { + if (cellpart.size() != static_cast(num_cells)) { auto msg = fmt::format("Partition file contains {} entries, but there are {} cells.", cellpart.size(), num_cells); throw std::runtime_error(msg); diff --git a/opm/simulators/linalg/ISTLSolverEbos.cpp b/opm/simulators/linalg/ISTLSolverEbos.cpp index dd0572071..25b3d2cdd 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.cpp +++ b/opm/simulators/linalg/ISTLSolverEbos.cpp @@ -49,7 +49,7 @@ namespace Opm { namespace detail { #ifdef HAVE_MPI -void copyParValues(std::any& parallelInformation, size_t size, +void copyParValues(std::any& parallelInformation, std::size_t size, Dune::OwnerOverlapCopyCommunication& comm) { if (parallelInformation.type() == typeid(ParallelISTLInformation)) { @@ -85,7 +85,7 @@ void makeOverlapRowsInvalid(Matrix& matrix, template std::function getWeightsCalculator(const PropertyTree& prm, const Matrix& matrix, - size_t pressureIndex, + std::size_t pressureIndex, std::function trueFunc) { std::function weightsCalculator; @@ -122,7 +122,7 @@ template void FlexibleSolverInfo::create(const Matrix& matrix, bool parallel, const PropertyTree& prm, - size_t pressureIndex, + std::size_t pressureIndex, std::function trueFunc, [[maybe_unused]] Comm& comm) diff --git a/opm/simulators/linalg/ISTLSolverEbos.hpp b/opm/simulators/linalg/ISTLSolverEbos.hpp index 427a54eb0..6f26d8c07 100644 --- a/opm/simulators/linalg/ISTLSolverEbos.hpp +++ b/opm/simulators/linalg/ISTLSolverEbos.hpp @@ -101,7 +101,7 @@ struct FlexibleSolverInfo void create(const Matrix& matrix, bool parallel, const PropertyTree& prm, - size_t pressureIndex, + std::size_t pressureIndex, std::function trueFunc, Comm& comm); @@ -109,13 +109,13 @@ struct FlexibleSolverInfo std::unique_ptr op_; std::unique_ptr> wellOperator_; AbstractPreconditionerType* pre_ = nullptr; - size_t interiorCellNum_ = 0; + std::size_t interiorCellNum_ = 0; }; #ifdef HAVE_MPI /// Copy values in parallel. -void copyParValues(std::any& parallelInformation, size_t size, +void copyParValues(std::any& parallelInformation, std::size_t size, Dune::OwnerOverlapCopyCommunication& comm); #endif @@ -130,7 +130,7 @@ void makeOverlapRowsInvalid(Matrix& matrix, template std::unique_ptr blockJacobiAdjacency(const Grid& grid, const std::vector& cell_part, - size_t nonzeroes, + std::size_t nonzeroes, const std::vector>& wellConnectionsGraph); } @@ -262,7 +262,7 @@ std::unique_ptr blockJacobiAdjacency(const Grid& grid, const bool firstcall = (matrix_ == nullptr); #if HAVE_MPI if (firstcall) { - const size_t size = M.N(); + const std::size_t size = M.N(); detail::copyParValues(parallelInformation_, size, *comm_); } #endif diff --git a/opm/simulators/linalg/ISTLSolverEbosBda.cpp b/opm/simulators/linalg/ISTLSolverEbosBda.cpp index 681032330..18ad730ce 100644 --- a/opm/simulators/linalg/ISTLSolverEbosBda.cpp +++ b/opm/simulators/linalg/ISTLSolverEbosBda.cpp @@ -73,7 +73,7 @@ prepare(const Grid& grid, const Dune::CartesianIndexMapper& cartMapper, const std::vector& wellsForConn, const std::vector& cellPartition, - const size_t nonzeroes, + const std::size_t nonzeroes, const bool useWellConn) { if (numJacobiBlocks_ > 1) { @@ -146,7 +146,7 @@ template void BdaSolverInfo:: blockJacobiAdjacency(const Grid& grid, const std::vector& cell_part, - size_t nonzeroes) + std::size_t nonzeroes) { using size_type = typename Matrix::size_type; using Iter = typename Matrix::CreateIterator; @@ -219,7 +219,7 @@ using BV = Dune::BlockVector>; const Dune::CartesianIndexMapper&, \ const std::vector&, \ const std::vector&, \ - const size_t, const bool); + const std::size_t, const bool); using PolyHedralGrid3D = Dune::PolyhedralGrid<3, 3>; #if HAVE_DUNE_ALUGRID #if HAVE_MPI diff --git a/opm/simulators/linalg/ISTLSolverEbosBda.hpp b/opm/simulators/linalg/ISTLSolverEbosBda.hpp index 5d4e00af3..8fb0fbd74 100644 --- a/opm/simulators/linalg/ISTLSolverEbosBda.hpp +++ b/opm/simulators/linalg/ISTLSolverEbosBda.hpp @@ -24,6 +24,8 @@ #include +#include + namespace Opm { class Well; @@ -54,7 +56,7 @@ struct BdaSolverInfo const Dune::CartesianIndexMapper& cartMapper, const std::vector& wellsForConn, const std::vector& cellPartition, - const size_t nonzeroes, + const std::size_t nonzeroes, const bool useWellConn); bool apply(Vector& rhs, @@ -75,7 +77,7 @@ private: template void blockJacobiAdjacency(const Grid& grid, const std::vector& cell_part, - size_t nonzeroes); + std::size_t nonzeroes); void copyMatToBlockJac(const Matrix& mat, Matrix& blockJac); diff --git a/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp b/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp index 2102fae78..b7084d748 100644 --- a/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp +++ b/opm/simulators/linalg/ParallelOverlappingILU0_impl.hpp @@ -38,7 +38,7 @@ namespace detail //! Compute Blocked ILU0 decomposition, when we know junk ghost rows are located at the end of A template -void ghost_last_bilu0_decomposition (M& A, size_t interiorSize) +void ghost_last_bilu0_decomposition (M& A, std::size_t interiorSize) { // iterator types using rowiterator = typename M::RowIterator; @@ -419,7 +419,7 @@ update() // The ILU_ matrix is already a copy with the same // sparse structure as A_, but the values of A_ may // have changed, so we must copy all elements. - for (size_t row = 0; row < A_->N(); ++row) { + for (std::size_t row = 0; row < A_->N(); ++row) { const auto& Arow = (*A_)[row]; auto& ILUrow = (*ILU_)[row]; auto Ait = Arow.begin(); diff --git a/opm/simulators/linalg/PreconditionerFactory_impl.hpp b/opm/simulators/linalg/PreconditionerFactory_impl.hpp index df634f014..521f07caf 100644 --- a/opm/simulators/linalg/PreconditionerFactory_impl.hpp +++ b/opm/simulators/linalg/PreconditionerFactory_impl.hpp @@ -128,7 +128,7 @@ makeAmgPreconditioner(const Operator& op, if (useKamg) { using Type = Dune::DummyUpdatePreconditioner>; return std::make_shared(op, crit, sargs, - prm.get("max_krylov", 1), + prm.get("max_krylov", 1), prm.get("min_reduction", 1e-1)); } else { using Type = Dune::Amg::AMGCPR; @@ -255,7 +255,7 @@ struct StandardPreconditioners const bool reorder_spheres = prm.get("reorder_spheres", false); // Already a parallel preconditioner. Need to pass comm, but no need to wrap it in a BlockPreconditioner. if (ilulevel == 0) { - const size_t num_interior = interiorIfGhostLast(comm); + const std::size_t num_interior = interiorIfGhostLast(comm); return std::make_shared>( op.getmat(), comm, w, Opm::MILU_VARIANT::ILU, num_interior, redblack, reorder_spheres); } else { @@ -268,10 +268,10 @@ struct StandardPreconditioners /// K interior cells from [0, K-1] and ghost cells from [K, N-1]. /// Returns K if true, otherwise returns N. This is motivated by /// usage in the ParallelOverlappingILU0 preconditioner. - static size_t interiorIfGhostLast(const Comm& comm) + static std::size_t interiorIfGhostLast(const Comm& comm) { - size_t interior_count = 0; - size_t highest_interior_index = 0; + std::size_t interior_count = 0; + std::size_t highest_interior_index = 0; const auto& is = comm.indexSet(); for (const auto& ind : is) { if (Comm::OwnerSet::contains(ind.local().attribute())) { diff --git a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp index 755e1b087..67e9a7017 100644 --- a/opm/simulators/linalg/PressureBhpTransferPolicy.hpp +++ b/opm/simulators/linalg/PressureBhpTransferPolicy.hpp @@ -28,6 +28,8 @@ #include +#include + namespace Opm { template @@ -44,22 +46,22 @@ namespace Opm const int max_nw = comm.communicator().max(nw); const int rank = comm.communicator().rank(); int glo_max = 0; - size_t loc_max = 0; + std::size_t loc_max = 0; indset_rw.beginResize(); for (auto ind = indset.begin(), indend = indset.end(); ind != indend; ++ind) { indset_rw.add(ind->global(), LocalIndex(ind->local(), ind->local().attribute(), true)); const int glo = ind->global(); - const size_t loc = ind->local().local(); + const std::size_t loc = ind->local().local(); glo_max = std::max(glo_max, glo); loc_max = std::max(loc_max, loc); } const int global_max = comm.communicator().max(glo_max); // used append the welldofs at the end assert(loc_max + 1 == indset.size()); - size_t local_ind = loc_max + 1; + std::size_t local_ind = loc_max + 1; for (int i = 0; i < nw; ++i) { // need to set unique global number - const size_t v = global_max + max_nw * rank + i + 1; + const std::size_t v = global_max + max_nw * rank + i + 1; // set to true to not have problems with higher levels if growing of domains is used indset_rw.add(v, LocalIndex(local_ind, Dune::OwnerOverlapCopyAttributeSet::owner, true)); ++local_ind; @@ -114,8 +116,8 @@ namespace Opm const auto& fineLevelMatrix = fineOperator.getmat(); const auto& nw = fineOperator.getNumberOfExtraEquations(); if (prm_.get("add_wells")) { - const size_t average_elements_per_row - = static_cast(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N())); + const std::size_t average_elements_per_row + = static_cast(std::ceil(fineLevelMatrix.nonzeroes() / fineLevelMatrix.N())); const double overflow_fraction = 1.2; coarseLevelMatrix_.reset(new CoarseMatrix(fineLevelMatrix.N() + nw, fineLevelMatrix.M() + nw, @@ -176,12 +178,12 @@ namespace Opm double matrix_el = 0; if (transpose) { const auto& bw = weights_[entry.index()]; - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matrix_el += (*entry)[pressure_var_index_][i] * bw[i]; } } else { const auto& bw = weights_[row.index()]; - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matrix_el += (*entry)[i][pressure_var_index_] * bw[i]; } } @@ -216,7 +218,7 @@ namespace Opm if (transpose) { rhs_el = (*block)[pressure_var_index_]; } else { - for (size_t i = 0; i < block->size(); ++i) { + for (std::size_t i = 0; i < block->size(); ++i) { rhs_el += (*block)[i] * bw[i]; } } @@ -235,7 +237,7 @@ namespace Opm for (auto block = begin; block != end; ++block) { if (transpose) { const auto& bw = weights_[block.index()]; - for (size_t i = 0; i < block->size(); ++i) { + for (std::size_t i = 0; i < block->size(); ++i) { (*block)[i] = this->lhs_[block - begin] * bw[i]; } } else { diff --git a/opm/simulators/linalg/PressureTransferPolicy.hpp b/opm/simulators/linalg/PressureTransferPolicy.hpp index 0383c871a..ba292306b 100644 --- a/opm/simulators/linalg/PressureTransferPolicy.hpp +++ b/opm/simulators/linalg/PressureTransferPolicy.hpp @@ -26,6 +26,7 @@ #include #include +#include namespace Opm { @@ -104,12 +105,12 @@ public: double matrix_el = 0; if (transpose) { const auto& bw = weights_[entry.index()]; - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matrix_el += (*entry)[pressure_var_index_][i] * bw[i]; } } else { const auto& bw = weights_[row.index()]; - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matrix_el += (*entry)[i][pressure_var_index_] * bw[i]; } } @@ -132,7 +133,7 @@ public: if (transpose) { rhs_el = (*block)[pressure_var_index_]; } else { - for (size_t i = 0; i < block->size(); ++i) { + for (std::size_t i = 0; i < block->size(); ++i) { rhs_el += (*block)[i] * bw[i]; } } @@ -149,7 +150,7 @@ public: for (auto block = begin; block != end; ++block) { if (transpose) { const auto& bw = weights_[block.index()]; - for (size_t i = 0; i < block->size(); ++i) { + for (std::size_t i = 0; i < block->size(); ++i) { (*block)[i] = this->lhs_[block - begin] * bw[i]; } } else { @@ -172,6 +173,7 @@ public: { return pressure_var_index_; } + private: Communication* communication_; const FineVectorType& weights_; diff --git a/opm/simulators/linalg/WellOperators.hpp b/opm/simulators/linalg/WellOperators.hpp index e5bd0f758..5fcc0ab27 100644 --- a/opm/simulators/linalg/WellOperators.hpp +++ b/opm/simulators/linalg/WellOperators.hpp @@ -22,9 +22,16 @@ #ifndef OPM_WELLOPERATORS_HEADER_INCLUDED #define OPM_WELLOPERATORS_HEADER_INCLUDED +#include #include +#include + +#include + #include +#include + namespace Opm { @@ -237,7 +244,7 @@ public: //! constructor: just store a reference to a matrix WellModelGhostLastMatrixAdapter (const M& A, const Opm::LinearOperatorExtra& wellOper, - const size_t interiorSize ) + const std::size_t interiorSize ) : A_( A ), wellOper_( wellOper ), interiorSize_(interiorSize) {} @@ -294,14 +301,14 @@ public: protected: void ghostLastProject(Y& y) const { - size_t end = y.size(); - for (size_t i = interiorSize_; i < end; ++i) + std::size_t end = y.size(); + for (std::size_t i = interiorSize_; i < end; ++i) y[i] = 0; } const matrix_type& A_ ; const Opm::LinearOperatorExtra< X, Y>& wellOper_; - size_t interiorSize_; + std::size_t interiorSize_; }; } // namespace Opm diff --git a/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp b/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp index 3443b23ae..733813be4 100644 --- a/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp +++ b/opm/simulators/linalg/bda/rocsparseSolverBackend.cpp @@ -72,6 +72,7 @@ } \ } +#include namespace Opm { @@ -421,7 +422,7 @@ void rocsparseSolverBackend::update_system_on_gpu(double *b) { template bool rocsparseSolverBackend::analyze_matrix() { - size_t d_bufferSize_M, d_bufferSize_L, d_bufferSize_U, d_bufferSize; + std::size_t d_bufferSize_M, d_bufferSize_L, d_bufferSize_U, d_bufferSize; Timer t; ROCSPARSE_CHECK(rocsparse_set_pointer_mode(handle, rocsparse_pointer_mode_host)); diff --git a/opm/simulators/linalg/findOverlapRowsAndColumns.hpp b/opm/simulators/linalg/findOverlapRowsAndColumns.hpp index 14258c5e3..280816982 100644 --- a/opm/simulators/linalg/findOverlapRowsAndColumns.hpp +++ b/opm/simulators/linalg/findOverlapRowsAndColumns.hpp @@ -20,11 +20,13 @@ #ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED #define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED -#include -#include #include #include +#include +#include +#include + namespace Dune { template class CartesianIndexMapper; } @@ -117,9 +119,9 @@ namespace detail /// returns the number of interior cells numInterior. In the linear solver only the first numInterior rows of /// the matrix are needed. template - size_t numMatrixRowsToUseInSolver(const Grid& grid, bool ownerFirst) + std::size_t numMatrixRowsToUseInSolver(const Grid& grid, bool ownerFirst) { - size_t numInterior = 0; + std::size_t numInterior = 0; if (!ownerFirst || grid.comm().size()==1) return grid.leafGridView().size(0); const auto& gridView = grid.leafGridView(); diff --git a/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp b/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp index aba06e85d..db575bebd 100644 --- a/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp +++ b/opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp @@ -21,12 +21,12 @@ #include "config.h" #endif // HAVE_CONFIG_H -#include -#include -#include - #include +#include +#include +#include #include +#include #include #include @@ -157,7 +157,7 @@ AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ () report(std::ostream& os) const { os << "Sub steps started at time = " << unit::convert::to( start_time_, unit::day ) << " (days)" << std::endl; - for( size_t i=0; i #include +#include #include #include #include @@ -247,7 +248,7 @@ namespace Opm void SimulatorReport::fullReports(std::ostream& os) const { os << " Time(day) TStep(day) Assembly LSetup LSolve Update Output WellIt Lins NewtIt LinIt Conv\n"; - for (size_t i = 0; i < this->stepreports.size(); ++i) { + for (std::size_t i = 0; i < this->stepreports.size(); ++i) { const SimulatorReportSingle& sr = this->stepreports[i]; os.precision(10); os << std::defaultfloat; diff --git a/opm/simulators/timestepping/SimulatorTimer.cpp b/opm/simulators/timestepping/SimulatorTimer.cpp index 5ef763204..32ed8c0a2 100644 --- a/opm/simulators/timestepping/SimulatorTimer.cpp +++ b/opm/simulators/timestepping/SimulatorTimer.cpp @@ -22,12 +22,14 @@ #include #include #include -#include -#include #include #include +#include +#include +#include + namespace Opm { @@ -65,11 +67,11 @@ namespace Opm } /// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap - void SimulatorTimer::init(const Schedule& schedule, size_t report_step) + void SimulatorTimer::init(const Schedule& schedule, std::size_t report_step) { total_time_ = schedule.seconds( schedule.size() - 1 ); timesteps_.resize(schedule.size() - 1); - for ( size_t i = 0; i < schedule.size() - 1; ++i ) { + for (std::size_t i = 0; i < schedule.size() - 1; ++i) { timesteps_[i] = schedule.stepLength(i); } diff --git a/opm/simulators/timestepping/SimulatorTimer.hpp b/opm/simulators/timestepping/SimulatorTimer.hpp index b0af8443c..a91ac1d43 100644 --- a/opm/simulators/timestepping/SimulatorTimer.hpp +++ b/opm/simulators/timestepping/SimulatorTimer.hpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -52,7 +53,7 @@ namespace Opm void init(const ParameterGroup& param); /// Use the SimulatorTimer as a shim around opm-commons Schedule class - void init(const Schedule& schedule, size_t report_step = 0); + void init(const Schedule& schedule, std::size_t report_step = 0); /// Whether the current step is the first step. bool initialStep() const override; diff --git a/opm/simulators/utils/HDF5File.cpp b/opm/simulators/utils/HDF5File.cpp index 4c77a6f4a..f9d47233e 100644 --- a/opm/simulators/utils/HDF5File.cpp +++ b/opm/simulators/utils/HDF5File.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -115,7 +116,7 @@ void HDF5File::write(const std::string& group, } else { auto grps = split_string(realGroup, '/'); std::string curr; - for (size_t i = 0; i < grps.size(); ++i) { + for (std::size_t i = 0; i < grps.size(); ++i) { if (grps[i].empty()) continue; curr += '/'; diff --git a/opm/simulators/utils/ParallelEclipseState.cpp b/opm/simulators/utils/ParallelEclipseState.cpp index b85501f23..b74d901d3 100644 --- a/opm/simulators/utils/ParallelEclipseState.cpp +++ b/opm/simulators/utils/ParallelEclipseState.cpp @@ -23,6 +23,8 @@ #include +#include + namespace Opm { @@ -63,7 +65,7 @@ std::vector ParallelFieldPropsManager::porv(bool global) const if (m_comm.rank() == 0) global_porv = m_manager.porv(true); - size_t size = global_porv.size(); + std::size_t size = global_porv.size(); m_comm.broadcast(&size, 1, 0); global_porv.resize(size); m_comm.broadcast(global_porv.data(), size, 0); @@ -124,7 +126,7 @@ std::vector ParallelFieldPropsManager::get_global_int(const std::string& ke if (exceptionThrown) OPM_THROW_NOLOG(std::runtime_error, "No integer property field: " + keyword); - size_t size = result.size(); + std::size_t size = result.size(); m_comm.broadcast(&size, 1, 0); result.resize(size); m_comm.broadcast(result.data(), size, 0); @@ -178,7 +180,7 @@ std::vector ParallelFieldPropsManager::get_global_double(const std::stri if (exceptionThrown) OPM_THROW_NOLOG(std::runtime_error, "No double property field: " + keyword); - size_t size = result.size(); + std::size_t size = result.size(); m_comm.broadcast(&size, 1, 0); result.resize(size); m_comm.broadcast(result.data(), size, 0); diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index cbafd08d1..656baabd0 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -169,7 +169,7 @@ void BlackoilWellModelGeneric:: initFromRestartFile(const RestartValue& restartValues, WellTestState wtestState, - const size_t numCells, + const std::size_t numCells, bool handle_ms_well) { // The restart step value is used to identify wells present at the given @@ -224,7 +224,7 @@ initFromRestartFile(const RestartValue& restartValues, void BlackoilWellModelGeneric:: -prepareDeserialize(int report_step, const size_t numCells, bool handle_ms_well) +prepareDeserialize(int report_step, const std::size_t numCells, bool handle_ms_well) { // wells_ecl_ should only contain wells on this processor. wells_ecl_ = getLocalWells(report_step); @@ -1201,7 +1201,7 @@ updateWellPotentials(const int reportStepIdx, const bool write_restart_file = schedule().write_rst_file(reportStepIdx); auto exc_type = ExceptionType::NONE; std::string exc_msg; - size_t widx = 0; + std::size_t widx = 0; for (const auto& well : well_container_generic_) { const bool needed_for_summary = ((summaryConfig.hasSummaryKey( "WWPI:" + well->name()) || @@ -1458,7 +1458,7 @@ void BlackoilWellModelGeneric::initInjMult() { void BlackoilWellModelGeneric::updateFiltrationParticleVolume(const double dt, - const size_t water_index) + const std::size_t water_index) { for (auto& well : this->well_container_generic_) { if (well->isInjector() && well->wellEcl().getFilterConc() > 0.) { diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index dbdc18917..24de3372d 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -146,11 +146,11 @@ public: void initFromRestartFile(const RestartValue& restartValues, WellTestState wtestState, - const size_t numCells, + const std::size_t numCells, bool handle_ms_well); void prepareDeserialize(int report_step, - const size_t numCells, + const std::size_t numCells, bool handle_ms_well); /* @@ -386,7 +386,7 @@ protected: void updateInjMult(DeferredLogger& deferred_logger); void updateInjFCMult(DeferredLogger& deferred_logger); - void updateFiltrationParticleVolume(const double dt, const size_t water_index); + void updateFiltrationParticleVolume(const double dt, const std::size_t water_index); // create the well container virtual void createWellContainer(const int time_step) = 0; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 14f585623..8dd563493 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1007,9 +1007,9 @@ namespace Opm { const double dt = this->ebosSimulator_.timeStepSize(); // TODO: should we also have the group and network backed-up here in case the solution did not get converged? auto& well_state = this->wellState(); - constexpr size_t max_iter = 100; + constexpr std::size_t max_iter = 100; bool converged = false; - size_t iter = 0; + std::size_t iter = 0; bool changed_well_group = false; do { changed_well_group = updateWellControlsAndNetwork(true, dt, deferred_logger); @@ -1107,9 +1107,9 @@ namespace Opm { bool do_network_update = true; bool well_group_control_changed = false; // after certain number of the iterations, we use relaxed tolerance for the network update - const size_t iteration_to_relax = param_.network_max_strict_iterations_; + const std::size_t iteration_to_relax = param_.network_max_strict_iterations_; // after certain number of the iterations, we terminate - const size_t max_iteration = param_.network_max_iterations_; + const std::size_t max_iteration = param_.network_max_iterations_; std::size_t network_update_iteration = 0; while (do_network_update) { if (network_update_iteration == iteration_to_relax) { diff --git a/opm/simulators/wells/GasLiftStage2.cpp b/opm/simulators/wells/GasLiftStage2.cpp index d1150c7b8..2fd240a23 100644 --- a/opm/simulators/wells/GasLiftStage2.cpp +++ b/opm/simulators/wells/GasLiftStage2.cpp @@ -29,12 +29,14 @@ #include #include #include -#include -#include -#include #include +#include +#include +#include +#include + namespace Opm { GasLiftStage2::GasLiftStage2( @@ -372,8 +374,8 @@ mpiSyncLocalToGlobalGradVector_( using Pair = std::pair; std::vector grads_local_tmp; grads_local_tmp.reserve(grads_local.size()); - for (size_t i = 0; i < grads_local.size(); ++i) { - if(!this->well_state_.wellIsOwned(grads_local[i].first)) + for (std::size_t i = 0; i < grads_local.size(); ++i) { + if (!this->well_state_.wellIsOwned(grads_local[i].first)) continue; grads_local_tmp.push_back( std::make_pair( @@ -395,7 +397,7 @@ mpiSyncLocalToGlobalGradVector_( // memory is not reallocated here grads_global.clear(); - for (size_t i = 0; i < grads_global_tmp.size(); ++i) { + for (std::size_t i = 0; i < grads_global_tmp.size(); ++i) { grads_global.emplace_back( std::make_pair( well_state_.globalIdxToWellName(grads_global_tmp[i].first), diff --git a/opm/simulators/wells/MSWellHelpers.cpp b/opm/simulators/wells/MSWellHelpers.cpp index 1a12136bc..9d912585f 100644 --- a/opm/simulators/wells/MSWellHelpers.cpp +++ b/opm/simulators/wells/MSWellHelpers.cpp @@ -43,6 +43,7 @@ #endif // HAVE_UMFPACK #include +#include namespace { @@ -118,8 +119,8 @@ applyUMFPack(Dune::UMFPack& linsolver, // Checking if there is any inf or nan in y // it will be the solution before we find a way to catch the singularity of the matrix - for (size_t i_block = 0; i_block < y.size(); ++i_block) { - for (size_t i_elem = 0; i_elem < y[i_block].size(); ++i_elem) { + for (std::size_t i_block = 0; i_block < y.size(); ++i_block) { + for (std::size_t i_elem = 0; i_elem < y[i_block].size(); ++i_elem) { if (std::isinf(y[i_block][i_elem]) || std::isnan(y[i_block][i_elem]) ) { const std::string msg{"nan or inf value found after UMFPack solve due to singular matrix"}; OpmLog::debug(msg); diff --git a/opm/simulators/wells/MultisegmentWellEquations.cpp b/opm/simulators/wells/MultisegmentWellEquations.cpp index e84c8b43a..5d1adde76 100644 --- a/opm/simulators/wells/MultisegmentWellEquations.cpp +++ b/opm/simulators/wells/MultisegmentWellEquations.cpp @@ -25,7 +25,6 @@ #include #include - #include #if COMPILE_BDA_BRIDGE @@ -40,6 +39,7 @@ #include #include +#include #include namespace Opm { @@ -278,11 +278,11 @@ extract(SparseMatrixAdapter& jacobian) const // perforation at cell j connected to segment i. The code // assumes that no cell is connected to more than one segment, // i.e. the columns of B/C have no more than one nonzero. - for (size_t rowC = 0; rowC < duneC_.N(); ++rowC) { + for (std::size_t rowC = 0; rowC < duneC_.N(); ++rowC) { for (auto colC = duneC_[rowC].begin(), endC = duneC_[rowC].end(); colC != endC; ++colC) { const auto row_index = colC.index(); - for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { + for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) { for (auto colB = duneB_[rowB].begin(), endB = duneB_[rowB].end(); colB != endB; ++colB) { const auto col_index = colB.index(); @@ -313,14 +313,14 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, // Add for coupling from well to reservoir const int welldof_ind = duneC_.M() + well.indexOfWell(); if (!well.isPressureControlled(well_state)) { - for (size_t rowC = 0; rowC < duneC_.N(); ++rowC) { + for (std::size_t rowC = 0; rowC < duneC_.N(); ++rowC) { for (auto colC = duneC_[rowC].begin(), endC = duneC_[rowC].end(); colC != endC; ++colC) { const auto row_index = colC.index(); const auto& bw = weights[row_index]; double matel = 0.0; - for(size_t i = 0; i< bw.size(); ++i){ + for (std::size_t i = 0; i< bw.size(); ++i) { matel += bw[i]*(*colC)[seg_pressure_var_ind][i]; } jacobian[row_index][welldof_ind] += matel; @@ -333,7 +333,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, auto well_weight = weights[0]; well_weight = 0.0; int num_perfs = 0; - for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { + for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) { for (auto colB = duneB_[rowB].begin(), endB = duneB_[rowB].end(); colB != endB; ++colB) { const auto col_index = colB.index(); @@ -348,13 +348,13 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, // Add for coupling from reservoir to well and caclulate diag elelement corresping to incompressible standard well double diag_ell = 0.0; - for (size_t rowB = 0; rowB < duneB_.N(); ++rowB) { + for (std::size_t rowB = 0; rowB < duneB_.N(); ++rowB) { const auto& bw = well_weight; for (auto colB = duneB_[rowB].begin(), endB = duneB_[rowB].end(); colB != endB; ++colB) { const auto col_index = colB.index(); double matel = 0.0; - for(size_t i = 0; i< bw.size(); ++i){ + for (std::size_t i = 0; i< bw.size(); ++i) { matel += bw[i] *(*colB)[i][pressureVarIndex]; } jacobian[welldof_ind][col_index] += matel; diff --git a/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp b/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp index 8972b0168..78c88cc70 100644 --- a/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp +++ b/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp @@ -53,7 +53,7 @@ template void MultisegmentWellPrimaryVariables:: init() { - for (size_t seg = 0; seg < value_.size(); ++seg) { + for (std::size_t seg = 0; seg < value_.size(); ++seg) { for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) { evaluation_[seg][eq_idx] = 0.0; evaluation_[seg][eq_idx].setValue(value_[seg][eq_idx]); @@ -85,7 +85,7 @@ update(const WellState& well_state, const bool stop_or_zero_rate_target) const auto& segment_pressure = segments.pressure; const PhaseUsage& pu = well_.phaseUsage(); - for (size_t seg = 0; seg < value_.size(); ++seg) { + for (std::size_t seg = 0; seg < value_.size(); ++seg) { // calculate the total rate for each segment double total_seg_rate = 0.0; // the segment pressure @@ -160,7 +160,7 @@ updateNewton(const BVectorWell& dwells, { const std::vector> old_primary_variables = value_; - for (size_t seg = 0; seg < value_.size(); ++seg) { + for (std::size_t seg = 0; seg < value_.size(); ++seg) { if (has_wfrac_variable) { const int sign = dwells[seg][WFrac] > 0. ? 1 : -1; const double dx_limited = sign * std::min(std::abs(dwells[seg][WFrac]) * relaxation_factor, dFLimit); @@ -228,7 +228,7 @@ copyToWellState(const MultisegmentWellGeneric& mswell, auto& disgas = segments.dissolved_gas_rate; auto& vapoil = segments.vaporized_oil_rate; auto& segment_pressure = segments.pressure; - for (size_t seg = 0; seg < value_.size(); ++seg) { + for (std::size_t seg = 0; seg < value_.size(); ++seg) { std::vector fractions(well_.numPhases(), 0.0); fractions[oil_pos] = 1.0; @@ -540,7 +540,7 @@ typename MultisegmentWellPrimaryVariables::EvalWell MultisegmentWellPrimaryVariables:: getSegmentRateUpwinding(const int seg, const int seg_upwind, - const size_t comp_idx) const + const std::size_t comp_idx) const { // the result will contain the derivative with respect to WQTotal in segment seg, // and the derivatives with respect to WFrac GFrac in segment seg_upwind. diff --git a/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp b/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp index c2d610f67..cbe663688 100644 --- a/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp +++ b/opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp @@ -28,6 +28,7 @@ #include #include +#include #include namespace Opm @@ -119,7 +120,7 @@ public: //! \brief Returns upwinding rate for a component in a segment. EvalWell getSegmentRateUpwinding(const int seg, const int seg_upwind, - const size_t comp_idx) const; + const std::size_t comp_idx) const; //! \brief Get bottomhole pressure. EvalWell getBhp() const; diff --git a/opm/simulators/wells/MultisegmentWellSegments.cpp b/opm/simulators/wells/MultisegmentWellSegments.cpp index cb7953688..e9f945c0f 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.cpp +++ b/opm/simulators/wells/MultisegmentWellSegments.cpp @@ -88,7 +88,7 @@ MultisegmentWellSegments(const int numSegments, int i_perf_wells = 0; well.perfDepth().resize(well_.numPerfs(), 0.); const auto& segment_set = well_.wellEcl().getSegments(); - for (size_t perf = 0; perf < completion_set.size(); ++perf) { + for (std::size_t perf = 0; perf < completion_set.size(); ++perf) { const Connection& connection = completion_set.get(perf); if (connection.state() == Connection::State::OPEN) { const int segment_index = segment_set.segmentNumberToIndex(connection.segment()); @@ -148,7 +148,7 @@ computeFluidProperties(const EvalWell& temperature, surf_dens[compIdx] = FluidSystem::referenceDensity( phaseIdx, pvt_region_index); } - for (size_t seg = 0; seg < perforations_.size(); ++seg) { + for (std::size_t seg = 0; seg < perforations_.size(); ++seg) { // the compostion of the components inside wellbore under surface condition std::vector mix_s(well_.numComponents(), 0.0); for (int comp_idx = 0; comp_idx < well_.numComponents(); ++comp_idx) { @@ -310,7 +310,7 @@ template void MultisegmentWellSegments:: updateUpwindingSegments(const PrimaryVariables& primary_variables) { - for (size_t seg = 0; seg < perforations_.size(); ++seg) { + for (std::size_t seg = 0; seg < perforations_.size(); ++seg) { // special treatment is needed for segment 0 if (seg == 0) { // we are not supposed to have injecting producers and producing injectors diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 6a650769d..df15d30df 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -35,8 +35,9 @@ #include #include -#include #include +#include +#include #if HAVE_CUDA || HAVE_OPENCL #include @@ -1044,7 +1045,7 @@ namespace Opm * this->segments_.perforation_depth_diff(perf); const double perf_press = segment_pres + perf_seg_press_diff; const double multiplier = this->getInjMult(perf, segment_pres, perf_press); - for (size_t i = 0; i < mob.size(); ++i) { + for (std::size_t i = 0; i < mob.size(); ++i) { mob[i] *= multiplier; } } @@ -1160,7 +1161,7 @@ namespace Opm // calculating the b for the connection std::vector b_perf(this->num_components_); - for (size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { + for (std::size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { if (!FluidSystem::phaseIsActive(phase)) { continue; } @@ -1209,7 +1210,7 @@ namespace Opm ipr_b_perf[oil_comp_idx] += vap_oil_b; } - for (size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { + for (std::size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx]; this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx]; } diff --git a/opm/simulators/wells/StandardWellEquations.cpp b/opm/simulators/wells/StandardWellEquations.cpp index 9fc8f9733..19b5cffcc 100644 --- a/opm/simulators/wells/StandardWellEquations.cpp +++ b/opm/simulators/wells/StandardWellEquations.cpp @@ -35,6 +35,7 @@ #include #include +#include namespace Opm { @@ -164,7 +165,7 @@ void StandardWellEquations::invert() } catch (NumericalProblem&) { // for singular matrices, use identity as the inverse invDuneD_[0][0] = 0.0; - for (size_t i = 0; i < invDuneD_[0][0].rows(); ++i) { + for (std::size_t i = 0; i < invDuneD_[0][0].rows(); ++i) { invDuneD_[0][0][i][i] = 1.0; } } @@ -316,7 +317,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, const auto& bw = weights[row_ind]; double matel = 0; assert((*colC).M() == bw.size()); - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matel += (*colC)[bhp_var_index][i] * bw[i]; } @@ -328,7 +329,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, cell_weights /= nperf; BVectorWell bweights(1); - size_t blockSz = duneD_[0][0].N(); + std::size_t blockSz = duneD_[0][0].N(); bweights[0].resize(blockSz); bweights[0] = 0.0; double diagElem = 0; @@ -343,15 +344,15 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, DiagMatrixBlockWellType inv_diag_block = invDuneD_[0][0]; DiagMatrixBlockWellType inv_diag_block_transpose = Opm::wellhelpers::transposeDenseDynMatrix(inv_diag_block); - for (size_t i = 0; i < blockSz; ++i) { + for (std::size_t i = 0; i < blockSz; ++i) { bweights[0][i] = 0; - for (size_t j = 0; j < blockSz; ++j) { + for (std::size_t j = 0; j < blockSz; ++j) { bweights[0][i] += inv_diag_block_transpose[i][j] * rhs[0][j]; } abs_max = std::max(abs_max, std::fabs(bweights[0][i])); } assert(abs_max > 0.0); - for (size_t i = 0; i < blockSz; ++i) { + for (std::size_t i = 0; i < blockSz; ++i) { bweights[0][i] /= abs_max; } diagElem = 1.0 / abs_max; @@ -361,13 +362,13 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, bweights[0][blockSz-1] = 1.0; diagElem = 1.0; // better scaling could have used the calculation below if weights were calculated } else { - for (size_t i = 0; i < cell_weights.size(); ++i) { + for (std::size_t i = 0; i < cell_weights.size(); ++i) { bweights[0][i] = cell_weights[i]; } bweights[0][blockSz-1] = 0.0; diagElem = 0.0; const auto& locmat = duneD_[0][0]; - for (size_t i = 0; i < cell_weights.size(); ++i) { + for (std::size_t i = 0; i < cell_weights.size(); ++i) { diagElem += locmat[i][bhp_var_index] * cell_weights[i]; } @@ -382,7 +383,7 @@ extractCPRPressureMatrix(PressureMatrix& jacobian, const auto col_index = colB.index(); const auto& bw = bweights[0]; double matel = 0; - for (size_t i = 0; i < bw.size(); ++i) { + for (std::size_t i = 0; i < bw.size(); ++i) { matel += (*colB)[i][pressureVarIndex] * bw[i]; } jacobian[welldof_ind][col_index] = matel; diff --git a/opm/simulators/wells/StandardWellEval.cpp b/opm/simulators/wells/StandardWellEval.cpp index 0ae56a75d..bb05ce0d1 100644 --- a/opm/simulators/wells/StandardWellEval.cpp +++ b/opm/simulators/wells/StandardWellEval.cpp @@ -39,8 +39,7 @@ #include #include - - +#include namespace Opm { @@ -93,7 +92,7 @@ void StandardWellEval:: computeAccumWell() { - for (size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) { + for (std::size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) { F0_[eq_idx] = this->primary_variables_.surfaceVolumeFraction(eq_idx).value(); } } diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 281392ccf..e36aed2d8 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -34,10 +34,10 @@ #include #include +#include #include #include - namespace { template @@ -648,10 +648,11 @@ namespace Opm if constexpr (!Base::has_polymermw) { if constexpr (std::is_same_v) { std::vector mob_eval(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.}); - for (size_t i = 0; i < mob.size(); ++i) + for (std::size_t i = 0; i < mob.size(); ++i) { mob_eval[i].setValue(mob[i]); + } updateWaterMobilityWithPolymer(ebosSimulator, perf, mob_eval, deferred_logger); - for (size_t i = 0; i < mob.size(); ++i) { + for (std::size_t i = 0; i < mob.size(); ++i) { mob[i] = getValue(mob_eval[i]); } } else { @@ -665,7 +666,7 @@ namespace Opm const double bhp = this->primary_variables_.value(Bhp); const double perf_press = bhp + this->connections_.pressure_diff(perf); const double multiplier = this->getInjMult(perf, bhp, perf_press); - for (size_t i = 0; i < mob.size(); ++i) { + for (std::size_t i = 0; i < mob.size(); ++i) { mob[i] *= multiplier; } } @@ -759,7 +760,7 @@ namespace Opm // calculating the b for the connection std::vector b_perf(this->num_components_); - for (size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { + for (std::size_t phase = 0; phase < FluidSystem::numPhases; ++phase) { if (!FluidSystem::phaseIsActive(phase)) { continue; } @@ -816,7 +817,7 @@ namespace Opm ipr_b_perf[oil_comp_idx] += vap_oil_b; } - for (size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { + for (std::size_t comp_idx = 0; comp_idx < ipr_a_perf.size(); ++comp_idx) { this->ipr_a_[comp_idx] += ipr_a_perf[comp_idx]; this->ipr_b_[comp_idx] += ipr_b_perf[comp_idx]; } diff --git a/opm/simulators/wells/VFPProdProperties.cpp b/opm/simulators/wells/VFPProdProperties.cpp index 072310410..5c9f9f420 100644 --- a/opm/simulators/wells/VFPProdProperties.cpp +++ b/opm/simulators/wells/VFPProdProperties.cpp @@ -27,7 +27,7 @@ #include - +#include namespace Opm { @@ -125,7 +125,7 @@ bhpwithflo(const std::vector& flos, const auto alq_i = detail::findInterpData( alq, table.getALQAxis()); //assume constant std::vector bhps(flos.size(), 0.); - for (size_t i = 0; i < flos.size(); ++i) { + for (std::size_t i = 0; i < flos.size(); ++i) { // Value of FLO is negative in OPM for producers, but positive in VFP table const auto flo_i = detail::findInterpData(-flos[i], table.getFloAxis()); const detail::VFPEvaluation bhp_val = detail::interpolate(table, flo_i, thp_i, wfr_i, gfr_i, alq_i); diff --git a/opm/simulators/wells/VFPProperties.hpp b/opm/simulators/wells/VFPProperties.hpp index 96d1b0d4c..2f41d4881 100644 --- a/opm/simulators/wells/VFPProperties.hpp +++ b/opm/simulators/wells/VFPProperties.hpp @@ -25,6 +25,7 @@ #include #include +#include #include namespace Opm { @@ -71,7 +72,7 @@ public: return &m_prod; } - double getExplicitWFR(const int table_id, const size_t well_index) const { + double getExplicitWFR(const int table_id, const std::size_t well_index) const { const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& pu = well_state_.phaseUsage(); const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; @@ -81,7 +82,7 @@ public: return detail::getWFR(table, aqua, liquid, vapour); } - double getExplicitGFR(const int table_id, const size_t well_index) const { + double getExplicitGFR(const int table_id, const std::size_t well_index) const { const auto& rates = well_state_.well(well_index).prev_surface_rates; const auto& pu = well_state_.phaseUsage(); const auto& aqua = pu.phase_used[BlackoilPhases::Aqua]? rates[pu.phase_pos[BlackoilPhases::Aqua]]:0.0; diff --git a/opm/simulators/wells/WellGroupControls.cpp b/opm/simulators/wells/WellGroupControls.cpp index 4e2b48037..dba8bc0e1 100644 --- a/opm/simulators/wells/WellGroupControls.cpp +++ b/opm/simulators/wells/WellGroupControls.cpp @@ -37,6 +37,7 @@ #include #include +#include #include namespace Opm @@ -164,9 +165,9 @@ getGroupInjectionControl(const Group& group, const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep()); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) { // Apply local reductions only at the control level // (top) and for levels where we have a specified @@ -284,9 +285,9 @@ getGroupInjectionTargetRate(const Group& group, const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep()); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || well_.guideRate()->has(chain[ii], injectionPhase)) { // Apply local reductions only at the control level // (top) and for levels where we have a specified @@ -388,9 +389,9 @@ void WellGroupControls::getGroupProductionControl(const Group& group, const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep()); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || well_.guideRate()->has(chain[ii])) { // Apply local reductions only at the control level // (top) and for levels where we have a specified @@ -474,9 +475,9 @@ getGroupProductionTargetRate(const Group& group, const auto chain = WellGroupHelpers::groupChainTopBot(well_.name(), group.name(), schedule, well_.currentStep()); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || well_.guideRate()->has(chain[ii])) { // Apply local reductions only at the control level // (top) and for levels where we have a specified diff --git a/opm/simulators/wells/WellGroupHelpers.cpp b/opm/simulators/wells/WellGroupHelpers.cpp index 28869dd62..bfbfe3185 100644 --- a/opm/simulators/wells/WellGroupHelpers.cpp +++ b/opm/simulators/wells/WellGroupHelpers.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -847,7 +848,7 @@ namespace WellGroupHelpers up = down; } else { assert (up.size() == down.size()); - for (size_t ii = 0; ii < up.size(); ++ii) { + for (std::size_t ii = 0; ii < up.size(); ++ii) { up[ii] += down[ii]; } } @@ -1306,10 +1307,10 @@ namespace WellGroupHelpers = -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers. const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; // we need to find out the level where the current well is applied to the local reduction - size_t local_reduction_level = 0; - for (size_t ii = 1; ii < num_ancestors; ++ii) { + std::size_t local_reduction_level = 0; + for (std::size_t ii = 1; ii < num_ancestors; ++ii) { const int num_gr_ctrl = groupControlledWells(schedule, wellState, group_state, @@ -1323,7 +1324,7 @@ namespace WellGroupHelpers } } // check whether guide rate is violated - for (size_t ii = 1; ii < num_ancestors; ++ii) { + for (std::size_t ii = 1; ii < num_ancestors; ++ii) { if (guideRate->has(chain[ii])) { const auto& guided_group = chain[ii]; const double grefficiency @@ -1338,7 +1339,7 @@ namespace WellGroupHelpers } } double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || guideRate->has(chain[ii])) { // Apply local reductions only at the control level // (top) and for levels where we have a specified @@ -1453,10 +1454,10 @@ namespace WellGroupHelpers = tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers. const auto chain = groupChainTopBot(name, group.name(), schedule, reportStepIdx); // Because 'name' is the last of the elements, and not an ancestor, we subtract one below. - const size_t num_ancestors = chain.size() - 1; + const std::size_t num_ancestors = chain.size() - 1; // we need to find out the level where the current well is applied to the local reduction - size_t local_reduction_level = 0; - for (size_t ii = 1; ii < num_ancestors; ++ii) { + std::size_t local_reduction_level = 0; + for (std::size_t ii = 1; ii < num_ancestors; ++ii) { const int num_gr_ctrl = groupControlledWells(schedule, wellState, group_state, @@ -1471,7 +1472,7 @@ namespace WellGroupHelpers } // check whether guide rate is violated - for (size_t ii = 1; ii < num_ancestors; ++ii) { + for (std::size_t ii = 1; ii < num_ancestors; ++ii) { if (guideRate->has(chain[ii], injectionPhase)) { const auto& guided_group = chain[ii]; const double grefficiency @@ -1487,7 +1488,7 @@ namespace WellGroupHelpers } double target = orig_target; - for (size_t ii = 0; ii < num_ancestors; ++ii) { + for (std::size_t ii = 0; ii < num_ancestors; ++ii) { if ((ii == 0) || guideRate->has(chain[ii], injectionPhase)) { // Apply local reductions only at the control level // (top) and for levels where we have a specified diff --git a/opm/simulators/wells/WellHelpers.cpp b/opm/simulators/wells/WellHelpers.cpp index af9c73866..46a517761 100644 --- a/opm/simulators/wells/WellHelpers.cpp +++ b/opm/simulators/wells/WellHelpers.cpp @@ -32,6 +32,8 @@ #include #include + +#include #include namespace Opm { @@ -62,7 +64,7 @@ mv (const X& x, Y& y) const parallel_well_info_.communication().allgatherv(send, cstring_size, cstrings.data(), sizes.data(), offsets.data()); - for(std::size_t i = 0; i < sizes.size(); ++i) + for (std::size_t i = 0; i < sizes.size(); ++i) { std::string name(cstrings.data()+offsets[i]); if (name != parallel_well_info_.name()) @@ -164,8 +166,8 @@ template DenseMatrix transposeDenseDynMatrix(const DenseMatrix& M) { DenseMatrix tmp{M.cols(), M.rows()}; - for (size_t i = 0; i < M.rows(); ++i) { - for (size_t j = 0; j < M.cols(); ++j) { + for (std::size_t i = 0; i < M.rows(); ++i) { + for (std::size_t j = 0; j < M.cols(); ++j) { tmp[j][i] = M[i][j]; } } diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 34290b6af..19508584d 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -32,6 +32,8 @@ #include +#include + namespace Opm { @@ -286,7 +288,7 @@ namespace Opm // individually. We first open all completions, then we close one by one by calling updateWellTestState // untill the number of closed completions do not increase anymore. while (testWell) { - const size_t original_number_closed_completions = welltest_state_temp.num_closed_completions(); + const std::size_t original_number_closed_completions = welltest_state_temp.num_closed_completions(); bool converged = solveWellForTesting(simulator, well_state_copy, group_state, deferred_logger); if (!converged) { const auto msg = fmt::format("WTEST: Well {} is not solvable (physical)", this->name()); diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index e5e60a20e..61e6ccd72 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -420,7 +420,7 @@ void WellState::resize(const std::vector& wells_ecl, const std::vector>& parallel_well_info, const Schedule& schedule, const bool handle_ms_well, - const size_t numCells, + const std::size_t numCells, const std::vector>& well_perf_data, const SummaryState& summary_state) { @@ -614,7 +614,7 @@ void WellState::reportConnections(std::vector& connections, pi .at( pu.phase_pos[Gas] ) = rt::productivity_index_gas; } - size_t local_conn_index = 0; + std::size_t local_conn_index = 0; for (auto& comp : connections) { const auto * rates = &perf_data.phase_rates[np * local_conn_index]; const auto * connPI = &perf_data.prod_index[np * local_conn_index]; @@ -670,7 +670,7 @@ void WellState::initWellStateMSWell(const std::vector& wells_ecl, // we need to know for each segment, how many perforation it has and how many segments using it as outlet_segment // that is why I think we should use a well model to initialize the WellState here std::vector> segment_perforations(well_nseg); - for (size_t perf = 0; perf < completion_set.size(); ++perf) { + for (std::size_t perf = 0; perf < completion_set.size(); ++perf) { const Connection& connection = completion_set.get(perf); if (connection.state() == Connection::State::OPEN) { const int segment_index = segment_set.segmentNumberToIndex(connection.segment()); diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 0943e3b65..0b058aaa6 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -108,7 +108,7 @@ public: const std::vector>& parallel_well_info, const Schedule& schedule, const bool handle_ms_well, - const size_t numCells, + const std::size_t numCells, const std::vector>& well_perf_data, const SummaryState& summary_state);