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 19 of file ComputeNodalUserObjectsThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalUserObjectsThread() [1/2]

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

Definition at line 19 of file ComputeNodalUserObjectsThread.C.

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

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

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

65 { return !_fe_problem.hasException(); }

◆ 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 }

◆ operator()()

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

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()

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

Called after the node range loop.

Reimplemented in ComputeNodalAuxVarsThread< AuxKernelType >.

Definition at line 122 of file ThreadedNodeLoop.h.

123 {
124 }

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

135 {
136 }

◆ pre()

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

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Definition at line 116 of file ThreadedNodeLoop.h.

117 {
118 }

Member Data Documentation

◆ _fe_problem

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

Definition at line 68 of file ThreadedNodeLoop.h.

◆ _query

const TheWarehouse::Query ComputeNodalUserObjectsThread::_query
private

Definition at line 34 of file ComputeNodalUserObjectsThread.h.

Referenced by onNode().

◆ _tid

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

Definition at line 69 of file ThreadedNodeLoop.h.


The documentation for this class was generated from the following files:
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::postNode
virtual void postNode(ConstNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
Definition: ThreadedNodeLoop.h:134
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::onNode
virtual void onNode(ConstNodeRange::const_iterator &node_it)
Called for each node.
Definition: ThreadedNodeLoop.h:128
MooseUtils::split
std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Python like split function for strings.
Definition: MooseUtils.C:753
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::caughtMooseException
virtual void caughtMooseException(MooseException &e)
Called if a MooseException is caught anywhere during the computation.
Definition: ThreadedNodeLoop.h:54
ComputeNodalUserObjectsThread::_query
const TheWarehouse::Query _query
Definition: ComputeNodalUserObjectsThread.h:34
AttribBoundaries
Definition: Attributes.h:119
MooseException
Provides a way for users to bail out of the current solve.
Definition: MooseException.h:20
ParallelUniqueId
Definition: ParallelUniqueId.h:29
AttribThread
Definition: Attributes.h:138
x
static PetscErrorCode Vec x
Definition: PetscDMMoose.C:1263
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::_fe_problem
FEProblemBase & _fe_problem
Definition: ThreadedNodeLoop.h:68
MooseMesh::getMesh
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2599
MooseMesh::getNodeBlockIds
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
Definition: MooseMesh.C:879
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< ConstNodeRange, ConstNodeRange::const_iterator >::_tid
THREAD_ID _tid
Definition: ThreadedNodeLoop.h:69
MooseException::what
virtual const char * what() const
Get out the error message.
Definition: MooseException.h:60
FEProblemBase::reinitNode
virtual void reinitNode(const Node *node, THREAD_ID tid) override
Definition: FEProblemBase.C:1670
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::post
virtual void post()
Called after the node range loop.
Definition: ThreadedNodeLoop.h:122
TheWarehouse::Query::condition
Query & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:157
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::keepGoing
virtual bool keepGoing()
Whether or not the loop should continue.
Definition: ThreadedNodeLoop.h:65
Interfaces::NodalUserObject
TheWarehouse::Query::clone
Query clone() const
clone creates and returns an independent copy of the query in its current state.
Definition: TheWarehouse.h:164
AttribSubdomains
Definition: Attributes.h:102
ThreadedNodeLoop< ConstNodeRange, ConstNodeRange::const_iterator >::pre
virtual void pre()
Called before the node range loop.
Definition: ThreadedNodeLoop.h:116
FEProblemBase::mesh
virtual MooseMesh & mesh() override
Definition: FEProblemBase.h:148