www.mooseframework.org
Public 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 Attributes

FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

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

Definition at line 16 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 73 of file ThreadedNodeLoop.h.

74  : _fe_problem(fe_problem)
75 {
76 }

◆ ThreadedNodeLoop() [2/2]

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

Definition at line 79 of file ThreadedNodeLoop.h.

81  : _fe_problem(x._fe_problem)
82 {
83 }

◆ ~ThreadedNodeLoop()

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

Definition at line 24 of file ThreadedNodeLoop.h.

24 {};

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 54 of file ThreadedNodeLoop.h.

55  {
56  std::string what(e.what());
58  };

◆ 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 65 of file ThreadedNodeLoop.h.

65 { return !_fe_problem.hasException(); }

◆ 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 87 of file ThreadedNodeLoop.h.

88 {
89  try
90  {
91  ParallelUniqueId puid;
92  _tid = puid.id;
93 
94  pre();
95 
96  for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
97  {
98  if (!keepGoing())
99  break;
100 
101  onNode(nd);
102 
103  postNode(nd);
104  }
105 
106  post();
107  }
108  catch (MooseException & e)
109  {
111  }
112 }

◆ 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 122 of file ThreadedNodeLoop.h.

123 {
124 }

◆ 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 134 of file ThreadedNodeLoop.h.

135 {
136 }

◆ pre()

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

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, ComputeNodalKernelsThread, ComputeNodalKernelBCJacobiansThread, and ComputeNodalKernelBcsThread.

Definition at line 116 of file ThreadedNodeLoop.h.

117 {
118 }

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 69 of file ThreadedNodeLoop.h.


The documentation for this class was generated from the following file:
ThreadedNodeLoop::postNode
virtual void postNode(IteratorType &node_it)
Called after the node assembly is done (including surface assembling)
Definition: ThreadedNodeLoop.h:134
ThreadedNodeLoop::onNode
virtual void onNode(IteratorType &node_it)
Called for each node.
Definition: ThreadedNodeLoop.h:128
ThreadedNodeLoop::caughtMooseException
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.
Definition: ThreadedNodeLoop.h:54
MooseException
Provides a way for users to bail out of the current solve.
Definition: MooseException.h:20
ParallelUniqueId
Definition: ParallelUniqueId.h:29
x
static PetscErrorCode Vec x
Definition: PetscDMMoose.C:1263
ThreadedNodeLoop::_fe_problem
FEProblemBase & _fe_problem
Definition: ThreadedNodeLoop.h:68
FEProblemBase::setException
virtual void setException(const std::string &message)
Set an exception.
Definition: FEProblemBase.C:4655
FEProblemBase::hasException
virtual bool hasException()
Whether or not an exception has occurred.
Definition: FEProblemBase.h:412
ParallelUniqueId::id
THREAD_ID id
Definition: ParallelUniqueId.h:82
ThreadedNodeLoop::_tid
THREAD_ID _tid
Definition: ThreadedNodeLoop.h:69
MooseException::what
virtual const char * what() const
Get out the error message.
Definition: MooseException.h:60
ThreadedNodeLoop::post
virtual void post()
Called after the node range loop.
Definition: ThreadedNodeLoop.h:122
ThreadedNodeLoop::keepGoing
virtual bool keepGoing()
Whether or not the loop should continue.
Definition: ThreadedNodeLoop.h:65
ThreadedNodeLoop::pre
virtual void pre()
Called before the node range loop.
Definition: ThreadedNodeLoop.h:116