3 #ifndef vtkPVDataDeliveryManagerInternals_h 4 #define vtkPVDataDeliveryManagerInternals_h 24 std::map<int, vtkSmartPointer<vtkDataObject>> EmptyDataObjectTypes;
33 if (iter != this->EmptyDataObjectTypes.end())
72 std::map<double, vtkRepresentedData> Data;
83 auto& store = this->Data[cacheKey];
86 store.DataObject.TakeReference(data->
NewInstance());
87 store.DataObject->ShallowCopy(data);
91 store.DataObject =
nullptr;
94 store.DeliveredDataObjects.clear();
106 this->Producer->
SetOutput(helper->GetEmptyDataObject(data));
110 store.TimeStamp = ts;
116 auto& store = this->Data[cacheKey];
117 store.ActualMemorySize = size;
122 auto iter = this->Data.find(cacheKey);
123 return iter != this->Data.end() ? iter->second.ActualMemorySize : 0;
130 const auto& store = this->Data.at(cacheKey);
131 return store.DeliveredDataObjects.at(dataKey);
133 catch (std::out_of_range&)
141 auto& store = this->Data[cacheKey];
142 store.DeliveredDataObjects[dataKey] = data;
148 vtkDataObject* cur = this->GetDeliveredDataObject(dataKey, cacheKey);
150 if (cur != prev && cur !=
nullptr)
161 auto iter = this->Data.find(cacheKey);
162 return iter != this->Data.end() ? iter->second.DataObject.GetPointer() :
nullptr;
167 auto iter = this->Data.find(cacheKey);
168 return iter != this->Data.end() ? iter->second.TimeStamp :
vtkMTimeType{ 0 };
173 auto& store = this->Data[cacheKey];
174 if (store.Information ==
nullptr)
178 return store.Information;
184 if (
auto dobj = this->GetDeliveredDataObject(dataKey, cacheKey))
186 return dobj->GetMTime();
194 typedef std::map<ReprPortType, std::pair<vtkItem, vtkItem>>
ItemsMapType;
199 vtkItem*
GetItem(
unsigned int index,
bool use_second,
int port,
bool create_if_needed =
false)
201 ReprPortType
key(index, port);
202 ItemsMapType::iterator items = this->
ItemsMap.find(key);
205 return use_second ? &(items->second.second) : &(items->second.first);
207 else if (create_if_needed)
209 std::pair<vtkItem, vtkItem>& itemsPair = this->
ItemsMap[key];
210 return use_second ? &(itemsPair.second) : &(itemsPair.first);
225 [&id](
int sum,
const ItemsMapType::value_type& item_pair) {
226 return sum + (item_pair.first.first ==
id ? 1 : 0);
232 unsigned long size = 0;
233 ItemsMapType::iterator iter;
236 const ReprPortType&
key = iter->first;
244 assert(repr !=
nullptr);
247 if (use_second_if_available && iter->second.second.GetDataObject(cacheKey))
249 size += iter->second.second.GetActualMemorySize(cacheKey);
253 size += iter->second.first.GetActualMemorySize(cacheKey);
262 return (riter != this->
RepresentationsMap.end() && riter->second.GetPointer() !=
nullptr &&
263 riter->second->GetVisibility());
271 if (ipair.first.first ==
id)
273 ipair.second.first.ClearCache();
274 ipair.second.second.ClearCache();
bool IsRepresentationVisible(unsigned int id) const
manager for data-delivery.
void SetDataObject(vtkDataObject *data, vtkInternals *helper, double cacheKey)
std::map< ReprPortType, std::pair< vtkItem, vtkItem > > ItemsMapType
RepresentationsMapType RepresentationsMap
void SetOutput(vtkDataObject *output) override
Set the data object that is "produced" by this producer.
vtkSmartPointer< vtkInformation > Information
vtkItem * GetItem(vtkPVDataRepresentation *repr, bool use_second, int port, bool create_if_needed=false)
vtkSmartPointer< vtkDataObject > DataObject
unsigned long GetVisibleDataSize(bool use_second_if_available, vtkPVDataDeliveryManager *dmgr)
vtkPVDataRepresentation adds some ParaView specific API to data representations.
void ClearCache(vtkPVDataRepresentation *repr)
vtkPVTrivialProducer * GetProducer(int dataKey, double cacheKey)
double GetCacheKey(vtkPVDataRepresentation *repr) const
void SetActualMemorySize(unsigned long size, double cacheKey)
vtkDataObject * GetOutputDataObject(int port)
static vtkSmartPointer< T > New()
vtkTypeUInt64 vtkMTimeType
vtkMTimeType ActualMemorySize
vtkMTimeType GetTimeStamp() const
vtkDataObject * GetDataObject(double cacheKey) const
unsigned int GetUniqueIdentifier()
Return 0 if the Initialize() method was not called otherwise a unique ID that will be shared across t...
vtkDataObject * NewInstance() const
specialized subclass of vtkTrivialProducer that preserves the information about the whole extent of t...
std::map< unsigned int, vtkWeakPointer< vtkPVDataRepresentation > > RepresentationsMapType
void SetDeliveredDataObject(int dataKey, double cacheKey, vtkDataObject *data)
vtkInformation * GetPieceInformation(double cacheKey)
unsigned long GetActualMemorySize(double cacheKey) const
virtual unsigned long GetActualMemorySize()
void TakeReference(vtkDataObject *t)
vtkMTimeType GetTimeStamp(double cacheKey) const
int GetNumberOfPorts(vtkPVDataRepresentation *repr)
vtkDataObject * GetDeliveredDataObject(int dataKey, double cacheKey) const
virtual int GetDataObjectType()
std::pair< unsigned int, int > ReprPortType
vtkItem * GetItem(unsigned int index, bool use_second, int port, bool create_if_needed=false)
vtkMTimeType GetDeliveryTimeStamp(int dataKey, double cacheKey) const
std::map< int, vtkSmartPointer< vtkDataObject > > DeliveredDataObjects
void ClearCache(unsigned int id)