SpECTRE Documentation Coverage Report
Current view: top level - Domain/Structure - BlockGroups.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 100.0 % 5 5
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            1 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : /// \file
       5              : /// Utilities to work with block names and groups
       6              : 
       7              : #pragma once
       8              : 
       9              : #include <string>
      10              : #include <unordered_map>
      11              : #include <unordered_set>
      12              : #include <vector>
      13              : 
      14              : namespace domain {
      15              : 
      16              : /*!
      17              :  * \brief Check if a block is in the given group
      18              :  *
      19              :  * \param block_name The name of the block to check
      20              :  * \param block_or_group_name The group name we're testing. Returns true if
      21              :  * the block is in this group. This can also be the name of the block itself.
      22              :  * \param block_groups All block groups.
      23              :  */
      24            1 : bool block_is_in_group(
      25              :     const std::string& block_name, const std::string& block_or_group_name,
      26              :     const std::unordered_map<std::string, std::unordered_set<std::string>>&
      27              :         block_groups);
      28              : 
      29              : /*!
      30              :  * \brief Expand a list of block or group names into a list of block names
      31              :  *
      32              :  * Throws a `std::invalid_argument` exception if any of the input names are not
      33              :  * in \p all_block_names or \p block_groups.
      34              :  *
      35              :  * \param block_or_group_names Block or group names to expand
      36              :  * \param all_block_names All block names in the domain
      37              :  * \param block_groups Block groups used to expand the names
      38              :  * \return std::unordered_set<std::string> List of block names that appear in
      39              :  * \p all_block_names. If one of the input names was a group, then all block
      40              :  * names from that group are included. Overlaps between groups are allowed.
      41              :  */
      42            1 : std::unordered_set<std::string> expand_block_groups_to_block_names(
      43              :     const std::vector<std::string>& block_or_group_names,
      44              :     const std::vector<std::string>& all_block_names,
      45              :     const std::unordered_map<std::string, std::unordered_set<std::string>>&
      46              :         block_groups);
      47              : 
      48              : /*!
      49              :  * \brief The entries of \p block_or_group_names that contain the block
      50              :  * \p block_name
      51              :  *
      52              :  * An entry contains the block if it is the name of the block itself or the name
      53              :  * of a group that includes the block. Throws a `std::invalid_argument`
      54              :  * exception if any of the input names are not in \p all_block_names or
      55              :  * \p block_groups.
      56              :  *
      57              :  * \param block_name The name of the block to look for
      58              :  * \param block_or_group_names Block or group names to search
      59              :  * \param all_block_names All block names in the domain
      60              :  * \param block_groups All block groups
      61              :  * \return The entries of \p block_or_group_names that contain the block, in
      62              :  * the order they appear in \p block_or_group_names. Empty if no entry contains
      63              :  * the block.
      64              :  */
      65            1 : std::vector<std::string> block_or_group_names_containing_block(
      66              :     const std::string& block_name,
      67              :     const std::vector<std::string>& block_or_group_names,
      68              :     const std::vector<std::string>& all_block_names,
      69              :     const std::unordered_map<std::string, std::unordered_set<std::string>>&
      70              :         block_groups);
      71              : 
      72              : /*!
      73              :  * \brief Sorted block IDs corresponding to the given block or group names.
      74              :  *
      75              :  * Throws a `std::invalid_argument` exception if any of the input names are not
      76              :  * in \p all_block_names or \p block_groups.
      77              :  *
      78              :  * \param block_or_group_names Block names to get the IDs of. Any block groups
      79              :  * in this list are expanded.
      80              :  * \param all_block_names All block names in the domain.
      81              :  * \param block_groups Block groups used to expand the names.
      82              :  * \return std::vector<size_t> Sorted list of block IDs.
      83              :  */
      84            1 : std::vector<size_t> block_ids_from_names(
      85              :     const std::vector<std::string>& block_or_group_names,
      86              :     const std::vector<std::string>& all_block_names,
      87              :     const std::unordered_map<std::string, std::unordered_set<std::string>>&
      88              :         block_groups);
      89              : 
      90              : }  // namespace domain
        

Generated by: LCOV version 2.0-1