目录
1.2 vtkPVRenderViewDataDeliveryManager::GetCurrentStreamedPiece
1.2.1class vtkPVDataDeliveryManager
1.2.2this->Internals->GetItem(repr,false,port)
2.1.vtkPVTRenderViewClientServer类调用流程:
2.2.vtkAMRStreamingVolumeRepresentation类调用流程
2.3.vtkAMROutlineRepresentation.cxx类调用流程
《paraview探索视图与关联表达:vtkPVRenderView与vtkPVDataRepresentation》一文中简单介绍了vtkPVRenderView中使用了vtkPVDataRepresentation的方法,本文将详细介绍vtkPVRenderView::GetCurrentStreamedPiece()函数的使用。
1.实现
GetCurrentStremedPiece,字面理解为:获取当前流片
本质上,是从map中获取vtkDataRepresentation对象对应的vtkDataObject对象;知识获取并没有转换;
vtkDataObject* vtkPVRenderView::GetCurrentStreamedPiece(vtkInformation* info, vtkPVDataRepresentation* repr);
获取当前流片实现:
vtkDataObject* vtkPVRenderView::GetCurrentStreamedPiece(
vtkInformation* info, vtkPVDataRepresentation* repr)
{
vtkPVRenderView* self = vtkPVRenderView::SafeDownCast(info->Get(VIEW()));
if (!self)
{
vtkGenericWarningMacro("Missing VIEW().");
return nullptr;
}
return vtkPVRenderViewDataDeliveryManager::SafeDownCast(self->GetDeliveryManager())
->GetCurrentStreamedPiece(repr);
}
1.1第4行 VIEW()
/*用于将vtkPVView指针传递到表示的键,在任何视图过程中
如REQUEST_UPDATE()、REQUEST_UPDATE_LOD(),
*REQUEST_RENDER()等。*/
static vtkInformationObjectBaseKey* VIEW();
1.2 vtkPVRenderViewDataDeliveryManager::GetCurrentStreamedPiece
vtkDataObject* vtkPVRenderViewDataDeliveryManager::GetCurrentStreamedPiece(
vtkPVDataRepresentation* repr, int port)
{
vtkInternals::vtkItem* item = this->Internals->GetItem(repr,
/*low_res=*/false, port);
if (item == nullptr)
{
vtkErrorMacro("Invalid argument.");
return nullptr;
}
const auto cacheKey = this->GetCacheKey(repr);
return item->GetDeliveredDataObject(STREAMING_DATA_KEY, cacheKey);
}
1.2.1class vtkPVDataDeliveryManager
/**
* @class vtkPVDataDeliveryManager
* @brief manager for data-delivery.
*
* ParaView's multi-configuration / multi-process modes pose a challenge for
* views. At runtime, the current configuration will determine which processes
* have what parts of data and which processes are expected to "render" that data.
* While views and their representations may add certain qualifiers to this
* statement, generally speaking, all views have to support taking the data from
* the data-processing nodes and delivering it to the rendering nodes. This is
* where vtkPVDataDeliveryManager comes in play. It helps views (viz. vtkPVView
* subclasses) move the data.
*/
ParaView的多配置/多进程模式对视图提出了挑战。
在运行时,当前配置将确定哪些进程具有数据的哪些部分,以及哪些进程将“呈现”该数据。
虽然视图及其表示可能会为此语句添加某些限定符,但一般来说,所有视图都必须支持从数据处理节点获取数据并将其传递到渲染节点。
这就是vtkPVDataDeliveryManager发挥作用的地方。
它帮助view(即。vtkPVView子类)移动数据。
1.2.2this->Internals->GetItem(repr,false,port)
Internals定义
class vtkInternals;
vtkInternals* Internals;
vtkInternals是vtkPVDataDeliveryManager类的静态成员变量,该静态成员变量类型为一个类,vtkInternals定义在D:\\pv\\ParaView\\Remoting\\Views\\vtkPVDataDeliveryManagerInternals.h文件中。
class vtkPVDataDeliveryManager::vtkInternals
1.2.3this->GetCacheKey(repr)
vtkPVDataRepresentation::GetCacheKey()实现代码:
double vtkPVDataRepresentation::GetCacheKey() const
{
return this->ForceUseCache ? this->ForcedCacheKey : this->CacheKey;
}
vtkPVDataRepresentation类中通过vtkPVDataRepresentation::ProcessViewRequest()中设置CacheKey:this->CacheKey = pvview->GetCacheKey();
int vtkPVDataRepresentation::ProcessViewRequest(
vtkInformationRequestKey* request, vtkInformation*, vtkInformation*)
this->CacheKey = pvview->GetCacheKey();
表示需要更新。为了支持播放动画的缓存,我们需要使用缓存键保存我们将在这个更新请求中准备的数据。
该键只是视图的当前键。
如果自上次更新以来,表示的输入中没有任何更改,那么我们将无法到达这里,在这种情况下,我们将继续使用旧的缓存键。
这个巧妙的小技巧对于确保我们不更新不受动画影响的表示至关重要。
2.调用关系
vtkPVRenderView::GetCurrentStreamedPiece()方法的调用:
2.1.vtkPVRenderViewClientServer文件调用流程:
vtkPVRenderViewCommand()是vtkPVTRenderViewClientServer文件中方法
2.2.vtkAMRStreamingVolumeRepresentation类调用流程
2.2.1ProcessViewRequest方法
/**
* vtkAlgorithm::ProcessRequest() equivalent for rendering passes. This is
* typically called by the vtkView to request meta-data from the
* representations or ask them to perform certain tasks e.g.
* PrepareForRendering.
* Overridden to skip processing when visibility if off.
*/
int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
vtkInformation* outInfo) override;
vtkAlgorithm::ProcessRequest()等价于渲染过程。
通常由vtkView调用,从表示中请求元数据或要求表示执行某些任务,例如PrepareForRendering。
如果禁用可见性,则重写为跳过处理。
2.3.vtkAMROutlineRepresentation.cxx类调用流程
2.4.总结
1,2,3处调用的源头都是vtkRemotingViewsCSInit.cxx中的vtkRemotingViewsCS_Initialize(vtkClientServerInterpreter* csi),但是目前还不知道怎样触发调用的?
暂无评论内容