Cadabra
Computer algebra system for field theory problems
|
A Jupyter kernel for Cadabra, which provides the Cadabra pre-processor to enable input as in the Gtk notebook frontend.
Built using Xeus.
#include <cadabra-jupyter-kernel.hh>
Public Member Functions | |
CadabraJupyter () | |
virtual | ~CadabraJupyter ()=default |
virtual uint64_t | send (const std::string &output, const std::string &msg_type, uint64_t parent_id, bool last) override |
Public Member Functions inherited from Server | |
Server () | |
Server (const Server &)=delete | |
Server (const std::string &socket) | |
virtual | ~Server () |
void | run (int port=0, bool exit_on_disconnect=true) |
The only user-visible part: just instantiate a server object and start it with run(). More... | |
virtual uint64_t | send (const std::string &output, const std::string &msg_type, uint64_t parent_id=0, uint64_t cell_id=0, bool last_in_sequence=false) |
Raw code to send a string (which must be JSON formatted) as a message to the client. More... | |
void | send_progress_update (const std::string &msg, int n, int total) |
void | send_json (const std::string &) |
bool | handles (const std::string &otype) const |
std::string | architecture () const |
void | wait_for_job () |
Thread entry point for the code that waits for blocks to appear on the block queue, and executes them in turn. More... | |
void | wait_for_websocket () |
Thread entry point for code that sets up and runs the websocket listener. More... | |
Public Attributes | |
int | current_counter |
bool | finished =true |
Public Attributes inherited from Server | |
CatchOutput | catchOut |
CatchOutput | catchErr |
Stopwatch | server_stopwatch |
Stopwatch | sympy_stopwatch |
Protected Member Functions | |
virtual void | on_block_error (Block) override |
Protected Member Functions inherited from Server | |
void | init () |
void | on_socket_init (websocketpp::connection_hdl hdl, boost::asio::ip::tcp::socket &s) |
void | on_message (websocketpp::connection_hdl hdl, WebsocketServer::message_ptr msg) |
void | on_open (websocketpp::connection_hdl hdl) |
void | on_close (websocketpp::connection_hdl hdl) |
std::string | run_string (const std::string &, bool handle_output=true) |
virtual void | on_block_finished (Block) |
Called by the run_block() thread upon completion of the task. More... | |
virtual void | on_kernel_fault (Block) |
void | stop_block () |
Halt the currently running block and prevent execution of any further blocks that may still be on the queue. More... | |
void | dispatch_message (websocketpp::connection_hdl, const std::string &json_string) |
Takes a JSON encoded message and performs the required action to process it. More... | |
Private Member Functions | |
void | configure_impl () override |
xjson | execute_request_impl (int execution_counter, const std::string &code, bool silent, bool store_history, xjson user_expressions, bool allow_stdin) override |
xjson | complete_request_impl (const std::string &code, int cursor_pos) override |
xjson | inspect_request_impl (const std::string &code, int cursor_pos, int detail_level) override |
xjson | is_complete_request_impl (const std::string &code) override |
xjson | kernel_info_request_impl () override |
void | shutdown_request_impl () override |
Additional Inherited Members | |
Protected Types inherited from Server | |
typedef websocketpp::server< websocketpp::config::asio > | WebsocketServer |
typedef std::map< websocketpp::connection_hdl, Connection, std::owner_less< websocketpp::connection_hdl > > | ConnectionMap |
Protected Attributes inherited from Server | |
WebsocketServer | wserver |
std::string | socket_name |
ConnectionMap | connections |
std::string | authentication_token |
std::mutex | ws_mutex |
std::thread | runner |
std::mutex | block_available_mutex |
std::condition_variable | block_available |
bool | exit_on_disconnect |
int | run_on_port |
unsigned long | main_thread_id |
std::queue< Block > | block_queue |
websocketpp::connection_hdl | current_hdl |
uint64_t | current_id |
bool | started |
std::future< std::string > | job |
pybind11::scoped_interpreter | guard |
pybind11::module | main_module |
pybind11::object | main_namespace |
cadabra::CadabraJupyter::CadabraJupyter | ( | ) |
|
virtualdefault |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
overrideprotectedvirtual |
Reimplemented from Server.
|
overridevirtual |
|
overrideprivate |
int cadabra::CadabraJupyter::current_counter |
bool cadabra::CadabraJupyter::finished =true |