www.mooseframework.org
ComputeThreadedGeneralUserObjectsThread.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13  FEProblemBase & fe_problem)
14  : _fe_problem(fe_problem)
15 {
16 }
17 
19  ComputeThreadedGeneralUserObjectsThread & x, Threads::split /*split*/)
20  : _fe_problem(x._fe_problem)
21 {
22 }
23 
25 
26 void
28 {
29  Threads::spin_mutex::scoped_lock lock(threaded_general_user_objects_mutex);
30 
31  std::string what(e.what());
33 }
34 
35 void
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 }
52 
53 void
55  const GeneralUserObjectRange & range) const
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)
virtual const char * what() const
Get out the error message.
FEProblemBase & _fe_problem
FEProblem running this thread.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
virtual void setException(const std::string &message)
Set an exception, which is stored at this point by toggling a member variable in this class...
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.
Thread to compute threaded general user objects.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
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...
StoredRange< std::vector< GeneralUserObject * >::iterator, GeneralUserObject * > GeneralUserObjectRange
Provides a way for users to bail out of the current solve.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
void operator()(const GeneralUserObjectRange &range)