Paraview源码解析6:vtkExecutive类

VTKEExecutive是VTK中所有管道管理人员的超类。

  • VTK执行官负责控制vtkAlgorithm的一个实例。管道由一个或多个控制数据流的主管组成。管道中的每个读卡器、源、写卡器或数据处理算法都在vtkAlgorithm的一个实例中实现。

1.类图结构

2.实现代码

2.1 GetOutputInformation()

vtkInformationVector* vtkExecutive::GetOutputInformation()
{
  // Use the shared output information vector if any is set.
  if (this->SharedOutputInformation)
  {
    return this->SharedOutputInformation;
  }

  // Use this executive's output information vector.
  if (!this->Algorithm)
  {
    return nullptr;
  }
  // Set the length of the vector to match the number of ports.
  int oldNumberOfPorts = this->OutputInformation->GetNumberOfInformationObjects();
  this->OutputInformation->SetNumberOfInformationObjects(this->GetNumberOfOutputPorts());

  // For any new information obects, set the executive pointer and
  // port number on the information object to tell it what produces
  // it.
  int nop = this->Algorithm->GetNumberOfOutputPorts();
  for (int i = oldNumberOfPorts; i < nop; ++i)
  {
    vtkInformation* info = this->OutputInformation->GetInformationObject(i);
    vtkExecutive::PRODUCER()->Set(info, this, i);
  }

  return this->OutputInformation;
}
// Pointers to an outside instance of input or output information.
  // No references are held.  These are used to implement internal
  // pipelines.
  vtkInformationVector* SharedOutputInformation;
 // Store an information object for each output port of the algorithm.
 //为算法的每个输出端口存储一个信息对象。
  vtkInformationVector* OutputInformation;

2.2 GetInputInformation()

vtkInformationVector** vtkExecutive::GetInputInformation()
{
  // Use the shared input information vector if any is set.
  if (this->SharedInputInformation)
  {
    return this->SharedInputInformation;
  }

  // Use this executive's input information vector.
  if (this->Algorithm)
  {
    int numPorts = this->Algorithm->GetNumberOfInputPorts();
    return this->ExecutiveInternal->GetInputInformation(numPorts);
  }
  else
  {
    return this->ExecutiveInternal->GetInputInformation(0);
  }
}

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容