Skip to content

Commit

Permalink
refactor source filter logic for ascent and flow runtimes (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Jan 25, 2018
1 parent ab3c4cc commit e2d1eb4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
29 changes: 17 additions & 12 deletions src/ascent/runtimes/ascent_flow_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,21 @@ FlowRuntime::Publish(const conduit::Node &data)
{
// create our own tree, with all data zero copied.
m_data.set_external(data);

}

//-----------------------------------------------------------------------------
void
FlowRuntime::ResetInfo()
{
m_info.reset();
m_info["runtime/type"] = "flow";
m_info["runtime/options"] = m_runtime_options;
}

//-----------------------------------------------------------------------------
void
FlowRuntime::ConnectSource()
{
// note: if the reg entry for data was already added
// the set_external updates everything,
// we don't need to remove and re-add.
Expand All @@ -187,22 +201,13 @@ FlowRuntime::Publish(const conduit::Node &data)
}
}

//-----------------------------------------------------------------------------
void
FlowRuntime::ResetInfo()
{
m_info.reset();
m_info["runtime/type"] = "flow";
m_info["runtime/options"] = m_runtime_options;
}


//-----------------------------------------------------------------------------
void
FlowRuntime::Execute(const conduit::Node &actions)
{
ResetInfo();

// make sure we always have our source data
ConnectSource();
// Loop over the actions
for (int i = 0; i < actions.number_of_children(); ++i)
{
Expand Down
1 change: 1 addition & 0 deletions src/ascent/runtimes/ascent_flow_runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class FlowRuntime : public Runtime
flow::Workspace w;

void ResetInfo();
void ConnectSource();

WebInterface m_web_interface;

Expand Down
40 changes: 24 additions & 16 deletions src/ascent/runtimes/ascent_main_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,6 @@ AscentRuntime::Publish(const conduit::Node &data)
{
// create our own tree, with all data zero copied.
m_data.set_external(data);

// note: if the reg entry for data was already added
// the set_external updates everything,
// we don't need to remove and re-add.
if(!w.registry().has_entry("_ascent_input_data"))
{
w.registry().add<Node>("_ascent_input_data",
&m_data);
}

if(!w.graph().has_filter("source"))
{
Node p;
p["entry"] = "_ascent_input_data";
w.graph().add_filter("registry_source","source",p);
}
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -564,6 +548,28 @@ AscentRuntime::CreateExtracts(const conduit::Node &extracts)
ConvertExtractToFlow(extract, names[i]);
}
}

//-----------------------------------------------------------------------------
void
AscentRuntime::ConnectSource()
{
// note: if the reg entry for data was already added
// the set_external updates everything,
// we don't need to remove and re-add.
if(!w.registry().has_entry("_ascent_input_data"))
{
w.registry().add<Node>("_ascent_input_data",
&m_data);
}

if(!w.graph().has_filter("source"))
{
Node p;
p["entry"] = "_ascent_input_data";
w.graph().add_filter("registry_source","source",p);
}
}

//-----------------------------------------------------------------------------
void
AscentRuntime::ConnectGraphs()
Expand Down Expand Up @@ -886,6 +892,8 @@ void
AscentRuntime::Execute(const conduit::Node &actions)
{
ResetInfo();
// make sure we always have our source data
ConnectSource();
// Loop over the actions
for (int i = 0; i < actions.number_of_children(); ++i)
{
Expand Down
1 change: 1 addition & 0 deletions src/ascent/runtimes/ascent_main_runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class AscentRuntime : public Runtime
std::vector<std::string> GetPipelines(const conduit::Node &plots);
void CreateScenes(const conduit::Node &scenes);
void ConvertSceneToFlow(const conduit::Node &scenes);
void ConnectSource();
void ConnectGraphs();
void ExecuteGraphs();
std::string GetDefaultImagePrefix(const std::string scene);
Expand Down

0 comments on commit e2d1eb4

Please sign in to comment.