SpECTRE Documentation Coverage Report
Current view: top level - Domain/Structure - BlockId.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 7.1 % 14 1
Test Date: 2026-10-22 17:29:42
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 <ostream>
       8              : #include <pup.h>
       9              : 
      10              : /// \cond
      11              : namespace PUP {
      12              : class er;
      13              : }  // namespace PUP
      14              : /// \endcond
      15              : 
      16              : namespace domain {
      17              : /*!
      18              :  * \ingroup ComputationalDomainGroup
      19              :  * \brief Index a block of the computational domain.
      20              :  */
      21            1 : class BlockId {
      22              :  public:
      23            0 :   BlockId() = default;
      24            0 :   explicit BlockId(size_t id) : id_(id) {}
      25              : 
      26              :   // NOLINTNEXTLINE(google-runtime-references)
      27            0 :   void pup(PUP::er& p) { p | id_; }
      28              : 
      29            0 :   size_t get_index() const { return id_; }
      30              : 
      31            0 :   BlockId& operator++() {
      32              :     ++id_;
      33              :     return *this;
      34              :   }
      35              : 
      36            0 :   BlockId& operator--() {
      37              :     --id_;
      38              :     return *this;
      39              :   }
      40              : 
      41            0 :   BlockId operator++(int) {
      42              :     BlockId temp = *this;
      43              :     id_++;
      44              :     return temp;
      45              :   }
      46              : 
      47            0 :   BlockId operator--(int) {
      48              :     BlockId temp = *this;
      49              :     id_--;
      50              :     return temp;
      51              :   }
      52              : 
      53              :  private:
      54            0 :   size_t id_{0};
      55              : };
      56              : 
      57            0 : inline bool operator==(const BlockId& lhs, const BlockId& rhs) {
      58              :   return lhs.get_index() == rhs.get_index();
      59              : }
      60              : 
      61            0 : inline bool operator!=(const BlockId& lhs, const BlockId& rhs) {
      62              :   return not(lhs == rhs);
      63              : }
      64              : 
      65            0 : inline std::ostream& operator<<(std::ostream& os, const BlockId& block_id) {
      66              :   return os << '[' << block_id.get_index() << ']';
      67              : }
      68              : 
      69              : }  // namespace domain
        

Generated by: LCOV version 2.0-1