opm-simulators
Loading...
Searching...
No Matches
Opm::GroupStateHelper< Scalar, IndexTraits >::ScopedLoggerGuard Class Reference

RAII guard that owns a DeferredLogger and auto-gathers on destruction. More...

#include <GroupStateHelper.hpp>

Public Member Functions

 ScopedLoggerGuard (const GroupStateHelper &helper, bool do_mpi_gather=true)
 Constructor for scoped logger guard.
 ScopedLoggerGuard (const ScopedLoggerGuard &)=delete
ScopedLoggerGuardoperator= (const ScopedLoggerGuard &)=delete
ScopedLoggerGuardoperator= (ScopedLoggerGuard &&)=delete
 ScopedLoggerGuard (ScopedLoggerGuard &&other) noexcept

Detailed Description

template<typename Scalar, typename IndexTraits>
class Opm::GroupStateHelper< Scalar, IndexTraits >::ScopedLoggerGuard

RAII guard that owns a DeferredLogger and auto-gathers on destruction.

This class provides a complete lifecycle for deferred logging in parallel simulations. It owns a DeferredLogger instance and automatically handles:

  • Pushing the logger onto the stack (saving the previous logger)
  • On destruction: gathering messages across MPI ranks, logging on rank 0 (if terminal_output enabled), and restoring the previous logger

Usage: auto guard = groupStateHelper.pushLogger(); // Use groupStateHelper.deferredLogger() to log messages // On scope exit: gather, log (if terminal), restore previous logger

Constructor & Destructor Documentation

◆ ScopedLoggerGuard()

template<typename Scalar, typename IndexTraits>
Opm::GroupStateHelper< Scalar, IndexTraits >::ScopedLoggerGuard::ScopedLoggerGuard ( const GroupStateHelper & helper,
bool do_mpi_gather = true )
inlineexplicit

Constructor for scoped logger guard.

Parameters
helperReference to the GroupStateHelper
do_mpi_gatherIf true, gather messages across MPI ranks on destruction. Set to false when called from contexts where MPI synchronization is not possible (e.g., NLDD domain-local operations).

The documentation for this class was generated from the following file: