-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#10568 StimPlan Template: Add python api for appending Pressure Table…
… Items
- Loading branch information
Showing
4 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
ApplicationLibCode/ProjectDataModelCommands/RimcPressureTable.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor 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 "RimcPressureTable.h" | ||
|
||
#include "RimPressureTable.h" | ||
#include "RimPressureTableItem.h" | ||
|
||
#include "cafPdmAbstractFieldScriptingCapability.h" | ||
#include "cafPdmFieldScriptingCapability.h" | ||
|
||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimPressureTable, RimcPressureTable_addPressure, "AddPressure" ); | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RimcPressureTable_addPressure::RimcPressureTable_addPressure( caf::PdmObjectHandle* self ) | ||
: caf::PdmObjectMethod( self ) | ||
{ | ||
CAF_PDM_InitObject( "Add pressure data", "", "", "Add pressure data to pressure table." ); | ||
|
||
CAF_PDM_InitScriptableFieldNoDefault( &m_depth, "Depth", "", "", "", "Depth: TVDMSL [m]" ); | ||
CAF_PDM_InitScriptableFieldNoDefault( &m_initialPressure, "InitialPressure", "", "", "", "Initial Pressure [Bar]" ); | ||
CAF_PDM_InitScriptableFieldNoDefault( &m_pressure, "Pressure", "", "", "", "Pressure [Bar]" ); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
caf::PdmObjectHandle* RimcPressureTable_addPressure::execute() | ||
{ | ||
RimPressureTableItem* pressureTableItem = new RimPressureTableItem; | ||
pressureTableItem->setValues( m_depth, m_initialPressure, m_pressure ); | ||
|
||
RimPressureTable* pressureTable = self<RimPressureTable>(); | ||
pressureTable->insertItem( nullptr, pressureTableItem ); | ||
|
||
pressureTable->updateAllRequiredEditors(); | ||
return pressureTableItem; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
bool RimcPressureTable_addPressure::resultIsPersistent() const | ||
{ | ||
return true; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
std::unique_ptr<caf::PdmObjectHandle> RimcPressureTable_addPressure::defaultResult() const | ||
{ | ||
return std::unique_ptr<caf::PdmObjectHandle>( new RimPressureTableItem ); | ||
} |
45 changes: 45 additions & 0 deletions
45
ApplicationLibCode/ProjectDataModelCommands/RimcPressureTable.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor 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 "RimPressureTable.h" | ||
|
||
#include "cafPdmField.h" | ||
#include "cafPdmObjectHandle.h" | ||
#include "cafPdmObjectMethod.h" | ||
|
||
//================================================================================================== | ||
/// | ||
//================================================================================================== | ||
class RimcPressureTable_addPressure : public caf::PdmObjectMethod | ||
{ | ||
CAF_PDM_HEADER_INIT; | ||
|
||
public: | ||
RimcPressureTable_addPressure( caf::PdmObjectHandle* self ); | ||
|
||
caf::PdmObjectHandle* execute() override; | ||
bool resultIsPersistent() const override; | ||
std::unique_ptr<PdmObjectHandle> defaultResult() const override; | ||
|
||
private: | ||
caf::PdmField<double> m_depth; | ||
caf::PdmField<double> m_initialPressure; | ||
caf::PdmField<double> m_pressure; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters