SpECTRE Documentation Coverage Report
Current view: top level - Evolution/DgSubcell - GhostData.hpp Hit Total Coverage
Commit: b5f497991094937944b0a3f519166bb54739d08a Lines: 8 18 44.4 %
Date: 2024-03-28 18:20: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 <iosfwd>
       8             : #include <pup.h>
       9             : #include <vector>
      10             : 
      11             : #include "DataStructures/DataVector.hpp"
      12             : 
      13             : namespace evolution::dg::subcell {
      14             : /*!
      15             :  * Ghost data used on the subcell grid for reconstruction
      16             :  *
      17             :  * This class holds both the local ghost data on the local subcell mesh for a
      18             :  * given direction, as well as the neighbor's ghost data (on the neighbor's
      19             :  * mesh) in that same direction. This class is similar to
      20             :  * `evolution::dg::MortarData` in the sense that it holds both local and
      21             :  * neighbor data in a direction. However, it differs because the local ghost
      22             :  * data is not used in our own calculation when reconstructing the solution at
      23             :  * the face between the elements. This is because we already have our own data
      24             :  * on our own FD grid. Only the neighbor ghost data is used to reconstruct the
      25             :  * solution on the face.
      26             :  *
      27             :  * With Charm++ messages, storing the local ghost data is necessary because it
      28             :  * must live somewhere so we can send a pointer to our neighbor.
      29             :  */
      30           1 : class GhostData {
      31             :  public:
      32           0 :   GhostData(size_t number_of_buffers = 1);
      33             : 
      34             :   /// Move to the next internal mortar buffer
      35           1 :   void next_buffer();
      36             : 
      37             :   /// Return the current internal buffer index
      38           1 :   size_t current_buffer_index() const;
      39             : 
      40             :   /// Return the total number of buffers that this GhostData was constructed
      41             :   /// with
      42           1 :   size_t total_number_of_buffers() const;
      43             : 
      44             :   /// @{
      45             :   /// The local ghost data for in the current buffer
      46             :   ///
      47             :   /// The non-const reference function can be used to edit the data in-place
      48           1 :   DataVector& local_ghost_data();
      49             : 
      50           1 :   const DataVector& local_ghost_data() const;
      51             :   /// @}
      52             : 
      53             :   /// @{
      54             :   /// The ghost data from our neighbor which is meant to be used in
      55             :   /// reconstruction for in the current buffer.
      56             :   ///
      57             :   /// The non-const reference function can be used to edit the data in-place
      58           1 :   DataVector& neighbor_ghost_data_for_reconstruction();
      59             : 
      60           1 :   const DataVector& neighbor_ghost_data_for_reconstruction() const;
      61             :   /// @}
      62             : 
      63             :   // NOLINTNEXTLINE(google-runtime-references)
      64           0 :   void pup(PUP::er& p);
      65             : 
      66             :  private:
      67             :   // NOLINTNEXTLINE
      68           0 :   friend bool operator==(const GhostData& lhs, const GhostData& rhs);
      69             : 
      70           0 :   size_t number_of_buffers_{1};
      71           0 :   size_t buffer_index_{0};
      72           0 :   std::vector<DataVector> local_ghost_data_{};
      73           0 :   std::vector<DataVector> neighbor_ghost_data_for_reconstruction_{};
      74             : };
      75             : 
      76           0 : bool operator!=(const GhostData& lhs, const GhostData& rhs);
      77             : 
      78           0 : std::ostream& operator<<(std::ostream& os, const GhostData& ghost_data);
      79             : }  // namespace evolution::dg::subcell

Generated by: LCOV version 1.14