Support setting of child fields from Python and pass in WbsParameters if provided

Also fixes #5354
This commit is contained in:
Gaute Lindkvist 2020-01-17 10:35:42 +01:00
parent 5b8b76179b
commit 954bf1e02e
27 changed files with 314 additions and 174 deletions

View File

@ -25,6 +25,7 @@
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimWbsParameters.h"
#include "RimWellBoreStabilityPlot.h" #include "RimWellBoreStabilityPlot.h"
#include "RimWellPath.h" #include "RimWellPath.h"
@ -51,6 +52,8 @@ RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
RICF_InitField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" ); RICF_InitField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" );
RICF_InitField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" ); RICF_InitField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" );
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" ); RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wbsParameters, "wbsParameters", "WbsParameters", "", "", "" );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -87,7 +90,8 @@ RicfCommandResponse RicfCreateWellBoreStabilityPlotFeature::execute()
{ {
RimWellBoreStabilityPlot* wbsPlot = RicNewWellBoreStabilityPlotFeature::createPlot( chosenCase, RimWellBoreStabilityPlot* wbsPlot = RicNewWellBoreStabilityPlotFeature::createPlot( chosenCase,
chosenWellPath, chosenWellPath,
m_timeStep() ); m_timeStep(),
m_wbsParameters() );
RicfCommandResponse response; RicfCommandResponse response;
response.setResult( new RicfCreateWbsPlotResult( wbsPlot->id() ) ); response.setResult( new RicfCreateWbsPlotResult( wbsPlot->id() ) );
return response; return response;

View File

@ -18,8 +18,11 @@
#pragma once #pragma once
#include "RicfCommandObject.h" #include "RicfCommandObject.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
class RimWbsParameters;
//================================================================================================== //==================================================================================================
// //
// //
@ -53,4 +56,5 @@ private:
caf::PdmField<int> m_caseId; caf::PdmField<int> m_caseId;
caf::PdmField<QString> m_wellPath; caf::PdmField<QString> m_wellPath;
caf::PdmField<int> m_timeStep; caf::PdmField<int> m_timeStep;
caf::PdmChildField<RimWbsParameters*> m_wbsParameters;
}; };

View File

@ -66,12 +66,16 @@ CAF_CMD_SOURCE_INIT( RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilit
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot* RimWellBoreStabilityPlot*
RicNewWellBoreStabilityPlotFeature::createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep ) RicNewWellBoreStabilityPlotFeature::createPlot( RimGeoMechCase* geoMechCase,
RimWellPath* wellPath,
int timeStep,
const RimWbsParameters* parameters /* = nullptr*/ )
{ {
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" ); caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false, RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
"Well Bore Stability" ); "Well Bore Stability",
parameters );
{ {
auto task = progInfo.task( "Creating formation track", 2 ); auto task = progInfo.task( "Creating formation track", 2 );

View File

@ -22,6 +22,7 @@
class RimGeoMechCase; class RimGeoMechCase;
class RimGeoMechView; class RimGeoMechView;
class RimWbsParameters;
class RimWellBoreStabilityPlot; class RimWellBoreStabilityPlot;
class RimWellPath; class RimWellPath;
@ -33,7 +34,10 @@ class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static RimWellBoreStabilityPlot* createPlot( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep ); static RimWellBoreStabilityPlot* createPlot( RimGeoMechCase* geoMechCase,
RimWellPath* wellPath,
int timeStep,
const RimWbsParameters* parameters = nullptr );
protected: protected:
// Overrides // Overrides

View File

@ -43,7 +43,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot* RimWellBoreStabilityPlot*
RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( bool showAfterCreation /*= true*/, RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( bool showAfterCreation /*= true*/,
const QString& plotDescription /*= QString("")*/ ) const QString& plotDescription /*= QString("")*/,
const RimWbsParameters* params /*= nullptr*/ )
{ {
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection(); RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT( wellLogPlotColl ); CVF_ASSERT( wellLogPlotColl );
@ -52,6 +53,11 @@ RimWellBoreStabilityPlot*
RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot(); RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot();
if ( params )
{
plot->copyWbsParameters( params );
}
plot->setAsPlotMdiWindow(); plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back( plot ); wellLogPlotColl->wellLogPlots().push_back( plot );

View File

@ -21,6 +21,7 @@
#include <QString> #include <QString>
class RimWbsParameters;
class RimWellBoreStabilityPlot; class RimWellBoreStabilityPlot;
class RimWellLogPlotCollection; class RimWellLogPlotCollection;
class RimWellLogPlot; class RimWellLogPlot;
@ -33,7 +34,8 @@ class RicNewWellLogPlotFeatureImpl
{ {
public: public:
static RimWellBoreStabilityPlot* createWellBoreStabilityPlot( bool showAfterCreation = true, static RimWellBoreStabilityPlot* createWellBoreStabilityPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) ); const QString& plotDescription = QString( "" ),
const RimWbsParameters* params = nullptr );
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true, static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) ); const QString& plotDescription = QString( "" ) );
static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true, static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true,

View File

@ -2,6 +2,7 @@ syntax = "proto3";
import "Case.proto"; import "Case.proto";
import "Definitions.proto"; import "Definitions.proto";
import "PdmObject.proto";
package rips; package rips;
@ -277,6 +278,7 @@ message CreateWbsPlotRequest
int32 caseId = 1; int32 caseId = 1;
string wellPath = 2; string wellPath = 2;
int32 timeStep = 3; int32 timeStep = 3;
PdmObject wbsParameters = 4;
} }
message ImportWellPathsRequest message ImportWellPathsRequest

View File

@ -29,7 +29,6 @@ message CreatePdmChildObjectRequest
{ {
PdmObject object = 1; PdmObject object = 1;
string child_field = 2; string child_field = 2;
string child_class = 3;
} }
message PdmParentObjectRequest message PdmParentObjectRequest

View File

@ -750,7 +750,7 @@ class Case(PdmObject):
exportFile=export_file, exportFile=export_file,
)) ))
def create_well_bore_stability_plot(self, well_path, time_step): def create_well_bore_stability_plot(self, well_path, time_step, wbsParameters=None):
""" Create a new well bore stability plot """ Create a new well bore stability plot
Arguments: Arguments:
@ -762,7 +762,8 @@ class Case(PdmObject):
""" """
plot_result = self._execute_command(createWellBoreStabilityPlot=Cmd.CreateWbsPlotRequest(caseId=self.case_id, plot_result = self._execute_command(createWellBoreStabilityPlot=Cmd.CreateWbsPlotRequest(caseId=self.case_id,
wellPath=well_path, wellPath=well_path,
timeStep=time_step)) timeStep=time_step,
wbsParameters=wbsParameters))
return self._project.plot(view_id=plot_result.createWbsPlotResult.viewId) return self._project.plot(view_id=plot_result.createWbsPlotResult.viewId)
def import_formation_names(self, formation_files=None): def import_formation_names(self, formation_files=None):

View File

@ -23,8 +23,10 @@
#include "RicfSetTimeStep.h" #include "RicfSetTimeStep.h"
#include "cafAssert.h" #include "cafAssert.h"
#include "cafPdmChildField.h"
#include "cafPdmDataValueField.h" #include "cafPdmDataValueField.h"
#include "cafPdmDefaultObjectFactory.h" #include "cafPdmDefaultObjectFactory.h"
#include "cafPdmObject.h"
#include "cafPdmValueField.h" #include "cafPdmValueField.h"
#include <google/protobuf/reflection.h> #include <google/protobuf/reflection.h>
@ -52,13 +54,13 @@ grpc::Status
auto grpcOneOfMessage = requestDescriptor->FindFieldByNumber( (int)paramsCase ); auto grpcOneOfMessage = requestDescriptor->FindFieldByNumber( (int)paramsCase );
CAF_ASSERT( grpcOneOfMessage->type() == FieldDescriptor::TYPE_MESSAGE ); CAF_ASSERT( grpcOneOfMessage->type() == FieldDescriptor::TYPE_MESSAGE );
const Message& params = request->GetReflection()->GetMessage( *request, grpcOneOfMessage );
QString grpcOneOfMessageName = QString::fromStdString( grpcOneOfMessage->name() ); QString grpcOneOfMessageName = QString::fromStdString( grpcOneOfMessage->name() );
auto pdmObjectHandle = caf::PdmDefaultObjectFactory::instance()->create( grpcOneOfMessageName ); auto pdmObjectHandle = caf::PdmDefaultObjectFactory::instance()->create( grpcOneOfMessageName );
auto commandHandle = dynamic_cast<RicfCommandObject*>( pdmObjectHandle ); auto commandHandle = dynamic_cast<RicfCommandObject*>( pdmObjectHandle );
if ( commandHandle ) if ( commandHandle )
{ {
// Copy parameters
RicfMultiCaseReplace* multiCaseReplaceCommand = dynamic_cast<RicfMultiCaseReplace*>( commandHandle ); RicfMultiCaseReplace* multiCaseReplaceCommand = dynamic_cast<RicfMultiCaseReplace*>( commandHandle );
if ( multiCaseReplaceCommand ) if ( multiCaseReplaceCommand )
{ {
@ -74,24 +76,13 @@ grpc::Status
} }
else else
{ {
auto subMessageDescriptor = grpcOneOfMessage->message_type(); assignPdmObjectValues( commandHandle, *request, grpcOneOfMessage );
int numParameters = subMessageDescriptor->field_count();
for ( int i = 0; i < numParameters; ++i )
{
auto parameter = subMessageDescriptor->field( i );
if ( parameter )
{
QString parameterName = QString::fromStdString( parameter->name() );
auto pdmValueFieldHandle = dynamic_cast<caf::PdmValueField*>(
pdmObjectHandle->findField( parameterName ) );
if ( pdmValueFieldHandle )
{
assignPdmFieldValue( pdmValueFieldHandle, params, parameter );
}
}
}
} }
// Execute command
RicfCommandResponse response = commandHandle->execute(); RicfCommandResponse response = commandHandle->execute();
// Copy results
if ( response.status() == RicfCommandResponse::COMMAND_ERROR ) if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
{ {
return grpc::Status( grpc::FAILED_PRECONDITION, response.sanitizedResponseMessage().toStdString() ); return grpc::Status( grpc::FAILED_PRECONDITION, response.sanitizedResponseMessage().toStdString() );
@ -234,6 +225,60 @@ void RiaGrpcCommandService::assignPdmFieldValue( caf::PdmValueField* pdmValue
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGrpcCommandService::assignPdmObjectValues( caf::PdmObjectHandle* pdmObjectHandle,
const google::protobuf::Message& params,
const google::protobuf::FieldDescriptor* paramDescriptor )
{
FieldDescriptor::Type fieldDataType = paramDescriptor->type();
const Reflection* reflection = params.GetReflection();
CAF_ASSERT( fieldDataType == FieldDescriptor::TYPE_MESSAGE );
const Message& subMessage = reflection->GetMessage( params, paramDescriptor );
auto messageDescriptor = paramDescriptor->message_type();
int numParameters = messageDescriptor->field_count();
for ( int i = 0; i < numParameters; ++i )
{
auto parameter = messageDescriptor->field( i );
if ( parameter )
{
QString parameterName = QString::fromStdString( parameter->name() );
auto pdmChildFieldHandle = dynamic_cast<caf::PdmChildFieldHandle*>(
pdmObjectHandle->findField( parameterName ) );
auto pdmValueFieldHandle = dynamic_cast<caf::PdmValueField*>( pdmObjectHandle->findField( parameterName ) );
if ( pdmChildFieldHandle )
{
std::vector<caf::PdmObjectHandle*> childObjects;
pdmChildFieldHandle->childObjects( &childObjects );
caf::PdmObjectHandle* childObject = nullptr;
CAF_ASSERT( childObjects.size() <= 1u ); // We do not support child array fields yet
if ( childObjects.size() == 1u )
{
childObject = childObjects.front();
}
else if ( childObjects.empty() )
{
childObject = emplaceChildField( pdmChildFieldHandle );
}
CAF_ASSERT( childObject );
if ( childObject )
{
assignPdmObjectValues( childObject, subMessage, parameter );
}
}
else if ( pdmValueFieldHandle )
{
assignPdmFieldValue( pdmValueFieldHandle, subMessage, parameter );
}
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -26,8 +26,10 @@
namespace caf namespace caf
{ {
class PdmChildFieldHandle;
class PdmValueField; class PdmValueField;
class PdmObject; class PdmObject;
class PdmObjectHandle;
template <typename T> template <typename T>
class PdmField; class PdmField;
} // namespace caf } // namespace caf
@ -58,6 +60,10 @@ private:
void assignPdmFieldValue( caf::PdmValueField* pdmValueField, void assignPdmFieldValue( caf::PdmValueField* pdmValueField,
const google::protobuf::Message& params, const google::protobuf::Message& params,
const google::protobuf::FieldDescriptor* paramDescriptor ); const google::protobuf::FieldDescriptor* paramDescriptor );
void assignPdmObjectValues( caf::PdmObjectHandle* pdmObject,
const google::protobuf::Message& params,
const google::protobuf::FieldDescriptor* paramDescriptor );
void assignGrpcFieldValue( google::protobuf::Message* reply, void assignGrpcFieldValue( google::protobuf::Message* reply,
const google::protobuf::FieldDescriptor* fieldDescriptor, const google::protobuf::FieldDescriptor* fieldDescriptor,
const caf::PdmValueField* pdmValueField ); const caf::PdmValueField* pdmValueField );

View File

@ -212,9 +212,8 @@ grpc::Status RiaGrpcPdmObjectService::CreateChildPdmObject( grpc::ServerContext*
{ {
CAF_ASSERT( request ); CAF_ASSERT( request );
caf::PdmObject* pdmObject = emplaceChildArrayField( matchingObject, caf::PdmObjectHandle* pdmObject = emplaceChildField( matchingObject,
QString::fromStdString( request->child_field() ), QString::fromStdString( request->child_field() ) );
QString::fromStdString( request->child_class() ) );
if ( pdmObject ) if ( pdmObject )
{ {
copyPdmObjectFromCafToRips( pdmObject, reply ); copyPdmObjectFromCafToRips( pdmObject, reply );

View File

@ -24,6 +24,8 @@
#include "RicfFieldHandle.h" #include "RicfFieldHandle.h"
#include "RicfMessages.h" #include "RicfMessages.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmDataValueField.h" #include "cafPdmDataValueField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmXmlFieldHandle.h" #include "cafPdmXmlFieldHandle.h"
@ -64,11 +66,12 @@ size_t RiaGrpcServiceInterface::numberOfMessagesForByteCount( size_t messageSize
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaGrpcServiceInterface::copyPdmObjectFromCafToRips( const caf::PdmObject* source, rips::PdmObject* destination ) void RiaGrpcServiceInterface::copyPdmObjectFromCafToRips( const caf::PdmObjectHandle* source,
rips::PdmObject* destination )
{ {
CAF_ASSERT( source && destination ); CAF_ASSERT( source && destination && source->xmlCapability() );
destination->set_class_keyword( source->classKeyword().toStdString() ); destination->set_class_keyword( source->xmlCapability()->classKeyword().toStdString() );
destination->set_address( reinterpret_cast<uint64_t>( source ) ); destination->set_address( reinterpret_cast<uint64_t>( source ) );
std::vector<caf::PdmFieldHandle*> fields; std::vector<caf::PdmFieldHandle*> fields;
source->fields( fields ); source->fields( fields );
@ -95,10 +98,11 @@ void RiaGrpcServiceInterface::copyPdmObjectFromCafToRips( const caf::PdmObject*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaGrpcServiceInterface::copyPdmObjectFromRipsToCaf( const rips::PdmObject* source, caf::PdmObject* destination ) void RiaGrpcServiceInterface::copyPdmObjectFromRipsToCaf( const rips::PdmObject* source,
caf::PdmObjectHandle* destination )
{ {
CAF_ASSERT( source && destination ); CAF_ASSERT( source && destination && destination->xmlCapability() );
CAF_ASSERT( source->class_keyword() == destination->classKeyword().toStdString() ); CAF_ASSERT( source->class_keyword() == destination->xmlCapability()->classKeyword().toStdString() );
CAF_ASSERT( source->address() == reinterpret_cast<uint64_t>( destination ) ); CAF_ASSERT( source->address() == reinterpret_cast<uint64_t>( destination ) );
std::vector<caf::PdmFieldHandle*> fields; std::vector<caf::PdmFieldHandle*> fields;
destination->fields( fields ); destination->fields( fields );
@ -134,34 +138,50 @@ void RiaGrpcServiceInterface::assignFieldValue( const QString& stringValue, caf:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmObject* RiaGrpcServiceInterface::emplaceChildArrayField( caf::PdmObject* parent, caf::PdmObjectHandle* RiaGrpcServiceInterface::emplaceChildField( caf::PdmObject* parent, const QString& fieldLabel )
const QString& fieldLabel,
const QString& classKeyword )
{ {
std::vector<caf::PdmFieldHandle*> fields; std::vector<caf::PdmFieldHandle*> fields;
parent->fields( fields ); parent->fields( fields );
QString childClassKeyword = classKeyword;
for ( auto field : fields ) for ( auto field : fields )
{ {
auto pdmChildArrayField = dynamic_cast<caf::PdmChildArrayFieldHandle*>( field ); auto pdmChildArrayField = dynamic_cast<caf::PdmChildArrayFieldHandle*>( field );
auto pdmChildField = dynamic_cast<caf::PdmChildFieldHandle*>( field );
if ( pdmChildArrayField && pdmChildArrayField->keyword() == fieldLabel ) if ( pdmChildArrayField && pdmChildArrayField->keyword() == fieldLabel )
{ {
if ( childClassKeyword.isEmpty() ) return emplaceChildArrayField( pdmChildArrayField );
{
childClassKeyword = pdmChildArrayField->xmlCapability()->childClassKeyword();
} }
else if ( pdmChildField && pdmChildField->keyword() == fieldLabel )
auto pdmObjectHandle = caf::PdmDefaultObjectFactory::instance()->create( childClassKeyword );
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( pdmObjectHandle );
CAF_ASSERT( pdmObject );
if ( pdmObject )
{ {
pdmChildArrayField->insertAt( -1, pdmObject ); return emplaceChildField( pdmChildField );
return pdmObject;
}
} }
} }
return nullptr; return nullptr;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RiaGrpcServiceInterface::emplaceChildField( caf::PdmChildFieldHandle* childField )
{
QString childClassKeyword = childField->xmlCapability()->childClassKeyword();
auto pdmObjectHandle = caf::PdmDefaultObjectFactory::instance()->create( childClassKeyword );
CAF_ASSERT( pdmObjectHandle );
childField->setChildObject( pdmObjectHandle );
return pdmObjectHandle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RiaGrpcServiceInterface::emplaceChildArrayField( caf::PdmChildArrayFieldHandle* childArrayField )
{
QString childClassKeyword = childArrayField->xmlCapability()->childClassKeyword();
auto pdmObjectHandle = caf::PdmDefaultObjectFactory::instance()->create( childClassKeyword );
CAF_ASSERT( pdmObjectHandle );
childArrayField->insertAt( -1, pdmObjectHandle );
return pdmObjectHandle;
}

View File

@ -26,7 +26,10 @@ class RimCase;
namespace caf namespace caf
{ {
class PdmChildArrayFieldHandle;
class PdmChildFieldHandle;
class PdmObject; class PdmObject;
class PdmObjectHandle;
class PdmValueField; class PdmValueField;
} // namespace caf } // namespace caf
@ -50,13 +53,15 @@ public:
static RimCase* findCase( int caseId ); static RimCase* findCase( int caseId );
static size_t numberOfMessagesForByteCount( size_t messageSize, size_t byteCount = 64 * 1024u ); static size_t numberOfMessagesForByteCount( size_t messageSize, size_t byteCount = 64 * 1024u );
static void copyPdmObjectFromCafToRips( const caf::PdmObject* source, rips::PdmObject* destination ); static void copyPdmObjectFromCafToRips( const caf::PdmObjectHandle* source, rips::PdmObject* destination );
static void copyPdmObjectFromRipsToCaf( const rips::PdmObject* source, caf::PdmObject* destination ); static void copyPdmObjectFromRipsToCaf( const rips::PdmObject* source, caf::PdmObjectHandle* destination );
static void assignFieldValue( const QString& stringValue, caf::PdmValueField* field ); static void assignFieldValue( const QString& stringValue, caf::PdmValueField* field );
static caf::PdmObject* static caf::PdmObjectHandle* emplaceChildField( caf::PdmObject* parent, const QString& fieldLabel );
emplaceChildArrayField( caf::PdmObject* parent, const QString& fieldLabel, const QString& classKeyword );
static caf::PdmObjectHandle* emplaceChildField( caf::PdmChildFieldHandle* childField );
static caf::PdmObjectHandle* emplaceChildArrayField( caf::PdmChildArrayFieldHandle* childArrayField );
}; };
#include "cafFactory.h" #include "cafFactory.h"

View File

@ -82,6 +82,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h ${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.h ${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWbsParameters.h
${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.h ${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.h
${CMAKE_CURRENT_LIST_DIR}/RimViewLinkerCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimViewLinkerCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h
@ -232,6 +233,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotWindow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMultiPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWbsParameters.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.cpp ${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.cpp

View File

@ -17,6 +17,8 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimWbsParameters.h" #include "RimWbsParameters.h"
#include "RicfCommandObject.h"
#include "RigFemPartResultsCollection.h" #include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h" #include "RigGeoMechCaseData.h"
@ -33,33 +35,34 @@ RimWbsParameters::RimWbsParameters()
{ {
CAF_PDM_InitObject( "Well Bore Stability Parameters", ":/WellLogPlot16x16.png", "", "" ); CAF_PDM_InitObject( "Well Bore Stability Parameters", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_porePressureSource, RICF_InitFieldNoDefault( &m_porePressureSource,
"PorePressureSource", "PorePressureReservoirSource",
"Pore Pressure", "Reservoir Pore Pressure",
"", "",
"Data source for Pore Pressure", "Data source for Pore Pressure in reservoir",
"" ); "" );
CAF_PDM_InitFieldNoDefault( &m_porePressureShaleSource, RICF_InitFieldNoDefault( &m_porePressureNonReservoirSource,
"PorePressureShaleSource", "PorePressureNonReservoirSource",
"Shale Pore Pressure", "Non-Reservoir Pore Pressure",
"", "",
"Data source for Pore Pressure in Shale", "Data source for Pore Pressure outside reservoir",
"" ); "" );
RICF_InitField( &m_userDefinedPPShale, "UserPPNonReservoir", 1.05, " Multiplier of hydrostatic PP", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_poissonRatioSource, RICF_InitFieldNoDefault( &m_poissonRatioSource,
"PoissionRatioSource", "PoissionRatioSource",
"Poisson Ratio", "Poisson Ratio",
"", "",
"Data source for Poisson Ratio", "Data source for Poisson Ratio",
"" ); "" );
CAF_PDM_InitFieldNoDefault( &m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", "" ); RICF_InitFieldNoDefault( &m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", "" );
CAF_PDM_InitFieldNoDefault( &m_OBG0Source, "OBG0Source", "Initial Overburden Gradient", "", "Data source for OBG0", "" ); RICF_InitFieldNoDefault( &m_OBG0Source, "OBG0Source", "Initial Overburden Gradient", "", "Data source for OBG0", "" );
CAF_PDM_InitFieldNoDefault( &m_DFSource, "DFSource", "Depletion Factor (DF)", "", "Data source for Depletion Factor", "" ); RICF_InitFieldNoDefault( &m_DFSource, "DFSource", "Depletion Factor (DF)", "", "Data source for Depletion Factor", "" );
CAF_PDM_InitFieldNoDefault( &m_K0SHSource, RICF_InitFieldNoDefault( &m_K0SHSource,
"K0SHSource", "K0SHSource",
"K0_SH", "K0_SH",
"", "",
@ -67,17 +70,15 @@ RimWbsParameters::RimWbsParameters()
"(SH - PP)/(OBG-PP)", "(SH - PP)/(OBG-PP)",
"" ); "" );
CAF_PDM_InitFieldNoDefault( &m_FGShaleSource, "FGShaleSource", "FG in Shale Calculation", "", "", "" ); RICF_InitFieldNoDefault( &m_FGShaleSource, "FGShaleSource", "FG in Shale Calculation", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_K0FGSource, RICF_InitFieldNoDefault( &m_K0FGSource,
"K0FGSource", "K0FGSource",
"K0_FG", "K0_FG",
"", "",
"FG in shale = K0_FG * (OBG0-PP0)\nK0_FG = (FG-PP)/(OBG-PP)", "FG in shale = K0_FG * (OBG0-PP0)\nK0_FG = (FG-PP)/(OBG-PP)",
"" ); "" );
CAF_PDM_InitField( &m_userDefinedPPShale, "UserPPShale", 1.05, "Multiplier of hydrostatic PP", "", "", "" ); RICF_InitField( &m_userDefinedPoissionRatio,
CAF_PDM_InitField( &m_userDefinedPoissionRatio,
"UserPoissionRatio", "UserPoissionRatio",
0.35, 0.35,
"User Defined Poisson Ratio", "User Defined Poisson Ratio",
@ -86,12 +87,12 @@ RimWbsParameters::RimWbsParameters()
"" ); "" );
// Typical UCS: http://ceae.colorado.edu/~amadei/CVEN5768/PDF/NOTES8.pdf // Typical UCS: http://ceae.colorado.edu/~amadei/CVEN5768/PDF/NOTES8.pdf
// Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar. // Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar.
CAF_PDM_InitField( &m_userDefinedUcs, "UserUcs", 100.0, "User Defined UCS [bar]", "", "User Defined UCS [bar]", "" ); RICF_InitField( &m_userDefinedUcs, "UserUcs", 100.0, "User Defined UCS [bar]", "", "User Defined UCS [bar]", "" );
CAF_PDM_InitField( &m_userDefinedDF, "UserDF", 0.7, "User Defined DF", "", "User Defined Depletion Factor", "" ); RICF_InitField( &m_userDefinedDF, "UserDF", 0.7, "User Defined DF", "", "User Defined Depletion Factor", "" );
CAF_PDM_InitField( &m_userDefinedK0FG, "UserK0FG", 0.75, "User Defined K0_FG", "", "", "" ); RICF_InitField( &m_userDefinedK0FG, "UserK0FG", 0.75, "User Defined K0_FG", "", "", "" );
CAF_PDM_InitField( &m_userDefinedK0SH, "UserK0SH", 0.65, "User Defined K0_SH", "", "", "" ); RICF_InitField( &m_userDefinedK0SH, "UserK0SH", 0.65, "User Defined K0_SH", "", "", "" );
CAF_PDM_InitField( &m_FGShaleMultiplier, RICF_InitField( &m_FGShaleMultiplier,
"FGMultiplier", "FGMultiplier",
1.05, 1.05,
"SH Multiplier for FG in Shale", "SH Multiplier for FG in Shale",
@ -100,11 +101,14 @@ RimWbsParameters::RimWbsParameters()
"" ); "" );
CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "GeoMechCase", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "GeoMechCase", "", "", "" );
m_geoMechCase.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "WellPath", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "WellPath", "", "", "" );
m_wellPath.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "TimeStep", "", "", "" ); CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "TimeStep", "", "", "" );
m_timeStep.uiCapability()->setUiHidden( true );
m_parameterSourceFields = {{RigWbsParameter::PP_Sand(), &m_porePressureSource}, m_parameterSourceFields = {{RigWbsParameter::PP_Reservoir(), &m_porePressureSource},
{RigWbsParameter::PP_Shale(), &m_porePressureShaleSource}, {RigWbsParameter::PP_NonReservoir(), &m_porePressureNonReservoirSource},
{RigWbsParameter::poissonRatio(), &m_poissonRatioSource}, {RigWbsParameter::poissonRatio(), &m_poissonRatioSource},
{RigWbsParameter::UCS(), &m_ucsSource}, {RigWbsParameter::UCS(), &m_ucsSource},
{RigWbsParameter::OBG0(), &m_OBG0Source}, {RigWbsParameter::OBG0(), &m_OBG0Source},
@ -113,7 +117,7 @@ RimWbsParameters::RimWbsParameters()
{RigWbsParameter::K0_SH(), &m_K0SHSource}, {RigWbsParameter::K0_SH(), &m_K0SHSource},
{RigWbsParameter::FG_Shale(), &m_FGShaleSource}}; {RigWbsParameter::FG_Shale(), &m_FGShaleSource}};
m_userDefinedValueFields = {{RigWbsParameter::PP_Shale(), &m_userDefinedPPShale}, m_userDefinedValueFields = {{RigWbsParameter::PP_NonReservoir(), &m_userDefinedPPShale},
{RigWbsParameter::poissonRatio(), &m_userDefinedPoissionRatio}, {RigWbsParameter::poissonRatio(), &m_userDefinedPoissionRatio},
{RigWbsParameter::UCS(), &m_userDefinedUcs}, {RigWbsParameter::UCS(), &m_userDefinedUcs},
{RigWbsParameter::DF(), &m_userDefinedDF}, {RigWbsParameter::DF(), &m_userDefinedDF},
@ -150,7 +154,11 @@ RimWbsParameters& RimWbsParameters::operator=( const RimWbsParameters& copyFrom
for ( auto parameterSourcePair : m_parameterSourceFields ) for ( auto parameterSourcePair : m_parameterSourceFields )
{ {
setParameterSource( parameterSourcePair.first, copyFrom.parameterSource( parameterSourcePair.first ) ); auto paramSource = copyFrom.parameterSource( parameterSourcePair.first );
if ( paramSource != RigWbsParameter::UNDEFINED )
{
setParameterSource( parameterSourcePair.first, paramSource );
}
} }
for ( auto parameterUserDefinedValuePair : m_userDefinedValueFields ) for ( auto parameterUserDefinedValuePair : m_userDefinedValueFields )
{ {
@ -215,7 +223,7 @@ RimWbsParameters::ParameterSource RimWbsParameters::parameterSource( const RigWb
{ {
return ( *field )(); return ( *field )();
} }
return RigWbsParameter::INVALID; return RigWbsParameter::UNDEFINED;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -334,8 +342,8 @@ void RimWbsParameters::loadDataAndUpdate()
void RimWbsParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) void RimWbsParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add( &m_porePressureSource ); uiOrdering.add( &m_porePressureSource );
uiOrdering.add( &m_porePressureShaleSource ); uiOrdering.add( &m_porePressureNonReservoirSource );
if ( m_porePressureShaleSource == RigWbsParameter::USER_DEFINED ) if ( m_porePressureNonReservoirSource == RigWbsParameter::USER_DEFINED )
{ {
uiOrdering.add( &m_userDefinedPPShale ); uiOrdering.add( &m_userDefinedPPShale );
} }
@ -358,6 +366,7 @@ void RimWbsParameters::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
uiOrdering.add( &m_K0FGSource ); uiOrdering.add( &m_K0FGSource );
uiOrdering.add( &m_userDefinedK0FG ); uiOrdering.add( &m_userDefinedK0FG );
} }
uiOrdering.skipRemainingFields( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ private:
private: private:
caf::PdmField<ParameterSourceEnum> m_porePressureSource; caf::PdmField<ParameterSourceEnum> m_porePressureSource;
caf::PdmField<ParameterSourceEnum> m_porePressureShaleSource; caf::PdmField<ParameterSourceEnum> m_porePressureNonReservoirSource;
caf::PdmField<ParameterSourceEnum> m_poissonRatioSource; caf::PdmField<ParameterSourceEnum> m_poissonRatioSource;
caf::PdmField<ParameterSourceEnum> m_ucsSource; caf::PdmField<ParameterSourceEnum> m_ucsSource;
caf::PdmField<ParameterSourceEnum> m_OBG0Source; caf::PdmField<ParameterSourceEnum> m_OBG0Source;

View File

@ -70,9 +70,12 @@ double RimWellBoreStabilityPlot::userDefinedValue( const RigWbsParameter& parame
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::setWbsParameters( const RimWbsParameters& wbsParameters ) void RimWellBoreStabilityPlot::copyWbsParameters( const RimWbsParameters* wbsParameters )
{ {
*m_wbsParameters = wbsParameters; if ( wbsParameters )
{
*m_wbsParameters = *wbsParameters;
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ public:
RimWellBoreStabilityPlot(); RimWellBoreStabilityPlot();
void applyWbsParametersToExtractor( RigGeoMechWellLogExtractor* extractor ); void applyWbsParametersToExtractor( RigGeoMechWellLogExtractor* extractor );
double userDefinedValue( const RigWbsParameter& parameter ) const; double userDefinedValue( const RigWbsParameter& parameter ) const;
void setWbsParameters( const RimWbsParameters& wbsParameters ); void copyWbsParameters( const RimWbsParameters* wbsParameters );
protected: protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;

View File

@ -541,7 +541,7 @@ void RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( const RimW
auto allParams = RigWbsParameter::allParameters(); auto allParams = RigWbsParameter::allParameters();
for ( const RigWbsParameter& parameter : allParams ) for ( const RigWbsParameter& parameter : allParams )
{ {
if ( parameter == RigWbsParameter::PP_Sand() || parameter == RigWbsParameter::PP_Shale() ) if ( parameter == RigWbsParameter::PP_Reservoir() || parameter == RigWbsParameter::PP_NonReservoir() )
{ {
findAndLoadPorePressuresFromLasFiles( wellPath, parameter, geomExtractor ); findAndLoadPorePressuresFromLasFiles( wellPath, parameter, geomExtractor );
} }

View File

@ -21,6 +21,8 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RicfCommandObject.h"
#include "RigWellLogCurveData.h" #include "RigWellLogCurveData.h"
#include "RigWellPath.h" #include "RigWellPath.h"
@ -82,24 +84,24 @@ RimWellLogPlot::RimWellLogPlot()
m_commonDataSource.xmlCapability()->disableIO(); m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource; m_commonDataSource = new RimWellLogCurveCommonDataSource;
CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" ); RICF_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" );
CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" ); CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" );
m_plotWindowTitle.xmlCapability()->setIOWritable( false ); m_plotWindowTitle.xmlCapability()->setIOWritable( false );
caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = RiaDefines::MEASURED_DEPTH; caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = RiaDefines::MEASURED_DEPTH;
CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" ); RICF_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" );
caf::AppEnum<RiaDefines::DepthUnitType> depthUnit = RiaDefines::UNIT_METER; caf::AppEnum<RiaDefines::DepthUnitType> depthUnit = RiaDefines::UNIT_METER;
CAF_PDM_InitField( &m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", "" ); RICF_InitField( &m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", "" );
CAF_PDM_InitField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "" ); RICF_InitField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "" );
CAF_PDM_InitField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "" ); RICF_InitField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "" );
m_minVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_minVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
m_maxVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_maxVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" ); RICF_InitFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" );
CAF_PDM_InitField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" ); RICF_InitField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" );
m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true ); m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );

View File

@ -2290,8 +2290,9 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) ); caf::ColorTable colorTable( RimRegularLegendConfig::colorArrayFromColorType( m_colorShadingPalette() ) );
std::vector<QString> sourceNames = std::vector<QString> sourceNames =
RigWbsParameter::PP_Sand().allSourceLabels( "\n", RigWbsParameter::PP_Reservoir().allSourceLabels( "\n",
wbsPlot->userDefinedValue( RigWbsParameter::PP_Shale() ) ); wbsPlot->userDefinedValue(
RigWbsParameter::PP_NonReservoir() ) );
curveData.data = ppSourceRegions; curveData.data = ppSourceRegions;
std::vector<QString> sourceNamesToPlot; std::vector<QString> sourceNamesToPlot;

View File

@ -211,16 +211,16 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
{ {
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults(); RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();
std::vector<WbsParameterSource> finalSourcesPerSegment( m_intersections.size(), RigWbsParameter::INVALID ); std::vector<WbsParameterSource> finalSourcesPerSegment( m_intersections.size(), RigWbsParameter::UNDEFINED );
outputValues->resize( m_intersections.size(), std::numeric_limits<double>::infinity() ); outputValues->resize( m_intersections.size(), std::numeric_limits<double>::infinity() );
if ( primarySource == RigWbsParameter::INVALID ) if ( primarySource == RigWbsParameter::UNDEFINED )
{ {
return finalSourcesPerSegment; return finalSourcesPerSegment;
} }
bool isPPresult = parameter == RigWbsParameter::PP_Sand() || parameter == RigWbsParameter::PP_Shale(); bool isPPresult = parameter == RigWbsParameter::PP_Reservoir() || parameter == RigWbsParameter::PP_NonReservoir();
std::vector<WbsParameterSource> allSources = parameter.sources(); std::vector<WbsParameterSource> allSources = parameter.sources();
auto primary_it = std::find( allSources.begin(), allSources.end(), primarySource ); auto primary_it = std::find( allSources.begin(), allSources.end(), primarySource );
@ -438,7 +438,7 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
CVF_ASSERT( values ); CVF_ASSERT( values );
values->resize( m_intersections.size(), std::numeric_limits<double>::infinity() ); values->resize( m_intersections.size(), std::numeric_limits<double>::infinity() );
std::vector<WbsParameterSource> sources( m_intersections.size(), RigWbsParameter::INVALID ); std::vector<WbsParameterSource> sources( m_intersections.size(), RigWbsParameter::UNDEFINED );
if ( resAddr.fieldName == RiaDefines::wbsPPResult().toStdString() ) if ( resAddr.fieldName == RiaDefines::wbsPPResult().toStdString() )
{ {
@ -446,12 +446,10 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
std::vector<double> ppSandValues( m_intersections.size(), std::numeric_limits<double>::infinity() ); std::vector<double> ppSandValues( m_intersections.size(), std::numeric_limits<double>::infinity() );
std::vector<double> ppShaleValues( m_intersections.size(), std::numeric_limits<double>::infinity() ); std::vector<double> ppShaleValues( m_intersections.size(), std::numeric_limits<double>::infinity() );
std::vector<WbsParameterSource> ppSandSources = calculateWbsParameterForAllSegments( RigWbsParameter::PP_Sand(), std::vector<WbsParameterSource> ppSandSources =
frameIndex, calculateWbsParameterForAllSegments( RigWbsParameter::PP_Reservoir(), frameIndex, &ppSandValues );
&ppSandValues ); std::vector<WbsParameterSource> ppShaleSources =
std::vector<WbsParameterSource> ppShaleSources = calculateWbsParameterForAllSegments( RigWbsParameter::PP_Shale(), calculateWbsParameterForAllSegments( RigWbsParameter::PP_NonReservoir(), 0, &ppShaleValues );
0,
&ppShaleValues );
#pragma omp parallel for #pragma omp parallel for
for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx ) for ( int64_t intersectionIdx = 0; intersectionIdx < (int64_t)m_intersections.size(); ++intersectionIdx )
@ -504,7 +502,7 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData( const RigFemResultAddres
RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" ); RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" );
// Allow POR as an element property value // Allow POR as an element property value
RigFemResultAddress ppSandElementPropertyAddr = RigWbsParameter::PP_Sand().femAddress( RigFemResultAddress ppSandElementPropertyAddr = RigWbsParameter::PP_Reservoir().femAddress(
RigWbsParameter::ELEMENT_PROPERTY_TABLE ); RigWbsParameter::ELEMENT_PROPERTY_TABLE );
RigFemResultAddress poissonResAddr = RigWbsParameter::poissonRatio().femAddress( RigFemResultAddress poissonResAddr = RigWbsParameter::poissonRatio().femAddress(
@ -531,7 +529,7 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData( const RigFemResultAddres
values->resize( m_intersections.size(), 0.0f ); values->resize( m_intersections.size(), 0.0f );
std::vector<double> ppSandAllSegments( m_intersections.size(), std::numeric_limits<double>::infinity() ); std::vector<double> ppSandAllSegments( m_intersections.size(), std::numeric_limits<double>::infinity() );
std::vector<WbsParameterSource> ppSources = calculateWbsParameterForAllSegments( RigWbsParameter::PP_Sand(), std::vector<WbsParameterSource> ppSources = calculateWbsParameterForAllSegments( RigWbsParameter::PP_Reservoir(),
RigWbsParameter::GRID, RigWbsParameter::GRID,
frameIndex, frameIndex,
&ppSandAllSegments ); &ppSandAllSegments );

View File

@ -29,10 +29,10 @@ void RigWbsParameter::SourceEnum::setUp()
addItem( RigWbsParameter::ELEMENT_PROPERTY_TABLE, "ELEMENT_PROPERTY_TABLE", "Property Table" ); addItem( RigWbsParameter::ELEMENT_PROPERTY_TABLE, "ELEMENT_PROPERTY_TABLE", "Property Table" );
addItem( RigWbsParameter::USER_DEFINED, "USER_DEFINED", "User Defined" ); addItem( RigWbsParameter::USER_DEFINED, "USER_DEFINED", "User Defined" );
addItem( RigWbsParameter::HYDROSTATIC, "HYDROSTATIC", "Hydrostatic" ); addItem( RigWbsParameter::HYDROSTATIC, "HYDROSTATIC", "Hydrostatic" );
addItem( RigWbsParameter::DERIVED_FROM_K0FG, "K0FG", "FG derived from K0_FG" ); addItem( RigWbsParameter::DERIVED_FROM_K0FG, "DERIVED_FROM_K0FG", "FG derived from K0_FG" );
addItem( RigWbsParameter::PROPORTIONAL_TO_SH, "PROPORTIONAL_TO_SH", "Proportional to SH" ); addItem( RigWbsParameter::PROPORTIONAL_TO_SH, "PROPORTIONAL_TO_SH", "Proportional to SH" );
addItem( RigWbsParameter::INVALID, "UNDEFINED", "Undefined" ); addItem( RigWbsParameter::UNDEFINED, "UNDEFINED", "Undefined" );
setDefault( RigWbsParameter::INVALID ); setDefault( RigWbsParameter::UNDEFINED );
} }
} // End namespace caf } // End namespace caf
@ -169,7 +169,7 @@ bool RigWbsParameter::operator<( const RigWbsParameter& rhs ) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWbsParameter RigWbsParameter::PP_Sand() RigWbsParameter RigWbsParameter::PP_Reservoir()
{ {
SourceVector sources = {{GRID, SourceAddress( "POR-Bar" )}, SourceVector sources = {{GRID, SourceAddress( "POR-Bar" )},
{LAS_FILE, SourceAddress( "POR" )}, {LAS_FILE, SourceAddress( "POR" )},
@ -180,11 +180,11 @@ RigWbsParameter RigWbsParameter::PP_Sand()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWbsParameter RigWbsParameter::PP_Shale() RigWbsParameter RigWbsParameter::PP_NonReservoir()
{ {
return RigWbsParameter( "PP Shale", return RigWbsParameter( "PP Non-Reservoir",
true, true,
{{LAS_FILE, SourceAddress( "POR_Shale" )}, {{LAS_FILE, SourceAddress( "POR_NonReservoir" )},
{HYDROSTATIC, SourceAddress( "Hydrostatic" )}, {HYDROSTATIC, SourceAddress( "Hydrostatic" )},
{USER_DEFINED, SourceAddress()}} ); {USER_DEFINED, SourceAddress()}} );
} }
@ -209,7 +209,7 @@ RigWbsParameter RigWbsParameter::UCS()
return RigWbsParameter( "UCS", return RigWbsParameter( "UCS",
false, false,
{{LAS_FILE, SourceAddress( "UCS" )}, {{LAS_FILE, SourceAddress( "UCS" )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "RATIO" )}, {ELEMENT_PROPERTY_TABLE, SourceAddress( "UCS" )},
{USER_DEFINED, SourceAddress()}} ); {USER_DEFINED, SourceAddress()}} );
} }
@ -285,7 +285,7 @@ RigWbsParameter RigWbsParameter::FG_Shale()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<RigWbsParameter> RigWbsParameter::allParameters() std::set<RigWbsParameter> RigWbsParameter::allParameters()
{ {
return {PP_Sand(), PP_Shale(), poissonRatio(), UCS(), OBG(), OBG0(), SH(), DF(), K0_FG(), K0_SH(), FG_Shale()}; return {PP_Reservoir(), PP_NonReservoir(), poissonRatio(), UCS(), OBG(), OBG0(), SH(), DF(), K0_FG(), K0_SH(), FG_Shale()};
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ public:
HYDROSTATIC, HYDROSTATIC,
DERIVED_FROM_K0FG, // FG in shale DERIVED_FROM_K0FG, // FG in shale
PROPORTIONAL_TO_SH, // FG in shale PROPORTIONAL_TO_SH, // FG in shale
INVALID = 1000, UNDEFINED = 1000,
}; };
using SourceEnum = caf::AppEnum<Source>; using SourceEnum = caf::AppEnum<Source>;
using SourceVector = std::vector<std::pair<Source, SourceAddress>>; using SourceVector = std::vector<std::pair<Source, SourceAddress>>;
@ -66,8 +66,8 @@ public:
bool operator==( const RigWbsParameter& rhs ) const; bool operator==( const RigWbsParameter& rhs ) const;
bool operator<( const RigWbsParameter& rhs ) const; bool operator<( const RigWbsParameter& rhs ) const;
static RigWbsParameter PP_Sand(); static RigWbsParameter PP_Reservoir();
static RigWbsParameter PP_Shale(); static RigWbsParameter PP_NonReservoir();
static RigWbsParameter poissonRatio(); static RigWbsParameter poissonRatio();
static RigWbsParameter UCS(); static RigWbsParameter UCS();
static RigWbsParameter OBG(); static RigWbsParameter OBG();

View File

@ -16,8 +16,14 @@ template< typename T> class PdmFieldXmlCap;
/// This is supposed to be renamed to PdmChildField /// This is supposed to be renamed to PdmChildField
//================================================================================================== //==================================================================================================
class PdmChildFieldHandle : public PdmFieldHandle
{
public:
virtual void setChildObject(PdmObjectHandle* object) = 0;
};
template<typename DataType> template<typename DataType>
class PdmChildField : public PdmFieldHandle class PdmChildField : public PdmChildFieldHandle
{ {
public: public:
PdmChildField() PdmChildField()
@ -27,7 +33,7 @@ public:
}; };
template<typename DataType > template<typename DataType >
class PdmChildField <DataType*> : public PdmFieldHandle class PdmChildField <DataType*> : public PdmChildFieldHandle
{ {
typedef DataType* DataTypePtr; typedef DataType* DataTypePtr;
public: public:
@ -53,8 +59,8 @@ public:
const PdmPointer<DataType>& v() const { return m_fieldValue; } const PdmPointer<DataType>& v() const { return m_fieldValue; }
// Child objects // Child objects
virtual void childObjects(std::vector<PdmObjectHandle*>* objects); virtual void childObjects(std::vector<PdmObjectHandle*>* objects);
void setChildObject(PdmObjectHandle* object) override;
virtual void removeChildObject(PdmObjectHandle* object); virtual void removeChildObject(PdmObjectHandle* object);
private: private:

View File

@ -1,3 +1,4 @@
#include "cafPdmObjectHandle.h"
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@ -19,6 +20,23 @@ void caf::PdmChildField<DataType*>::childObjects(std::vector<PdmObjectHandle*>*
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename DataType >
void caf::PdmChildField<DataType*>::setChildObject(PdmObjectHandle* object)
{
if (m_fieldValue.rawPtr() != NULL)
{
PdmObjectHandle* oldObject = m_fieldValue.rawPtr();
this->removeChildObject(oldObject);
delete oldObject;
}
m_fieldValue.setRawPtr(object);
object->setAsParentField(this);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------