#1440 Merge dev into pre-proto (WellPath viz restructure and constness)

Had to do quite a bit constness fiddeling to make the merge work
This commit is contained in:
Jacob Støren
2017-06-22 10:42:07 +02:00
50 changed files with 650 additions and 510 deletions

View File

@@ -51,8 +51,9 @@ public:
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0;
virtual QStringList timeStepStrings() = 0;
virtual QString timeStepName(int frameIdx) = 0;
virtual std::vector<QDateTime> timeStepDates() const = 0;
virtual QStringList timeStepStrings() const = 0;
virtual QString timeStepName(int frameIdx) const = 0;
virtual cvf::BoundingBox activeCellsBoundingBox() const = 0;
virtual cvf::BoundingBox allCellsBoundingBox() const = 0;
@@ -61,6 +62,8 @@ public:
virtual void updateFormationNamesData() = 0;
virtual double characteristicCellSize() const = 0;
protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
private:

View File

@@ -76,14 +76,20 @@ RimEclipseCase::RimEclipseCase()
CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "");
CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "");
CAF_PDM_InitFieldNoDefault(&filesContainingFaults, "FilesContainingFaults", "", "", "", "");
filesContainingFaults.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "");
m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden(true);
// Obsolete fields
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaults_OBSOLETE, "FilesContainingFaults", "", "", "", "");
m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false);
m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true);
// Obsolete field
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,"");
caseName.xmlCapability()->setIOWritable(false);
caseName.uiCapability()->setUiHidden(true);
// Init
m_matrixModelResults = new RimReservoirCellResultsStorage;
m_matrixModelResults.uiCapability()->setUiHidden(true);
m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true);
@@ -422,6 +428,51 @@ void RimEclipseCase::setReservoirData(RigEclipseCaseData* eclipseCase)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::createTimeStepFormatString()
{
std::vector<QDateTime> timeStepDates = this->timeStepDates();
bool hasHoursAndMinutesInTimesteps = false;
bool hasSecondsInTimesteps = false;
bool hasMillisecondsInTimesteps = false;
for (size_t i = 0; i < timeStepDates.size(); i++)
{
if (timeStepDates[i].time().msec() != 0.0)
{
hasMillisecondsInTimesteps = true;
hasSecondsInTimesteps = true;
hasHoursAndMinutesInTimesteps = true;
break;
}
else if (timeStepDates[i].time().second() != 0.0)
{
hasHoursAndMinutesInTimesteps = true;
hasSecondsInTimesteps = true;
}
else if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
{
hasHoursAndMinutesInTimesteps = true;
}
}
m_timeStepFormatString = "dd.MMM yyyy";
if (hasHoursAndMinutesInTimesteps)
{
m_timeStepFormatString += " - hh:mm";
if (hasSecondsInTimesteps)
{
m_timeStepFormatString += ":ss";
if (hasMillisecondsInTimesteps)
{
m_timeStepFormatString += ".zzz";
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -470,7 +521,7 @@ cvf::Vec3d RimEclipseCase::displayModelOffset() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel) const
RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel)
{
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
{
@@ -480,7 +531,51 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro
return m_fractureModelResults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel) const
{
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
{
return m_matrixModelResults();
}
return m_fractureModelResults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimEclipseCase::filesContainingFaults() const
{
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
QStringList pathList = separatedPaths.split(";", QString::SkipEmptyParts);
std::vector<QString> stdPathList;
for (auto& path: pathList) stdPathList.push_back(path);
return stdPathList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::setFilesContainingFaults(const std::vector<QString>& val)
{
QString separatedPaths;
for (size_t i = 0; i < val.size(); ++i)
{
const auto& path = val[i];
separatedPaths += path;
if (!(i+1 >= val.size()) )
{
separatedPaths += ";";
}
}
m_filesContainingFaultsSemColSeparated = separatedPaths;
}
//--------------------------------------------------------------------------------------------------
///
@@ -516,6 +611,8 @@ bool RimEclipseCase::openReserviorCase()
if (results->cellResults()) results->cellResults()->createPlaceholderResultEntries();
}
createTimeStepFormatString();
return true;
}
@@ -535,7 +632,7 @@ std::vector<RimView*> RimEclipseCase::views()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimEclipseCase::timeStepStrings()
QStringList RimEclipseCase::timeStepStrings() const
{
QStringList stringList;
@@ -551,50 +648,11 @@ QStringList RimEclipseCase::timeStepStrings()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseCase::timeStepName(int frameIdx)
QString RimEclipseCase::timeStepName(int frameIdx) const
{
std::vector<QDateTime> timeStepDates = this->timeStepDates();
CVF_ASSERT(frameIdx < static_cast<int>(timeStepDates.size()));
if (m_timeStepFormatString.isEmpty())
{
bool hasHoursAndMinutesInTimesteps = false;
bool hasSecondsInTimesteps = false;
bool hasMillisecondsInTimesteps = false;
for (size_t i = 0; i < timeStepDates.size(); i++)
{
if (timeStepDates[i].time().msec() != 0.0)
{
hasMillisecondsInTimesteps = true;
hasSecondsInTimesteps = true;
hasHoursAndMinutesInTimesteps = true;
break;
}
else if (timeStepDates[i].time().second() != 0.0) {
hasHoursAndMinutesInTimesteps = true;
hasSecondsInTimesteps = true;
}
else if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
{
hasHoursAndMinutesInTimesteps = true;
}
}
m_timeStepFormatString = "dd.MMM yyyy";
if (hasHoursAndMinutesInTimesteps)
{
m_timeStepFormatString += " - hh:mm";
if (hasSecondsInTimesteps)
{
m_timeStepFormatString += ":ss";
if (hasMillisecondsInTimesteps)
{
m_timeStepFormatString += ".zzz";
}
}
}
}
QDateTime date = timeStepDates.at(frameIdx);
return date.toString(m_timeStepFormatString);
@@ -626,6 +684,7 @@ void RimEclipseCase::reloadDataAndUpdate()
RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView);
reservoirView->loadDataAndUpdate();
reservoirView->updateGridBoxData();
}
RimProject* project = RiaApplication::instance()->project();
@@ -663,7 +722,21 @@ void RimEclipseCase::reloadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RimEclipseCase::timeStepDates()
double RimEclipseCase::characteristicCellSize() const
{
const RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if (rigEclipseCase)
{
return rigEclipseCase->mainGrid()->characteristicIJCellSize();
}
return 10.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RimEclipseCase::timeStepDates() const
{
return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates();
}

View File

@@ -63,8 +63,8 @@ public:
caf::PdmField<bool> flipXAxis;
caf::PdmField<bool> flipYAxis;
caf::PdmField<std::vector<QString> > filesContainingFaults;
std::vector<QString> filesContainingFaults() const;
void setFilesContainingFaults(const std::vector<QString>& val);
bool openReserviorCase();
virtual bool openEclipseGridFile() = 0;
@@ -73,7 +73,8 @@ public:
const RigEclipseCaseData* eclipseCaseData() const;
cvf::Color3f defaultWellColor(const QString& wellName);
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel) const ;
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);
const RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
RimEclipseView* createAndAddReservoirView();
RimEclipseView* createCopyAndAddView(const RimEclipseView* sourceView);
@@ -87,9 +88,9 @@ public:
RimCaseCollection* parentCaseCollection();
virtual std::vector<RimView*> views();
virtual QStringList timeStepStrings();
virtual QString timeStepName(int frameIdx);
std::vector<QDateTime> timeStepDates();
virtual QStringList timeStepStrings() const override;
virtual QString timeStepName(int frameIdx) const override;
virtual std::vector<QDateTime> timeStepDates() const override;
virtual cvf::BoundingBox activeCellsBoundingBox() const;
@@ -99,8 +100,8 @@ public:
void reloadDataAndUpdate();
virtual void reloadEclipseGridFile() = 0;
// Overridden methods from PdmObject
public:
virtual double characteristicCellSize() const override;
protected:
virtual void initAfterRead();
@@ -114,16 +115,22 @@ protected:
void setReservoirData(RigEclipseCaseData* eclipseCase);
private:
cvf::ref<RigEclipseCaseData> m_rigEclipseCase;
void createTimeStepFormatString();
private:
cvf::ref<RigEclipseCaseData> m_rigEclipseCase;
QString m_timeStepFormatString;
std::map<QString , cvf::Color3f> m_wellToColorMap;
caf::PdmField<QString > m_filesContainingFaultsSemColSeparated;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_matrixModelResults;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults;
QString m_timeStepFormatString;
std::map<QString , cvf::Color3f> m_wellToColorMap;
// Obsolete fields
protected:
caf::PdmField<QString> caseName;
private:
caf::PdmField<std::vector<QString> > m_filesContainingFaults_OBSOLETE;
};

View File

@@ -117,7 +117,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
return false;
}
this->filesContainingFaults = readerInterface->filenamesWithFaults();
this->setFilesContainingFaults(readerInterface->filenamesWithFaults());
this->setReservoirData( eclipseCase.p() );
}
@@ -359,13 +359,14 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
std::vector<QString> relocatedFaultFiles;
for (auto faultFileName : filesContainingFaults())
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
for (auto faultFileName : orgFilesContainingFaults)
{
QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
relocatedFaultFiles.push_back(relocatedFaultFile);
}
filesContainingFaults = relocatedFaultFiles;
setFilesContainingFaults(relocatedFaultFiles);
#if 0 // Output the search path for debugging
for (size_t i = 0; i < searchedPaths.size(); ++i)

View File

@@ -67,7 +67,6 @@
#include "RivReservoirViewPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h"
#include "RivWellFracturePartMgr.h"
#include "cafCadNavigation.h"
@@ -440,22 +439,13 @@ void RimEclipseView::createDisplayModel()
*/
// Well path model
m_wellPathPipeVizModel->removeAllParts();
RigMainGrid* mainGrid = this->mainGrid();
if (mainGrid)
{
// NB! StimPlan legend colors must be updated before well path geometry is added to the model
// as the fracture geometry depends on the StimPlan legend colors
stimPlanColors->updateLegendData();
// NB! StimPlan legend colors must be updated before well path geometry is added to the model
// as the fracture geometry depends on the StimPlan legend colors
stimPlanColors->updateLegendData();
addWellPathsToModel(m_wellPathPipeVizModel.p(),
mainGrid->displayModelOffset(),
mainGrid->characteristicIJCellSize(),
currentActiveCellInfo()->geometryBoundingBox(),
m_reservoirGridPartManager->scaleTransform());
}
addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox());
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
@@ -638,44 +628,71 @@ void RimEclipseView::updateCurrentTimeStep()
crossSectionCollection->applySingleColorEffect();
}
// Simulation Wells
if (m_viewer)
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
simWellModelBasicList->setName("SimWellPipeMod");
m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep);
simWellModelBasicList->updateBoundingBoxesRecursive();
this->removeModelByName(frameScene, simWellModelBasicList->name());
frameScene->addModel(simWellModelBasicList.p());
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
std::vector<RimFracture*> fractures;
this->descendantsIncludingThisOfType(fractures);
for (RimFracture* f : fractures)
// Simulation Wells
{
RimEclipseWell* eclWell = nullptr;
f->firstAncestorOrThisOfType(eclWell);
if (eclWell)
{
bool isAnyGeometryPresent = eclWell->isWellPipeVisible(m_currentTimeStep) || eclWell->isWellSpheresVisible(m_currentTimeStep);
if (!isAnyGeometryPresent)
{
continue;
}
}
cvf::String name = "SimWellPipeMod";
this->removeModelByName(frameScene, name);
f->fracturePartManager()->appendGeometryPartsToModel(simWellModelBasicList.p(), transForm.p());
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
simWellModelBasicList->setName(name);
m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep);
simWellModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(simWellModelBasicList.p());
m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep);
}
simWellModelBasicList->updateBoundingBoxesRecursive();
// Well Paths
{
cvf::String name = "WellPathMod";
this->removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
wellPathModelBasicList->setName(name);
m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep);
addDynamicWellPathsToModel(wellPathModelBasicList.p(), currentActiveCellInfo()->geometryBoundingBox());
frameScene->addModel(wellPathModelBasicList.p());
}
// Sim Well Fractures
{
cvf::String name = "SimWellFracturesModel";
this->removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> simWellFracturesModelBasicList = new cvf::ModelBasicList;
simWellFracturesModelBasicList->setName(name);
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
std::vector<RimFracture*> fractures;
this->descendantsIncludingThisOfType(fractures);
for (RimFracture* f : fractures)
{
RimEclipseWell* eclWell = nullptr;
f->firstAncestorOrThisOfType(eclWell);
if (eclWell)
{
bool isAnyGeometryPresent = eclWell->isWellPipeVisible(m_currentTimeStep) || eclWell->isWellSpheresVisible(m_currentTimeStep);
if (!isAnyGeometryPresent)
{
continue;
}
}
f->fracturePartManager()->appendGeometryPartsToModel(simWellFracturesModelBasicList.p(), transForm.p());
}
simWellFracturesModelBasicList->updateBoundingBoxesRecursive();
}
}
}

View File

@@ -89,6 +89,38 @@ RimGeoMechCase::~RimGeoMechCase(void)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::setFileName(const QString& fileName)
{
m_caseFileName = fileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechCase::caseFileName() const
{
return m_caseFileName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechCaseData* RimGeoMechCase::geoMechData()
{
return m_geoMechCaseData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigGeoMechCaseData* RimGeoMechCase::geoMechData() const
{
return m_geoMechCaseData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -172,6 +204,16 @@ std::vector<RimView*> RimGeoMechCase::views()
return views;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RimGeoMechCase::timeStepDates() const
{
QStringList timeStrings = timeStepStrings();
return RimGeoMechCase::dateTimeVectorFromTimeStepStrings(timeStrings);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -191,11 +233,11 @@ void RimGeoMechCase::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimGeoMechCase::timeStepStrings()
QStringList RimGeoMechCase::timeStepStrings() const
{
QStringList stringList;
RigGeoMechCaseData* rigCaseData = geoMechData();
const RigGeoMechCaseData* rigCaseData = geoMechData();
if (rigCaseData && rigCaseData->femPartResults())
{
std::vector<std::string> stepNames = rigCaseData->femPartResults()->stepNames();
@@ -211,9 +253,9 @@ QStringList RimGeoMechCase::timeStepStrings()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechCase::timeStepName(int frameIdx)
QString RimGeoMechCase::timeStepName(int frameIdx) const
{
RigGeoMechCaseData* rigCaseData = geoMechData();
const RigGeoMechCaseData* rigCaseData = geoMechData();
if (rigCaseData && rigCaseData->femPartResults())
{
std::vector<std::string> stepNames = rigCaseData->femPartResults()->stepNames();
@@ -247,6 +289,21 @@ cvf::BoundingBox RimGeoMechCase::allCellsBoundingBox() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimGeoMechCase::characteristicCellSize() const
{
if (geoMechData() && geoMechData()->femParts())
{
double cellSize = geoMechData()->femParts()->characteristicElementSize();
return cellSize;
}
return 10.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -46,32 +46,34 @@ public:
RimGeoMechCase(void);
virtual ~RimGeoMechCase(void);
void setFileName(const QString& fileName) {m_caseFileName = fileName;}
QString caseFileName() const {return m_caseFileName();}
void setFileName(const QString& fileName);
QString caseFileName() const;
bool openGeoMechCase(std::string* errorMessage);
RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); }
const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); }
RigGeoMechCaseData* geoMechData();
const RigGeoMechCaseData* geoMechData() const;
RimGeoMechView* createAndAddReservoirView();
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath);
virtual std::vector<RimView*> views();
virtual QStringList timeStepStrings();
virtual QString timeStepName(int frameIdx);
virtual std::vector<QDateTime> timeStepDates() const override;
virtual QStringList timeStepStrings() const override;
virtual QString timeStepName(int frameIdx) const override;
virtual cvf::BoundingBox activeCellsBoundingBox() const;
virtual cvf::BoundingBox allCellsBoundingBox() const;
virtual double characteristicCellSize() const override;
// Fields:
caf::PdmChildArrayField<RimGeoMechView*> geoMechViews;
static std::vector<QDateTime> dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings);
private:
static std::vector<QDateTime> dateTimeVectorFromTimeStepStrings(const QStringList& timeStepStrings);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
@@ -85,6 +87,4 @@ private:
caf::PdmField<QString> m_caseFileName;
caf::PdmField<double> m_cohesion;
caf::PdmField<double> m_frictionAngleDeg;
protected:
};

View File

@@ -210,15 +210,10 @@ void RimGeoMechView::createDisplayModel()
// Well path model
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
m_wellPathPipeVizModel->removeAllParts();
addWellPathsToModel(m_wellPathPipeVizModel.p(),
cvf::Vec3d(0, 0, 0),
characteristicCellSize,
femBBox,
scaleTransform());
addWellPathsToModel(m_wellPathPipeVizModel.p(), femBBox);
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
@@ -259,14 +254,32 @@ void RimGeoMechView::updateCurrentTimeStep()
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
// Grid model
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
frameParts->setName("GridModel");
m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p());
frameParts->updateBoundingBoxesRecursive();
{
// Grid model
cvf::String name = "GridModel";
this->removeModelByName(frameScene, name);
this->removeModelByName(frameScene, frameParts->name());
frameScene->addModel(frameParts.p());
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
frameParts->setName(name);
m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p());
frameParts->updateBoundingBoxesRecursive();
frameScene->addModel(frameParts.p());
}
// Well Paths
{
cvf::String name = "WellPathMod";
this->removeModelByName(frameScene, name);
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
wellPathModelBasicList->setName(name);
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
addDynamicWellPathsToModel(wellPathModelBasicList.p(), femBBox);
frameScene->addModel(wellPathModelBasicList.p());
}
}
}
@@ -283,6 +296,7 @@ void RimGeoMechView::updateCurrentTimeStep()
{
crossSectionCollection->applySingleColorEffect();
}
}
else
{

View File

@@ -385,8 +385,7 @@ std::vector<time_t> RimGridTimeHistoryCurve::timeStepValues() const
{
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
std::vector<QDateTime> dates = geoMechTopItem->geoMechCase()->timeStepDates();
if (dates.size() == values.size())
{
for (QDateTime dt : dates)
@@ -430,8 +429,7 @@ std::vector<double> RimGridTimeHistoryCurve::daysSinceSimulationStart() const
{
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
std::vector<QDateTime> dates = geoMechTopItem->geoMechCase()->timeStepDates();
if (dates.size() == values.size())
{
if (!dates.empty()) {

View File

@@ -40,8 +40,6 @@
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RivWellPathCollectionPartMgr.h"
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmObjectFactory.h"
@@ -54,6 +52,7 @@
#include "cvfViewport.h"
#include <limits.h>
#include "cvfTransform.h"
namespace caf {
@@ -423,6 +422,18 @@ void RimView::endAnimation()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCollection* RimView::wellPathsPartManager()
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfTypeAsserted(proj);
CVF_ASSERT(proj && proj->activeOilField() && proj->activeOilField()->wellPathCollection());
return proj->activeOilField()->wellPathCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -600,8 +611,7 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
// Regenerate well paths
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen();
crossSectionCollection->updateIntersectionBoxGeometry();
if (m_viewer)
@@ -703,25 +713,42 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
///
//--------------------------------------------------------------------------------------------------
void RimView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::Vec3d& displayModelOffset,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform)
const cvf::BoundingBox& wellPathClipBoundingBox)
{
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
RimWellPathCollection* wellPathCollection = oilFields ? oilFields->wellPathCollection() : NULL;
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = wellPathCollection ? wellPathCollection->wellPathCollectionPartMgr() : NULL;
if (!this->ownerCase()) return;
if (wellPathCollectionPartMgr)
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
wellPathsPartManager()->appendStaticGeometryPartsToModel(wellPathModelBasicList,
this->ownerCase()->characteristicCellSize(),
wellPathClipBoundingBox,
transForm.p());
wellPathModelBasicList->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox)
{
if (!this->ownerCase()) return;
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
QDateTime currentTimeStamp;
std::vector<QDateTime> timeStamps = ownerCase()->timeStepDates();
if (currentTimeStep() < timeStamps.size())
{
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList,
displayModelOffset,
scaleTransform,
characteristicCellSize,
wellPathClipBoundingBox,
this->displayCoordTransform().p());
currentTimeStamp = timeStamps[currentTimeStep()];
}
wellPathsPartManager()->appendDynamicGeometryPartsToModel(wellPathModelBasicList,
currentTimeStamp,
this->ownerCase()->characteristicCellSize(),
wellPathClipBoundingBox,
transForm.p());
wellPathModelBasicList->updateBoundingBoxesRecursive();
}

View File

@@ -50,6 +50,7 @@ class RimPropertyFilterCollection;
class RimViewController;
class RimViewLinker;
class RiuViewer;
class RimWellPathCollection;
namespace cvf
{
@@ -169,6 +170,7 @@ public:
public:
virtual void loadDataAndUpdate() = 0;
void updateGridBoxData();
virtual RimCase* ownerCase() = 0;
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
@@ -177,17 +179,16 @@ protected:
void setDefaultView();
void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::Vec3d& displayModelOffset,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform);
const cvf::BoundingBox& wellPathClipBoundingBox);
void addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
const cvf::BoundingBox& wellPathClipBoundingBox);
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
virtual void createDisplayModel() = 0;
void createHighlightAndGridBoxDisplayModel();
void updateGridBoxData();
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;
@@ -203,6 +204,8 @@ protected:
virtual void resetLegendsInViewer() = 0;
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0;
RimWellPathCollection* wellPathsPartManager();
QPointer<RiuViewer> m_viewer;
caf::PdmField<int> m_currentTimeStep;

View File

@@ -426,7 +426,14 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
if (curveNames.size() == 1)
{
curveDepths = curveData->measuredDepthPlotValues(RiaDefines::UNIT_NONE);
if (depthType() == TRUE_VERTICAL_DEPTH)
{
curveDepths = curveData->trueDepthPlotValues(depthUnit());
}
else
{
curveDepths = curveData->measuredDepthPlotValues(depthUnit());
}
}
std::vector<double> xPlotValues = curveData->xPlotValues();
@@ -435,9 +442,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
}
for (int i = static_cast<int>(curveDepths.size()) - 1; i >= 0; i--)
for (size_t i = 0; i < curveDepths.size(); ++i)
{
if (i == static_cast<int>(curveDepths.size()) - 1)
if (i == 0)
{
if (depthType() == CONNECTION_NUMBER) out += "Connection";
else if (depthType() == MEASURED_DEPTH) out += "MD ";
@@ -446,7 +453,7 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
for (QString name : curveNames) out += " \t" + name;
out += "\n";
}
else if (curveDepths[i] == curveDepths[i+1])
else if (curveDepths[i] == curveDepths[i-1])
{
continue;
}

View File

@@ -269,8 +269,6 @@ RivWellPathPartMgr* RimWellPath::partMgr()
//--------------------------------------------------------------------------------------------------
void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
partMgr()->scheduleGeometryRegen();
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
if (changedField == &showWellPath)

View File

@@ -37,8 +37,6 @@
#include "RiuMainWindow.h"
#include "RivWellPathCollectionPartMgr.h"
#include "RifWellPathImporter.h"
#include "cafPdmUiEditorHandle.h"
@@ -50,6 +48,7 @@
#include <fstream>
#include <cmath>
#include "RivWellPathPartMgr.h"
namespace caf
{
@@ -94,8 +93,6 @@ RimWellPathCollection::RimWellPathCollection()
wellPaths.uiCapability()->setUiHidden(true);
m_wellPathCollectionPartManager = new RivWellPathCollectionPartMgr(this);
m_wellPathImporter = new RifWellPathImporter;
}
@@ -115,7 +112,7 @@ RimWellPathCollection::~RimWellPathCollection()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
scheduleGeometryRegenAndRedrawViews();
scheduleRedrawAffectedViews();
}
@@ -327,14 +324,51 @@ caf::PdmFieldHandle* RimWellPathCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::scheduleGeometryRegenAndRedrawViews()
void RimWellPathCollection::scheduleRedrawAffectedViews()
{
m_wellPathCollectionPartManager->scheduleGeometryRegen();
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
if (!this->isActive()) return;
if (this->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++)
{
RivWellPathPartMgr* partMgr = this->wellPaths[wIdx]->partMgr();
partMgr->appendStaticGeometryPartsToModel(model, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform)
{
if (!this->isActive()) return;
if (this->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF) return;
for (size_t wIdx = 0; wIdx < this->wellPaths.size(); wIdx++)
{
RivWellPathPartMgr* partMgr = this->wellPaths[wIdx]->partMgr();
partMgr->appendDynamicGeometryPartsToModel(model, timeStamp, characteristicCellSize, wellPathClipBoundingBox, displayCoordTransform);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -36,13 +36,19 @@
#include <QString>
//class RimFractureCollection;
class RivWellPathCollectionPartMgr;
class RifWellPathImporter;
class RimWellPath;
class RimProject;
class RigWellPath;
namespace cvf {
class ModelBasicList;
class BoundingBox;
}
namespace caf {
class DisplayCoordTransform;
}
//==================================================================================================
///
@@ -77,13 +83,8 @@ public:
caf::PdmField<bool> wellPathClip;
caf::PdmField<int> wellPathClipZDistance;
caf::PdmChildArrayField<RimWellPath*> wellPaths;
// caf::PdmChildField<RimFractureCollection*> fractureCollection;
caf::PdmChildArrayField<RimWellPath*> wellPaths;
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr() { return m_wellPathCollectionPartManager.p(); }
void readWellPathFiles();
void addWellPaths(QStringList filePaths);
@@ -93,8 +94,18 @@ public:
RimWellPath* wellPathByName(const QString& wellPathName) const;
void addWellLogs(const QStringList& filePaths);
void scheduleRedrawAffectedViews();
void scheduleGeometryRegenAndRedrawViews();
void appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
const QDateTime& timeStamp,
double characteristicCellSize,
const cvf::BoundingBox& wellPathClipBoundingBox,
const caf::DisplayCoordTransform* displayCoordTransform);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
protected:
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
@@ -108,7 +119,5 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath);
cvf::ref<RivWellPathCollectionPartMgr> m_wellPathCollectionPartManager;
RifWellPathImporter* m_wellPathImporter;
};