#3269 Compdat Export Performance : Load all data before loop

This commit is contained in:
Magne Sjaastad
2018-08-24 09:59:37 +02:00
parent b3a7dc943c
commit 5f52dae545
5 changed files with 78 additions and 11 deletions

View File

@@ -146,6 +146,34 @@ std::vector<RigCompletionData>
std::vector<std::vector<RigCompletionData>> sharedComplForFracture(fractures.size()); std::vector<std::vector<RigCompletionData>> sharedComplForFracture(fractures.size());
{
// Load the data required by computations to be able to use const access only inside OpenMP loop
std::vector<QString> resultNames = RigEclipseToStimPlanCellTransmissibilityCalculator::requiredResultNames();
if (!caseToApply->loadStaticResultsByName(resultNames))
{
QString msg;
msg += "Compdat Export : Required data missing. Required results ";
for (const auto& r : resultNames)
{
msg += " ";
msg += r;
}
RiaLogging::error(msg);
return fractureCompletions;
}
}
{
// Optional results
std::vector<QString> resultNames = RigEclipseToStimPlanCellTransmissibilityCalculator::optionalResultNames();
caseToApply->loadStaticResultsByName(resultNames);
}
// Temporarily commented out due to sync problems. Needs more analysis // Temporarily commented out due to sync problems. Needs more analysis
//#pragma omp parallel for //#pragma omp parallel for
for (int i = 0; i < (int)fractures.size(); i++) for (int i = 0; i < (int)fractures.size(); i++)
@@ -463,9 +491,9 @@ std::vector<RigCompletionData>
fractureDataReportItems->push_back(reportItem); fractureDataReportItems->push_back(reportItem);
} }
std::copy( std::copy(allCompletionsForOneFracture.begin(),
allCompletionsForOneFracture.begin(), allCompletionsForOneFracture.end(), std::back_inserter(sharedComplForFracture[i])); allCompletionsForOneFracture.end(),
std::back_inserter(sharedComplForFracture[i]));
if (outputStreamForIntermediateResultsText) if (outputStreamForIntermediateResultsText)
{ {

View File

@@ -655,18 +655,26 @@ const RigCaseCellResultsData* RimEclipseCase::results(RiaDefines::PorosityModelT
/// Convenience function used to pre-load data before const access of data /// Convenience function used to pre-load data before const access of data
/// Used when implementing calculations in a parallelized loop /// Used when implementing calculations in a parallelized loop
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseCase::loadStaticResultsByName(const std::vector<QString>& resultNames) bool RimEclipseCase::loadStaticResultsByName(const std::vector<QString>& resultNames)
{ {
bool foundDataForAllResults = true;
RigCaseCellResultsData* cellResultsData = this->results(RiaDefines::MATRIX_MODEL); RigCaseCellResultsData* cellResultsData = this->results(RiaDefines::MATRIX_MODEL);
if(cellResultsData) if(cellResultsData)
{ {
for (const auto& resultName : resultNames) for (const auto& resultName : resultNames)
{ {
cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, resultName); size_t resultIdx = cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, resultName);
if (resultIdx == cvf::UNDEFINED_SIZE_T)
{
foundDataForAllResults = false;
} }
} }
} }
return foundDataForAllResults;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -78,7 +78,7 @@ public:
RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel); RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel);
const RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel) const; const RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel) const;
void loadStaticResultsByName(const std::vector<QString>& resultNames); bool loadStaticResultsByName(const std::vector<QString>& resultNames);
RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel); RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel);
const RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel) const; const RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel) const;

View File

@@ -84,6 +84,34 @@ const RigFractureCell& RigEclipseToStimPlanCellTransmissibilityCalculator::fract
return m_stimPlanCell; return m_stimPlanCell;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigEclipseToStimPlanCellTransmissibilityCalculator::requiredResultNames()
{
std::vector<QString> resultNames;
resultNames.push_back("PERMX");
resultNames.push_back("PERMY");
resultNames.push_back("PERMZ");
resultNames.push_back("DX");
resultNames.push_back("DY");
resultNames.push_back("DZ");
return resultNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigEclipseToStimPlanCellTransmissibilityCalculator::optionalResultNames()
{
std::vector<QString> resultNames;
resultNames.push_back("NTG");
return resultNames;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -50,6 +50,9 @@ public:
const std::vector<double>& contributingEclipseCellAreas() const; const std::vector<double>& contributingEclipseCellAreas() const;
const RigFractureCell& fractureCell() const; const RigFractureCell& fractureCell() const;
static std::vector<QString> requiredResultNames();
static std::vector<QString> optionalResultNames();
private: private:
void calculateStimPlanCellsMatrixTransmissibility(); void calculateStimPlanCellsMatrixTransmissibility();
std::vector<size_t> getPotentiallyFracturedCellsForPolygon(const std::vector<cvf::Vec3d>& polygon) const; std::vector<size_t> getPotentiallyFracturedCellsForPolygon(const std::vector<cvf::Vec3d>& polygon) const;