SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A VTK source for exposing smtk resources. More...
#include <vtkResourceMultiBlockSource.h>
Classes | |
struct | BlockId |
Block Ids for the primary blocks that comprise the output. More... | |
struct | CacheEntry |
Cache entries hold VTK data and a sequence number for a given UUID. More... | |
Public Types | |
typedef vtkMultiBlockDataSetAlgorithm | Superclass |
using | UUID = smtk::common::UUID |
using | SequenceType = int |
Sequence numbers are integers describing how recent a given component's data is. | |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkResourceMultiBlockSource * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
vtkResourceMultiBlockSource (const vtkResourceMultiBlockSource &)=delete | |
vtkResourceMultiBlockSource & | operator= (const vtkResourceMultiBlockSource &)=delete |
smtk::resource::ComponentPtr | GetComponent (vtkInformation *) |
smtk::resource::ResourcePtr | GetResource () |
void | SetResource (const smtk::resource::ResourcePtr &) |
vtkMTimeType | GetMTime () override |
We are modified by updated parameters and by updated resource geometry. | |
bool | SetCachedData (const UUID &uid, vtkDataObject *data, SequenceType sequenceNumber) |
Given a UUID and a data object, insert it into the cache, overwriting any pre-existing entry. More... | |
SequenceType | GetCachedDataSequenceNumber (const UUID &uid) const |
Fetch a cache entry's sequence number. | |
vtkDataObject * | GetCachedDataObject (const UUID &uid) |
Fetch a cache entry's data. | |
bool | RemoveCacheEntry (const UUID &uid) |
Remove a single cache entry. More... | |
bool | RemoveCacheEntriesExcept (const std::set< UUID > &exceptions) |
Remove cache entries not listed in the provided set. | |
void | ClearCache () |
Remove all cache entries (releasing their VTK data objects). | |
int | RequestData (vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkResourceMultiBlockSource * | SafeDownCast (vtkObjectBase *o) |
static vtkResourceMultiBlockSource * | New () |
static vtkInformationStringKey * | COMPONENT_ID () |
Key used to put entity UUID in the meta-data associated with a block. | |
static void | SetDataObjectUUID (vtkInformation *, const UUID &) |
Set the COMPONENT_ID key on the given information object to a given UUID. | |
static UUID | GetDataObjectUUID (vtkInformation *) |
Return a UUID for the data object. | |
static void | SetResourceId (vtkMultiBlockDataSet *dataset, const UUID &) |
Store the resource UUID in the output dataset's top-level block metadata. | |
static UUID | GetResourceId (vtkMultiBlockDataSet *dataset) |
Fetch the resource UUID from a dataset's top-level block metadata. | |
static smtk::resource::ComponentPtr | GetComponent (const smtk::resource::ResourcePtr &, vtkInformation *) |
Return the component corresponding to the data object. | |
static void | DumpBlockStructureWithUUIDs (vtkMultiBlockDataSet *dataset, int indent=0) |
A debug utility to print out the block structure of a multiblock dataset annotated with UUIDs (where present) and data type. | |
static void | DumpBlockStructureWithUUIDsInternal (vtkMultiBlockDataSet *dataset, int &counter, int indent=0) |
Static Public Attributes | |
constexpr static SequenceType | InvalidSequence = -1 |
Reserve a special value for invalid (non-existent) sequence numbers. | |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
int | RequestDataFromGeometry (vtkInformation *request, vtkInformationVector *outputData, const smtk::extension::vtk::geometry::Geometry &provider) |
If any subclass determines that the resource has an appropriate geometry provider, it can call this method for the body of its RequestData() implementation. | |
Protected Attributes | |
std::weak_ptr< smtk::resource::Resource > | Resource |
std::map< UUID, CacheEntry > | Cache |
std::set< UUID > | Visited |
smtk::geometry::Geometry::GenerationNumber | LastModified { 0 } |
A VTK source for exposing smtk resources.
This filter generates a vtkMultiBlockDataSet with the following structure:
Block <Components>: a vtkMultiBlockDataSet where each block represents a component in the resource. Block <Prototypes>: a vtkMultiBlockDataSet where each block represents a component that is to be used as a prototype for a glyph. Block <Instances>: a vtkMultiBlockDataSet where each block is a vtkPolyData containing the points at which the prototypes should be placed.
This class provides methods to cache blocks so that resource-specific subclasses need only regenerate data for modified components.
bool vtkResourceMultiBlockSource::RemoveCacheEntry | ( | const UUID & | uid | ) |
Remove a single cache entry.
Note that this effectively resets the sequence numbers for uid.
This method returns true when the cache was modified.
bool vtkResourceMultiBlockSource::SetCachedData | ( | const UUID & | uid, |
vtkDataObject * | data, | ||
SequenceType | sequenceNumber | ||
) |
Given a UUID and a data object, insert it into the cache, overwriting any pre-existing entry.
The sequenceNumber specifies how recent the provided data object is. If a more recent (larger) sequenceNumber number is in the map, this method does nothing and returns false. This method returns true when the cache is modified.