~ubuntu-branches/ubuntu/karmic/paraview/karmic

« back to all changes in this revision

Viewing changes to Servers/ServerManager/vtkSMUniformGridParallelStrategy.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-06-15 22:04:41 UTC
  • Revision ID: james.westby@ubuntu.com-20080615220441-8us51vf6ra2umcov
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   ParaView
 
4
  Module:    $RCSfile: vtkSMUniformGridParallelStrategy.cxx,v $
 
5
 
 
6
  Copyright (c) Kitware, Inc.
 
7
  All rights reserved.
 
8
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
 
9
 
 
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.
 
13
 
 
14
=========================================================================*/
 
15
#include "vtkSMUniformGridParallelStrategy.h"
 
16
 
 
17
#include "vtkObjectFactory.h"
 
18
#include "vtkSMSourceProxy.h"
 
19
#include "vtkSMIntVectorProperty.h"
 
20
#include "vtkProcessModule.h"
 
21
#include "vtkClientServerStream.h"
 
22
#include "vtkMPIMoveData.h"
 
23
 
 
24
vtkStandardNewMacro(vtkSMUniformGridParallelStrategy);
 
25
vtkCxxRevisionMacro(vtkSMUniformGridParallelStrategy, "$Revision: 1.5 $");
 
26
//----------------------------------------------------------------------------
 
27
vtkSMUniformGridParallelStrategy::vtkSMUniformGridParallelStrategy()
 
28
{
 
29
  this->Collect = 0;
 
30
  this->CollectLOD = 0;
 
31
  this->SetEnableLOD(true);
 
32
  this->SetKeepLODPipelineUpdated(true);
 
33
}
 
34
 
 
35
//----------------------------------------------------------------------------
 
36
vtkSMUniformGridParallelStrategy::~vtkSMUniformGridParallelStrategy()
 
37
{
 
38
}
 
39
 
 
40
//----------------------------------------------------------------------------
 
41
void vtkSMUniformGridParallelStrategy::BeginCreateVTKObjects()
 
42
{
 
43
  this->Collect = 
 
44
    vtkSMSourceProxy::SafeDownCast(this->GetSubProxy("Collect"));
 
45
  this->Collect->SetServers(vtkProcessModule::CLIENT_AND_SERVERS);
 
46
  
 
47
  this->CollectLOD =
 
48
    vtkSMSourceProxy::SafeDownCast(this->GetSubProxy("CollectLOD"));
 
49
  this->CollectLOD->SetServers(vtkProcessModule::CLIENT_AND_SERVERS);
 
50
  
 
51
  this->Superclass::BeginCreateVTKObjects();
 
52
}
 
53
 
 
54
//----------------------------------------------------------------------------
 
55
void vtkSMUniformGridParallelStrategy::EndCreateVTKObjects()
 
56
{
 
57
  this->Superclass::EndCreateVTKObjects();
 
58
  this->InitializeCollectProxy(this->Collect);
 
59
  this->InitializeCollectProxy(this->CollectLOD);
 
60
 
 
61
  vtkSMIntVectorProperty* ivp = vtkSMIntVectorProperty::SafeDownCast(
 
62
    this->Collect->GetProperty("MoveMode"));
 
63
  ivp->SetElement(0, vtkMPIMoveData::PASS_THROUGH);
 
64
  this->Collect->UpdateVTKObjects();
 
65
 
 
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();
 
72
 
 
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);
 
77
 
 
78
  ivp = vtkSMIntVectorProperty::SafeDownCast(
 
79
    this->CollectLOD->GetProperty("OutputDataType"));
 
80
  ivp->SetElement(0, VTK_POLY_DATA);
 
81
  this->CollectLOD->UpdateVTKObjects();
 
82
}
 
83
 
 
84
//----------------------------------------------------------------------------
 
85
void vtkSMUniformGridParallelStrategy::InitializeCollectProxy(
 
86
  vtkSMProxy* collectProxy)
 
87
{
 
88
  vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
 
89
  vtkClientServerStream stream;
 
90
 
 
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);
 
105
 
 
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);
 
115
 
 
116
  // Set the server flag on the collect filter to correctly identify each
 
117
  // processes.
 
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);
 
133
}
 
134
 
 
135
//----------------------------------------------------------------------------
 
136
void vtkSMUniformGridParallelStrategy::CreatePipeline(vtkSMSourceProxy* input,
 
137
  int outputport)
 
138
{
 
139
  this->Connect(input, this->Collect, "Input", outputport);
 
140
  this->Superclass::CreatePipeline(this->Collect, 0);
 
141
}
 
142
 
 
143
//----------------------------------------------------------------------------
 
144
void vtkSMUniformGridParallelStrategy::CreateLODPipeline(vtkSMSourceProxy* input, 
 
145
  int outputport)
 
146
{
 
147
  this->Connect(input, this->LODDecimator, "Input", outputport);
 
148
  this->Connect(this->LODDecimator, this->CollectLOD);
 
149
  this->Connect(this->CollectLOD, this->UpdateSuppressorLOD);
 
150
}
 
151
 
 
152
//----------------------------------------------------------------------------
 
153
void vtkSMUniformGridParallelStrategy::PrintSelf(ostream& os, vtkIndent indent)
 
154
{
 
155
  this->Superclass::PrintSelf(os, indent);
 
156
}
 
157
 
 
158