Introduced RigFemResultAddress

Breaks build, possibly. Intermediate chek-in
This commit is contained in:
Jacob Støren 2015-05-08 10:34:57 +02:00
parent d405643d60
commit 55512db6a0
6 changed files with 81 additions and 18 deletions

View File

@ -18,6 +18,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RigFemPartResults.h"
#include "RigFemResultAddress.h"
//--------------------------------------------------------------------------------------------------
///
@ -52,13 +53,11 @@ void RigFemPartResults::initResultStages(const std::vector<std::string>& stageNa
///
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResults::createScalarResult(size_t stageIndex,
RigFemResultPosEnum resultPosType,
const std::string& fieldName,
const std::string& componentName,
const RigFemResultAddress& resVarAddr,
const std::vector<double>& frameTimes)
{
RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(frameTimes);
m_femAnalysisStages[stageIndex].resultSets[resultPosType][fieldName][componentName] = resFrames;
m_femAnalysisStages[stageIndex].resultSets[resVarAddr] = resFrames;
return resFrames;
}
@ -66,9 +65,7 @@ RigFemScalarResultFrames* RigFemPartResults::createScalarResult(size_t stageInde
///
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResults::findScalarResult(size_t stageIndex,
RigFemResultPosEnum resultPosType,
const std::string& fieldName,
const std::string& componentName)
const RigFemResultAddress& resVarAddr)
{
return m_femAnalysisStages[stageIndex].resultSets[resultPosType][fieldName][componentName].p();
return m_femAnalysisStages[stageIndex].resultSets[resVarAddr].p();
}

View File

@ -25,6 +25,7 @@
#include <map>
#include "RigFemScalarResultFrames.h"
#include "RigFemResultAddress.h"
//==================================================================================================
///
@ -39,22 +40,18 @@ public:
void initResultStages( const std::vector<std::string>& stageNames);
RigFemScalarResultFrames* createScalarResult( size_t stageIndex,
RigFemResultPosEnum resultPosType,
const std::string& fieldName,
const std::string& componentName,
const RigFemResultAddress& resVarAddr,
const std::vector<double>& frameTimes);
RigFemScalarResultFrames* findScalarResult( size_t stageIndex,
RigFemResultPosEnum resultPosType,
const std::string& fieldName,
const std::string& componentName);
const RigFemResultAddress& resVarAddr);
private:
struct RigAnalysisStage
{
std::string stageName;
std::map<RigFemResultPosEnum, std::map<std::string, std::map< std::string, cvf::ref<RigFemScalarResultFrames> > > > resultSets;
std::map<RigFemResultAddress, cvf::ref<RigFemScalarResultFrames> > resultSets;
};
std::vector<RigAnalysisStage> m_femAnalysisStages;

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFemResultPosEnum.h"
#include <string>
//==================================================================================================
///
//==================================================================================================
class RigFemResultAddress
{
public:
RigFemResultAddress(RigFemResultPosEnum resPosType,
const std::string& aFieldName,
const std::string& aComponentName)
: resultPosType(resPosType), fieldName(aFieldName), componentName(aComponentName)
{}
RigFemResultPosEnum resultPosType;
std::string fieldName;
std::string componentName;
bool operator< (const RigFemResultAddress& other ) const
{
if (resultPosType != other.resultPosType)
{
return (resultPosType < other.resultPosType);
}
if (fieldName != other.fieldName)
{
return (fieldName < other.fieldName);
}
return (componentName < other.componentName);
}
};

View File

@ -225,8 +225,13 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe
RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData();
if (!caseData) return;
caf::AppEnum<RigFemResultPosEnum> resPosType = cellResultSlot->resultPositionType();
QString fieldName = cellResultSlot->resultFieldName();
QString compName = cellResultSlot->resultComponentName();
RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, cellResultSlot->resultPositionType(), cellResultSlot->resultFieldName().toStdString(), cellResultSlot->resultComponentName().toStdString());
RigFemResultAddress resVarAddress(resPosType, fieldName.toStdString(), compName.toStdString());
RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, resVarAddress);
std::vector<float>& resultValues = scalarResults->frameData(timeStepIndex);
const std::vector<size_t>* vxToResultMapping = NULL;

View File

@ -169,7 +169,10 @@ void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
// Todo: Read results into cache ?
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
if (m_reservoirView)
{
m_reservoirView->createDisplayModelAndRedraw();
}
}
}

View File

@ -24,6 +24,7 @@
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "RigFemResultPosEnum.h"
#include "RigFemResultAddress.h"
class RimLegendConfig;
class RimGeoMechView;
@ -43,7 +44,9 @@ public:
void setReservoirView(RimGeoMechView* ownerReservoirView);
RigGeoMechCaseData* ownerCaseData();
RigFemResultAddress resultAddress() { return RigFemResultAddress(resultPositionType(), resultFieldName().toStdString(), resultComponentName().toStdString());}
RigFemResultPosEnum resultPositionType() { return m_resultPositionType();}
QString resultFieldName() { return m_resultFieldName();}
QString resultComponentName() { return m_resultComponentName();}