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

Bins a set of arrays onto a user defined uniform Cartesian mesh. More...

#include <DataBinning.h>

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

Public Types

enum  {
  INVALID_OP, BIN_SUM, BIN_AVG, BIN_MIN,
  BIN_MAX
}
 The supported binning operations. More...
 
- Public Types inherited from sensei::AnalysisAdaptor
enum  { DEVICE_HOST =-1, DEVICE_AUTO =-2 }
 values controling device selection More...
 

Public Member Functions

 senseiTypeMacro (DataBinning, AnalysisAdaptor)
 
void SetAsynchronous (int val) override
 When set binning runs in a thread and ::Execute returns immediately. More...
 
int Initialize (const std::string &meshName, const std::string &xAxisArray, const std::string &yAxisArray, const std::vector< std::string > &binnedArray, const std::vector< std::string > &operation, long xres, long yres, const std::string &outDir, int returnData, int maxThreads)
 set the name of the mesh and arrays to request from the simulation. More...
 
int Initialize (pugi::xml_node node)
 Initialize from XML Input mesh, coordinate axis arrays, grid resolution, and output path are specified as attributes. More...
 
bool Execute (DataAdaptor *data, DataAdaptor **) override
 compute the histogram for this time step More...
 
int Finalize () override
 finalize the run More...
 
- Public Member Functions inherited from sensei::AnalysisAdaptor
 senseiBaseTypeMacro (AnalysisAdaptor, svtkObjectBase)
 
void PrintSelf (ostream &os, svtkIndent indent) override
 Prints the current state of the adaptor. More...
 
virtual int SetCommunicator (MPI_Comm comm)
 Set the MPI communicator to be used by the adaptor. More...
 
MPI_Comm GetCommunicator ()
 returns the MPI communicator to be used for all communication More...
 
virtual void SetVerbose (int val)
 Set the level of verbosity of console output. More...
 
virtual int GetVerbose ()
 Get the level of verbosity of console output. More...
 
virtual int GetAsynchronous ()
 Get asynchronous mode. More...
 
virtual void SetDeviceId (int val)
 Set the device that the analysis should run on. More...
 
virtual int GetDeviceId ()
 Get the device that the analysis should run on. More...
 
virtual void SetDevicesToUse (int val)
 Set the number of devices to use per node. More...
 
virtual int GetDevicesToUse ()
 Get the number of devices to use per node. More...
 
virtual void SetDeviceStart (int val)
 Set the first on node device to use in automatic device selection. More...
 
virtual int GetDeviceStart ()
 Get the first device to use. More...
 
virtual void SetDeviceStride (int val)
 Set the number of devices to skip in automatic device selection. More...
 
virtual int GetDeviceStride ()
 Get the number of devices to skip. More...
 

Static Public Member Functions

static DataBinningNew ()
 allocates a new instance More...
 
static int GetOperation (const std::string &opName, int &opCode)
 converts the string to the corresponding enumeration. More...
 
static int GetOperation (int opCode, std::string &opName)
 converts the enumeration to a string More...
 

Protected Member Functions

 DataBinning (const DataBinning &)=delete
 
void operator= (const DataBinning &)=delete
 
void InitializeThreads ()
 
int WaitThreads ()
 
- Protected Member Functions inherited from sensei::AnalysisAdaptor
 AnalysisAdaptor (const AnalysisAdaptor &)=delete
 
void operator= (const AnalysisAdaptor &)=delete
 

Protected Attributes

long XRes
 
long YRes
 
std::string OutDir
 
unsigned long Iteration
 
double AxisFactor
 
std::string MeshName
 
std::string XAxisArray
 
std::string YAxisArray
 
std::vector< std::string > BinnedArray
 
std::vector< int > Operation
 
int ReturnData
 
int MaxThreads
 
std::vector< std::future< int > > Threads
 
std::vector< MPI_Comm > ThreadComm
 
- Protected Attributes inherited from sensei::AnalysisAdaptor
MPI_Comm Comm
 
int Verbose
 
int DeviceId
 
int DevicesPerNode
 
int DevicesToUse
 
int DeviceStart
 
int DeviceStride
 
int Asynchronous
 

Detailed Description

Bins a set of arrays onto a user defined uniform Cartesian mesh.

The binning operations supported are: min, max, and sum. A count is always computed. From count and sum bin averages can be obtained. At each time step the results are stored on disk in VTK format. Binning can be used to compute phase space plots or visualize particle data using mesh based visualization techniques.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The supported binning operations.

Member Function Documentation

◆ Execute()

bool sensei::DataBinning::Execute ( DataAdaptor data,
DataAdaptor **   
)
overridevirtual

compute the histogram for this time step

Implements sensei::AnalysisAdaptor.

◆ Finalize()

int sensei::DataBinning::Finalize ( )
overridevirtual

finalize the run

Reimplemented from sensei::AnalysisAdaptor.

◆ GetOperation() [1/2]

static int sensei::DataBinning::GetOperation ( const std::string &  opName,
int &  opCode 
)
static

converts the string to the corresponding enumeration.

Parameters
[in]opNamestring naming the operation(one of: "sum", "avg", "min", "max")
[out]opCodethe enumerated value
Returns
zero if successful

◆ GetOperation() [2/2]

static int sensei::DataBinning::GetOperation ( int  opCode,
std::string &  opName 
)
static

converts the enumeration to a string

Parameters
[in]opCodethe enumerated value(one of: BIN_SUM, BIN_AVG, BIN_MIN, BIN_MAX)
[out]opNamestring naming the operation
Returns
zero if successful

◆ Initialize() [1/2]

int sensei::DataBinning::Initialize ( const std::string &  meshName,
const std::string &  xAxisArray,
const std::string &  yAxisArray,
const std::vector< std::string > &  binnedArray,
const std::vector< std::string > &  operation,
long  xres,
long  yres,
const std::string &  outDir,
int  returnData,
int  maxThreads 
)

set the name of the mesh and arrays to request from the simulation.

Sets the output image resolution and the name of a file to write them in. the substring t% is replaced with the current simulation time step. if one of resx or resy is -1 it is calculated from the data's aspect ratio so that image pixels are square.

◆ Initialize() [2/2]

int sensei::DataBinning::Initialize ( pugi::xml_node  node)

Initialize from XML Input mesh, coordinate axis arrays, grid resolution, and output path are specified as attributes.

The supported attributes are:

attribute description
mesh names the mesh to process
x_axis names the array to use as x-axis coordinates
y_axis names the array to use as y-axis coordinates
out_dir the path to write results to
x_res the grid resolution to bin to in the x-direction
y_res the grid resolution to bin to in the y-direction
return_data set to 1 to return a data adaptor w/ the results
max_threads the max number of threads to use

Nested elements: | element | description | | arrays | a list of comma or space delimited array names to bin | | operations | a list of comma or space delimited binning operations |

The arrays to bin and binning operations are specified in a nested elements with a space or comma delimited lists. There must be an operation specified for each array.

◆ New()

static DataBinning* sensei::DataBinning::New ( )
static

allocates a new instance

◆ SetAsynchronous()

void sensei::DataBinning::SetAsynchronous ( int  val)
overridevirtual

When set binning runs in a thread and ::Execute returns immediately.

Reimplemented from sensei::AnalysisAdaptor.


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