diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp index cc059c57e5..bb85ed3f58 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp @@ -37,36 +37,31 @@ RigFemPartResults::~RigFemPartResults() } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFemPartResults::initResultStages(const std::vector& stageNames) +void RigFemPartResults::initResultSteps(const std::vector& stepNames) { - m_femAnalysisStages.clear(); - m_femAnalysisStages.resize(stageNames.size()); - for (size_t sIdx = 0; sIdx < stageNames.size(); ++sIdx) - { - m_femAnalysisStages[sIdx].stageName = stageNames[sIdx]; - } + m_stepNames = stepNames; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFemScalarResultFrames* RigFemPartResults::createScalarResult(size_t stageIndex, - const RigFemResultAddress& resVarAddr, - const std::vector& frameTimes) +RigFemScalarResultFrames* RigFemPartResults::createScalarResult(const RigFemResultAddress& resVarAddr) { - RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(frameTimes); - m_femAnalysisStages[stageIndex].resultSets[resVarAddr] = resFrames; + CVF_ASSERT(m_stepNames.size()); + + RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(m_stepNames); + resultSets[resVarAddr] = resFrames; return resFrames; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFemScalarResultFrames* RigFemPartResults::findScalarResult(size_t stageIndex, - const RigFemResultAddress& resVarAddr) +RigFemScalarResultFrames* RigFemPartResults::findScalarResult(const RigFemResultAddress& resVarAddr) { - return m_femAnalysisStages[stageIndex].resultSets[resVarAddr].p(); + return resultSets[resVarAddr].p(); } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h index ce2de4c366..f2a96059ac 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h @@ -37,14 +37,11 @@ public: RigFemPartResults(); ~RigFemPartResults(); - void initResultStages( const std::vector& stageNames); + void initResultSteps(const std::vector& stepNames); - RigFemScalarResultFrames* createScalarResult( size_t stageIndex, - const RigFemResultAddress& resVarAddr, - const std::vector& frameTimes); + RigFemScalarResultFrames* createScalarResult(const RigFemResultAddress& resVarAddr); - RigFemScalarResultFrames* findScalarResult( size_t stageIndex, - const RigFemResultAddress& resVarAddr); + RigFemScalarResultFrames* findScalarResult(const RigFemResultAddress& resVarAddr); private: @@ -54,7 +51,8 @@ private: std::map > resultSets; }; - std::vector m_femAnalysisStages; - + //std::vector m_femAnalysisStages; + std::vector m_stepNames; + std::map > resultSets; }; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp index 4be61a325e..e742c28181 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp @@ -26,10 +26,10 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFemScalarResultFrames::RigFemScalarResultFrames(const std::vector& frameTimes) -: m_frameTimes(frameTimes) +RigFemScalarResultFrames::RigFemScalarResultFrames(const std::vector& frameNames) +: m_frameNames(frameNames) { - m_dataForEachFrame.resize(m_frameTimes.size()); + m_dataForEachFrame.resize(m_frameNames.size()); } //-------------------------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ RigFemScalarResultFrames::~RigFemScalarResultFrames() //-------------------------------------------------------------------------------------------------- size_t RigFemScalarResultFrames::frameCount() { - return m_frameTimes.size(); + return m_frameNames.size(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h index cd024f8410..386cb4c858 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h @@ -29,7 +29,7 @@ class RigStatisticsDataCache; class RigFemScalarResultFrames: public cvf::Object { public: - RigFemScalarResultFrames(const std::vector& frameTimes); + RigFemScalarResultFrames(const std::vector& frameNames); virtual ~RigFemScalarResultFrames(); std::vector& frameData(size_t frameIndex); @@ -39,7 +39,7 @@ public: private: std::vector< std::vector > m_dataForEachFrame; - std::vector m_frameTimes; + std::vector m_frameNames; cvf::ref m_statistics; }; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp index d8f8d51b93..9faf32e849 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp @@ -92,7 +92,7 @@ bool RigGeoMechCaseData::openAndReadFemParts() for (int pIdx = 0; pIdx < static_cast(m_femPartResults.size()); ++pIdx) { m_femPartResults[pIdx] = new RigFemPartResults; - m_femPartResults[pIdx]->initResultStages(stepNames); + m_femPartResults[pIdx]->initResultSteps(stepNames); } // Calculate derived Fem data @@ -136,21 +136,25 @@ std::map > RigGeoMechCaseData::scalarField //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFemScalarResultFrames* RigGeoMechCaseData::findOrLoadScalarResult(int partIndex, int stepIndex, +RigFemScalarResultFrames* RigGeoMechCaseData::findOrLoadScalarResult(int partIndex, const RigFemResultAddress& resVarAddr) { CVF_ASSERT(partIndex < m_femParts->partCount()); CVF_ASSERT(m_readerInterface.notNull()); - RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(stepIndex, resVarAddr); + RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr); if (frames) return frames; - std::vector frameTimes = m_readerInterface->frameTimes((int)stepIndex); - frames = m_femPartResults[partIndex]->createScalarResult( stepIndex, resVarAddr, frameTimes); + std::vector stepNames = m_readerInterface->stepNames(); + frames = m_femPartResults[partIndex]->createScalarResult( resVarAddr); - for (int fIdx = 0; (size_t)fIdx < frameTimes.size(); ++fIdx) + for (int stepIndex = 0; stepIndex < stepNames.size(); ++stepIndex) { - std::vector* frameData = &(frames->frameData(fIdx)); + std::vector frameTimes = m_readerInterface->frameTimes((int)stepIndex); + + for (int fIdx = 1; (size_t)fIdx < frameTimes.size() && fIdx < 2 ; ++fIdx) // Read only the second frame + { + std::vector* frameData = &(frames->frameData(stepIndex)); switch (resVarAddr.resultPosType) { case RIG_NODAL: @@ -164,7 +168,7 @@ RigFemScalarResultFrames* RigGeoMechCaseData::findOrLoadScalarResult(int partInd break; } } - + } return frames; } @@ -180,25 +184,25 @@ std::vector RigGeoMechCaseData::stepNames() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, +void RigGeoMechCaseData::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax) { - minMaxScalarValuesInternal(resVarAddr, stepIndex, frameIndex, localMin, localMax); + minMaxScalarValuesInternal(resVarAddr, frameIndex, localMin, localMax); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int stepIndex, +void RigGeoMechCaseData::minMaxScalarValues(const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax) { - minMaxScalarValuesInternal(resVarAddr, stepIndex, -1, globalMin, globalMax); + minMaxScalarValuesInternal(resVarAddr, -1, globalMin, globalMax); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, double* overallMin, double* overallMax) +void RigGeoMechCaseData::minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex, double* overallMin, double* overallMax) { CVF_ASSERT(overallMax && overallMin); @@ -209,7 +213,7 @@ void RigGeoMechCaseData::minMaxScalarValuesInternal(const RigFemResultAddress& r { if (m_femPartResults[pIdx].notNull()) { - RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, stepIndex, resVarAddr); + RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, resVarAddr); if (frames) { double lmin; @@ -237,23 +241,23 @@ void RigGeoMechCaseData::minMaxScalarValuesInternal(const RigFemResultAddress& r //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero) +void RigGeoMechCaseData::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero) { - posNegClosestToZeroInternal(resVarAddr, stepIndex, frameIndex, localPosClosestToZero, localNegClosestToZero); + posNegClosestToZeroInternal(resVarAddr, frameIndex, localPosClosestToZero, localNegClosestToZero); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int stepIndex, double* globalPosClosestToZero, double* globalNegClosestToZero) +void RigGeoMechCaseData::posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero) { - posNegClosestToZeroInternal(resVarAddr, stepIndex, -1, globalPosClosestToZero, globalNegClosestToZero); + posNegClosestToZeroInternal(resVarAddr, -1, globalPosClosestToZero, globalNegClosestToZero); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, +void RigGeoMechCaseData::posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex, double* overallPosClosestToZero, double* overallNegClosestToZero) { CVF_ASSERT(overallPosClosestToZero && overallNegClosestToZero); @@ -265,7 +269,7 @@ void RigGeoMechCaseData::posNegClosestToZeroInternal(const RigFemResultAddress& { if (m_femPartResults[pIdx].notNull()) { - RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, stepIndex, resVarAddr); + RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, resVarAddr); if (frames) { double partNeg, partPos; @@ -294,35 +298,21 @@ void RigGeoMechCaseData::posNegClosestToZeroInternal(const RigFemResultAddress& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RigGeoMechCaseData::frameCount(int stepIndex, const RigFemResultAddress& resVarAddr) +int RigGeoMechCaseData::frameCount() { - size_t maxFrameCount = 0; - for (int pIdx = 0; pIdx < static_cast(m_femPartResults.size()); ++pIdx) - { - if (m_femPartResults[pIdx].notNull()) - { - RigFemScalarResultFrames* frames = m_femPartResults[pIdx]->findScalarResult(stepIndex, resVarAddr); - if (frames) - { - size_t frameCount = frames->frameCount(); - if (frameCount > maxFrameCount) maxFrameCount = frameCount; - } - } - } - - return static_cast(maxFrameCount); + return static_cast(stepNames().size()); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigGeoMechCaseData::assertResultsLoaded(int stepIndex, const RigFemResultAddress& resVarAddr) +void RigGeoMechCaseData::assertResultsLoaded( const RigFemResultAddress& resVarAddr) { for (int pIdx = 0; pIdx < static_cast(m_femPartResults.size()); ++pIdx) { if (m_femPartResults[pIdx].notNull()) { - findOrLoadScalarResult(pIdx, stepIndex, resVarAddr); + findOrLoadScalarResult(pIdx, resVarAddr); } } } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h index 13bab7dbae..5e3fb10a6b 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h @@ -44,23 +44,21 @@ public: std::map > scalarFieldAndComponentNames(RigFemResultPosEnum resPos); std::vector stepNames(); - void assertResultsLoaded(int stepIndex, const RigFemResultAddress& resVarAddr); - RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex, - int stepIndex, - const RigFemResultAddress& resVarAddr); + void assertResultsLoaded(const RigFemResultAddress& resVarAddr); + RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex, + const RigFemResultAddress& resVarAddr); - int frameCount(int stepIndex, const RigFemResultAddress& resVarAddr); - std::vector frameTimes(int stepIndex, const RigFemResultAddress& resVarAddr); + int frameCount(); - void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, double* localMin, double* localMax); - void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero); - void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int stepIndex, double* globalMin, double* globalMax); - void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int stepIndex, double* globalPosClosestToZero, double* globalNegClosestToZero); + void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax); + void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero); + void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax); + void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero); private: - void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, + void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex, double* overallMin, double* overallMax); - void posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int stepIndex, int frameIndex, + void posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero); std::string m_geoMechCaseFileName; diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index 532c16211b..913b0ae8b7 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -236,7 +236,7 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe RigFemResultAddress resVarAddress(resPosType, fieldName.toStdString(), compName.toStdString()); - RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, resVarAddress); + RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, resVarAddress); std::vector& resultValues = scalarResults->frameData(timeStepIndex); const std::vector* vxToResultMapping = NULL; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp index d12d679c1a..1046795d37 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp @@ -173,7 +173,7 @@ void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedFi m_resultComponentName = ""; } - m_reservoirView->geoMechCase()->geoMechData()->assertResultsLoaded(0, this->resultAddress()); + m_reservoirView->geoMechCase()->geoMechData()->assertResultsLoaded(this->resultAddress()); if (m_reservoirView) { diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 17e83d9d42..679e56576e 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -137,7 +137,7 @@ void RimGeoMechView::loadDataAndUpdate() progress.setProgressDescription("Reading Current Result"); CVF_ASSERT(this->cellResult() != NULL); - m_geomechCase->geoMechData()->assertResultsLoaded(0, this->cellResult()->resultAddress()); + m_geomechCase->geoMechData()->assertResultsLoaded(this->cellResult()->resultAddress()); progress.incrementProgress(); progress.setProgressDescription("Create Display model"); @@ -200,7 +200,7 @@ void RimGeoMechView::createDisplayModel() if (isTimeStepDependentDataVisible()) { int i; - for (i = 0; i < geoMechCase()->geoMechData()->frameCount(0, cellResult()->resultAddress()); i++) + for (i = 0; i < geoMechCase()->geoMechData()->frameCount(); ++i) { timeStepIndices.push_back(i); } @@ -380,11 +380,11 @@ void RimGeoMechView::updateLegends() RigFemResultAddress resVarAddress = cellResult->resultAddress(); if (resVarAddress.fieldName != "") { - gmCase->minMaxScalarValues(resVarAddress, 0, m_currentTimeStep, &localMin, &localMax); - gmCase->posNegClosestToZero(resVarAddress, 0, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero); + gmCase->minMaxScalarValues(resVarAddress, m_currentTimeStep, &localMin, &localMax); + gmCase->posNegClosestToZero(resVarAddress, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero); - gmCase->minMaxScalarValues(resVarAddress, 0, &globalMin, &globalMax); - gmCase->posNegClosestToZero(resVarAddress, 0, &globalPosClosestToZero, &globalNegClosestToZero); + gmCase->minMaxScalarValues(resVarAddress, &globalMin, &globalMax); + gmCase->posNegClosestToZero(resVarAddress, &globalPosClosestToZero, &globalNegClosestToZero); cellResult->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero); @@ -421,7 +421,7 @@ void RimGeoMechView::clampCurrentTimestep() int maxFrameCount = 0; if (m_geomechCase){ - maxFrameCount = m_geomechCase->geoMechData()->frameCount(0, cellResult()->resultAddress()); + maxFrameCount = m_geomechCase->geoMechData()->frameCount(); } if (m_currentTimeStep >= maxFrameCount ) m_currentTimeStep = maxFrameCount -1; diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 6d57709a2e..deaa606bb7 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -764,11 +764,10 @@ void RiuMainWindow::refreshAnimationActions() { if (activeGmv->isTimeStepDependentDataVisible()) { - RigFemResultAddress resAddr = activeGmv->cellResult()->resultAddress(); - size_t frameCount = activeGmv->geoMechCase()->geoMechData()->frameCount(0, resAddr); - for (size_t i = 0; i < frameCount; i++) + std::vector stepNames = activeGmv->geoMechCase()->geoMechData()->stepNames(); + for (size_t i = 0; i < stepNames.size(); i++) { - timeStepStrings += QString::number(i); + timeStepStrings += QString::fromStdString(stepNames[i]); } } }