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

#include <ComputeNodalUserObjectsThread.h>

Inheritance diagram for ComputeNodalUserObjectsThread:
[legend]

Public Member Functions

 ComputeNodalUserObjectsThread (FEProblemBase &fe_problem, const TheWarehouse::Query &query)
 
 ComputeNodalUserObjectsThread (ComputeNodalUserObjectsThread &x, Threads::split split)
 
virtual ~ComputeNodalUserObjectsThread ()
 
virtual void onNode (ConstNodeRange::const_iterator &node_it) override
 Called for each node. More...
 
void join (const ComputeNodalUserObjectsThread &)
 
void operator() (const ConstNodeRange &range)
 
virtual void pre ()
 Called before the node range loop. More...
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void postNode (ConstNodeRange::const_iterator &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
 

Private Attributes

const TheWarehouse::Query _query
 

Detailed Description

Definition at line 20 of file ComputeNodalUserObjectsThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalUserObjectsThread() [1/2]

ComputeNodalUserObjectsThread::ComputeNodalUserObjectsThread ( FEProblemBase fe_problem,
const TheWarehouse::Query query 
)

◆ ComputeNodalUserObjectsThread() [2/2]

ComputeNodalUserObjectsThread::ComputeNodalUserObjectsThread ( ComputeNodalUserObjectsThread x,
Threads::split  split 
)

◆ ~ComputeNodalUserObjectsThread()

ComputeNodalUserObjectsThread::~ComputeNodalUserObjectsThread ( )
virtual

Definition at line 32 of file ComputeNodalUserObjectsThread.C.

32 {}

Member Function Documentation

◆ caughtMooseException()

virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::caughtMooseException ( MooseException e)
inlinevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Definition at line 55 of file ThreadedNodeLoop.h.

56  {
57  std::string what(e.what());
59  };
virtual const char * what() const
Get out the error message.
virtual void setException(const std::string &message)
Set an exception.

◆ join()

void ComputeNodalUserObjectsThread::join ( const ComputeNodalUserObjectsThread )

Definition at line 84 of file ComputeNodalUserObjectsThread.C.

85 {
86 }

◆ keepGoing()

virtual bool ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::keepGoing ( )
inlinevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Definition at line 66 of file ThreadedNodeLoop.h.

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

◆ onNode()

void ComputeNodalUserObjectsThread::onNode ( ConstNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

Reimplemented from ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >.

Definition at line 35 of file ComputeNodalUserObjectsThread.C.

36 {
37  const Node * node = *node_it;
39 
40  std::vector<NodalUserObject *> objs;
41 
42  // Boundary Restricted
43  std::vector<BoundaryID> nodeset_ids;
44  _fe_problem.mesh().getMesh().get_boundary_info().boundary_ids(node, nodeset_ids);
45  for (const auto & bnd : nodeset_ids)
46  {
47  _query.clone()
49  .condition<AttribInterfaces>(Interfaces::NodalUserObject)
50  .condition<AttribBoundaries>(bnd, true)
51  .queryInto(objs);
52  for (const auto & uo : objs)
53  uo->execute();
54  }
55 
56  // Block Restricted
57  // NodalUserObjects may be block restricted, in this case by default the execute() method is
58  // called for
59  // each subdomain that the node "belongs". This may be disabled in the NodalUserObject by setting
60  // "unique_node_execute = true".
61 
62  // To inforce the unique execution this vector is populated and checked if the unique flag is
63  // enabled.
64  std::set<NodalUserObject *> computed;
65  const std::set<SubdomainID> & block_ids = _fe_problem.mesh().getNodeBlockIds(*node);
66  for (const auto & block : block_ids)
67  {
68  _query.clone()
70  .condition<AttribInterfaces>(Interfaces::NodalUserObject)
71  .condition<AttribSubdomains>(block)
72  .queryInto(objs);
73 
74  for (const auto & uo : objs)
75  if (!uo->isUniqueNodeExecute() || computed.count(uo) == 0)
76  {
77  uo->execute();
78  computed.insert(uo);
79  }
80  }
81 }
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
Definition: MooseMesh.C:883
Query & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:184
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2512
Query clone() const
clone creates and returns an independent copy of the query in its current state.
Definition: TheWarehouse.h:191
virtual MooseMesh & mesh() override
virtual void reinitNode(const Node *node, THREAD_ID tid) override

◆ operator()()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::operator() ( const ConstNodeRange &  range)
inherited

Definition at line 88 of file ThreadedNodeLoop.h.

89 {
90  try
91  {
92  ParallelUniqueId puid;
93  _tid = puid.id;
94 
95  pre();
96 
97  for (IteratorType nd = range.begin(); nd != range.end(); ++nd)
98  {
99  if (!keepGoing())
100  break;
101 
102  onNode(nd);
103 
104  postNode(nd);
105  }
106 
107  post();
108  }
109  catch (MooseException & e)
110  {
112  }
113 }
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(ConstNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(ConstNodeRange::const_iterator &node_it)
Called for each node.

◆ post()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

Reimplemented in ComputeNodalAuxVarsThread.

Definition at line 123 of file ThreadedNodeLoop.h.

124 {
125 }

◆ postNode()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::postNode ( ConstNodeRange::const_iterator &  node_it)
virtualinherited

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

Parameters
node- active node

Definition at line 135 of file ThreadedNodeLoop.h.

136 {
137 }

◆ pre()

void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Definition at line 117 of file ThreadedNodeLoop.h.

118 {
119 }

Member Data Documentation

◆ _fe_problem

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited

◆ _query

const TheWarehouse::Query ComputeNodalUserObjectsThread::_query
private

Definition at line 35 of file ComputeNodalUserObjectsThread.h.

Referenced by onNode().

◆ _tid

THREAD_ID ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_tid
protectedinherited

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