TTK
Loading...
Searching...
No Matches
ttkWebSocketIO Class Reference

#include <ttkWebSocketIO.h>

Inheritance diagram for ttkWebSocketIO:
ttkAlgorithm ttk::WebSocketIO ttk::Debug ttk::Debug ttk::BaseClass ttk::BaseClass

Public Types

typedef ttkAlgorithm Superclass
Public Types inherited from ttkAlgorithm
typedef vtkAlgorithm Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
virtual void SetPortNumber (int)
virtual int GetPortNumber ()
virtual void SetNeedsUpdate (bool)
virtual bool GetNeedsUpdate ()
int processEvent (const std::string &eventName, const std::string &eventData="") override
Public Member Functions inherited from ttkAlgorithm
void UpdateThreadNumber ()
void SetThreadNumber (int threadNumber)
void SetUseAllCores (bool useAllCores)
void SetDebugLevel (int debugLevel)
void SetCompactTriangulationCacheSize (float cacheSize)
vtkDataArray * GetOptionalArray (const bool &enforceArrayIndex, const int &arrayIndex, const std::string &arrayName, vtkDataSet *const inputData, const int &inputPort=0)
vtkDataArray * GetOrderArray (vtkDataSet *const inputData, const int scalarArrayIdx, ttk::Triangulation *triangulation, const bool getGlobalOrder=false, const int orderArrayIdx=0, const bool enforceOrderArrayIdx=false)
vtkDataArray * checkForGlobalAndComputeOrderArray (vtkDataSet *const inputData, vtkDataArray *scalarArray, const int scalarArrayIdx, const bool getGlobalOrder, vtkDataArray *orderArray, ttk::Triangulation *triangulation, const bool enforceOrderArrayIdx)
vtkDataArray * ComputeOrderArray (vtkDataSet *const inputData, vtkDataArray *scalarArray, const int scalarArrayIdx, const bool getGlobalOrder, vtkDataArray *oldOrderArray, ttk::Triangulation *triangulation)
ttk::SimplexIdGetIdentifierArrayPtr (const bool &enforceArrayIndex, const int &arrayIndex, const std::string &arrayName, vtkDataSet *const inputData, std::vector< ttk::SimplexId > &spareStorage, const int inputPort=0, const bool printErr=true)
ttk::TriangulationGetTriangulation (vtkDataSet *dataSet)
int ProcessRequest (vtkInformation *request, vtkInformationVector **inputVectors, vtkInformationVector *outputVector) override
vtkDataSet * GetOutput ()
vtkDataSet * GetOutput (int)
void SetInputData (vtkDataSet *)
void SetInputData (int, vtkDataSet *)
void AddInputData (vtkDataSet *)
void AddInputData (int, vtkDataSet *)
template<typename inputType>
int checkEmptyMPIInput (inputType *input)
 This method tests whether the input is a nullptr. If the computation is being done on multiple processes, it is possible that the domain of one process or more is empty, but not others, therefore in that particular case the rest of the filter will not be computed but an error message will not be sent.
Public Member Functions inherited from ttk::Debug
 Debug ()
 ~Debug () override
virtual int setDebugLevel (const int &debugLevel)
int setWrapper (const Wrapper *wrapper) override
int printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const
int printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const
void setDebugMsgPrefix (const std::string &prefix)
Public Member Functions inherited from ttk::BaseClass
 BaseClass ()
virtual ~BaseClass ()=default
int getThreadNumber () const
virtual int setThreadNumber (const int threadNumber)

Static Public Member Functions

static ttkWebSocketIONew ()
static int IsTypeOf (const char *type)
static ttkWebSocketIOSafeDownCast (vtkObject *o)
Static Public Member Functions inherited from ttkAlgorithm
static ttkAlgorithmNew ()
static int IsTypeOf (const char *type)
static ttkAlgorithmSafeDownCast (vtkObject *o)
static std::string GetOrderArrayName (vtkDataArray *const array)
static vtkInformationIntegerKey * SAME_DATA_TYPE_AS_INPUT_PORT ()

Protected Member Functions

 ttkWebSocketIO ()
 ~ttkWebSocketIO () override
int FillInputPortInformation (int port, vtkInformation *info) override
int FillOutputPortInformation (int port, vtkInformation *info) override
int RequestData (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
int SendVtkDataObject (vtkDataObject *object)
int ParseVtkDataObjectFromJSON (const std::string &json)
Protected Member Functions inherited from ttkAlgorithm
 ttkAlgorithm ()
 ~ttkAlgorithm () override
void MPIGhostPipelinePreconditioning (vtkDataSet *input)
void MPIPipelinePreconditioning (vtkDataSet *input, std::vector< int > &neighbors, std::map< int, int > &neighToId, ttk::Triangulation *triangulation=nullptr)
bool checkGlobalIdValidity (ttk::LongSimplexId *globalIds, ttk::SimplexId simplexNumber, unsigned char *ghost, int *rankArray)
int GenerateGlobalIds (vtkDataSet *input, std::unordered_map< ttk::SimplexId, ttk::SimplexId > &vertGtoL, std::vector< int > &neighborRanks, std::map< int, int > &neighborsToId)
void MPITriangulationPreconditioning (ttk::Triangulation *triangulation, vtkDataSet *input)
virtual int RequestDataObject (vtkInformation *request, vtkInformationVector **inputVectors, vtkInformationVector *outputVector)
virtual int RequestInformation (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestUpdateTime (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestUpdateTimeDependentInformation (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestUpdateExtent (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestDataNotGenerated (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestData (vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
int FillInputPortInformation (int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
int FillOutputPortInformation (int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
Protected Member Functions inherited from ttk::Debug
int printMsgInternal (const std::string &msg, const std::string &right, const std::string &filler, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const
int printMsgInternal (const std::string &msg, const debug::Priority &priority, const debug::LineMode &lineMode, std::ostream &stream=std::cout) const
int welcomeMsg (std::ostream &stream)
Protected Member Functions inherited from ttk::WebSocketIO
 WebSocketIO ()
 ~WebSocketIO () override
int isListening ()
int startServer (int PortNumber)
int stopServer ()
int getPortNumber ()
int sendString (const std::string &msg) const
int sendBinary (const size_t &sizeInBytes, const void *data) const
int sendMessage (const Message &msg) const
int queueMessage (const std::string &msg)
int queueMessage (const size_t &sizeInBytes, const void *data)
int queueMessage (const Message &msg)
int sendNextQueuedMessage ()
int processMessageQueue ()
int clearMessageQueue ()

Additional Inherited Members

Protected Attributes inherited from ttkAlgorithm
float CompactTriangulationCacheSize {0.2f}
Protected Attributes inherited from ttk::Debug
int debugLevel_
std::string debugMsgPrefix_
std::string debugMsgNamePrefix_
Protected Attributes inherited from ttk::BaseClass
bool lastObject_
int threadNumber_
Wrapperwrapper_
Static Protected Attributes inherited from ttk::Debug
static COMMON_EXPORTS debug::LineMode lastLineMode = ttk::debug::LineMode::NEW

Detailed Description

Author
Jonas Lukasczyk jl@jl.nosp@m.uk.d.nosp@m.e
Date
13.04.2021

This module provides functions for bi-directional communication between two websockets, where the heavy lifting is done by the websocketpp library. The primary use case for this module is to send data that was computed in a c++ environment to a browser client, which can then freely process/render the data via JavaScript and HTML. To this end, this module needs to run a websocket server, to which a client can connect to via the ttkWebSocketIO.js library. The server can also receive data from the client, which is then fed into the processEvent function. In order to add custom processing of events, one needs to inherit from the WebSocketIO class and override the processEvent method. The vtk wrapper ttkWebSocketIO provides an example on how this abstract base module can be specialized to the application of sending/receiving vtkDataObjects. Specifically, the ttkWebSocketIO filter will send its input vtkDataObject as a serialized JSON object to all connected clients every time the filter is called with a new input. When the server receives a serialized JSON object form the client, then the filter will instantiate a vtkDataObject and pass it as the filter output.

Definition at line 38 of file ttkWebSocketIO.h.

Member Typedef Documentation

◆ Superclass

Definition at line 49 of file ttkWebSocketIO.h.

Constructor & Destructor Documentation

◆ ttkWebSocketIO()

ttkWebSocketIO::ttkWebSocketIO ( )
protected

Definition at line 30 of file ttkWebSocketIO.cpp.

◆ ~ttkWebSocketIO()

ttkWebSocketIO::~ttkWebSocketIO ( )
overrideprotecteddefault

Member Function Documentation

◆ FillInputPortInformation()

int ttkWebSocketIO::FillInputPortInformation ( int port,
vtkInformation * info )
overrideprotected

Definition at line 40 of file ttkWebSocketIO.cpp.

◆ FillOutputPortInformation()

int ttkWebSocketIO::FillOutputPortInformation ( int port,
vtkInformation * info )
overrideprotected

Definition at line 51 of file ttkWebSocketIO.cpp.

◆ GetClassName()

virtual const char * ttkWebSocketIO::GetClassName ( )
virtual

Reimplemented from ttkAlgorithm.

◆ GetNeedsUpdate()

virtual bool ttkWebSocketIO::GetNeedsUpdate ( )
virtual

◆ GetPortNumber()

virtual int ttkWebSocketIO::GetPortNumber ( )
virtual

◆ IsA()

virtual int ttkWebSocketIO::IsA ( const char * type)
virtual

Reimplemented from ttkAlgorithm.

◆ IsTypeOf()

int ttkWebSocketIO::IsTypeOf ( const char * type)
static

◆ New()

ttkWebSocketIO * ttkWebSocketIO::New ( )
static

◆ ParseVtkDataObjectFromJSON()

int ttkWebSocketIO::ParseVtkDataObjectFromJSON ( const std::string & json)
protected

Definition at line 132 of file ttkWebSocketIO.cpp.

◆ processEvent()

int ttkWebSocketIO::processEvent ( const std::string & eventName,
const std::string & eventData = "" )
overridevirtual

Reimplemented from ttk::WebSocketIO.

Definition at line 95 of file ttkWebSocketIO.cpp.

◆ RequestData()

int ttkWebSocketIO::RequestData ( vtkInformation * request,
vtkInformationVector ** inputVector,
vtkInformationVector * outputVector )
overrideprotected

Definition at line 59 of file ttkWebSocketIO.cpp.

◆ SafeDownCast()

ttkWebSocketIO * ttkWebSocketIO::SafeDownCast ( vtkObject * o)
static

◆ SendVtkDataObject()

int ttkWebSocketIO::SendVtkDataObject ( vtkDataObject * object)
protected

Definition at line 310 of file ttkWebSocketIO.cpp.

◆ SetNeedsUpdate()

virtual void ttkWebSocketIO::SetNeedsUpdate ( bool )
virtual

◆ SetPortNumber()

virtual void ttkWebSocketIO::SetPortNumber ( int )
virtual

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