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

#include <ComputeNodalKernelBcsThread.h>

Inheritance diagram for ComputeNodalKernelBcsThread:
[legend]

Public Member Functions

 ComputeNodalKernelBcsThread (FEProblemBase &fe_problem, const MooseObjectWarehouse< NodalKernel > &nodal_kernels)
 
 ComputeNodalKernelBcsThread (ComputeNodalKernelBcsThread &x, Threads::split split)
 
virtual void pre () override
 Called before the node range loop. More...
 
virtual void onNode (ConstBndNodeRange::const_iterator &node_it) override
 Called for each node. More...
 
void join (const ComputeNodalKernelBcsThread &)
 
void operator() (const ConstBndNodeRange &range)
 
virtual void post ()
 Called after the node range loop. More...
 
virtual void postNode (ConstBndNodeRange::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

AuxiliarySystem_aux_sys
 
const MooseObjectWarehouse< NodalKernel > & _nodal_kernels
 
unsigned int _num_cached
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

Definition at line 24 of file ComputeNodalKernelBcsThread.h.

Constructor & Destructor Documentation

ComputeNodalKernelBcsThread::ComputeNodalKernelBcsThread ( FEProblemBase fe_problem,
const MooseObjectWarehouse< NodalKernel > &  nodal_kernels 
)
ComputeNodalKernelBcsThread::ComputeNodalKernelBcsThread ( ComputeNodalKernelBcsThread x,
Threads::split  split 
)

Definition at line 35 of file ComputeNodalKernelBcsThread.C.

Member Function Documentation

virtual void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::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 ComputeNodalKernelBcsThread::join ( const ComputeNodalKernelBcsThread )

Definition at line 87 of file ComputeNodalKernelBcsThread.C.

88 {
89 }
virtual bool ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::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 ComputeNodalKernelBcsThread::onNode ( ConstBndNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

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

Definition at line 51 of file ComputeNodalKernelBcsThread.C.

52 {
53  const BndNode * bnode = *node_it;
54 
55  BoundaryID boundary_id = bnode->_bnd_id;
56 
57  // prepare variables
58  for (const auto & it : _aux_sys._nodal_vars[_tid])
59  {
60  MooseVariable * var = it.second;
61  var->prepareAux();
62  }
63 
64  if (_nodal_kernels.hasActiveBoundaryObjects(boundary_id, _tid))
65  {
66  Node * node = bnode->_node;
67  if (node->processor_id() == _fe_problem.processor_id())
68  {
69  _fe_problem.reinitNodeFace(node, boundary_id, _tid);
70  const auto & objects = _nodal_kernels.getActiveBoundaryObjects(boundary_id, _tid);
71  for (const auto & nodal_kernel : objects)
72  nodal_kernel->computeResidual();
73 
74  _num_cached++;
75  }
76  }
77 
78  if (_num_cached == 20) // cache 20 nodes worth before adding into the residual
79  {
80  _num_cached = 0;
81  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
83  }
84 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
BoundaryID _bnd_id
boundary id for the node
Definition: BndNode.h:28
Node * _node
pointer to the node
Definition: BndNode.h:26
virtual void addCachedResidual(THREAD_ID tid) override
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
const MooseObjectWarehouse< NodalKernel > & _nodal_kernels
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid) override
boundary_id_type BoundaryID
Definition: MooseTypes.h:75
void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::operator() ( const ConstBndNodeRange range)
inherited
virtual void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::post ( )
virtualinherited

Called after the node range loop.

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

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

Parameters
node- active node
void ComputeNodalKernelBcsThread::pre ( )
overridevirtual

Called before the node range loop.

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

Definition at line 45 of file ComputeNodalKernelBcsThread.C.

46 {
47  _num_cached = 0;
48 }

Member Data Documentation

AuxiliarySystem& ComputeNodalKernelBcsThread::_aux_sys
protected

Definition at line 40 of file ComputeNodalKernelBcsThread.h.

Referenced by onNode().

FEProblemBase& ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::_fe_problem
protectedinherited
const MooseObjectWarehouse<NodalKernel>& ComputeNodalKernelBcsThread::_nodal_kernels
protected

Definition at line 42 of file ComputeNodalKernelBcsThread.h.

Referenced by onNode().

unsigned int ComputeNodalKernelBcsThread::_num_cached
protected

Definition at line 45 of file ComputeNodalKernelBcsThread.h.

Referenced by onNode(), and pre().

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

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