mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Result Storage: Finally things have come together, and seems to behave.
Refactored the loadProject system to make loading of statistical cases work as they should. Got the update of references regarding grid and unionActive cells work Introduced a bool to keep track of what cell results to store. Introduced a clear method in ActiveCellInfo. Renamed a bit p4#: 21036
This commit is contained in:
@@ -223,14 +223,21 @@ const char* RIApplication::getVersionStringApp(bool includeCrtInfo)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RIApplication::loadProject(const QString& projectFileName)
|
||||
{
|
||||
// First Close the current project
|
||||
|
||||
if (!closeProject(true)) return false;
|
||||
|
||||
// Open the project file and read the serialized data.
|
||||
// Will initialize itself.
|
||||
|
||||
if (!QFile::exists(projectFileName)) return false;
|
||||
|
||||
m_project->fileName = projectFileName;
|
||||
m_project->readFile();
|
||||
m_project->fileName = projectFileName; // Make sure we overwrite the old filename read from the project file
|
||||
|
||||
// On error, delete everything, and bail out.
|
||||
|
||||
if (m_project->projectFileVersionString().isEmpty())
|
||||
{
|
||||
closeProject(false);
|
||||
@@ -244,62 +251,78 @@ bool RIApplication::loadProject(const QString& projectFileName)
|
||||
// Delete all object possibly generated by readFile()
|
||||
delete m_project;
|
||||
m_project = new RimProject;
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
///////
|
||||
// Load the external data, and initialize stuff that needs specific ordering
|
||||
|
||||
m_preferences->lastUsedProjectFileName = projectFileName;
|
||||
writePreferences();
|
||||
|
||||
for (size_t cgIdx = 0; cgIdx < m_project->caseGroups.size(); ++cgIdx)
|
||||
{
|
||||
m_preferences->lastUsedProjectFileName = projectFileName;
|
||||
writePreferences();
|
||||
// Load the Main case of each IdenticalGridCaseGroup
|
||||
|
||||
std::vector<RimReservoir*> casesToLoad;
|
||||
RimIdenticalGridCaseGroup* igcg = m_project->caseGroups[cgIdx];
|
||||
igcg->loadMainCaseAndActiveCellInfo();
|
||||
}
|
||||
|
||||
// Add all "native" cases in the project
|
||||
for (size_t cIdx = 0; cIdx < m_project->reservoirs().size(); ++cIdx)
|
||||
// Now load the ReservoirViews for the cases
|
||||
|
||||
std::vector<RimReservoir*> casesToLoad;
|
||||
|
||||
// Add all "native" cases in the project
|
||||
for (size_t cIdx = 0; cIdx < m_project->reservoirs().size(); ++cIdx)
|
||||
{
|
||||
casesToLoad.push_back(m_project->reservoirs()[cIdx]);
|
||||
}
|
||||
|
||||
// Add all statistics cases as well
|
||||
for (size_t cgIdx = 0; cgIdx < m_project->caseGroups().size(); ++cgIdx)
|
||||
{
|
||||
if (m_project->caseGroups[cgIdx]->statisticalReservoirCollection())
|
||||
{
|
||||
casesToLoad.push_back(m_project->reservoirs()[cIdx]);
|
||||
}
|
||||
|
||||
// Add all statistics cases as well
|
||||
for (size_t cgIdx = 0; cgIdx < m_project->caseGroups().size(); ++cgIdx)
|
||||
{
|
||||
if (m_project->caseGroups[cgIdx]->statisticalReservoirCollection())
|
||||
caf::PdmPointersField<RimStatisticalCalculation*> & statCases = m_project->caseGroups[cgIdx]->statisticalReservoirCollection()->reservoirs();
|
||||
for (size_t scIdx = 0; scIdx < statCases.size(); ++scIdx)
|
||||
{
|
||||
caf::PdmPointersField<RimStatisticalCalculation*> & statCases = m_project->caseGroups[cgIdx]->statisticalReservoirCollection()->reservoirs();
|
||||
for (size_t scIdx = 0; scIdx < statCases.size(); ++scIdx)
|
||||
{
|
||||
casesToLoad.push_back(statCases[scIdx]);
|
||||
}
|
||||
casesToLoad.push_back(statCases[scIdx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
caf::ProgressInfo caseProgress(casesToLoad.size() , "Reading Cases");
|
||||
caf::ProgressInfo caseProgress(casesToLoad.size() , "Reading Cases");
|
||||
|
||||
for (size_t cIdx = 0; cIdx < casesToLoad.size(); ++cIdx)
|
||||
for (size_t cIdx = 0; cIdx < casesToLoad.size(); ++cIdx)
|
||||
{
|
||||
RimReservoir* ri = casesToLoad[cIdx];
|
||||
CVF_ASSERT(ri);
|
||||
|
||||
caseProgress.setProgressDescription(ri->caseName());
|
||||
|
||||
caf::ProgressInfo viewProgress(ri->reservoirViews().size() , "Creating Views");
|
||||
|
||||
size_t j;
|
||||
for (j = 0; j < ri->reservoirViews().size(); j++)
|
||||
{
|
||||
RimReservoir* ri = casesToLoad[cIdx];
|
||||
CVF_ASSERT(ri);
|
||||
RimReservoirView* riv = ri->reservoirViews[j];
|
||||
CVF_ASSERT(riv);
|
||||
|
||||
caseProgress.setProgressDescription(ri->caseName());
|
||||
viewProgress.setProgressDescription(riv->name());
|
||||
|
||||
caf::ProgressInfo viewProgress(ri->reservoirViews().size() , "Creating Views");
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
size_t j;
|
||||
for (j = 0; j < ri->reservoirViews().size(); j++)
|
||||
{
|
||||
RimReservoirView* riv = ri->reservoirViews()[j];
|
||||
CVF_ASSERT(riv);
|
||||
|
||||
viewProgress.setProgressDescription(riv->name());
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
viewProgress.incrementProgress();
|
||||
}
|
||||
|
||||
caseProgress.incrementProgress();
|
||||
viewProgress.incrementProgress();
|
||||
}
|
||||
|
||||
caseProgress.incrementProgress();
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user