Deep fix of #316 and also implements #317

#316 Do not show wrong results ...
#317 Avoid stopping animation when switching results
This commit cleans up some of the inconsistencies etc in the top of the
display model generation logic.
This commit is contained in:
Jacob Støren
2015-06-09 16:18:11 +02:00
parent 05315bc7a9
commit 30fcbebc8e
12 changed files with 100 additions and 83 deletions

View File

@@ -96,6 +96,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in
{
CVF_ASSERT(partIndex < (int)(m_femPartResults.size()));
CVF_ASSERT(m_readerInterface.notNull());
CVF_ASSERT(resVarAddr.isValid());
RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(resVarAddr);
if (frames) return frames;
@@ -145,17 +146,27 @@ int RigFemPartResultsCollection::frameCount()
}
//--------------------------------------------------------------------------------------------------
///
/// Returns whether any of the parts actually had any of the requested results
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress& resVarAddr)
bool RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress& resVarAddr)
{
if (!resVarAddr.isValid()) return false;
bool foundResults = false;
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
{
if (m_femPartResults[pIdx].notNull())
{
findOrLoadScalarResult(pIdx, resVarAddr);
RigFemScalarResultFrames* scalarResults = findOrLoadScalarResult(pIdx, resVarAddr);
for (int fIdx = 0; fIdx < scalarResults->frameCount(); ++fIdx)
{
foundResults = foundResults || scalarResults->frameData(fIdx).size();
}
}
}
return foundResults;
}
//--------------------------------------------------------------------------------------------------
@@ -163,6 +174,8 @@ void RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress&
//--------------------------------------------------------------------------------------------------
const std::vector<float>& RigFemPartResultsCollection::resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex)
{
CVF_ASSERT(resVarAddr.isValid());
RigFemScalarResultFrames* scalarResults = findOrLoadScalarResult(partIndex, resVarAddr);
return scalarResults->frameData(frameIndex);
}

View File

@@ -40,7 +40,7 @@ public:
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
std::vector<std::string> stepNames();
void assertResultsLoaded(const RigFemResultAddress& resVarAddr);
bool assertResultsLoaded(const RigFemResultAddress& resVarAddr);
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
int frameCount();
@@ -53,16 +53,11 @@ public:
void meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue);
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90);
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr);
private:
RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex,
const RigFemResultAddress& resVarAddr);
void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
double* overallMin, double* overallMax);
void posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
double* localPosClosestToZero, double* localNegClosestToZero);
friend class RigFemNativeStatCalc;
cvf::Collection<RigFemPartResults> m_femPartResults;
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;

View File

@@ -39,6 +39,15 @@ RigFemResultAddress(RigFemResultPosEnum resPosType,
std::string fieldName;
std::string componentName;
bool isValid() const
{
bool isTypeValid = resultPosType == RIG_NODAL
|| resultPosType == RIG_ELEMENT_NODAL
|| resultPosType == RIG_INTEGRATION_POINT;
bool isFieldValid = fieldName != "";
return isTypeValid && isFieldValid;
}
bool operator< (const RigFemResultAddress& other ) const
{
if (resultPosType != other.resultPosType)