CDPDataProvider

Functions

~CDPDataProvider

bool

init

void

close

bool

getMetaData

bool

getGeometry

bool

getSet

bool

getResult

bool

getRigidBodyTransformations

bool

getElementVisibilityResult

void

pollForChanges

bool

handleClientRequest

Detailed Description

class CDPDataProvider

CDPDataProvider is the base class for data providers that can be used in both desktop and cloud products from Ceetron.

A data provider acts as a data source for a Ceetron cloud/desktop based host application. It allows for reading or otherwise providing data in an unified way. The host application does not need any special handling per data provider (or other built-in readers).

In addition to providing data for visualization, the data provider also supports communicating updated data to the host application. This is done via the pollForChanges() method and any change is communicated back to the host application via the CDPChangeNotifications interface.

Public Functions

inline virtual ~CDPDataProvider()
virtual bool init(const CDPString &modelKey, const CDPInitOptions &initOptions, CDPError *error) = 0

Initializes the provider with the given model key and prepare to provide meta data.

The first call to the provider after it was created is init(). In this method you should prepare to return meta data and also validate if this is actually a supported model.

init is only called if the corresponding CDPDataProviderFactory responded positive to the CDPDataProviderFactory::isSupportedByProvider() call.

The initOptions contains the user defined options for this provider. You should at least support the options that are published in the CDPDataProviderInfo delivered from your factory.

The error object can be used to communicate an error message back to the host app

virtual void close() = 0

This method is called by the host when the data provider is no longer needed.

Release any resources allocated by this instance

virtual bool getMetaData(CDPMetaData *metaData) = 0

Provides the meta data (model/simulation content) for the current model.

The meta data is a description of the contents of the model/simulation. It contains information about the geometry (number of geometries, names and ids of each part), states, results (scalar, vector, tensor, displacement), rigid body results and sets.

The minimum requirement to provide is one state using the CDPMetaData::addStateInfo().

getMetaData() is always called once after init(). It will also be called if using pollForChanges() or handleClientRequest() and you call notifyTriggerNewGetMetaData().

virtual bool getGeometry(const CDPGeometrySpec &spec, CDPGeometry *geometry) = 0

Provides the geometry for the given spec (geometry index and state id).

A model can consist of 1 or more geometries per state. If the model is partly adaptive or there are other reason to split the model into multiple geometries then you can have any number of geometries per state.

If the model is remeshed/adaptive, you can provide a different geometry for each state.

The normal case is to have one geometry that is non-adaptive.

There are some restrictions regarding geometries:

  1. The number of geometries must be the same in all states. The number of geometries is specified by the number of geometry infos that are added to the CDPMetaData.

  2. A geometry is either constant for all states, or adaptive in all states. This is specified by the CDPGeometryInfo::setHasAdaptiveGeometry() method. Default is false.

The host will only call getGeometry() whenever a new geometry is needed. So in the normal case (non-adaptive, single geometry) this method will only be called once.

Note

Data providers support displacements, so there is no need to create adaptive geometries if the topology of the part is constant, and only the nodes are moved/displaced. You only need adaptive geometries when the number of elements changes between states.

virtual bool getSet(cdp_int_t setId, CDPSet *set) = 0

Provides the items of the set with the given id.

Populate the provided set with the contents of the given set.

The available sets are specified in CDPMetaData.

Note

Currently only element sets are supported.

virtual bool getResult(const CDPResultSpec &spec, CDPResult *result) = 0

Provides the result based on the given spec.

Populate the result with the results corresponding to the given spec. This can be scalar, vector, displacement, stress- and strain tensors results.

The type, id, name and result mapping is specified in the CDPMetaData in the CDPResultInfo object.

virtual bool getRigidBodyTransformations(cdp_size_t geometryIndex, cdp_int_t stateId, CDPTransformations *transformations) = 0

Provides the rigid body transformation result for the given geometry and state.

Rigid body transformation results are one transformation matrix (4*4) per element group.

virtual bool getElementVisibilityResult(cdp_size_t geometryIndex, cdp_int_t stateId, CDPVisibilityResult *result) = 0

Provides the element visibility result for the given geometry and state.

Visibility result is a result with a boolean per element per state specifying if the element is visible or not in the given state.

This is useful for analysis that have eroded or deleted elements as a cheap way of supporting remeshing. This is much more efficient that providing a new geometry per state.

virtual void pollForChanges(CDPChangeNotifications *changeNotifications) = 0

Allows the provider to communicate changes/updates to the host.

If polling is enable in the host application, this method will be called at regular intervals to allow the data provider to communicate any changes to the host. Any changes to what the data provider can deliver is communicated back to the host application via the CDPChangeNotifications interface. This interface allows for update of result and geometry and for addition or deletion of states and results.

The change notifications will be handled by the host app, and any new data needed by the app will trigger subsequent calls to the data provider (e.g. a getResults() call if notifyResultChanged was used).

There is one limitation to the updates that can happen. The setup of the geometry (number of geometries and the resulting number of parts per geometry) must be constant. However, the contents of the geometry might change, so the number of elements or number of nodes can change.

virtual bool handleClientRequest(const CDPClientRequest &request, CDPClientResponse *response, CDPChangeNotifications *changeNotifications) = 0

Processes a request from the client (EnvisionWeb client or EnvisionDesktop host application).

The client (web or desktop) can send a request to the data provider. The content of the request and the response is entirely up to the user and not used by EnvisionDesktop/EnvisionWeb in any way.

This request could be a query for information not passed through the DP API, it could be a command to modify the data or a command to do some other changes in the data provider. It is entirely up to the user of EnvisionDesktop/EnvisionWeb to define this behavior.

A request contains a message and some data (CDPClientRequest). Based on this request the data provider will respond with some data (CDPClientResponse) that will be sent to the client. There is also an option to notify the host (server) and client that the data provided have changed (CDPChangeNotifications). This is similar to pollForChanges().