www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputeThreadedGeneralUserObjectsThread Class Reference

Thread to compute threaded general user objects. More...

#include <ComputeThreadedGeneralUserObjectsThread.h>

Public Member Functions

 ComputeThreadedGeneralUserObjectsThread (FEProblemBase &fe_problem)
 
 ComputeThreadedGeneralUserObjectsThread (ComputeThreadedGeneralUserObjectsThread &x, Threads::split split)
 
virtual ~ComputeThreadedGeneralUserObjectsThread ()
 
void operator() (const GeneralUserObjectRange &range)
 
void join (const ComputeThreadedGeneralUserObjectsThread &)
 
virtual void caughtMooseException (MooseException &)
 Called if a MooseException is caught anywhere during the computation. More...
 

Protected Member Functions

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

Protected Attributes

FEProblemBase_fe_problem
 FEProblem running this thread. More...
 

Detailed Description

Thread to compute threaded general user objects.

This works on a range of thread IDs, so that we always compute all user objects for every threaded copy.

Definition at line 34 of file ComputeThreadedGeneralUserObjectsThread.h.

Constructor & Destructor Documentation

◆ ComputeThreadedGeneralUserObjectsThread() [1/2]

ComputeThreadedGeneralUserObjectsThread::ComputeThreadedGeneralUserObjectsThread ( FEProblemBase fe_problem)

Definition at line 12 of file ComputeThreadedGeneralUserObjectsThread.C.

14  : _fe_problem(fe_problem)
15 {
16 }
FEProblemBase & _fe_problem
FEProblem running this thread.

◆ ComputeThreadedGeneralUserObjectsThread() [2/2]

ComputeThreadedGeneralUserObjectsThread::ComputeThreadedGeneralUserObjectsThread ( ComputeThreadedGeneralUserObjectsThread x,
Threads::split  split 
)

Definition at line 18 of file ComputeThreadedGeneralUserObjectsThread.C.

21 {
22 }
FEProblemBase & _fe_problem
FEProblem running this thread.

◆ ~ComputeThreadedGeneralUserObjectsThread()

ComputeThreadedGeneralUserObjectsThread::~ComputeThreadedGeneralUserObjectsThread ( )
virtual

Definition at line 24 of file ComputeThreadedGeneralUserObjectsThread.C.

24 {}

Member Function Documentation

◆ caughtMooseException()

void ComputeThreadedGeneralUserObjectsThread::caughtMooseException ( MooseException e)
virtual

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Definition at line 27 of file ComputeThreadedGeneralUserObjectsThread.C.

Referenced by operator()().

28 {
29  Threads::spin_mutex::scoped_lock lock(threaded_general_user_objects_mutex);
30 
31  std::string what(e.what());
33 }
virtual const char * what() const
Get out the error message.
FEProblemBase & _fe_problem
FEProblem running this thread.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
static Threads::spin_mutex threaded_general_user_objects_mutex
This mutex is used to protect the creation of the strings used in the propogation of the error messag...

◆ join()

void ComputeThreadedGeneralUserObjectsThread::join ( const ComputeThreadedGeneralUserObjectsThread )
inline

Definition at line 45 of file ComputeThreadedGeneralUserObjectsThread.h.

45 {}

◆ operator()()

void ComputeThreadedGeneralUserObjectsThread::operator() ( const GeneralUserObjectRange range)

Definition at line 36 of file ComputeThreadedGeneralUserObjectsThread.C.

37 {
38  try
39  {
41  for (auto it = range.begin(); it != range.end(); ++it)
42  {
43  auto & tguo = *it;
44  tguo->execute();
45  }
46  }
47  catch (MooseException & e)
48  {
50  }
51 }
virtual void caughtMooseException(MooseException &)
Called if a MooseException is caught anywhere during the computation.
void printGeneralExecutionInformation(const GeneralUserObjectRange &range) const
Print information about the loop, mostly order of execution of objects.
Provides a way for users to bail out of the current solve.

◆ printGeneralExecutionInformation()

void ComputeThreadedGeneralUserObjectsThread::printGeneralExecutionInformation ( const GeneralUserObjectRange range) const
protected

Print information about the loop, mostly order of execution of objects.

Definition at line 54 of file ComputeThreadedGeneralUserObjectsThread.C.

Referenced by operator()().

56 {
57  // TODO: Threaded UOs dont know their thread number so this will print too often
58  if (!_fe_problem.shouldPrintExecution(0) || !range.size())
59  return;
60 
61  const auto & console = _fe_problem.console();
62  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
63  console << "[DBG] Executing Threaded General User Object " << (*range.begin())->name() << " on "
64  << execute_on << std::endl;
65 }
std::string name(const ElemQuality q)
FEProblemBase & _fe_problem
FEProblem running this thread.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48

Member Data Documentation

◆ _fe_problem

FEProblemBase& ComputeThreadedGeneralUserObjectsThread::_fe_problem
protected

FEProblem running this thread.

Definition at line 58 of file ComputeThreadedGeneralUserObjectsThread.h.

Referenced by caughtMooseException(), and printGeneralExecutionInformation().


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