19#ifndef SCRIPT_INTERFACE_LOCAL_CONTEXT_HPP
20#define SCRIPT_INTERFACE_LOCAL_CONTEXT_HPP
28#include <boost/mpi/communicator.hpp>
46 boost::mpi::communicator
const &m_comm;
51 boost::mpi::communicator
const &comm)
52 : m_factory(std::
move(
factory)), m_is_head_node(comm.rank() == 0),
55 m_parallel_exception_handler(comm) {}
64 std::shared_ptr<ObjectHandle>
74 std::shared_ptr<ObjectHandle>
90 boost::mpi::communicator
const &
get_comm()
const override {
return m_comm; }
ScriptInterface::Context decorates ScriptInterface::ObjectHandle objects with a context: a creation p...
Context of an object handle.
void set_context(ObjectHandle *o)
Set the context of an object to this.
std::shared_ptr< ObjectHandle > make_shared_local(std::string const &name, VariantMap const ¶meters) override
std::shared_ptr< ObjectHandle > make_shared(std::string const &name, const VariantMap ¶meters) override
boost::string_ref name(const ObjectHandle *o) const override
boost::mpi::communicator const & get_comm() const override
bool is_head_node() const override
void notify_call_method(const ObjectHandle *, std::string const &, VariantMap const &) override
LocalContext(Utils::Factory< ObjectHandle > factory, boost::mpi::communicator const &comm)
void parallel_try_catch(std::function< void()> const &cb) const override
const Utils::Factory< ObjectHandle > & factory() const
void notify_set_parameter(const ObjectHandle *, std::string const &, Variant const &) override
Base class for interface handles.
Handle exceptions thrown in MPI parallel code.
void parallel_try_catch(std::function< void()> const &callback) const
Handle exceptions in synchronous code.
pointer_type make(const std::string &name) const
Construct an instance by name.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.