SizeOfElement.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 <string>
9 
12 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 class DataVector;
16 template <size_t VolumeDim>
17 class Mesh;
18 namespace Tags {
19 template <size_t Dim, typename Frame>
20 struct Coordinates;
21 template <size_t VolumeDim>
22 struct Mesh;
23 } // namespace Tags
24 /// \endcond
25 
26 /*!
27  * \ingroup ComputationalDomainGroup
28  * \brief Compute the inertial-coordinate size of an element along each of its
29  * logical directions.
30  *
31  * For each logical direction, compute the mean position (in inertial
32  * coordinates) of the element's lower and upper faces in that direction.
33  * This is done by simply averaging the coordinates of the face grid points.
34  * The size of the element along this logical direction is then the distance
35  * between the mean positions of the lower and upper faces.
36  * Note that for curved elements, this is an approximate measurement of size.
37  *
38  * \details
39  * Because this quantity is defined in terms of specific coordinates, it is
40  * not well represented by a `Tensor`, so we use a `std::array`.
41  */
42 template <size_t VolumeDim>
44  const Mesh<VolumeDim>& mesh,
45  const tnsr::I<DataVector, VolumeDim>& inertial_coords) noexcept;
46 
47 namespace Tags {
48 /// \ingroup DataBoxTagsGroup
49 /// \ingroup ComputationalDomainGroup
50 /// The inertial-coordinate size of an element along each of its logical
51 /// directions.
52 template <size_t VolumeDim>
54  static std::string name() noexcept { return "SizeOfElement"; }
55  using argument_tags =
56  tmpl::list<Tags::Mesh<VolumeDim>,
58  static constexpr auto function = size_of_element<VolumeDim>;
59 };
60 } // namespace Tags
std::array< double, VolumeDim > size_of_element(const Mesh< VolumeDim > &mesh, const tnsr::I< DataVector, VolumeDim > &inertial_coords) noexcept
Compute the inertial-coordinate size of an element along each of its logical directions.
Definition: SizeOfElement.cpp:18
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:155
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:49
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
The coordinates in a given frame.
Definition: Tags.hpp:95
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
The inertial-coordinate size of an element along each of its logical directions.
Definition: SizeOfElement.hpp:53
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...