www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
FloatingPointExceptionGuard Class Reference

Scope guard for starting and stopping Floating Point Exception Trapping. More...

#include <FloatingPointExceptionGuard.h>

Public Member Functions

 FloatingPointExceptionGuard (const MooseApp &moose_app)
 Instantiation turns on FPE Trapping as long as trapping is enabled on the application. More...
 
 ~FloatingPointExceptionGuard ()
 Stop FPE Trapping on destruction. More...
 

Private Attributes

const bool _trapping_enabled
 Determine whether or not PFE trapping needs to be toggled off. More...
 

Detailed Description

Scope guard for starting and stopping Floating Point Exception Trapping.

Definition at line 18 of file FloatingPointExceptionGuard.h.

Constructor & Destructor Documentation

◆ FloatingPointExceptionGuard()

FloatingPointExceptionGuard::FloatingPointExceptionGuard ( const MooseApp moose_app)
inline

Instantiation turns on FPE Trapping as long as trapping is enabled on the application.

By default trapping is enabled when the DEBUG symbol is defined (dbg mode), but can be overridden and turned on and off for any particular simulation run.

Definition at line 26 of file FloatingPointExceptionGuard.h.

27  : _trapping_enabled(moose_app.getFPTrapFlag())
28  {
30  libMesh::enableFPE(true);
31  }
const bool _trapping_enabled
Determine whether or not PFE trapping needs to be toggled off.
void enableFPE(bool on)
bool getFPTrapFlag() const
Returns whether FPE trapping is turned on (either because of debug or user requested) ...
Definition: MooseApp.h:908

◆ ~FloatingPointExceptionGuard()

FloatingPointExceptionGuard::~FloatingPointExceptionGuard ( )
inline

Stop FPE Trapping on destruction.

Definition at line 36 of file FloatingPointExceptionGuard.h.

37  {
39  libMesh::enableFPE(false);
40  }
const bool _trapping_enabled
Determine whether or not PFE trapping needs to be toggled off.
void enableFPE(bool on)

Member Data Documentation

◆ _trapping_enabled

const bool FloatingPointExceptionGuard::_trapping_enabled
private

Determine whether or not PFE trapping needs to be toggled off.

Definition at line 44 of file FloatingPointExceptionGuard.h.

Referenced by FloatingPointExceptionGuard(), and ~FloatingPointExceptionGuard().


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