SENSEI
A frame work for generic in situ analytics
sensei::SVTKUtils Namespace Reference

A collection of generally useful funcitons implementing common access patterns or operations on SVTK data structures. More...

Classes

class  SVTKObjectFactory
 Constructs SVTK objects from VTK objects enabling the consumption of the output of VTK filters and ParaView Catalyst. More...
 
class  VTKObjectFactory
 Constructs VTK objects from SVTK objects enabling the use of VTK filters and ParaView Catalyst on SVTK data. More...
 

Typedefs

using BinaryDatasetFunction = std::function< int(svtkDataSet *, svtkDataSet *)>
 A callback that processes input and output datasets. More...
 
using DatasetFunction = std::function< int(svtkDataSet *)>
 A callback that processes input and output datasets return 0 for success, > zero to stop without error, < zero to stop with error. More...
 

Functions

template<typename SVTK_TT >
SVTK_TT * GetPointer (svtkDataArray *da)
 given a svtkDataArray get a pointer to underlying data this handles access from SVTK's AOS and SOA layouts. More...
 
SENSEI_EXPORT unsigned int Size (int svtkt)
 given a SVTK type enum returns the sizeof that type More...
 
SENSEI_EXPORT int IsLegacyDataObject (int code)
 given a SVTK data object enum returns true if it a legacy object More...
 
SENSEI_EXPORT svtkDataObject * NewDataObject (int code)
 givne a SVTK data object enum constructs an instance More...
 
SENSEI_EXPORT int GetAssociation (std::string assocStr, int &assoc)
 returns the enum value given an association name. More...
 
SENSEI_EXPORT const char * GetAttributesName (int association)
 returns the name of the association, point, cell or field More...
 
SENSEI_EXPORT svtkFieldData * GetAttributes (svtkDataSet *dobj, int association)
 returns the container for the associations: svtkPointData, svtkCellData, or svtkFieldData More...
 
SENSEI_EXPORT int Apply (svtkDataObject *input, svtkDataObject *output, BinaryDatasetFunction &func)
 Applies the function to leaves of the structurally equivalent input and output data objects. More...
 
SENSEI_EXPORT int Apply (svtkDataObject *dobj, DatasetFunction &func)
 Applies the function to the data object. More...
 
SENSEI_EXPORT int SetGhostLayerMetadata (svtkDataObject *mesh, int nGhostCellLayers, int nGhostNodeLayers)
 Store ghost layer metadata in the mesh. More...
 
SENSEI_EXPORT int GetGhostLayerMetadata (svtkDataObject *mesh, int &nGhostCellLayers, int &nGhostNodeLayers)
 Retreive ghost layer metadata from the mesh. More...
 
SENSEI_EXPORT int GetMetadata (MPI_Comm comm, svtkDataSet *ds, MeshMetadataPtr)
 
SENSEI_EXPORT int GetMetadata (MPI_Comm comm, svtkCompositeDataSet *cd, MeshMetadataPtr)
 
SENSEI_EXPORT svtkCompositeDataSetPtr AsCompositeData (MPI_Comm comm, svtkDataObject *dobj, bool take=true)
 Given a data object ensure that it is a composite data set If it already is, then the call is a no-op, if it is not then it is converted to a multiblock. More...
 
bool AMR (const MeshMetadataPtr &md)
 Return true if the mesh or block type is AMR. More...
 
bool Structured (const MeshMetadataPtr &md)
 Return true if the mesh or block type is logically Cartesian. More...
 
bool Polydata (const MeshMetadataPtr &md)
 Return true if the mesh or block type is polydata. More...
 
bool Unstructured (const MeshMetadataPtr &md)
 Return true if the mesh or block type is unstructured. More...
 
bool StretchedCartesian (const MeshMetadataPtr &md)
 Return true if the mesh or block type is stretched Cartesian. More...
 
bool UniformCartesian (const MeshMetadataPtr &md)
 Return true if the mesh or block type is uniform Cartesian. More...
 
bool LogicallyCartesian (const MeshMetadataPtr &md)
 Return true if the mesh or block type is logically Cartesian. More...
 
SENSEI_EXPORT int WriteDomainDecomp (MPI_Comm comm, const sensei::MeshMetadataPtr &md, const std::string fileName)
 
SENSEI_EXPORT int WriteVTK (const char *fn, long npx, long npy, long npz, double x0, double y0, double z0, double dx, double dy, double dz, const std::vector< svtkDataArray *> &cellData, const std::vector< svtkDataArray *> &pointData)
 Write an svtkImageData data set to disk in a VTK compatible binary format. More...
 
template<typename SVTK_TT , typename ARRAY_TT = svtkAOSDataArrayTemplate<SVTK_TT>>
void PackCells (ARRAY_TT *coIn, ARRAY_TT *ccIn, ARRAY_TT *coOut, ARRAY_TT *ccOut, size_t &coId, size_t &ccId)
 Packs data from a cell array into another cell array keeping track of where to insert into the output array. More...
 
template<typename SVTK_TT , typename ARRAY_TT = svtkAOSDataArrayTemplate<SVTK_TT>>
void UnpackCells (size_t nc, ARRAY_TT *coIn, ARRAY_TT *ccIn, svtkCellArray *caOut, size_t &coId, size_t &ccId)
 deserializes a buffer made by SVTKUtils::PackCells. More...
 

Detailed Description

A collection of generally useful funcitons implementing common access patterns or operations on SVTK data structures.

Typedef Documentation

◆ BinaryDatasetFunction

using sensei::SVTKUtils::BinaryDatasetFunction = typedef std::function<int(svtkDataSet*, svtkDataSet*)>

A callback that processes input and output datasets.

return 0 for success, > zero to stop without error, < zero to stop with error

◆ DatasetFunction

using sensei::SVTKUtils::DatasetFunction = typedef std::function<int(svtkDataSet*)>

A callback that processes input and output datasets return 0 for success, > zero to stop without error, < zero to stop with error.

Function Documentation

◆ AMR()

bool sensei::SVTKUtils::AMR ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is AMR.

◆ Apply() [1/2]

SENSEI_EXPORT int sensei::SVTKUtils::Apply ( svtkDataObject *  input,
svtkDataObject *  output,
BinaryDatasetFunction func 
)

Applies the function to leaves of the structurally equivalent input and output data objects.

◆ Apply() [2/2]

SENSEI_EXPORT int sensei::SVTKUtils::Apply ( svtkDataObject *  dobj,
DatasetFunction func 
)

Applies the function to the data object.

The function is called once for each leaf dataset

◆ AsCompositeData()

SENSEI_EXPORT svtkCompositeDataSetPtr sensei::SVTKUtils::AsCompositeData ( MPI_Comm  comm,
svtkDataObject *  dobj,
bool  take = true 
)

Given a data object ensure that it is a composite data set If it already is, then the call is a no-op, if it is not then it is converted to a multiblock.

The flag take determines if the smart pointer takes ownership or adds a reference.

◆ GetAssociation()

SENSEI_EXPORT int sensei::SVTKUtils::GetAssociation ( std::string  assocStr,
int &  assoc 
)

returns the enum value given an association name.

where name can be one of: point, cell or, field

◆ GetAttributes()

SENSEI_EXPORT svtkFieldData* sensei::SVTKUtils::GetAttributes ( svtkDataSet *  dobj,
int  association 
)

returns the container for the associations: svtkPointData, svtkCellData, or svtkFieldData

◆ GetAttributesName()

SENSEI_EXPORT const char* sensei::SVTKUtils::GetAttributesName ( int  association)

returns the name of the association, point, cell or field

◆ GetGhostLayerMetadata()

SENSEI_EXPORT int sensei::SVTKUtils::GetGhostLayerMetadata ( svtkDataObject *  mesh,
int &  nGhostCellLayers,
int &  nGhostNodeLayers 
)

Retreive ghost layer metadata from the mesh.

returns non-zero if no such metadata is found.

◆ GetPointer()

template<typename SVTK_TT >
SVTK_TT* sensei::SVTKUtils::GetPointer ( svtkDataArray da)

given a svtkDataArray get a pointer to underlying data this handles access from SVTK's AOS and SOA layouts.

For SOA layout only single component arrays should be passed.

◆ IsLegacyDataObject()

SENSEI_EXPORT int sensei::SVTKUtils::IsLegacyDataObject ( int  code)

given a SVTK data object enum returns true if it a legacy object

◆ LogicallyCartesian()

bool sensei::SVTKUtils::LogicallyCartesian ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is logically Cartesian.

◆ NewDataObject()

SENSEI_EXPORT svtkDataObject* sensei::SVTKUtils::NewDataObject ( int  code)

givne a SVTK data object enum constructs an instance

◆ PackCells()

template<typename SVTK_TT , typename ARRAY_TT = svtkAOSDataArrayTemplate<SVTK_TT>>
void sensei::SVTKUtils::PackCells ( ARRAY_TT *  coIn,
ARRAY_TT *  ccIn,
ARRAY_TT *  coOut,
ARRAY_TT *  ccOut,
size_t &  coId,
size_t &  ccId 
)

Packs data from a cell array into another cell array keeping track of where to insert into the output array.

Use it to serialze verys, lines, polys strips form a polytdata into a single cell array for transport

◆ Polydata()

bool sensei::SVTKUtils::Polydata ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is polydata.

◆ SetGhostLayerMetadata()

SENSEI_EXPORT int sensei::SVTKUtils::SetGhostLayerMetadata ( svtkDataObject *  mesh,
int  nGhostCellLayers,
int  nGhostNodeLayers 
)

Store ghost layer metadata in the mesh.

◆ Size()

SENSEI_EXPORT unsigned int sensei::SVTKUtils::Size ( int  svtkt)

given a SVTK type enum returns the sizeof that type

◆ StretchedCartesian()

bool sensei::SVTKUtils::StretchedCartesian ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is stretched Cartesian.

◆ Structured()

bool sensei::SVTKUtils::Structured ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is logically Cartesian.

◆ UniformCartesian()

bool sensei::SVTKUtils::UniformCartesian ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is uniform Cartesian.

◆ UnpackCells()

template<typename SVTK_TT , typename ARRAY_TT = svtkAOSDataArrayTemplate<SVTK_TT>>
void sensei::SVTKUtils::UnpackCells ( size_t  nc,
ARRAY_TT *  coIn,
ARRAY_TT *  ccIn,
svtkCellArray *  caOut,
size_t &  coId,
size_t &  ccId 
)

deserializes a buffer made by SVTKUtils::PackCells.

◆ Unstructured()

bool sensei::SVTKUtils::Unstructured ( const MeshMetadataPtr &  md)
inline

Return true if the mesh or block type is unstructured.

◆ WriteVTK()

SENSEI_EXPORT int sensei::SVTKUtils::WriteVTK ( const char *  fn,
long  npx,
long  npy,
long  npz,
double  x0,
double  y0,
double  z0,
double  dx,
double  dy,
double  dz,
const std::vector< svtkDataArray *> &  cellData,
const std::vector< svtkDataArray *> &  pointData 
)

Write an svtkImageData data set to disk in a VTK compatible binary format.

This format can be read by ParaView and VisIt amoung others. This implementation does not depend on VTK iteself and can be used when VTK is not present in the build.

Parameters
[in]fnthe name of the file to write
[in]npxthe number of points in the x-dimension
[in]npythe number of points in the y-dimension
[in]npzthe number of points in the z-dimension
[in]x0the origin in the x-dimension
[in]y0the origin in the y-dimension
[in]z0the origin in the x-dimension
[in]dxthe grid spacing in the x-dimension
[in]dythe grid spacing in the y-dimension
[in]dzthe grid spacing in the z-dimension
[in]cellDataa vector of cell centered arrays to write
[in]pointDataa vector of point centered arrays to write
Returns
0 if successful