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 (ObjectHandle const *o, std::string const &name, Variant const &value) override
 
void notify_call_method (ObjectHandle const *o, std::string const &name, VariantMap const &arguments) override
 
std::shared_ptr< ObjectHandlemake_shared (std::string const &name, VariantMap const &parameters) override
 Get a new reference counted instance of a script interface object by name.
 
std::string_view name (ObjectHandle const *o) const override
 
bool is_head_node () const override
 
void parallel_try_catch (std::function< void()> const &cb) const override
 
boost::mpi::communicator constget_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 67 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 93 of file GlobalContext.hpp.

References ScriptInterface::get_value(), and name().

Member Function Documentation

◆ get_comm()

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

Implements ScriptInterface::Context.

Definition at line 177 of file GlobalContext.hpp.

◆ is_head_node()

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

Implements ScriptInterface::Context.

Definition at line 173 of file GlobalContext.hpp.

Referenced by make_shared().

◆ make_shared()

std::shared_ptr< ObjectHandle > ScriptInterface::GlobalContext::make_shared ( std::string const name,
VariantMap const 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 91 of file GlobalContext.cpp.

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

◆ name()

std::string_view ScriptInterface::GlobalContext::name ( ObjectHandle const o) const
overridevirtual

◆ notify_call_method()

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

◆ notify_set_parameter()

void ScriptInterface::GlobalContext::notify_set_parameter ( ObjectHandle const 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: