1
/*=========================================================================
4
Module: $RCSfile: vtkSMUniformGridParallelStrategy.cxx,v $
6
Copyright (c) Kitware, Inc.
8
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
14
=========================================================================*/
15
#include "vtkSMUniformGridParallelStrategy.h"
17
#include "vtkObjectFactory.h"
18
#include "vtkSMSourceProxy.h"
19
#include "vtkSMIntVectorProperty.h"
20
#include "vtkProcessModule.h"
21
#include "vtkClientServerStream.h"
22
#include "vtkMPIMoveData.h"
24
vtkStandardNewMacro(vtkSMUniformGridParallelStrategy);
25
vtkCxxRevisionMacro(vtkSMUniformGridParallelStrategy, "$Revision: 1.5 $");
26
//----------------------------------------------------------------------------
27
vtkSMUniformGridParallelStrategy::vtkSMUniformGridParallelStrategy()
31
this->SetEnableLOD(true);
32
this->SetKeepLODPipelineUpdated(true);
35
//----------------------------------------------------------------------------
36
vtkSMUniformGridParallelStrategy::~vtkSMUniformGridParallelStrategy()
40
//----------------------------------------------------------------------------
41
void vtkSMUniformGridParallelStrategy::BeginCreateVTKObjects()
44
vtkSMSourceProxy::SafeDownCast(this->GetSubProxy("Collect"));
45
this->Collect->SetServers(vtkProcessModule::CLIENT_AND_SERVERS);
48
vtkSMSourceProxy::SafeDownCast(this->GetSubProxy("CollectLOD"));
49
this->CollectLOD->SetServers(vtkProcessModule::CLIENT_AND_SERVERS);
51
this->Superclass::BeginCreateVTKObjects();
54
//----------------------------------------------------------------------------
55
void vtkSMUniformGridParallelStrategy::EndCreateVTKObjects()
57
this->Superclass::EndCreateVTKObjects();
58
this->InitializeCollectProxy(this->Collect);
59
this->InitializeCollectProxy(this->CollectLOD);
61
vtkSMIntVectorProperty* ivp = vtkSMIntVectorProperty::SafeDownCast(
62
this->Collect->GetProperty("MoveMode"));
63
ivp->SetElement(0, vtkMPIMoveData::PASS_THROUGH);
64
this->Collect->UpdateVTKObjects();
66
// Collect filter must be told the output data type since the data may not be
67
// available on all processess.
68
ivp = vtkSMIntVectorProperty::SafeDownCast(
69
this->Collect->GetProperty("OutputDataType"));
70
ivp->SetElement(0, VTK_IMAGE_DATA);
71
this->Collect->UpdateVTKObjects();
73
// CollectLOD on the other hand is used when rendering on the client side.
74
ivp = vtkSMIntVectorProperty::SafeDownCast(
75
this->CollectLOD->GetProperty("MoveMode"));
76
ivp->SetElement(0, vtkMPIMoveData::COLLECT);
78
ivp = vtkSMIntVectorProperty::SafeDownCast(
79
this->CollectLOD->GetProperty("OutputDataType"));
80
ivp->SetElement(0, VTK_POLY_DATA);
81
this->CollectLOD->UpdateVTKObjects();
84
//----------------------------------------------------------------------------
85
void vtkSMUniformGridParallelStrategy::InitializeCollectProxy(
86
vtkSMProxy* collectProxy)
88
vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
89
vtkClientServerStream stream;
91
// Collect filter needs the socket controller use to communicate between
92
// data-server root and the client.
93
stream << vtkClientServerStream::Invoke
94
<< pm->GetProcessModuleID()
95
<< "GetSocketController"
96
<< pm->GetConnectionClientServerID(this->ConnectionID)
97
<< vtkClientServerStream::End;
98
stream << vtkClientServerStream::Invoke
99
<< collectProxy->GetID()
100
<< "SetSocketController"
101
<< vtkClientServerStream::LastResult
102
<< vtkClientServerStream::End;
103
pm->SendStream(this->ConnectionID,
104
vtkProcessModule::CLIENT_AND_SERVERS, stream);
106
// Collect filter needs the MPIMToNSocketConnection to communicate between
107
// render server and data server nodes.
108
stream << vtkClientServerStream::Invoke
109
<< collectProxy->GetID()
110
<< "SetMPIMToNSocketConnection"
111
<< pm->GetMPIMToNSocketConnectionID(this->ConnectionID)
112
<< vtkClientServerStream::End;
113
pm->SendStream(this->ConnectionID,
114
vtkProcessModule::RENDER_SERVER|vtkProcessModule::DATA_SERVER, stream);
116
// Set the server flag on the collect filter to correctly identify each
118
stream << vtkClientServerStream::Invoke
119
<< collectProxy->GetID()
120
<< "SetServerToRenderServer"
121
<< vtkClientServerStream::End;
122
pm->SendStream(this->ConnectionID, vtkProcessModule::RENDER_SERVER, stream);
123
stream << vtkClientServerStream::Invoke
124
<< collectProxy->GetID()
125
<< "SetServerToDataServer"
126
<< vtkClientServerStream::End;
127
pm->SendStream(this->ConnectionID, vtkProcessModule::DATA_SERVER, stream);
128
stream << vtkClientServerStream::Invoke
129
<< collectProxy->GetID()
130
<< "SetServerToClient"
131
<< vtkClientServerStream::End;
132
pm->SendStream(this->ConnectionID, vtkProcessModule::CLIENT, stream);
135
//----------------------------------------------------------------------------
136
void vtkSMUniformGridParallelStrategy::CreatePipeline(vtkSMSourceProxy* input,
139
this->Connect(input, this->Collect, "Input", outputport);
140
this->Superclass::CreatePipeline(this->Collect, 0);
143
//----------------------------------------------------------------------------
144
void vtkSMUniformGridParallelStrategy::CreateLODPipeline(vtkSMSourceProxy* input,
147
this->Connect(input, this->LODDecimator, "Input", outputport);
148
this->Connect(this->LODDecimator, this->CollectLOD);
149
this->Connect(this->CollectLOD, this->UpdateSuppressorLOD);
152
//----------------------------------------------------------------------------
153
void vtkSMUniformGridParallelStrategy::PrintSelf(ostream& os, vtkIndent indent)
155
this->Superclass::PrintSelf(os, indent);