Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terminal-based steering interface via an extract #1345

Merged
merged 7 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libs/ascent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ set(ascent_headers
runtimes/flow_filters/ascent_runtime_trigger_filters.hpp
runtimes/flow_filters/ascent_runtime_query_filters.hpp
runtimes/flow_filters/ascent_runtime_command_filters.hpp
runtimes/flow_filters/ascent_runtime_steering_filters.hpp
runtimes/flow_filters/ascent_runtime_vtkh_utils.hpp
runtimes/flow_filters/ascent_runtime_utils.hpp
# utils
Expand Down Expand Up @@ -230,6 +231,7 @@ set(ascent_sources
runtimes/flow_filters/ascent_runtime_trigger_filters.cpp
runtimes/flow_filters/ascent_runtime_query_filters.cpp
runtimes/flow_filters/ascent_runtime_command_filters.cpp
runtimes/flow_filters/ascent_runtime_steering_filters.cpp
runtimes/flow_filters/ascent_runtime_utils.cpp
# utils
utils/ascent_actions_utils.cpp
Expand Down
27 changes: 24 additions & 3 deletions src/libs/ascent/ascent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,8 @@ static std::map<std::string, bool (*)(void)> m_bool_callback_map;
//-----------------------------------------------------------------------------
void
register_callback(const std::string &callback_name,
void (*callback_function)(conduit::Node &, conduit::Node &))
void (*callback_function)
(conduit::Node &, conduit::Node &))
{
if (callback_name == "")
{
Expand Down Expand Up @@ -904,7 +905,7 @@ register_callback(const std::string &callback_name,

//-----------------------------------------------------------------------------
void
execute_callback(std::string callback_name,
execute_callback(const std::string &callback_name,
conduit::Node &params,
conduit::Node &output)
{
Expand All @@ -918,7 +919,7 @@ execute_callback(std::string callback_name,

//-----------------------------------------------------------------------------
bool
execute_callback(std::string callback_name)
execute_callback(const std::string &callback_name)
{
if (m_bool_callback_map.count(callback_name) != 1)
{
Expand All @@ -928,6 +929,26 @@ execute_callback(std::string callback_name)
return callback_function();
}

//-----------------------------------------------------------------------------
void
get_void_callbacks(std::vector<std::string> &callback_names)
{
for (const auto &pair : m_void_callback_map)
{
callback_names.push_back(pair.first);
}
}

//-----------------------------------------------------------------------------
void
get_bool_callbacks(std::vector<std::string> &callback_names)
{
for (const auto &pair : m_bool_callback_map)
{
callback_names.push_back(pair.first);
}
}

//-----------------------------------------------------------------------------
void
reset_callbacks()
Expand Down
13 changes: 10 additions & 3 deletions src/libs/ascent/ascent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,25 @@ void ASCENT_API about(conduit::Node &node);

//-----------------------------------------------------------------------------
void ASCENT_API register_callback(const std::string &callback_name,
void (*callback_function)(conduit::Node &, conduit::Node &));
void (*callback_function)
(conduit::Node &, conduit::Node &));
//-----------------------------------------------------------------------------
void ASCENT_API register_callback(const std::string &callback_name,
bool (*callback_function)(void));

//-----------------------------------------------------------------------------
void ASCENT_API execute_callback(std::string callback_name,
void ASCENT_API execute_callback(const std::string &callback_name,
conduit::Node &params,
conduit::Node &output);

//-----------------------------------------------------------------------------
bool ASCENT_API execute_callback(std::string callback_name);
bool ASCENT_API execute_callback(const std::string &callback_name);

//-----------------------------------------------------------------------------
void ASCENT_API get_void_callbacks(std::vector<std::string> &callbacks);

//-----------------------------------------------------------------------------
void ASCENT_API get_bool_callbacks(std::vector<std::string> &callbacks);

//-----------------------------------------------------------------------------
void ASCENT_API reset_callbacks();
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ascent/runtimes/ascent_main_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ AscentRuntime::ConvertExtractToFlow(const conduit::Node &extract,
py_src_final << "jupyter_bridge()" << std::endl;
params["source"] = py_src_final.str();
}
else if(extract_type == "steering")
{
filter_name = "steering";
}
// generic extract support
else if(n_extracts.has_child(extract_type))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <ascent_runtime_trigger_filters.hpp>
#include <ascent_runtime_query_filters.hpp>
#include <ascent_runtime_command_filters.hpp>
#include <ascent_runtime_steering_filters.hpp>

#if defined(ASCENT_VTKM_ENABLED)
#include <ascent_runtime_vtkh_filters.hpp>
Expand Down Expand Up @@ -99,6 +100,7 @@ register_builtin()
AscentRuntime::register_filter_type<BasicQuery>();
AscentRuntime::register_filter_type<FilterQuery>("transforms","expression");
AscentRuntime::register_filter_type<Command>();
AscentRuntime::register_filter_type<Steering>("extracts");
AscentRuntime::register_filter_type<DataBinning>("transforms","binning");
AscentRuntime::register_filter_type<BlueprintPartition>("transforms","partition");
AscentRuntime::register_filter_type<AddFields>("transforms","add_fields");
Expand Down
Loading