ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ScriptInterface::GlobalContext Class Reference

Global synchronizing context. More...

#include <GlobalContext.hpp>

+ Inheritance diagram for ScriptInterface::GlobalContext:
+ Collaboration diagram for ScriptInterface::GlobalContext:

Public Member Functions

 GlobalContext (std::shared_ptr< Communication::MpiCallbacks > const &callbacks, std::shared_ptr< LocalContext > node_local_context)
 
void notify_set_parameter (const ObjectHandle *o, std::string const &name, Variant const &value) override
 
void notify_call_method (const ObjectHandle *o, std::string const &name, VariantMap const &arguments) override
 
std::shared_ptr< ObjectHandlemake_shared (std::string const &name, const VariantMap &parameters) override
 Get a new reference counted instance of a script interface object by name.
 
std::shared_ptr< ObjectHandlemake_shared_local (std::string const &name, VariantMap const &parameters) override
 
boost::string_ref name (const ObjectHandle *o) const override
 
bool is_head_node () const override
 
void parallel_try_catch (std::function< void()> const &cb) const override
 
boost::mpi::communicator const & get_comm () const override
 
- Public Member Functions inherited from ScriptInterface::Context
virtual ~Context ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptInterface::Context
void set_context (ObjectHandle *o)
 Set the context of an object to this.
 

Detailed Description

Global synchronizing context.

Objects created in this context are synchronized between multiple MPI ranks. That is, for each instance created on the head node, a copy is created on all other ranks. If the original copy is mutated via notify_set_parameter(), this change is also applied to all the copies. Calls to notify_call_method() are also propagated to all ranks. The lifetime of the copies is tied to the original, if the original copy is destroyed on the head node, the remote copies are also destroyed.

Definition at line 65 of file GlobalContext.hpp.

Constructor & Destructor Documentation

◆ GlobalContext()

ScriptInterface::GlobalContext::GlobalContext ( std::shared_ptr< Communication::MpiCallbacks > const &  callbacks,
std::shared_ptr< LocalContext node_local_context 
)
inline

Definition at line 91 of file GlobalContext.hpp.

References name().

Member Function Documentation

◆ get_comm()

boost::mpi::communicator const & ScriptInterface::GlobalContext::get_comm ( ) const
inlineoverridevirtual

Implements ScriptInterface::Context.

Definition at line 178 of file GlobalContext.hpp.

◆ is_head_node()

bool ScriptInterface::GlobalContext::is_head_node ( ) const
inlineoverridevirtual

Implements ScriptInterface::Context.

Definition at line 174 of file GlobalContext.hpp.

Referenced by make_shared().

◆ make_shared()

std::shared_ptr< ObjectHandle > ScriptInterface::GlobalContext::make_shared ( std::string const &  name,
const VariantMap parameters 
)
overridevirtual

Get a new reference counted instance of a script interface object by name.

Remote objects are automatically constructed.

Implements ScriptInterface::Context.

Definition at line 103 of file GlobalContext.cpp.

References is_head_node(), name(), ScriptInterface::object_id(), and ScriptInterface::Context::set_context().

◆ make_shared_local()

std::shared_ptr< ObjectHandle > ScriptInterface::GlobalContext::make_shared_local ( std::string const &  name,
VariantMap const &  parameters 
)
overridevirtual

Implements ScriptInterface::Context.

Definition at line 92 of file GlobalContext.cpp.

References name(), and ScriptInterface::Context::set_context().

◆ name()

boost::string_ref ScriptInterface::GlobalContext::name ( const ObjectHandle o) const
overridevirtual

◆ notify_call_method()

void ScriptInterface::GlobalContext::notify_call_method ( const ObjectHandle o,
std::string const &  name,
VariantMap const &  arguments 
)
overridevirtual

◆ notify_set_parameter()

void ScriptInterface::GlobalContext::notify_set_parameter ( const ObjectHandle o,
std::string const &  name,
Variant const &  value 
)
overridevirtual

◆ parallel_try_catch()

void ScriptInterface::GlobalContext::parallel_try_catch ( std::function< void()> const &  cb) const
inlineoverridevirtual

The documentation for this class was generated from the following files: