mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Some small refactoring. Preparing for Derived results
This commit is contained in:
parent
c22119e6a3
commit
bd67047f57
@ -53,7 +53,7 @@ RigFemScalarResultFrames* RigFemPartResults::createScalarResult(const RigFemResu
|
||||
{
|
||||
CVF_ASSERT(m_stepNames.size());
|
||||
|
||||
RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(m_stepNames);
|
||||
RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(static_cast<int>(m_stepNames.size()));
|
||||
resultSets[resVarAddr] = resFrames;
|
||||
return resFrames;
|
||||
}
|
||||
|
@ -98,13 +98,20 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in
|
||||
CVF_ASSERT(m_readerInterface.notNull());
|
||||
CVF_ASSERT(resVarAddr.isValid());
|
||||
|
||||
// If we have it in the cache, return it
|
||||
RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr);
|
||||
if (frames) return frames;
|
||||
|
||||
std::vector<std::string> stepNames = m_readerInterface->stepNames();
|
||||
frames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
||||
// Check whether a derived result is requested
|
||||
|
||||
for (int stepIndex = 0; stepIndex < static_cast<int>(stepNames.size()); ++stepIndex)
|
||||
|
||||
|
||||
// We need to read the data as bulk fields, and populate the correct scalar caches
|
||||
|
||||
frames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
||||
int frameCount = this->frameCount();
|
||||
|
||||
for (int stepIndex = 0; stepIndex < frameCount; ++stepIndex)
|
||||
{
|
||||
std::vector<double > frameTimes = m_readerInterface->frameTimes(stepIndex);
|
||||
|
||||
|
@ -25,10 +25,9 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames::RigFemScalarResultFrames(const std::vector<std::string>& frameNames)
|
||||
: m_frameNames(frameNames)
|
||||
RigFemScalarResultFrames::RigFemScalarResultFrames(int frameCount)
|
||||
{
|
||||
m_dataForEachFrame.resize(m_frameNames.size());
|
||||
m_dataForEachFrame.resize(frameCount);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -42,9 +41,9 @@ RigFemScalarResultFrames::~RigFemScalarResultFrames()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemScalarResultFrames::frameCount()
|
||||
int RigFemScalarResultFrames::frameCount()
|
||||
{
|
||||
return m_frameNames.size();
|
||||
return static_cast<int>(m_dataForEachFrame.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,16 +30,12 @@ class RigStatisticsDataCache;
|
||||
class RigFemScalarResultFrames: public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigFemScalarResultFrames(const std::vector<std::string>& frameNames);
|
||||
RigFemScalarResultFrames(int frameCount);
|
||||
virtual ~RigFemScalarResultFrames();
|
||||
|
||||
std::vector<float>& frameData(size_t frameIndex);
|
||||
size_t frameCount();
|
||||
int frameCount();
|
||||
|
||||
private:
|
||||
std::vector< std::vector<float> > m_dataForEachFrame;
|
||||
std::vector<std::string> m_frameNames;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user