AlgorithmNodegroup.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// This file should be included in each file which defines a nodegroup
6 /// parallel component; doing so ensures that the correct charm++ chares are
7 /// defined for executables that use that parallel component.
8 
9 #pragma once
10 
11 #include "Parallel/Algorithm.hpp"
12 #include "Parallel/Algorithms/AlgorithmNodegroupDeclarations.hpp"
13 #include "Parallel/ArrayIndex.hpp"
14 
15 /*!
16  * \ingroup ParallelGroup
17  * \brief A Spectre algorithm object that wraps a charm++ nodegroup chare.
18  *
19  * \details This object is the definition of the distributed charm++ object
20  * associated with the SpECTRE component wrappers (see \ref
21  * dev_guide_parallelization_foundations). See also the charm++ documentation:
22  * https://charm.readthedocs.io/en/latest/charm++/manual.html#nodegroup-objects
23  * When comparing against the implementations in the charm++ documentation, this
24  * object is the one directly associated to declarations in the corresponding
25  * `AlgorithmSingleton.ci` file.
26  *
27  * Unlike the techniques described in the charm++ documentation, however, we
28  * define `AlgorithmNodegroup` as a strong typedef so that the core
29  * functionality can be shared between chare types by introducing an additional
30  * inheritance layer. The documentation suggests the inheritance path `A ->
31  * CBase_A`, where we have the inheritance path:
32  * ```
33  * AlgorithmSingleton -> AlgorithmImpl -> CBase_AlgorithmSingleton
34  * ```
35  * That allows us to introduce the template class
36  * <code><a href="classParallel_1_1AlgorithmImpl_3_01ParallelComponent_00_01tmpl_1_1list_3_01PhaseDepActionListsPack_8_8_8_01_4_01_4.html">
37  * Parallel::AlgorithmImpl</a></code>
38  * that handles all generalizable control-flow.
39  */
40 // Note that the above manual link is needed because doxygen can't properly link
41 // template specializations, but we'd really like to link to the AlgorithmImpl
42 template <typename ParallelComponent, typename SpectreArrayIndex>
44  : public Parallel::AlgorithmImpl<
45  ParallelComponent,
46  typename ParallelComponent::phase_dependent_action_list> {
48 
49  public:
50  using Parallel::AlgorithmImpl<
51  ParallelComponent,
52  typename ParallelComponent::phase_dependent_action_list>::AlgorithmImpl;
53 };
54 
55 #define CK_TEMPLATES_ONLY
56 #include "Algorithms/AlgorithmNodegroup.def.h"
57 #undef CK_TEMPLATES_ONLY
Parallel::Algorithms::Nodegroup
A struct that stores the charm++ types relevant for a particular nodegroup component.
Definition: AlgorithmNodegroupDeclarations.hpp:31
AlgorithmNodegroup
A Spectre algorithm object that wraps a charm++ nodegroup chare.
Definition: AlgorithmNodegroup.hpp:43