SpECTRE  v2024.04.12
Parallel::protocols::ElementRegistrar Struct Reference

Conforming types register and deregister array elements with other parallel components. More...

#include <ElementRegistrar.hpp>

Classes

struct  test
 

Detailed Description

Conforming types register and deregister array elements with other parallel components.

For example, array elements may have to register and deregister with interpolators or observers when the elements get created and destroyed during AMR or migrated during load balancing. They may do so by sending messages to the parallel components that notify of the creation and destruction of the array elements.

Conforming classes have the following static member functions:

static void perform_registration<ParallelComponent>(const
db::DataBox<DbTagList>& box, Parallel::GlobalCache<Metavariables>& cache,
const ArrayIndex& array_index)
static void perform_deregistration<ParallelComponent>(const
db::DataBox<DbTagList>& box, Parallel::GlobalCache<Metavariables>& cache,
const ArrayIndex& array_index)
A Charm++ chare that caches global data once per Charm++ node.
Definition: GlobalCache.hpp:221

Here is an example implementation of this protocol:

struct RegisterElement : tt::ConformsTo<Parallel::protocols::ElementRegistrar> {
private:
template <typename ParallelComponent, typename RegisterOrDeregisterAction,
typename DbTagList, typename Metavariables, typename ArrayIndex>
static void register_or_deregister_impl(
db::DataBox<DbTagList>& /*box*/,
const ArrayIndex& array_index) {
auto& registrar = *Parallel::local_branch(
Parallel::get_parallel_component<Registrar<Metavariables>>(cache));
Parallel::simple_action<RegisterOrDeregisterAction>(registrar, array_index);
}
public:
template <typename ParallelComponent, typename DbTagList,
typename Metavariables, typename ArrayIndex>
static void perform_registration(db::DataBox<DbTagList>& box,
const ArrayIndex& array_index) {
register_or_deregister_impl<ParallelComponent, RegisterWithRegistrant>(
box, cache, array_index);
}
template <typename ParallelComponent, typename DbTagList,
typename Metavariables, typename ArrayIndex>
static void perform_deregistration(
db::DataBox<DbTagList>& box, Parallel::GlobalCache<Metavariables>& cache,
const ArrayIndex& array_index) {
register_or_deregister_impl<ParallelComponent, DeregisterWithRegistrant>(
box, cache, array_index);
}
};
auto get_parallel_component(GlobalCache< Metavariables > &cache) -> Parallel::proxy_from_parallel_component< GlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag > > &
Access the Charm++ proxy associated with a ParallelComponent.
Definition: GlobalCache.hpp:755
auto * local_branch(Proxy &&proxy)
Wrapper for calling Charm++'s .ckLocalBranch() on a proxy.
Definition: Local.hpp:48
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22

The documentation for this struct was generated from the following file: