mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2505 CommandFile. Add scaleFractureTemplate command. Currently accepting arguments width and height
This commit is contained in:
@@ -18,6 +18,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.h
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -39,6 +40,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
#include "RicfSetExportFolder.h"
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Statoil ASA
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RicfScaleFractureTemplate.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimFractureTemplate.h"
|
||||||
|
#include "RimFractureTemplateCollection.h"
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RicfScaleFractureTemplate, "scaleFractureTemplate");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RicfScaleFractureTemplate::RicfScaleFractureTemplate()
|
||||||
|
{
|
||||||
|
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
|
||||||
|
RICF_InitField(&m_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
|
||||||
|
RICF_InitField(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicfScaleFractureTemplate::execute()
|
||||||
|
{
|
||||||
|
if (m_id < 0)
|
||||||
|
{
|
||||||
|
RiaLogging::error("scaleFractureTemplate: Fracture template id not specified");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
|
||||||
|
if (!project)
|
||||||
|
{
|
||||||
|
RiaLogging::error("scaleFractureTemplate: Project not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RimFractureTemplateCollection* templColl = !project->allFractureTemplateCollections().empty() ? project->allFractureTemplateCollections()[0] : nullptr;
|
||||||
|
RimFractureTemplate* templ = templColl ? templColl->fractureTemplate(m_id) : nullptr;
|
||||||
|
|
||||||
|
if (!templ)
|
||||||
|
{
|
||||||
|
RiaLogging::error(QString("scaleFractureTemplate: Fracture template not found. Id=%1").arg(m_id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
templ->setScaleFactors(m_widthScaleFactor, m_heightScaleFactor);
|
||||||
|
templ->reload();
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Statoil ASA
|
||||||
|
//
|
||||||
|
// 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 "RicfCommandObject.h"
|
||||||
|
|
||||||
|
#include "RicfCommandFileExecutor.h"
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
class RicfScaleFractureTemplate : public RicfCommandObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RicfScaleFractureTemplate();
|
||||||
|
|
||||||
|
virtual void execute() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<int> m_id;
|
||||||
|
caf::PdmField<double> m_widthScaleFactor;
|
||||||
|
caf::PdmField<double> m_heightScaleFactor;
|
||||||
|
};
|
||||||
@@ -93,16 +93,12 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
|| changedField == &m_userDefinedEffectivePermeability
|
|| changedField == &m_userDefinedEffectivePermeability
|
||||||
|| changedField == &m_sizeScaleApplyButton)
|
|| changedField == &m_sizeScaleApplyButton)
|
||||||
{
|
{
|
||||||
|
m_sizeScaleApplyButton = false;
|
||||||
|
|
||||||
//Changes to one of these parameters should change all fractures with this fracture template attached.
|
//Changes to one of these parameters should change all fractures with this fracture template attached.
|
||||||
RimProject* proj;
|
reload();
|
||||||
this->firstAncestorOrThisOfType(proj);
|
|
||||||
if (proj)
|
|
||||||
{
|
|
||||||
//Regenerate geometry
|
|
||||||
proj->createDisplayModelAndRedrawAllViews();
|
|
||||||
setupFractureGridCells();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changedField == &m_width || changedField == &m_userDefinedEffectivePermeability)
|
if (changedField == &m_width || changedField == &m_userDefinedEffectivePermeability)
|
||||||
{
|
{
|
||||||
setupFractureGridCells();
|
setupFractureGridCells();
|
||||||
@@ -322,6 +318,21 @@ std::vector<std::pair<QString, QString>> RimEllipseFractureTemplate::uiResultNam
|
|||||||
return propertyNamesAndUnits;
|
return propertyNamesAndUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEllipseFractureTemplate::reload()
|
||||||
|
{
|
||||||
|
RimProject* proj;
|
||||||
|
this->firstAncestorOrThisOfType(proj);
|
||||||
|
if (proj)
|
||||||
|
{
|
||||||
|
//Regenerate geometry
|
||||||
|
proj->createDisplayModelAndRedrawAllViews();
|
||||||
|
setupFractureGridCells();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public:
|
|||||||
|
|
||||||
void loadDataAndUpdate() override;
|
void loadDataAndUpdate() override;
|
||||||
std::vector<std::pair<QString, QString>> uiResultNamesWithUnit() const override;
|
std::vector<std::pair<QString, QString>> uiResultNamesWithUnit() const override;
|
||||||
|
virtual void reload() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
|||||||
@@ -657,6 +657,15 @@ void RimFractureTemplate::setId(int id)
|
|||||||
m_id = id;
|
m_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFractureTemplate::setScaleFactors(double width, double height)
|
||||||
|
{
|
||||||
|
m_widthScaleFactor = width;
|
||||||
|
m_heightScaleFactor = height;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ public:
|
|||||||
|
|
||||||
void disconnectAllFracturesAndRedrawViews() const;
|
void disconnectAllFracturesAndRedrawViews() const;
|
||||||
void setId(int id);
|
void setId(int id);
|
||||||
|
void setScaleFactors(double width, double height);
|
||||||
|
virtual void reload() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|||||||
@@ -72,6 +72,18 @@ RimFractureTemplateCollection::~RimFractureTemplateCollection()
|
|||||||
m_fractureDefinitions.deleteAllChildObjects();
|
m_fractureDefinitions.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimFractureTemplate* RimFractureTemplateCollection::fractureTemplate(int id) const
|
||||||
|
{
|
||||||
|
for (auto templ : m_fractureDefinitions)
|
||||||
|
{
|
||||||
|
if (templ->id() == id) return templ;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
RimFractureTemplateCollection(void);
|
RimFractureTemplateCollection(void);
|
||||||
virtual ~RimFractureTemplateCollection(void);
|
virtual ~RimFractureTemplateCollection(void);
|
||||||
|
|
||||||
|
RimFractureTemplate* fractureTemplate(int id) const;
|
||||||
std::vector<RimFractureTemplate*> fractureTemplates() const;
|
std::vector<RimFractureTemplate*> fractureTemplates() const;
|
||||||
void addFractureTemplate(RimFractureTemplate* templ);
|
void addFractureTemplate(RimFractureTemplate* templ);
|
||||||
RiaEclipseUnitTools::UnitSystemType defaultUnitSystemType() const;
|
RiaEclipseUnitTools::UnitSystemType defaultUnitSystemType() const;
|
||||||
|
|||||||
@@ -155,17 +155,7 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch
|
|||||||
if (changedField == &m_sizeScaleApplyButton)
|
if (changedField == &m_sizeScaleApplyButton)
|
||||||
{
|
{
|
||||||
m_sizeScaleApplyButton = false;
|
m_sizeScaleApplyButton = false;
|
||||||
loadDataAndUpdate();
|
reload();
|
||||||
//setDefaultsBasedOnXMLfile();
|
|
||||||
|
|
||||||
updateFractureGrid();
|
|
||||||
|
|
||||||
RimProject* proj;
|
|
||||||
this->firstAncestorOrThisOfType(proj);
|
|
||||||
if (proj)
|
|
||||||
{
|
|
||||||
proj->createDisplayModelAndRedrawAllViews();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,6 +538,22 @@ void RimStimPlanFractureTemplate::convertToUnitSystem(RiaEclipseUnitTools::UnitS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanFractureTemplate::reload()
|
||||||
|
{
|
||||||
|
loadDataAndUpdate();
|
||||||
|
|
||||||
|
RimProject* proj;
|
||||||
|
this->firstAncestorOrThisOfType(proj);
|
||||||
|
if (proj)
|
||||||
|
{
|
||||||
|
proj->createDisplayModelAndRedrawAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit) override;
|
void convertToUnitSystem(RiaEclipseUnitTools::UnitSystem neededUnit) override;
|
||||||
|
virtual void reload() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user