Line data Source code
1 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/Algorithms/AlgorithmNodegroupDeclarations.hpp" 12 : #include "Parallel/ArrayIndex.hpp" 13 : #include "Parallel/DistributedObject.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 : * `AlgorithmNodegroup.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 : * AlgorithmNodegroup -> DistributedObject -> CBase_AlgorithmNodegroup 34 : * ``` 35 : * That allows us to introduce the template class 36 : * <code><a href="classParallel_1_1DistributedObject_3_01ParallelComponent_00_01tmpl_1_1list_3_01PhaseDepActionListsPack_8_8_8_01_4_01_4.html"> 37 : * Parallel::DistributedObject</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 42 : // DistributedObject 43 : template <typename ParallelComponent, typename SpectreArrayIndex> 44 1 : class AlgorithmNodegroup 45 : : public Parallel::DistributedObject< 46 : ParallelComponent, 47 : typename ParallelComponent::phase_dependent_action_list> { 48 0 : using algorithm = Parallel::Algorithms::Nodegroup; 49 : 50 : public: 51 : using Parallel::DistributedObject< 52 : ParallelComponent, typename ParallelComponent:: 53 : phase_dependent_action_list>::DistributedObject; 54 : }; 55 : 56 0 : #define CK_TEMPLATES_ONLY 57 : #include "Parallel/Algorithms/AlgorithmNodegroup.def.h" 58 : #undef CK_TEMPLATES_ONLY