SpECTRE Documentation Coverage Report
Current view: top level - Domain - BlockLogicalCoordinates.hpp Hit Total Coverage
Commit: 9f349d3c09e1c03107f00c2135ca40e209d3b84c Lines: 1 2 50.0 %
Date: 2023-06-09 21:05:06
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 <memory>
       8             : #include <optional>
       9             : #include <string>
      10             : #include <unordered_map>
      11             : #include <vector>
      12             : 
      13             : #include "DataStructures/IdPair.hpp"
      14             : #include "DataStructures/Tensor/TypeAliases.hpp"
      15             : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
      16             : #include "Domain/Structure/BlockId.hpp"
      17             : 
      18             : /// \cond
      19             : class DataVector;
      20             : template <size_t VolumeDim>
      21             : class Domain;
      22             : /// \endcond
      23             : 
      24             : /// \ingroup ComputationalDomainGroup
      25             : ///
      26             : /// Computes the block logical coordinates and the containing `BlockId` of
      27             : /// a set of points, given coordinates in a particular frame.
      28             : ///
      29             : /// \details Returns a std::vector<std::optional<IdPair<BlockId,coords>>>,
      30             : /// where the vector runs over the points and is indexed in the same order as
      31             : /// the input coordinates `x`. For each point, the `IdPair` holds the
      32             : /// block logical coords of that point and the `BlockId` of the `Block` that
      33             : /// contains that point.
      34             : /// The std::optional is invalid if the point is not in any Block.
      35             : /// If a point is on a shared boundary of two or more `Block`s, it is
      36             : /// returned only once, and is considered to belong to the `Block`
      37             : /// with the smaller `BlockId`.
      38             : ///
      39             : /// \warning Since map inverses can involve numerical roundoff error, care must
      40             : /// be taken with points on shared block boundaries. They will be assigned to
      41             : /// the first block (by block ID) that contains the point _within roundoff
      42             : /// error_. Therefore, be advised to use the logical coordinates returned by
      43             : /// this function, which are guaranteed to be in [-1, 1] and can be safely
      44             : /// passed along to `element_logical_coordinates`.
      45             : ///
      46             : /// \warning `block_logical_coordinates` with x in
      47             : /// `::Frame::Distorted` ignores all `Block`s that lack a distorted
      48             : /// frame, and it will return std::nullopt for points that lie outside
      49             : /// all distorted-frame-endowed `Block`s. This is what is expected for
      50             : /// typical use cases.  This means that `block_logical_coordinates`
      51             : /// does not assume that grid and distorted frames are equal in
      52             : /// `Block`s that lack a distorted frame.
      53             : template <size_t Dim, typename Frame>
      54           1 : auto block_logical_coordinates(
      55             :     const Domain<Dim>& domain, const tnsr::I<DataVector, Dim, Frame>& x,
      56             :     double time = std::numeric_limits<double>::signaling_NaN(),
      57             :     const std::unordered_map<
      58             :         std::string, std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
      59             :         functions_of_time = std::unordered_map<
      60             :             std::string,
      61             :             std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>{})
      62             :     -> std::vector<std::optional<
      63             :         IdPair<domain::BlockId, tnsr::I<double, Dim, ::Frame::BlockLogical>>>>;

Generated by: LCOV version 1.14