SpECTRE Documentation Coverage Report
Current view: top level - IO/Observer/Actions - GetLockPointer.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 20.0 % 5 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 <mutex>
       7              : 
       8              : #include "DataStructures/DataBox/DataBox.hpp"
       9              : #include "Parallel/NodeLock.hpp"
      10              : #include "Utilities/ErrorHandling/Error.hpp"
      11              : #include "Utilities/Gsl.hpp"
      12              : #include "Utilities/PrettyType.hpp"
      13              : #include "Utilities/TMPL.hpp"
      14              : 
      15            0 : namespace observers::Actions {
      16              : 
      17              : /// Local synchronous action for retrieving a pointer to the `NodeLock` with tag
      18              : /// `LockTag` on the component.
      19              : ///
      20              : /// \warning The retrieved pointer to a lock must only be treated as 'good'
      21              : /// during the execution of the action from which this synchronous action is
      22              : /// called. This is because we can only trust that charm will not migrate the
      23              : /// component on which the action is running until after the action has
      24              : /// completed, and it will not migrate the Nodegroup to which the lock points
      25              : /// until a checkpoint.
      26              : template <typename LockTag>
      27            1 : struct GetLockPointer {
      28            0 :   using return_type = Parallel::NodeLock*;
      29              : 
      30              :   template <typename ParallelComponent, typename DbTagList>
      31            0 :   static return_type apply(db::DataBox<DbTagList>& box,
      32              :                            const gsl::not_null<Parallel::NodeLock*> node_lock) {
      33              :     Parallel::NodeLock* result_lock;
      34              :     const std::lock_guard hold_lock(*node_lock);
      35              :     db::mutate<LockTag>(
      36              :         [&result_lock](const gsl::not_null<Parallel::NodeLock*> lock) {
      37              :           result_lock = lock;
      38              :         },
      39              :         make_not_null(&box));
      40              :     return result_lock;
      41              :   }
      42              : };
      43              : }  // namespace observers::Actions
        

Generated by: LCOV version 2.0-1