SpECTRE Documentation Coverage Report
Current view: top level - Parallel/ArrayCollection/Tags - ElementLocationsReference.hpp Hit Total Coverage
Commit: 6e1258ccd353220e12442198913007fb6c170b6b Lines: 1 9 11.1 %
Date: 2024-10-23 19:54:13
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : #include <unordered_map>
       8             : 
       9             : #include "DataStructures/DataBox/Tag.hpp"
      10             : #include "Parallel/ArrayCollection/Tags/ElementLocations.hpp"
      11             : #include "Parallel/GlobalCache.hpp"
      12             : #include "Parallel/Invoke.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : 
      15             : /// \cond
      16             : template <size_t Dim>
      17             : class ElementId;
      18             : namespace Parallel {
      19             : class NodeLock;
      20             : }  // namespace Parallel
      21             : /// \endcond
      22             : 
      23             : namespace Parallel::Tags {
      24             : /// \brief The node (location) where different elements are.
      25             : ///
      26             : /// This should be in the DgElementArrayMember's DataBox.
      27             : ///
      28             : /// Implementation note: This should point to the ElementLocations located in
      29             : /// the nodegroup's DataBox.
      30             : template <size_t Dim, typename Metavariables,
      31             :           typename DgElementCollectionComponent>
      32           1 : struct ElementLocationsReference : ElementLocations<Dim>, db::ReferenceTag {
      33             :  private:
      34           0 :   struct GetReference {
      35           0 :     using return_type = const typename ElementLocations<Dim>::type&;
      36             : 
      37             :     template <typename ParallelComponent, typename DbTagList>
      38           0 :     static return_type apply(
      39             :         db::DataBox<DbTagList>& box,
      40             :         const gsl::not_null<Parallel::NodeLock*> /*node_lock*/) {
      41             :       return db::get_mutable_reference<ElementLocations<Dim>>(
      42             :           make_not_null(&box));
      43             :     }
      44             :   };
      45             : 
      46             :  public:
      47           0 :   using base = ElementLocations<Dim>;
      48           0 :   using type = typename base::type;
      49           0 :   using argument_tags =
      50             :       tmpl::list<Parallel::Tags::GlobalCacheImpl<Metavariables>>;
      51             : 
      52           0 :   static const type& get(
      53             :       const Parallel::GlobalCache<Metavariables>* const& cache) {
      54             :     auto& parallel_comp =
      55             :         Parallel::get_parallel_component<DgElementCollectionComponent>(*cache);
      56             :     return Parallel::local_synchronous_action<GetReference>(parallel_comp);
      57             :   }
      58             : };
      59             : }  // namespace Parallel::Tags

Generated by: LCOV version 1.14