Skip to content

Commit

Permalink
Implement all suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
siramok committed Oct 31, 2023
1 parent 714336b commit da425ea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
4 changes: 4 additions & 0 deletions src/libs/ascent/ascent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,10 @@ about(conduit::Node &n)

}

// Callback maps
static std::map<std::string, void (*)(conduit::Node &, conduit::Node &)> m_void_callback_map;
static std::map<std::string, bool (*)(void)> m_bool_callback_map;

//-----------------------------------------------------------------------------
void
register_callback(const std::string &callback_name,
Expand Down
4 changes: 0 additions & 4 deletions src/libs/ascent/ascent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ class ASCENT_API Ascent
conduit::Node m_info;
};

// Callback maps
static std::map<std::string, void (*)(conduit::Node &, conduit::Node &)> m_void_callback_map;
static std::map<std::string, bool (*)(void)> m_bool_callback_map;

//-----------------------------------------------------------------------------
std::string ASCENT_API about();

Expand Down
8 changes: 4 additions & 4 deletions src/libs/ascent/python/ascent_module/py_src/mpi/ascent_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ def about():
from .ascent_mpi_python import about as ascent_about
return ascent_about()
except ImportError:
raise ImportError('failed to import ascent_mpi_python, was Ascent built with mpi support?')
raise ImportError('failed to import ascent_mpi_python, was Ascent built with MPI support ENABLE_MPI=ON ?')
return None

def execute_callback(callback_name, params, output):
try:
from .ascent_mpi_python import execute_callback as ascent_execute_callback
return ascent_execute_callback(callback_name, params, output)
except ImportError:
raise ImportError('failed to import ascent_mpi_python, was Ascent built with serial support ENABLE_SERIAL=ON ?')
raise ImportError('failed to import ascent_mpi_python, was Ascent built with MPI support ENABLE_MPI=ON ?')
return None

def Ascent():
try:
from .ascent_mpi_python import Ascent as ascent_obj
return ascent_obj()
except ImportError:
raise ImportError('failed to import ascent_mpi_python, was Ascent built with mpi support?')
raise ImportError('failed to import ascent_mpi_python, was Ascent built with MPI support ENABLE_MPI=ON ?')
return None

def jupyter_bridge():
try:
from ..bridge_kernel.server import jupyter_extract
return jupyter_extract()
except ImportError:
raise ImportError('failed to import ascent_mpi_python, was Ascent built with mpi support?')
raise ImportError('failed to import ascent_mpi_python, was Ascent built with MPI support ENABLE_MPI=ON ?')
return None


Expand Down
15 changes: 0 additions & 15 deletions src/tests/ascent/t_ascent_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,6 @@ TEST(ascent_commands, direct_void_callback_invocation)
// Register callbacks
ascent::register_callback("void_callback_1", void_callback_1);

//
// Run Ascent
//
Ascent ascent;
Node ascent_opts;
// default is now ascent
ascent_opts["runtime/type"] = "ascent";
ascent.open(ascent_opts);

Node params;
Node output;
ascent::execute_callback("void_callback_1", params, output);
Expand All @@ -189,12 +180,6 @@ TEST(ascent_commands, direct_void_callback_invocation)
has_output = output["param_was_passed"].to_uint8();
}
EXPECT_TRUE(has_output);

Node actions;
std::string msg = "An example of invoking void callbacks directly";
ASCENT_ACTIONS_DUMP(actions, std::string("direct_void_callback_invocation"), msg);

ascent.close();
}

//-----------------------------------------------------------------------------
Expand Down

0 comments on commit da425ea

Please sign in to comment.