AlgorithmGroup.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 group
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/AlgorithmGroupDeclarations.hpp"
13 #include "Parallel/ArrayIndex.hpp"
14 
15 /*!
16  * \ingroup ParallelGroup
17  * \brief A Spectre algorithm object that wraps a charm++ group 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#group-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  * `AlgorithmGroup.ci` file.
26  *
27  * Unlike the techniques described in the charm++ documentation, however, we
28  * define `AlgorithmGroup` as a strong typedef so that the core functionality
29  * can be shared between chare types by introducing an additional inheritance
30  * layer. The documentation suggests the inheritance path `A -> CBase_A`, where
31  * we have the inheritance path:
32  * ```
33  * AlgorithmGroup -> AlgorithmImpl -> CBase_AlgorithmGroup
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/AlgorithmGroup.def.h"
57 #undef CK_TEMPLATES_ONLY
Parallel::Algorithms::Group
A struct that stores the charm++ types relevant for a particular group component.
Definition: AlgorithmGroupDeclarations.hpp:31
AlgorithmGroup
A Spectre algorithm object that wraps a charm++ group chare.
Definition: AlgorithmGroup.hpp:43