mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5632 Generate PdmChildField and PdmChildArrayField methods
This commit is contained in:
@@ -16,7 +16,7 @@ if resinsight is not None:
|
||||
for case in cases:
|
||||
print("Case id: " + str(case.id))
|
||||
print("Case name: " + case.name)
|
||||
print("Case type: " + case.class_keyword)
|
||||
print("Case type: " + case.__class__.__name__)
|
||||
print("Case file name: " + case.file_path)
|
||||
print("Case reservoir bounding box:", case.reservoir_boundingbox())
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ for wbsplot in wbsplots:
|
||||
|
||||
# Example of setting parameters for existing plots
|
||||
params = wbsplot.parameters()
|
||||
params.user_poisson_ratio = 0.654321
|
||||
params.user_poisson_ratio = 0.12345
|
||||
params.update()
|
||||
wbsplot.update()
|
||||
wbsplot.export_snapshot(export_folder=dirname)
|
||||
|
||||
@@ -15,7 +15,6 @@ print("Exporting to: " + export_folder)
|
||||
for plot in plots:
|
||||
plot.export_snapshot(export_folder=export_folder)
|
||||
plot.export_snapshot(export_folder=export_folder, output_format='PDF')
|
||||
well_log_plot = plot.cast(rips.WellLogPlot)
|
||||
if well_log_plot is not None:
|
||||
well_log_plot.export_data_as_las(export_folder=export_folder)
|
||||
well_log_plot.export_data_as_ascii(export_folder=export_folder)
|
||||
if isinstance(plot, rips.WellLogPlot):
|
||||
plot.export_data_as_las(export_folder=export_folder)
|
||||
plot.export_data_as_ascii(export_folder=export_folder)
|
||||
|
||||
@@ -8,4 +8,4 @@ cases = resinsight.project.cases()
|
||||
print ("Got " + str(len(cases)) + " cases: ")
|
||||
for case in cases:
|
||||
print("Case name: " + case.name)
|
||||
print("Case grid path: " + case.grid_path())
|
||||
print("Case grid path: " + case.file_path)
|
||||
|
||||
@@ -245,11 +245,6 @@ def days_since_start(self):
|
||||
"""Get a list of decimal values representing days since the start of the simulation"""
|
||||
return self.__case_stub.GetDaysSinceStart(self.__request()).day_decimals
|
||||
|
||||
@add_method(Case)
|
||||
def views(self):
|
||||
"""Get a list of views belonging to a case"""
|
||||
return self.descendants(View)
|
||||
|
||||
@add_method(Case)
|
||||
def view(self, view_id):
|
||||
"""Get a particular view belonging to a case by providing view id
|
||||
|
||||
@@ -87,6 +87,7 @@ def copy_from(self, object):
|
||||
setattr(self, attribute, value)
|
||||
if self.__custom_init__ is not None:
|
||||
self.__custom_init__(self._pb2_object, self._channel)
|
||||
self.update()
|
||||
|
||||
@add_method(PdmObject)
|
||||
def warnings(self):
|
||||
|
||||
@@ -28,18 +28,6 @@ def __custom_init__(self, pb2_object=None, channel=None):
|
||||
self.user_k0fg = 0.75
|
||||
|
||||
@add_method(WellBoreStabilityPlot)
|
||||
def parameters(self):
|
||||
"""Retrieve the parameters of the Plot
|
||||
"""
|
||||
children = self.children("WbsParameters", WbsParameters)
|
||||
if len(children) == 1:
|
||||
child = children[0]
|
||||
return child
|
||||
return None
|
||||
|
||||
@add_method(WellBoreStabilityPlot)
|
||||
def set_parameters(self, wbs_parameters):
|
||||
children = self.children("WbsParameters", WbsParameters)
|
||||
if len(children) == 1:
|
||||
pdm_params = children[0]
|
||||
pdm_params.copy_from(wbs_parameters)
|
||||
def set_parameters(self, new_parameters):
|
||||
current_params = self.parameters()
|
||||
current_params.copy_from(new_parameters)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmFieldScriptability.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmObjectScriptabilityRegister.h"
|
||||
|
||||
@@ -171,7 +172,8 @@ Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectMethodRequest*
|
||||
m_fieldOwner->fields( fields );
|
||||
for ( auto field : fields )
|
||||
{
|
||||
if ( field->keyword() == fieldName )
|
||||
auto scriptability = field->capability<caf::PdmFieldScriptability>();
|
||||
if ( scriptability && scriptability->scriptFieldName() == fieldName )
|
||||
{
|
||||
caf::PdmProxyFieldHandle* proxyField = dynamic_cast<caf::PdmProxyFieldHandle*>( field );
|
||||
if ( proxyField )
|
||||
@@ -224,7 +226,8 @@ Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectSetMethodChunk
|
||||
m_fieldOwner->fields( fields );
|
||||
for ( auto field : fields )
|
||||
{
|
||||
if ( field->keyword() == fieldName )
|
||||
auto scriptability = field->capability<caf::PdmFieldScriptability>();
|
||||
if ( scriptability && scriptability->scriptFieldName() == fieldName )
|
||||
{
|
||||
caf::PdmProxyFieldHandle* proxyField = dynamic_cast<caf::PdmProxyFieldHandle*>( field );
|
||||
if ( proxyField )
|
||||
@@ -406,7 +409,8 @@ grpc::Status RiaGrpcPdmObjectService::GetChildPdmObjects( grpc::ServerContext*
|
||||
matchingObject->fields( fields );
|
||||
for ( auto field : fields )
|
||||
{
|
||||
if ( field->keyword() == fieldName )
|
||||
auto scriptability = field->capability<caf::PdmFieldScriptability>();
|
||||
if ( scriptability && scriptability->scriptFieldName() == fieldName )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> childObjects;
|
||||
field->childObjects( &childObjects );
|
||||
|
||||
Reference in New Issue
Block a user