Domain.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstddef>
8 #include <utility>
9 #include <vector>
10 
13 #include "Domain/CreateInitialElement.hpp"
14 #include "Domain/Domain.hpp"
15 #include "Domain/Element.hpp"
16 #include "Domain/ElementId.hpp"
17 #include "Domain/ElementMap.hpp"
19 #include "Domain/Mesh.hpp"
20 #include "Domain/MinimumGridSpacing.hpp"
21 #include "Domain/Tags.hpp"
22 #include "Evolution/Initialization/Helpers.hpp"
23 
24 /// \cond
25 template <size_t VolumeDim>
26 class ElementIndex;
27 namespace Frame {
28 struct Inertial;
29 } // namespace Frame
30 /// \endcond
31 
32 namespace Elliptic {
33 namespace Initialization {
34 
35 /*!
36  * \brief Initializes the DataBox tag related to the computational domain
37  *
38  * DataBox:
39  * - Adds:
40  * - `Tags::Mesh<Dim>`
41  * - `Tags::Element<Dim>`
42  * - `Tags::ElementMap<Dim, Frame::Inertial>`
43  * - `Tags::Coordinates<Dim, Frame::Logical>`
44  * - `Tags::Coordinates<Dim, Frame::Inertial>`
45  * - `Tags::InverseJacobian<
46  * Tags::ElementMap<Dim>, Tags::Coordinates<Dim, Frame::Logical>>`
47  */
48 template <size_t Dim>
49 struct Domain {
52  using compute_tags = db::AddComputeTags<
57  Tags::Coordinates<Dim, Frame::Logical>>>;
58 
59  template <typename TagsList>
60  static auto initialize(
61  db::DataBox<TagsList>&& box, const ElementIndex<Dim>& array_index,
62  const std::vector<std::array<size_t, Dim>>& initial_extents,
63  const ::Domain<Dim, Frame::Inertial>& domain) noexcept {
64  const ElementId<Dim> element_id{array_index};
65  const auto& my_block = domain.blocks()[element_id.block_id()];
66  Mesh<Dim> mesh =
67  ::Initialization::element_mesh(initial_extents, element_id);
68  Element<Dim> element = create_initial_element(element_id, my_block);
69  ElementMap<Dim, Frame::Inertial> map{element_id,
70  my_block.coordinate_map().get_clone()};
71 
72  return db::create_from<db::RemoveTags<>, simple_tags, compute_tags>(
73  std::move(box), std::move(mesh), std::move(element), std::move(map));
74  }
75 };
76 
77 } // namespace Initialization
78 } // namespace Elliptic
Items for initializing the DataBoxes of parallel components.
Definition: ConservativeSystem.hpp:21
Definition: BlockId.hpp:16
Definition: ComputeOperatorAction.hpp:28
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:49
Defines class ElementId.
The CoordinateMap for the Element from the Logical frame to the TargetFrame
Definition: ElementMap.hpp:36
Defines class template Domain.
Defines functions logical_coordinates and interface_logical_coordinates.
Computes the inverse Jacobian of the map held by MapTag at the coordinates held by SourceCoordsTag...
Definition: Tags.hpp:125
Defines classes and functions used for manipulating DataBox&#39;s.
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1227
The logical coordinates in the Element.
Definition: LogicalCoordinates.hpp:64
Element< VolumeDim > create_initial_element(const ElementId< VolumeDim > &element_id, const Block< VolumeDim, TargetFrame > &block) noexcept
Creates an initial element of a Block.
Definition: CreateInitialElement.cpp:27
A spectral element with knowledge of its neighbors.
Definition: Element.hpp:29
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Initializes the DataBox tag related to the computational domain.
Definition: Domain.hpp:49
Defines the class template Mesh.
The coordinates in a given frame.
Definition: Tags.hpp:95
The Element associated with the DataBox.
Definition: Tags.hpp:64
The coordinates in the target frame of MapTag. The SourceCoordsTag&#39;s frame must be the source frame o...
Definition: Tags.hpp:107
Defines tags related to domain quantities.
A class for indexing a Charm array by Element.
Definition: ElementIndex.hpp:53
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
The coordinate map from logical to grid coordinate.
Definition: Tags.hpp:84
tmpl::flatten< tmpl::list< Tags... > > AddComputeTags
List of Compute Item Tags to add to the DataBox.
Definition: DataBox.hpp:1234
Defines class Element.