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 an array 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/AlgorithmArrayDeclarations.hpp" 13 : #include "Parallel/ArrayIndex.hpp" 14 : 15 : /*! 16 : * \ingroup ParallelGroup 17 : * \brief A Spectre algorithm object that wraps a charm++ array 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#chare-arrays 23 : * When comparing against the implementations in the charm++ documentation, this 24 : * object is the one directly associated to declarations in the corresponding 25 : * `AlgorithmArray.ci` file. 26 : * 27 : * Unlike the techniques described in the charm++ documentation, however, we 28 : * define `AlgorithmArray` 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 : * AlgorithmArray -> AlgorithmImpl -> CBase_AlgorithmArray 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> 43 : class AlgorithmArray 44 : : public Parallel::AlgorithmImpl< 45 : ParallelComponent, 46 1 : typename ParallelComponent::phase_dependent_action_list> { 47 0 : using algorithm = Parallel::Algorithms::Array; 48 : 49 : public: 50 : using Parallel::AlgorithmImpl< 51 : ParallelComponent, 52 : typename ParallelComponent::phase_dependent_action_list>::AlgorithmImpl; 53 : }; 54 : 55 0 : #define CK_TEMPLATES_ONLY 56 : #include "Algorithms/AlgorithmArray.def.h" 57 : #undef CK_TEMPLATES_ONLY