diff --git a/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake b/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake index 7484d1c208..581bd22329 100644 --- a/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake +++ b/ApplicationCode/CommandFileInterface/CMakeLists_files.cmake @@ -19,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.h ${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h ${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h ${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.h +${CMAKE_CURRENT_LIST_DIR}/RicfSetFractureContainment.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -41,6 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp ${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.cpp +${CMAKE_CURRENT_LIST_DIR}/RicfSetFractureContainment.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.cpp b/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.cpp new file mode 100644 index 0000000000..dbe131d8a5 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.cpp @@ -0,0 +1,72 @@ +#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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicfSetFractureContainment.h" + +#include "RiaApplication.h" +#include "RiaLogging.h" + +#include "RimProject.h" +#include "RimFractureTemplate.h" +#include "RimFractureTemplateCollection.h" + +CAF_PDM_SOURCE_INIT(RicfSetFractureContainment, "setFractureContainment"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicfSetFractureContainment::RicfSetFractureContainment() +{ + RICF_InitField(&m_id, "id", -1, "Id", "", "", ""); + RICF_InitField(&m_topLayer, "topLayer", 1.0, "TopLayer", "", "", ""); + RICF_InitField(&m_baseLayer, "baseLayer", 1.0, "BaseLayer", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicfSetFractureContainment::execute() +{ + if (m_id < 0) + { + RiaLogging::error("setFractureContainment: Fracture template id not specified"); + return; + } + + RimProject* project = RiaApplication::instance()->project(); + + if (!project) + { + RiaLogging::error("setFractureContainment: 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("setFractureContainment: Fracture template not found. Id=%1").arg(m_id)); + return; + } + + templ->setContainmentTopKLayer(m_topLayer); + templ->setContainmentBaseKLayer(m_baseLayer); + templ->reload(); +} diff --git a/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.h b/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.h new file mode 100644 index 0000000000..b372cfdeb8 --- /dev/null +++ b/ApplicationCode/CommandFileInterface/RicfSetFractureContainment.h @@ -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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "RicfCommandFileExecutor.h" + +#include "cafPdmField.h" + +//================================================================================================== +// +// +// +//================================================================================================== +class RicfSetFractureContainment : public RicfCommandObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicfSetFractureContainment(); + + virtual void execute() override; + +private: + caf::PdmField m_id; + caf::PdmField m_topLayer; + caf::PdmField m_baseLayer; +}; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.cpp index bb6bc3816f..3d303b5e2c 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.cpp @@ -116,6 +116,22 @@ bool RimFractureContainment::isEclipseCellWithinContainment(const RigMainGrid* m return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureContainment::setTopKLayer(int topKLayer) +{ + m_topKLayer = topKLayer; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureContainment::setBaseKLayer(int baseKLayer) +{ + m_baseKLayer = baseKLayer; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.h b/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.h index 52089c4a6d..c5c3257762 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureContainment.h @@ -41,6 +41,9 @@ public: bool isEnabled() const { return m_isUsingFractureContainment();} bool isEclipseCellWithinContainment(const RigMainGrid* mainGrid, size_t anchorEclipseCell, size_t globalCellIndex) const; + void setTopKLayer(int topKLayer); + void setBaseKLayer(int baseKLayer); + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; protected: diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp index df7febc924..ce66a1ae5a 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp @@ -683,6 +683,22 @@ void RimFractureTemplate::setScaleFactors(double width, double height, double dF m_conductivityScaleFactor = supportsConductivityScaling() ? conductivity : 1.0; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureTemplate::setContainmentTopKLayer(int topKLayer) +{ + m_fractureContainment->setTopKLayer(topKLayer); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFractureTemplate::setContainmentBaseKLayer(int baseKLayer) +{ + m_fractureContainment->setBaseKLayer(baseKLayer); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h index 928d6fa0be..d1580b3262 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h @@ -150,6 +150,9 @@ public: void setScaleFactors(double width, double height, double dFactor, double conductivity); virtual void reload() {} + void setContainmentTopKLayer(int topKLayer); + void setContainmentBaseKLayer(int baseKLayer); + protected: virtual caf::PdmFieldHandle* userDescriptionField() override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;