SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/DiscontinuousGalerkin - InitializeDomain.hpp Hit Total Coverage
Commit: ebec864322c50bab8dca0a90baf8d01875114261 Lines: 1 6 16.7 %
Date: 2020-11-25 20:28:50
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 <array>
       7             : #include <cstddef>
       8             : #include <tuple>
       9             : #include <utility>
      10             : #include <vector>
      11             : 
      12             : #include "DataStructures/DataBox/DataBox.hpp"
      13             : #include "Domain/CreateInitialElement.hpp"
      14             : #include "Domain/Domain.hpp"
      15             : #include "Domain/ElementMap.hpp"
      16             : #include "Domain/LogicalCoordinates.hpp"
      17             : #include "Domain/MinimumGridSpacing.hpp"
      18             : #include "Domain/Structure/CreateInitialMesh.hpp"
      19             : #include "Domain/Structure/Element.hpp"
      20             : #include "Domain/Structure/ElementId.hpp"
      21             : #include "Domain/Tags.hpp"
      22             : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      23             : #include "Parallel/GlobalCache.hpp"
      24             : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
      25             : #include "Utilities/Requires.hpp"
      26             : #include "Utilities/TMPL.hpp"
      27             : #include "Utilities/TaggedTuple.hpp"
      28             : 
      29             : /// \cond
      30             : template <size_t VolumeDim>
      31             : class ElementId;
      32             : namespace Frame {
      33             : struct Inertial;
      34             : }  // namespace Frame
      35             : /// \endcond
      36             : 
      37             : namespace dg {
      38             : namespace Actions {
      39             : /*!
      40             :  * \ingroup InitializationGroup
      41             :  * \brief Initialize items related to the basic structure of the element
      42             :  *
      43             :  * GlobalCache:
      44             :  * - Uses:
      45             :  *   - `Tags::Domain<Dim, Frame::Inertial>`
      46             :  * DataBox:
      47             :  * - Uses:
      48             :  *   - `Tags::InitialExtents<Dim>`
      49             :  * - Adds:
      50             :  *   - `Tags::Mesh<Dim>`
      51             :  *   - `Tags::Element<Dim>`
      52             :  *   - `Tags::ElementMap<Dim, Frame::Inertial>`
      53             :  *   - `Tags::Coordinates<Dim, Frame::Logical>`
      54             :  *   - `Tags::Coordinates<Dim, Frame::Inertial>`
      55             :  *   - `Tags::InverseJacobianCompute<
      56             :  *   Tags::ElementMap<Dim>, Tags::Coordinates<Dim, Frame::Logical>>`
      57             :  *   - `Tags::DetInvJacobianCompute<Dim, Frame::Logical, Frame::Inertial>`
      58             :  *   - `Tags::MinimumGridSpacingCompute<Dim, Frame::Inertial>>`
      59             :  * - Removes: nothing
      60             :  * - Modifies: nothing
      61             :  *
      62             :  * \note This action relies on the `SetupDataBox` aggregated initialization
      63             :  * mechanism, so `Actions::SetupDataBox` must be present in the `Initialization`
      64             :  * phase action list prior to this action.
      65             :  */
      66             : template <size_t Dim>
      67           1 : struct InitializeDomain {
      68           0 :   using initialization_tags =
      69             :       tmpl::list<domain::Tags::InitialExtents<Dim>,
      70             :                  domain::Tags::InitialRefinementLevels<Dim>>;
      71             : 
      72           0 :   using simple_tags =
      73             :       tmpl::list<domain::Tags::Mesh<Dim>, domain::Tags::Element<Dim>,
      74             :                  domain::Tags::ElementMap<Dim>>;
      75           0 :   using compute_tags = tmpl::append<db::AddComputeTags<
      76             :       domain::Tags::LogicalCoordinates<Dim>,
      77             :       domain ::Tags::MappedCoordinates<
      78             :           domain::Tags::ElementMap<Dim>,
      79             :           domain ::Tags::Coordinates<Dim, Frame::Logical>>,
      80             :       domain ::Tags::InverseJacobianCompute<
      81             :           domain ::Tags::ElementMap<Dim>,
      82             :           domain::Tags::Coordinates<Dim, Frame::Logical>>,
      83             :       domain::Tags::DetInvJacobianCompute<Dim, Frame::Logical, Frame::Inertial>,
      84             :       domain::Tags::MinimumGridSpacingCompute<Dim, Frame::Inertial>>>;
      85             : 
      86             :   template <
      87             :       typename DataBox, typename... InboxTags, typename Metavariables,
      88             :       typename ActionList, typename ParallelComponent>
      89           0 :   static auto apply(DataBox& box,
      90             :                     const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      91             :                     const Parallel::GlobalCache<Metavariables>& /*cache*/,
      92             :                     const ElementId<Dim>& array_index,
      93             :                     const ActionList /*meta*/,
      94             :                     const ParallelComponent* const /*meta*/) noexcept {
      95             :     const auto& initial_extents =
      96             :         db::get<domain::Tags::InitialExtents<Dim>>(box);
      97             :     const auto& initial_refinement =
      98             :         db::get<domain::Tags::InitialRefinementLevels<Dim>>(box);
      99             :     const auto& domain = db::get<domain::Tags::Domain<Dim>>(box);
     100             : 
     101             :     const ElementId<Dim> element_id{array_index};
     102             :     const auto& my_block = domain.blocks()[element_id.block_id()];
     103             :     Mesh<Dim> mesh = domain::Initialization::create_initial_mesh(
     104             :         initial_extents, element_id, Spectral::Quadrature::GaussLobatto);
     105             :     Element<Dim> element = domain::Initialization::create_initial_element(
     106             :         element_id, my_block, initial_refinement);
     107             :     if (my_block.is_time_dependent()) {
     108             :       ERROR(
     109             :           "The version of the InitializeDomain action being used is for "
     110             :           "elliptic systems which do not have any time-dependence but the "
     111             :           "domain creator has set up the domain to have time-dependence.");
     112             :     }
     113             :     ElementMap<Dim, Frame::Inertial> element_map{
     114             :         element_id, my_block.stationary_map().get_clone()};
     115             :     Initialization::mutate_assign<simple_tags>(
     116             :         make_not_null(&box), std::move(mesh), std::move(element),
     117             :         std::move(element_map));
     118             : 
     119             :     return std::make_tuple(std::move(box));
     120             :   }
     121             : };
     122             : }  // namespace Actions
     123             : }  // namespace dg

Generated by: LCOV version 1.14