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 3 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
22 changes: 22 additions & 0 deletions src/libs/ascent/ascent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,28 @@ execute_callback(std::string callback_name)
return callback_function();
}

//-----------------------------------------------------------------------------
std::vector<std::string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy out still ref args are a bit more efficient (see below)

get_void_callbacks()
{
std::vector<std::string> keys;
for (const auto &pair : m_void_callback_map) {
keys.push_back(pair.first);
}
return keys;
}

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

//-----------------------------------------------------------------------------
void
reset_callbacks()
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ascent/ascent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ void ASCENT_API execute_callback(std::string callback_name,
//-----------------------------------------------------------------------------
bool ASCENT_API execute_callback(std::string callback_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool ASCENT_API execute_callback(std::string callback_name);
bool ASCENT_API execute_callback(const std::string &callback_name);


//-----------------------------------------------------------------------------
std::vector<std::string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref copy out style will be slight more efficient:

void ASCENT_API get_void_callbacks(std::vector<std::string> &name);

ASCENT_API get_void_callbacks();

//-----------------------------------------------------------------------------
std::vector<std::string>
ASCENT_API get_bool_callbacks();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref copy out style will be slight more efficient:

void ASCENT_API get_bool_callbacks(std::vector<std::string> &name);


//-----------------------------------------------------------------------------
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