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 19 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 27 of file FloatingPointExceptionGuard.h.

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

◆ ~FloatingPointExceptionGuard()

FloatingPointExceptionGuard::~FloatingPointExceptionGuard ( )
inline

Stop FPE Trapping on destruction.

Definition at line 37 of file FloatingPointExceptionGuard.h.

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

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 45 of file FloatingPointExceptionGuard.h.

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


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