www.mooseframework.org
SwapBackSentinel.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef SWAPBACKSENTINEL_H
16 #define SWAPBACKSENTINEL_H
17 
18 // MOOSE includes
19 #include "MooseTypes.h"
20 
21 // Forward declarations
22 class FEProblemBase;
23 
39 {
40 public:
47 
53  SwapBackFunction func,
54  THREAD_ID tid,
55  bool predicate = true)
56  : _fe_problem(fe_problem), _func(func), _thread_id(tid), _predicate(predicate)
57  {
58  }
59 
64  {
65  if (_predicate)
67  }
68 
69 private:
73  bool _predicate;
74 };
75 
76 #endif
void(FEProblemBase::*)(THREAD_ID) SwapBackFunction
SwapBackFunction is a typedef for a pointer to an FEProblemBase member function taking a THREAD_ID an...
~SwapBackSentinel()
The destructor calls swap back function only if the predicate is true.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FEProblemBase & _fe_problem
SwapBackSentinel(FEProblemBase &fe_problem, SwapBackFunction func, THREAD_ID tid, bool predicate=true)
Constructor taking an FEProblemBase reference, a function to call, and the THREAD_ID argument...
SwapBackFunction _func
unsigned int THREAD_ID
Definition: MooseTypes.h:79
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.