1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkPVDataDeliveryManager
* @brief manager for data-delivery.
*
* vtkPVDataDeliveryManager manages geometry delivering for rendering. It is
* used by vtkPVRenderView to manage the delivery of geometry to the nodes where
* rendering is happening. This class helps us consolidate all the code for
* delivering different types of geometries to all the nodes involved as well we
* a managing idiosyncrasies like requiring delivering to all nodes,
* redistributing for ordered compositing, etc.
*/
#ifndef vtkPVDataDeliveryManager_h
#define vtkPVDataDeliveryManager_h
#include "vtkObject.h"
#include "vtkPVClientServerCoreRenderingModule.h" //needed for exports
#include "vtkSmartPointer.h" // needed for iVar.
#include "vtkWeakPointer.h" // needed for iVar.
class vtkAlgorithmOutput;
class vtkDataObject;
class vtkExtentTranslator;
class vtkPKdTree;
class vtkPVDataRepresentation;
class vtkPVRenderView;
#include <vector>
class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkPVDataDeliveryManager : public vtkObject
{
public:
static vtkPVDataDeliveryManager* New();
vtkTypeMacro(vtkPVDataDeliveryManager, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Returned a hash number that can be used to verify that both client and
* server side are in synch representation wise for delivery.
*/
int GetSynchronizationMagicNumber();
//@{
/**
* View uses these methods to register a representation with the storage. This
* makes it possible for representations to communicate with the storage
* directly using a self pointer, while enables views on different processes
* to communicate information about representations using their unique ids.
*/
void RegisterRepresentation(vtkPVDataRepresentation* repr);
void UnRegisterRepresentation(vtkPVDataRepresentation*);
vtkPVDataRepresentation* GetRepresentation(unsigned int);
//@}
//@{
/**
* Representations (indirectly via vtkPVRenderView::SetPiece()) call this
* method to register the geometry type they are rendering. Every
* representation that requires delivering of any geometry must register with
* the vtkPVDataDeliveryManager and never manage the delivery on its own.
*/
void SetPiece(vtkPVDataRepresentation* repr, vtkDataObject* data, bool low_res,
unsigned long trueSize = 0, int port = 0);
void SetPiece(unsigned int repr_id, vtkDataObject* data, bool low_res, int port = 0);
//@}
//@{
/**
* Provides access to the producer port for the geometry of a registered
* representation. Representations use these methods (indirectly via
* vtkPVRenderView::GetPieceProducer() and GetPieceProducerLOD()) to obtain
* the geometry producer for the geometry to be rendered.
*/
vtkAlgorithmOutput* GetProducer(vtkPVDataRepresentation*, bool low_res, int port = 0);
vtkAlgorithmOutput* GetProducer(unsigned int, bool low_res, int port = 0);
//@}
/**
* By default, this class only delivers geometries to nodes that are doing the
* rendering at a given stage. However, certain representations, such as
* data-label representation, or cube-axes representation, need to the
* geometry to be delivered to all nodes always. That can be done by using
* this method (via vtkPVRenderView::SetDeliverToAllProcesses()).
*/
void SetDeliverToAllProcesses(vtkPVDataRepresentation*, bool flag, bool low_res, int port = 0);
/**
* By default, this class only delivers geometries to nodes that are doing the
* rendering at a given stage. However, certain representations, such as
* text-source representation, need to the geometry to be delivered to the
* client as well. That can be done by using this method (via
* vtkPVRenderView::SetDeliverToAllProcesses()). The different between
* SetDeliverToAllProcesses() and this is that the former gather-and-scatters
* the data on the server nodes, while the latter will optionally gather the data to
* deliver to the client and never scatter.
*/
void SetDeliverToClientAndRenderingProcesses(vtkPVDataRepresentation*, bool deliver_to_client,
bool gather_before_delivery, bool low_res, int port = 0);
/**
* Under certain cases, e.g. when remote rendering in parallel with
* translucent geometry, the geometry may need to be redistributed to ensure
* ordered compositing can be employed correctly. Marking geometry provided by
* a representation as redistributable makes it possible for this class to
* redistribute the geometry as needed. Only vtkPolyData, vtkUnstructuredGrid
* or a multi-block comprising of vtkPolyData is currently supported.
*/
void MarkAsRedistributable(vtkPVDataRepresentation*, bool value = true, int port = 0);
/**
* Returns the size for all visible geometry. If low_res is true, and low-res
* data is not available for a particular representation, then it's high-res
* data size will be used assuming that the representation is going to render
* the high-res geometry for low-res rendering as well.
*/
unsigned long GetVisibleDataSize(bool low_res);
/**
* Provides access to the partitioning kd-tree that was generated using the
* data provided by the representations. The view uses this kd-tree to decide
* on the compositing order when ordered compositing is being used.
*/
vtkPKdTree* GetKdTree();
//@{
/**
* Get/Set the render-view. The view is not reference counted.
*/
void SetRenderView(vtkPVRenderView*);
vtkPVRenderView* GetRenderView();
//@}
/**
* Called by the view on every render when ordered compositing is to be used to
* ensure that the geometries are redistributed, as needed.
*/
void RedistributeDataForOrderedCompositing(bool use_lod);
/**
* Removes all redistributed data that may have been redistributed for ordered compositing
* earlier when using KdTree based redistribution.
*/
void ClearRedistributedData(bool use_load);
/**
* Pass the structured-meta-data for determining rendering order for ordered
* compositing.
*/
void SetOrderedCompositingInformation(vtkPVDataRepresentation* repr,
vtkExtentTranslator* translator, const int whole_extents[6], const double origin[3],
const double spacing[3], int port = 0);
/**
* Internal method used to determine the list of representations that need
* their geometry delivered. This is done on the "client" side, with the
* client decide what geometries it needs and then requests those from the
* server-sides using Deliver().
*/
bool NeedsDelivery(
vtkMTimeType timestamp, std::vector<unsigned int>& keys_to_deliver, bool use_low_res);
/**
* Triggers delivery for the geometries of indicated representations.
*/
void Deliver(int use_low_res, unsigned int size, unsigned int* keys);
// *******************************************************************
// UNDER CONSTRUCTION STREAMING API
// *******************************************************************
/**
* Mark a representation as streamable. Any representation can indicate that
* it is streamable i.e. the view can call streaming passses on it and it will
* deliver data incrementally.
*/
void SetStreamable(vtkPVDataRepresentation*, bool, int port = 0);
//@{
/**
* Passes the current streamed piece. This is the piece that will be delivered
* to the rendering node.
*/
void SetNextStreamedPiece(vtkPVDataRepresentation* repr, vtkDataObject* piece, int port = 0);
vtkDataObject* GetCurrentStreamedPiece(vtkPVDataRepresentation* repr, int port = 0);
void ClearStreamedPieces();
//@}
/**
* Deliver streamed pieces. Unlike regular data, streamed pieces are delivered
* and released. Representations are expected to manage the pieces once they
* are delivered to them.
*/
void DeliverStreamedPieces(unsigned int size, unsigned int* keys);
/**
* Fills up the vector with the keys for representations that have non-null
* streaming pieces.
*/
bool GetRepresentationsReadyToStreamPieces(std::vector<unsigned int>& keys);
// *******************************************************************
protected:
vtkPVDataDeliveryManager();
~vtkPVDataDeliveryManager();
vtkWeakPointer<vtkPVRenderView> RenderView;
vtkSmartPointer<vtkPKdTree> KdTree;
vtkTimeStamp RedistributionTimeStamp;
private:
vtkPVDataDeliveryManager(const vtkPVDataDeliveryManager&) VTK_DELETE_FUNCTION;
void operator=(const vtkPVDataDeliveryManager&) VTK_DELETE_FUNCTION;
class vtkInternals;
vtkInternals* Internals;
};
#endif
// VTK-HeaderTest-Exclude: vtkPVDataDeliveryManager.h
|