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

#include <ComputeNodalUserObjectsThread.h>

Inheritance diagram for ComputeNodalUserObjectsThread:
[legend]

Public Member Functions

 ComputeNodalUserObjectsThread (FEProblemBase &fe_problem, const MooseObjectWarehouse< NodalUserObject > &user_objects)
 
 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

const MooseObjectWarehouse< NodalUserObject > & _user_objects
 Storage for NodalUserObjects (see FEProblemBase::cmputeUserObjects) More...
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

Definition at line 25 of file ComputeNodalUserObjectsThread.h.

Constructor & Destructor Documentation

ComputeNodalUserObjectsThread::ComputeNodalUserObjectsThread ( FEProblemBase fe_problem,
const MooseObjectWarehouse< NodalUserObject > &  user_objects 
)

Definition at line 24 of file ComputeNodalUserObjectsThread.C.

27  _user_objects(user_objects)
28 {
29 }
const MooseObjectWarehouse< NodalUserObject > & _user_objects
Storage for NodalUserObjects (see FEProblemBase::cmputeUserObjects)
ComputeNodalUserObjectsThread::ComputeNodalUserObjectsThread ( ComputeNodalUserObjectsThread x,
Threads::split  split 
)

Definition at line 32 of file ComputeNodalUserObjectsThread.C.

35  _user_objects(x._user_objects)
36 {
37 }
static PetscErrorCode Vec x
const MooseObjectWarehouse< NodalUserObject > & _user_objects
Storage for NodalUserObjects (see FEProblemBase::cmputeUserObjects)
ComputeNodalUserObjectsThread::~ComputeNodalUserObjectsThread ( )
virtual

Definition at line 39 of file ComputeNodalUserObjectsThread.C.

39 {}

Member Function Documentation

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

61  {
62  std::string what(e.what());
64  };
virtual void setException(const std::string &message)
Set an exception.
virtual const char * what() const
Get out the error message.
void ComputeNodalUserObjectsThread::join ( const ComputeNodalUserObjectsThread )

Definition at line 85 of file ComputeNodalUserObjectsThread.C.

86 {
87 }
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 71 of file ThreadedNodeLoop.h.

71 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.
void ComputeNodalUserObjectsThread::onNode ( ConstNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

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

Definition at line 42 of file ComputeNodalUserObjectsThread.C.

43 {
44  const Node * node = *node_it;
46 
47  // Boundary Restricted
48  std::vector<BoundaryID> nodeset_ids;
49  _fe_problem.mesh().getMesh().get_boundary_info().boundary_ids(node, nodeset_ids);
50  for (const auto & bnd : nodeset_ids)
51  {
53  {
54  const auto & objects = _user_objects.getActiveBoundaryObjects(bnd, _tid);
55  for (const auto & uo : objects)
56  uo->execute();
57  }
58  }
59 
60  // Block Restricted
61  // NodalUserObjects may be block restricted, in this case by default the execute() method is
62  // called for
63  // each subdomain that the node "belongs". This may be disabled in the NodalUserObject by setting
64  // "unique_node_execute = true".
65 
66  // To inforce the unique execution this vector is populated and checked if the unique flag is
67  // enabled.
68  std::vector<std::shared_ptr<NodalUserObject>> computed;
69 
70  const std::set<SubdomainID> & block_ids = _fe_problem.mesh().getNodeBlockIds(*node);
71  for (const auto & block : block_ids)
73  {
74  const auto & objects = _user_objects.getActiveBlockObjects(block, _tid);
75  for (const auto & uo : objects)
76  if (!uo->isUniqueNodeExecute() || std::count(computed.begin(), computed.end(), uo) == 0)
77  {
78  uo->execute();
79  computed.push_back(uo);
80  }
81  }
82 }
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2408
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
Definition: MooseMesh.C:808
virtual MooseMesh & mesh() override
const MooseObjectWarehouse< NodalUserObject > & _user_objects
Storage for NodalUserObjects (see FEProblemBase::cmputeUserObjects)
bool hasActiveBlockObjects(THREAD_ID tid=0) const
virtual void reinitNode(const Node *node, THREAD_ID tid) override
void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::operator() ( const ConstNodeRange &  range)
inherited
virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

virtual 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
virtual void ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::pre ( )
virtualinherited

Called before the node range loop.

Reimplemented in ComputeNodalKernelJacobiansThread, and ComputeNodalKernelsThread.

Member Data Documentation

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited
THREAD_ID ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_tid
protectedinherited
const MooseObjectWarehouse<NodalUserObject>& ComputeNodalUserObjectsThread::_user_objects
protected

Storage for NodalUserObjects (see FEProblemBase::cmputeUserObjects)

Definition at line 42 of file ComputeNodalUserObjectsThread.h.

Referenced by onNode().


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