SENSEI
A frame work for generic in situ analytics
sensei::SVTKDataAdaptor Class Reference

A sensei::DataAdaptor for a svtkDataObject. More...

#include <SVTKDataAdaptor.h>

Inheritance diagram for sensei::SVTKDataAdaptor:
[legend]
Collaboration diagram for sensei::SVTKDataAdaptor:
[legend]

Public Member Functions

 senseiTypeMacro (SVTKDataAdaptor, DataAdaptor)
 
void SetDataObject (const std::string &meshName, svtkDataObject *mesh)
 Set the data object for current timestep. More...
 
int GetDataObject (const std::string &meshName, svtkDataObject *&dobj)
 Get the data object for the current time step. More...
 
int GetNumberOfMeshes (unsigned int &numMeshes) override
 Gets the number of meshes a simulation can provide. More...
 
int GetMeshMetadata (unsigned int id, MeshMetadataPtr &metadata) override
 Get metadata of the i'th mesh. More...
 
int GetMesh (const std::string &meshName, bool structure_only, svtkDataObject *&mesh) override
 Fetches the requested data object from the simulation. More...
 
int AddArray (svtkDataObject *mesh, const std::string &meshName, int association, const std::string &arrayName) override
 Fetches the named array from the simulation and adds it to the passed mesh. More...
 
int ReleaseData () override
 Release data allocated for the current timestep. More...
 
- Public Member Functions inherited from sensei::DataAdaptor
 senseiBaseTypeMacro (DataAdaptor, svtkObjectBase)
 
void PrintSelf (ostream &os, svtkIndent indent) override
 Prints the current state of the adaptor. More...
 
virtual int SetCommunicator (MPI_Comm comm)
 Set the communicator used by the adaptor. More...
 
MPI_Comm GetCommunicator ()
 Get the communicator used by the adaptor. More...
 
virtual int AddGhostNodesArray (svtkDataObject *mesh, const std::string &meshName)
 Adds ghost nodes on the specified mesh. More...
 
virtual int AddGhostCellsArray (svtkDataObject *mesh, const std::string &meshName)
 Adds ghost cells on the specified mesh. More...
 
virtual int AddArrays (svtkDataObject *mesh, const std::string &meshName, int association, const std::vector< std::string > &arrayNames)
 Fetches multiple arrays from the simulation and adds them to the mesh. More...
 
virtual double GetDataTime ()
 Get the current simulated time. More...
 
virtual void SetDataTime (double time)
 Set the current simulated time. More...
 
virtual long GetDataTimeStep ()
 Get the current time step. More...
 
virtual void SetDataTimeStep (long index)
 Set the current simulated time step. More...
 

Static Public Member Functions

static SVTKDataAdaptorNew ()
 

Additional Inherited Members

- Protected Member Functions inherited from sensei::DataAdaptor
 DataAdaptor (const DataAdaptor &)=delete
 
void operator= (const DataAdaptor &)=delete
 
- Protected Attributes inherited from sensei::DataAdaptor
InternalsType * Internals
 
MPI_Comm Comm
 

Detailed Description

A sensei::DataAdaptor for a svtkDataObject.

To use this data adaptor for codes that produce a svtkDataObject natively. Once simply passes the svtkDataObject instance to this class and one then connect it to the sensei::AnalysisAdators.

If the DataObject is a composite-dataset, the first non-null block on the current rank is assumed to the representative block for answering all queries.

Member Function Documentation

◆ AddArray()

int sensei::SVTKDataAdaptor::AddArray ( svtkDataObject *  mesh,
const std::string &  meshName,
int  association,
const std::string &  arrayName 
)
overridevirtual

Fetches the named array from the simulation and adds it to the passed mesh.

Implementers should pass the data by zero copy when possible. See svtkAOSDataArrayTemplate and svtkSOADataArrayTemplate for details of passing data zero copy.

Parameters
[in]meshthe VTK object returned from GetMesh
[in]meshNamethe name of the mesh on which the array is stored
[in]associationfield association; one of svtkDataObject::FieldAssociations or svtkDataObject::AttributeTypes.
[in]arrayNamename of the array
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetDataObject()

int sensei::SVTKDataAdaptor::GetDataObject ( const std::string &  meshName,
svtkDataObject *&  dobj 
)

Get the data object for the current time step.

This method returns the mesh associated with the passed in name. It returns zero if the mesh is present and non-zero if it is not.

Parameters
[in]meshNamethe name of the mesh to get
[out]mesha reference to store a pointer to the named mesh
Returns
zero if the named mesh is present, non zero if it was not

◆ GetMesh()

int sensei::SVTKDataAdaptor::GetMesh ( const std::string &  meshName,
bool  structureOnly,
svtkDataObject *&  mesh 
)
overridevirtual

Fetches the requested data object from the simulation.

This method will return a svtkDataObject containing the simulation state. Implementers should prefer svtkMultiBlockData over svtkDataSet types. However, both approaches are supported. Callers should typically pass structureOnly to false. Caller may set stuctureOnly to true when data arrays without mesh geometry and connectivity are sufficient for processing. If structureOnly is set to true, then implementers should not populate the mesh geometry and connectivity information. This can result in large savings in data transfer.

Note
Callers are to take ownership of the newly allocated mesh and must Delete the returned mesh when finished to prevent a memory leak.
Parameters
[in]meshNamethe name of the mesh to access (see GetMeshMetadata)
[in]structureOnlyWhen set to true the returned mesh may not have any geometry or topology information.
[out]mesha reference to a pointer where a new VTK object is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetMeshMetadata()

int sensei::SVTKDataAdaptor::GetMeshMetadata ( unsigned int  id,
MeshMetadataPtr &  metadata 
)
overridevirtual

Get metadata of the i'th mesh.

The caller passes the integer id of the mesh for which the metadata is desired, and a pointer to a MeshMetadata instance where the metadata is stored.

Parameters
[in]idindex of the mesh to access
[out]metadataa pointer to instance where metadata is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetNumberOfMeshes()

int sensei::SVTKDataAdaptor::GetNumberOfMeshes ( unsigned int &  numMeshes)
overridevirtual

Gets the number of meshes a simulation can provide.

The caller passes a reference to an integer variable in the first argument upon return this variable contains the number of meshes the simulation can provide. If successfull the method returns 0, a non-zero return indicates an error occurred.

Parameters
[out]numMeshesan integer variable where number of meshes is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ ReleaseData()

int sensei::SVTKDataAdaptor::ReleaseData ( )
overridevirtual

Release data allocated for the current timestep.

This method allows implementers to free resources that were used in the conversion of the simulation data. However, note that callers of GetMesh must Delete the returned svtkDataObject which typically alleviates the need for the adaptor to hold references to the returned data. In most cases this method should not be overridden.

Note
The instrumentation (or bridge) code must call this method when done processing a time step to ensure that all resources are released. Analysis adaptors should not call this method.
Returns
zero if successful, non zero if an error occurred

Reimplemented from sensei::DataAdaptor.

◆ SetDataObject()

void sensei::SVTKDataAdaptor::SetDataObject ( const std::string &  meshName,
svtkDataObject *  mesh 
)

Set the data object for current timestep.

This method must be called to the set the data object for the current timestep.

Parameters
[in]meshNamename of the mesh represented in the object
[in]meshthe mesh or nullptr if this rank has no data

The documentation for this class was generated from the following file: