SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/FiniteDifference - NeighborDataAsVariables.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 50.0 % 2 1
Test Date: 2026-10-22 17:29:42
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 <utility>
       8              : 
       9              : #include "DataStructures/DataVector.hpp"
      10              : #include "DataStructures/Variables.hpp"
      11              : #include "Domain/Structure/Direction.hpp"
      12              : #include "Domain/Structure/DirectionalId.hpp"
      13              : #include "Domain/Structure/DirectionalIdMap.hpp"
      14              : #include "Domain/Structure/ElementId.hpp"
      15              : #include "Evolution/DgSubcell/GhostData.hpp"
      16              : #include "Evolution/DgSubcell/Mesh.hpp"
      17              : #include "NumericalAlgorithms/Spectral/Basis.hpp"
      18              : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      19              : #include "Utilities/ErrorHandling/Assert.hpp"
      20              : #include "Utilities/Gsl.hpp"
      21              : 
      22              : namespace fd {
      23              : /*!
      24              :  * \brief Given the type-erased neighbor data for reconstruction stored in a
      25              :  * `DataVector`, have `Variables` point into them.
      26              :  *
      27              :  * This function is helpful for reconstruction, especially when wanting to apply
      28              :  * different reconstruction methods to different tags. This can happen, for
      29              :  * example, when doing positivity-preserving reconstruction. The density should
      30              :  * remain positive, but negative velocities are fine.
      31              :  */
      32              : template <size_t Dim, typename ReconstructionTags>
      33            1 : void neighbor_data_as_variables(
      34              :     const gsl::not_null<DirectionalIdMap<Dim, Variables<ReconstructionTags>>*>
      35              :         vars_neighbor_data,
      36              :     const DirectionalIdMap<Dim, evolution::dg::subcell::GhostData>&
      37              :         all_ghost_data,
      38              :     const size_t ghost_zone_size, const Mesh<Dim>& subcell_mesh) {
      39              :   const size_t neighbor_num_pts =
      40              :       ghost_zone_size * subcell_mesh.extents().slice_away(0).product();
      41              :   evolution::dg::subcell::fd::verify_subcell_extents(subcell_mesh.extents());
      42              : 
      43              :   vars_neighbor_data->clear();
      44              :   for (const auto& [neighbor_id, ghost_data] : all_ghost_data) {
      45              :     const DataVector& data =
      46              :         ghost_data.neighbor_ghost_data_for_reconstruction();
      47              :     (*vars_neighbor_data)[neighbor_id] = {};
      48              :     (*vars_neighbor_data)[neighbor_id].set_data_ref(
      49              :         const_cast<double*>(data.data()),
      50              :         Variables<ReconstructionTags>::number_of_independent_components *
      51              :             neighbor_num_pts);
      52              :   }
      53              : }
      54              : }  // namespace fd
        

Generated by: LCOV version 2.0-1