1

在 Petrel 中,是否可以使用海洋在输入树中复制粘贴项目?我需要在某处拥有特定井或策略的副本;我怎样才能做到这一点?

例如,如果我想拥有这口井 (myWell) 的副本:

  Tubing = e.Data.GetData(typeof(TubingString)) as TubingString;
  Borehole myWell=Tubing.Borehole;

进入我的钻孔收藏(博霍尔):

  WellRoot Welrot = Slb.Ocean.Petrel.DomainObject.Well.WellRoot.Get(PetrelProject.PrimaryProject); 
  BoreholeCollection Borhol = Welrot.BoreholeCollection;

或者有一份 DevelopmentStrategy (oldStrategy):

  EclipseFormatSimulator.Arguments args=WellKnownSimulators.ECLIPSE100.GetEclipseFormatSimulatorArguments(theCase);
  DevelopmentStrategy oldStrategy=args.Strategies.DevelopmentStrategies.First();

进入 DevelopmentStrategyCollection (strategycol):

  SimulationRoot simroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
  DevelopmentStrategyCollection strategycol=simroot.DevelopmentStrategyCollection;
4

1 回答 1

1

许多在 Petrel 中具有复制/粘贴功能的域对象都实现了一个名为ICopyable. 但是,我不认为这对于所有域对象都是一致的。一种更可靠的复制/粘贴域对象的方法是使用ICopyableFactory服务。

Borehole borehole = ...;

ICopyable copyable = borehole as ICopyable;

if (copyable == null)
{
    ICopyableFactory factory = CoreSystem.GetService<ICopyableFactory>(borehole);
    copyable = factory.GetCopyable(borehole);
}

if (copyable != null)
{
    IDataSourceManager sourceMgr = ...;
    IDataSourceManager targetMgr = ...;
    IProjectInfo sourceProjectInfo = ...;
    IProjectInfo targetProjectInfo = ...;
    ICoordinateReferenceSystem sourceCrs = ...;
    ICoordinateReferenceSystem targetCrs = ...;
    ICoordinateOperation coordinateOperation = ...;
    CopyContext.Element ignoreElements = ...;
    CopyContext.Identify identity = ...;
    object targetCollection = ...;
    object snapshot = copyable.GetSnapshot();

    CopyContext context = new CopyContext(sourceMgr, targetMgr,
        sourceProjectInfo, targetProjectInfo, sourceCrs, targetCrs
        coordinateOperation, ignoreElements, identity, targetCollection,
        snapshot);

    Borehole copy = copyable.Copy(context) as Borehole;
}

ICopyable.Copy需要很多参数,因为此方法也用于参考项目工具(用于在项目之间复制域对象)。如果您在同一个项目中复制域对象,所有关联的源/目标属性都将相同(即targetMgr = sourceMgr)。

于 2014-07-15T14:11:01.980 回答