Creating a fem-results caching system

Needed specifically for statistics
Work in progress brakes build
This commit is contained in:
Jacob Støren
2015-05-06 16:07:30 +02:00
parent 746e9d402d
commit 27dcd80bfd
18 changed files with 443 additions and 107 deletions

View File

@@ -86,29 +86,9 @@ bool RimGeoMechCase::openGeoMechCase()
return false;
}
m_geoMechCaseData = new RigGeoMechCaseData(m_caseFileName().toStdString());
#ifdef USE_ODB_API
m_readerInterface = new RifOdbReader;
m_geoMechCaseData = new RigGeoMechCaseData;
if (m_readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts()))
{
// Todo: Default Results stuff, if needed
return true;
}
#endif
return false;
return m_geoMechCaseData->openAndReadFemParts();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifGeoMechReaderInterface* RimGeoMechCase::readerInterface()
{
return m_readerInterface.p();
}

View File

@@ -40,23 +40,22 @@ public:
RimGeoMechCase(void);
virtual ~RimGeoMechCase(void);
void setFileName(const QString& fileName) {m_caseFileName = fileName;}
bool openGeoMechCase();
void setFileName(const QString& fileName) {m_caseFileName = fileName;}
bool openGeoMechCase();
RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); }
const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); }
RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); }
const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); }
RimGeoMechView* createAndAddReservoirView();
RimGeoMechView* createAndAddReservoirView();
virtual caf::PdmFieldHandle* userDescriptionField();
RifGeoMechReaderInterface* readerInterface();
// Fields:
caf::PdmField<QString> caseUserDescription;
caf::PdmPointersField<RimGeoMechView*> geoMechViews;
// Fields:
caf::PdmField<QString> caseUserDescription;
caf::PdmPointersField<RimGeoMechView*> geoMechViews;
private:
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
caf::PdmField<QString> m_caseFileName;
virtual caf::PdmFieldHandle* userDescriptionField();
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
private:
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
caf::PdmField<QString> m_caseFileName;
};

View File

@@ -24,16 +24,17 @@
#include "RimGeoMechCase.h"
#include "RifGeoMechReaderInterface.h"
#include "cafPdmUiListEditor.h"
#include "RigGeoMechCaseData.h"
namespace caf {
template<>
void caf::AppEnum< RimGeoMechResultSlot::ResultPositionEnum >::setUp()
void caf::AppEnum< RigFemResultPosEnum >::setUp()
{
addItem(RimGeoMechResultSlot::NODAL, "NODAL", "Nodal");
addItem(RimGeoMechResultSlot::ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal");
addItem(RimGeoMechResultSlot::INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
setDefault(RimGeoMechResultSlot::NODAL);
addItem(RIG_NODAL, "NODAL", "Nodal");
addItem(RIG_ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal");
addItem(RIG_INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
setDefault(RIG_NODAL);
}
}
@@ -178,29 +179,15 @@ void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<std::string> > RimGeoMechResultSlot::getResultMetaDataForUIFieldSetting()
{
std::map<std::string, std::vector<std::string> > fieldCompNames;
RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
if (gmCase)
if (gmCase && gmCase->geoMechData())
{
cvf::ref<RifGeoMechReaderInterface> reader = gmCase->readerInterface();
if (reader.notNull())
{
if (m_resultPositionTypeUiField == NODAL)
{
fieldCompNames = reader->scalarNodeFieldAndComponentNames();
}
else if (m_resultPositionTypeUiField == ELEMENT_NODAL)
{
fieldCompNames = reader->scalarElementNodeFieldAndComponentNames();
}
else if (m_resultPositionTypeUiField == INTEGRATION_POINT)
{
fieldCompNames = reader->scalarIntegrationPointFieldAndComponentNames();
}
}
return gmCase->geoMechData()->scalarFieldAndComponentNames(m_resultPositionTypeUiField());
}
else
{
return std::map<std::string, std::vector<std::string> >() ;
}
return fieldCompNames;
}
void RimGeoMechResultSlot::getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames,
@@ -248,17 +235,7 @@ void RimGeoMechResultSlot::loadResult()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifGeoMechReaderInterface* RimGeoMechResultSlot::resultReaderInterface()
RigGeoMechCaseData* RimGeoMechResultSlot::ownerCaseData()
{
if (m_reservoirView)
{
RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
if (gmCase)
{
return gmCase->readerInterface();
}
}
return NULL;
return m_reservoirView->geoMechCase()->geoMechData();
}

View File

@@ -23,11 +23,12 @@
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "RigFemResultPosEnum.h"
class RimLegendConfig;
class RimGeoMechView;
class RifGeoMechReaderInterface;
class RigGeoMechCaseData;
//==================================================================================================
///
///
@@ -41,22 +42,15 @@ public:
virtual ~RimGeoMechResultSlot(void);
void setReservoirView(RimGeoMechView* ownerReservoirView);
RifGeoMechReaderInterface* resultReaderInterface();
enum ResultPositionEnum {
NODAL,
ELEMENT_NODAL,
INTEGRATION_POINT
};
ResultPositionEnum resultPositionType() { return m_resultPositionType();}
RigGeoMechCaseData* ownerCaseData();
RigFemResultPosEnum resultPositionType() { return m_resultPositionType();}
QString resultFieldName() { return m_resultFieldName();}
QString resultComponentName() { return m_resultComponentName();}
caf::PdmField<RimLegendConfig*> legendConfig;
private:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool * useOptionsOnly);
@@ -70,11 +64,11 @@ private:
virtual void initAfterRead();
void loadResult();
caf::PdmField<caf::AppEnum<ResultPositionEnum> > m_resultPositionType;
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionType;
caf::PdmField<QString> m_resultFieldName;
caf::PdmField<QString> m_resultComponentName;
caf::PdmField<caf::AppEnum<ResultPositionEnum> > m_resultPositionTypeUiField;
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionTypeUiField;
caf::PdmField<QString> m_resultVariableUiField;
caf::PdmPointer<RimGeoMechView> m_reservoirView;

View File

@@ -40,7 +40,7 @@
#include "RivGeoMechPartMgr.h"
#include "RigGeoMechCaseData.h"
#include "cvfqtUtils.h"
#include "RigFemPartCollection.h"
namespace caf {
@@ -254,7 +254,7 @@ void RimGeoMechView::updateLegends()
cellResult->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
cellResult->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
#endif
caf::AppEnum<RimGeoMechResultSlot::ResultPositionEnum> resPosType = cellResult->resultPositionType();
caf::AppEnum<RigFemResultPosEnum> resPosType = cellResult->resultPositionType();
QString fieldName = cellResult->resultFieldName();
QString compName = cellResult->resultComponentName();