www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ThreadedNodeLoop< RangeType, IteratorType > Class Template Reference

#include <ThreadedNodeLoop.h>

Public Member Functions

 ThreadedNodeLoop (FEProblemBase &fe_problem)
 
 ThreadedNodeLoop (ThreadedNodeLoop &x, Threads::split split)
 
virtual ~ThreadedNodeLoop ()
 
void operator() (const RangeType &range)
 
virtual void pre ()
 Called before the node range loop. More...
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void onNode (IteratorType &node_it)
 Called for each node. More...
 
virtual void postNode (IteratorType &node_it)
 Called after the node assembly is done (including surface assembling) More...
 
virtual void caughtMooseException (MooseException &e)
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing ()
 Whether or not the loop should continue. More...
 

Protected Member Functions

virtual void printGeneralExecutionInformation () const
 Print information about the loop, mostly order of execution of objects. More...
 

Protected Attributes

FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

template<typename RangeType, typename IteratorType>
class ThreadedNodeLoop< RangeType, IteratorType >

Definition at line 18 of file ThreadedNodeLoop.h.

Constructor & Destructor Documentation

◆ ThreadedNodeLoop() [1/2]

template<typename RangeType , typename IteratorType >
ThreadedNodeLoop< RangeType, IteratorType >::ThreadedNodeLoop ( FEProblemBase fe_problem)

Definition at line 80 of file ThreadedNodeLoop.h.

81  : _fe_problem(fe_problem)
82 {
83 }
FEProblemBase & _fe_problem

◆ ThreadedNodeLoop() [2/2]

template<typename RangeType , typename IteratorType >
ThreadedNodeLoop< RangeType, IteratorType >::ThreadedNodeLoop ( ThreadedNodeLoop< RangeType, IteratorType > &  x,
Threads::split  split 
)

Definition at line 86 of file ThreadedNodeLoop.h.

89 {
90 }
FEProblemBase & _fe_problem

◆ ~ThreadedNodeLoop()

template<typename RangeType, typename IteratorType>
virtual ThreadedNodeLoop< RangeType, IteratorType >::~ThreadedNodeLoop ( )
inlinevirtual

Definition at line 26 of file ThreadedNodeLoop.h.

26 {};

Member Function Documentation

◆ caughtMooseException()

template<typename RangeType, typename IteratorType>
virtual void ThreadedNodeLoop< RangeType, IteratorType >::caughtMooseException ( MooseException e)
inlinevirtual

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Definition at line 56 of file ThreadedNodeLoop.h.

57  {
58  Threads::spin_mutex::scoped_lock lock(threaded_node_mutex);
59 
60  std::string what(e.what());
62  };
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
FEProblemBase & _fe_problem
static Threads::spin_mutex threaded_node_mutex

◆ keepGoing()

template<typename RangeType, typename IteratorType>
virtual bool ThreadedNodeLoop< RangeType, IteratorType >::keepGoing ( )
inlinevirtual

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Definition at line 69 of file ThreadedNodeLoop.h.

69 { return !_fe_problem.hasException(); }
FEProblemBase & _fe_problem
virtual bool hasException()
Whether or not an exception has occurred.

◆ onNode()

template<typename RangeType , typename IteratorType>
void ThreadedNodeLoop< RangeType, IteratorType >::onNode ( IteratorType &  node_it)
virtual

◆ operator()()

template<typename RangeType, typename IteratorType >
void ThreadedNodeLoop< RangeType, IteratorType >::operator() ( const RangeType &  range)

Definition at line 94 of file ThreadedNodeLoop.h.

95 {
96  try
97  {
98  ParallelUniqueId puid;
99  _tid = puid.id;
100 
101  pre();
103 
104  for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
105  {
106  if (!keepGoing())
107  break;
108 
109  onNode(nd);
110 
111  postNode(nd);
112  }
113 
114  post();
115  }
116  catch (MooseException & e)
117  {
119  }
120 }
virtual void printGeneralExecutionInformation() const
Print information about the loop, mostly order of execution of objects.
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.
virtual bool keepGoing()
Whether or not the loop should continue.
Provides a way for users to bail out of the current solve.
virtual void pre()
Called before the node range loop.
virtual void post()
Called after the node range loop.
virtual void postNode(IteratorType &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(IteratorType &node_it)
Called for each node.

◆ post()

template<typename RangeType , typename IteratorType >
void ThreadedNodeLoop< RangeType, IteratorType >::post ( )
virtual

Called after the node range loop.

Reimplemented in ComputeNodalAuxVarsThread< AuxKernelType >.

Definition at line 130 of file ThreadedNodeLoop.h.

131 {
132 }

◆ postNode()

template<typename RangeType , typename IteratorType>
void ThreadedNodeLoop< RangeType, IteratorType >::postNode ( IteratorType &  node_it)
virtual

Called after the node assembly is done (including surface assembling)

Parameters
node- active node

Definition at line 142 of file ThreadedNodeLoop.h.

143 {
144 }

◆ pre()

template<typename RangeType , typename IteratorType >
void ThreadedNodeLoop< RangeType, IteratorType >::pre ( )
virtual

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, ComputeNodalKernelBCJacobiansThread, ComputeNodalKernelsThread, and ComputeNodalKernelBcsThread.

Definition at line 124 of file ThreadedNodeLoop.h.

125 {
126 }

◆ printGeneralExecutionInformation()

template<typename RangeType, typename IteratorType>
virtual void ThreadedNodeLoop< RangeType, IteratorType >::printGeneralExecutionInformation ( ) const
inlineprotectedvirtual

Member Data Documentation

◆ _fe_problem

template<typename RangeType, typename IteratorType>
FEProblemBase& ThreadedNodeLoop< RangeType, IteratorType >::_fe_problem
protected

◆ _tid

template<typename RangeType, typename IteratorType>
THREAD_ID ThreadedNodeLoop< RangeType, IteratorType >::_tid
protected

Definition at line 73 of file ThreadedNodeLoop.h.


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