diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index 0b75b13294..e3cd977c00 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -44,6 +44,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.h ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.h ${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.h ${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.h +${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.h # General delete of any object in a child array field @@ -92,6 +93,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.cpp ${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.cpp +${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.cpp diff --git a/ApplicationCode/Commands/RicDeleteItemFeature.cpp b/ApplicationCode/Commands/RicDeleteItemFeature.cpp index f174796d50..83e85b4a1a 100644 --- a/ApplicationCode/Commands/RicDeleteItemFeature.cpp +++ b/ApplicationCode/Commands/RicDeleteItemFeature.cpp @@ -44,6 +44,8 @@ #include "RimGeoMechPropertyFilter.h" #include "RimViewController.h" #include "RimWellLogCurve.h" +#include "RimSimWellFracture.h" +#include "RimSimWellFractureCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveFilter.h" #include "RimIntersection.h" @@ -78,6 +80,9 @@ bool isDeletable(PdmUiItem * uiItem) if (dynamic_cast(uiItem)) return true; if (dynamic_cast(uiItem)) return true; if (dynamic_cast(uiItem)) return true; + if (dynamic_cast(uiItem)) return true; + if (dynamic_cast(uiItem)) return true; + return false; } diff --git a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp index 4f804b85f2..387c38f29c 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp @@ -22,8 +22,8 @@ #include "RimCase.h" #include "RimEclipseWell.h" -#include "RimFracture.h" -#include "RimFractureCollection.h" +#include "RimSimWellFracture.h" +#include "RimSimWellFractureCollection.h" #include "RimProject.h" #include "cafSelectionManager.h" diff --git a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp index 3fda0d717e..7359f4e300 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp @@ -22,8 +22,8 @@ #include "RimCase.h" #include "RimEclipseWell.h" -#include "RimFracture.h" -#include "RimFractureCollection.h" +#include "RimSimWellFracture.h" +#include "RimSimWellFractureCollection.h" #include "RimProject.h" #include "cafSelectionManager.h" @@ -49,12 +49,12 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked) RimEclipseWell* eclipseWell = nullptr; objHandle->firstAncestorOrThisOfType(eclipseWell); - RimFractureCollection* fractureCollection = nullptr; + RimSimWellFractureCollection* fractureCollection = nullptr; objHandle->firstAncestorOrThisOfType(fractureCollection); CVF_ASSERT(fractureCollection); - RimFracture* fracture = new RimFracture(); - fractureCollection->fractures.push_back(fracture); + RimSimWellFracture* fracture = new RimSimWellFracture(); + fractureCollection->simwellFractures.push_back(fracture); fracture->name = "New Simulation Well Fracture"; diff --git a/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp new file mode 100644 index 0000000000..19ec726275 --- /dev/null +++ b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.cpp @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "RicSimWellFracturesDeleteAllFeature.h" + +#include "RimSimWellFractureCollection.h" + +#include "cafSelectionManager.h" + +#include + +namespace caf +{ + +CAF_CMD_SOURCE_INIT(RicSimWellFracturesDeleteAllFeature, "RicSimWellFracturesDeleteAllFeature"); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSimWellFracturesDeleteAllFeature::isCommandEnabled() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + if (objects.size() == 1) + { + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSimWellFracturesDeleteAllFeature::onActionTriggered(bool isChecked) +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType(&objects); + + RimSimWellFractureCollection* fractureCollection = nullptr; + if (objects.size() > 0) + { + fractureCollection = objects[0]; + fractureCollection->deleteFractures(); + fractureCollection->uiCapability()->updateConnectedEditors(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSimWellFracturesDeleteAllFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Delete All Fractures"); + actionToSetup->setIcon(QIcon(":/Erase.png")); +} + +} // end namespace caf diff --git a/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.h b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.h new file mode 100644 index 0000000000..4760850117 --- /dev/null +++ b/ApplicationCode/Commands/RicSimWellFracturesDeleteAllFeature.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// 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 "cafCmdFeature.h" + +namespace caf +{ + +//================================================================================================== +/// +//================================================================================================== +class RicSimWellFracturesDeleteAllFeature : public CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook( QAction* actionToSetup ); +}; + + + +} // end namespace caf diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 3e9e80ef74..32c21303aa 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -87,7 +87,10 @@ ${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h ${CEE_CURRENT_LIST_DIR}RimFractureDefinition.h ${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.h ${CEE_CURRENT_LIST_DIR}RimFracture.h +${CEE_CURRENT_LIST_DIR}RimSimWellFracture.h ${CEE_CURRENT_LIST_DIR}RimFractureCollection.h +${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.h + ) set (SOURCE_GROUP_SOURCE_FILES @@ -173,7 +176,9 @@ ${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp ${CEE_CURRENT_LIST_DIR}RimFractureDefinition.cpp ${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.cpp ${CEE_CURRENT_LIST_DIR}RimFracture.cpp +${CEE_CURRENT_LIST_DIR}RimSimWellFracture.cpp ${CEE_CURRENT_LIST_DIR}RimFractureCollection.cpp +${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 0a4ec11033..30eb5f519c 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -48,6 +48,8 @@ #include "RimGeoMechView.h" #include "RimIdenticalGridCaseGroup.h" #include "RimIntersectionBox.h" +#include "RimSimWellFracture.h" +#include "RimSimWellFractureCollection.h" #include "RimScriptCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" @@ -363,6 +365,12 @@ QStringList RimContextCommandBuilder::commandsFromSelection() commandIds << "RicNewWellPathCollFractureFeature"; commandIds << "RicFracturesDeleteAllFeature"; } + else if (dynamic_cast(uiItem) || + dynamic_cast(uiItem)) + { + commandIds << "RicNewSimWellFractureFeature"; + commandIds << "RicSimWellFracturesDeleteAllFeature"; + } else if (dynamic_cast(uiItem) || dynamic_cast(uiItem)) { diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index cb9850c031..f897ee092b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -23,7 +23,7 @@ #include "RimIntersectionCollection.h" #include "RimEclipseView.h" #include "RimEclipseWellCollection.h" -#include "RimFractureCollection.h" +#include "RimSimWellFractureCollection.h" #include "cvfMath.h" @@ -49,17 +49,17 @@ RimEclipseWell::RimEclipseWell() CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", ""); CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", ""); - CAF_PDM_InitFieldNoDefault(&fractureCollection, "FractureCollection", "Fractures", "", "", ""); + CAF_PDM_InitFieldNoDefault(&simwellFractureCollection, "FractureCollection", "Fractures", "", "", ""); name.uiCapability()->setUiHidden(true); name.uiCapability()->setUiReadOnly(true); - fractureCollection.uiCapability()->setUiHidden(true); + simwellFractureCollection.uiCapability()->setUiHidden(true); m_resultWellIndex = cvf::UNDEFINED_SIZE_T; m_reservoirView = NULL; - fractureCollection = new RimFractureCollection(); + simwellFractureCollection= new RimSimWellFractureCollection(); } //-------------------------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ RimEclipseWell::RimEclipseWell() //-------------------------------------------------------------------------------------------------- RimEclipseWell::~RimEclipseWell() { - if (fractureCollection()) delete fractureCollection(); + if (simwellFractureCollection()) delete simwellFractureCollection(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index a41ada72d6..2c9d0c07f0 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -34,7 +34,7 @@ #include "cafPdmChildField.h" class RimEclipseView; -class RimFractureCollection; +class RimSimWellFractureCollection; //================================================================================================== /// @@ -78,7 +78,7 @@ public: caf::PdmField wellPipeColor; caf::PdmField pipeRadiusScaleFactor; - caf::PdmChildField fractureCollection; + caf::PdmChildField simwellFractureCollection; private: diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp new file mode 100644 index 0000000000..be29564e94 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- 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 "RimSimWellFracture.h" + +#include "RiaApplication.h" + +#include "RimFractureDefinition.h" +#include "RimFractureDefinitionCollection.h" +#include "RimOilField.h" +#include "RimProject.h" +#include "RimWellPath.h" + +#include "cafPdmFieldHandle.h" +#include "cafPdmObject.h" +#include "cafPdmUiItem.h" + +#include "QToolBox" +#include "QList" +#include "cvfVector3.h" + + +CAF_PDM_SOURCE_INIT(RimSimWellFracture, "SimWellFracture"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSimWellFracture::RimSimWellFracture(void) +{ + CAF_PDM_InitObject("SimWellFracture", "", "", ""); + + CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Name"), "Name", "", "", ""); + + CAF_PDM_InitField(&i, "I", 1, "Fracture location cell I", "", "", ""); + CAF_PDM_InitField(&j, "J", 1, "Fracture location cell J", "", "", ""); + CAF_PDM_InitField(&k, "K", 1, "Fracture location cell K", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&fractureDefinition, "FractureDef", "FractureDef", "", "", ""); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSimWellFracture::~RimSimWellFracture() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimSimWellFracture::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) +{ + + QList options; + + RimProject* proj = RiaApplication::instance()->project(); + CVF_ASSERT(proj); + + RimOilField* oilField = proj->activeOilField(); + if (oilField == nullptr) return options; + + if (fieldNeedingOptions == &fractureDefinition) + { + + RimFractureDefinitionCollection* fracDefColl = oilField->fractureDefinitionCollection(); + if (fracDefColl == nullptr) return options; + + for (RimFractureDefinition* fracDef : fracDefColl->fractureDefinitions()) + { + options.push_back(caf::PdmOptionItemInfo(fracDef->name(), fracDef)); + } + } + + return options; + + + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSimWellFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + uiOrdering.add(&name); + + caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Fractures"); + geometryGroup->add(&fractureDefinition); + + geometryGroup->add(&i); + geometryGroup->add(&j); + geometryGroup->add(&k); + + uiOrdering.setForgetRemainingFields(true); + +} diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFracture.h b/ApplicationCode/ProjectDataModel/RimSimWellFracture.h new file mode 100644 index 0000000000..f425f84d3a --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimSimWellFracture.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- 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 "cafAppEnum.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" +#include "RimView.h" +#include "cvfVector3.h" + +class RimFractureDefinition; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimSimWellFracture : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimSimWellFracture(void); + virtual ~RimSimWellFracture(void); + + caf::PdmField name; + caf::PdmPtrField fractureDefinition; + + caf::PdmField i; + caf::PdmField j; + caf::PdmField k; + + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; + + +protected: + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); + + + +}; diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.cpp b/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.cpp new file mode 100644 index 0000000000..40f0818604 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.cpp @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- 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 "RimSimWellFractureCollection.h" + +#include "RimSimWellFracture.h" +#include "cafPdmObject.h" + + + + +CAF_PDM_SOURCE_INIT(RimSimWellFractureCollection, "SimWellFractureCollection"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSimWellFractureCollection::RimSimWellFractureCollection(void) +{ + CAF_PDM_InitObject("Fracture Collection", "", "", ""); + + CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&simwellFractures, "Fractures", "", "", "", ""); + simwellFractures.uiCapability()->setUiHidden(true); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSimWellFractureCollection::~RimSimWellFractureCollection() +{ + simwellFractures.deleteAllChildObjects(); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSimWellFractureCollection::deleteFractures() +{ + simwellFractures.deleteAllChildObjects(); +} diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.h b/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.h new file mode 100644 index 0000000000..2440c9a0fa --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimSimWellFractureCollection.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- 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 "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmChildArrayField.h" + +class RimSimWellFracture; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimSimWellFractureCollection : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimSimWellFractureCollection(void); + virtual ~RimSimWellFractureCollection(void); + + caf::PdmChildArrayField simwellFractures; + caf::PdmField isActive; + + void deleteFractures(); + +};