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

#include <ComputeNodalAuxBcsThread.h>

Inheritance diagram for ComputeNodalAuxBcsThread:
[legend]

Public Member Functions

 ComputeNodalAuxBcsThread (FEProblemBase &fe_problem, const MooseObjectWarehouse< AuxKernel > &storage)
 
 ComputeNodalAuxBcsThread (ComputeNodalAuxBcsThread &x, Threads::split split)
 
virtual void onNode (ConstBndNodeRange::const_iterator &node_it) override
 Called for each node. More...
 
void join (const ComputeNodalAuxBcsThread &)
 
void operator() (const ConstBndNodeRange &range)
 
virtual void pre ()
 Called before the node range loop. More...
 
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< AuxKernel > & _storage
 Storage object containing active AuxKernel objects. More...
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

Definition at line 22 of file ComputeNodalAuxBcsThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalAuxBcsThread() [1/2]

ComputeNodalAuxBcsThread::ComputeNodalAuxBcsThread ( FEProblemBase fe_problem,
const MooseObjectWarehouse< AuxKernel > &  storage 
)

Definition at line 18 of file ComputeNodalAuxBcsThread.C.

21  _aux_sys(fe_problem.getAuxiliarySystem()),
22  _storage(storage)
23 {
24 }
AuxiliarySystem & getAuxiliarySystem()
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

◆ ComputeNodalAuxBcsThread() [2/2]

ComputeNodalAuxBcsThread::ComputeNodalAuxBcsThread ( ComputeNodalAuxBcsThread x,
Threads::split  split 
)

Definition at line 27 of file ComputeNodalAuxBcsThread.C.

30  _aux_sys(x._aux_sys),
31  _storage(x._storage)
32 {
33 }
static PetscErrorCode Vec x
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

Member Function Documentation

◆ caughtMooseException()

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 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 ComputeNodalAuxBcsThread::join ( const ComputeNodalAuxBcsThread )

Definition at line 80 of file ComputeNodalAuxBcsThread.C.

81 {
82 }

◆ keepGoing()

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

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

◆ onNode()

void ComputeNodalAuxBcsThread::onNode ( ConstBndNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

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

Definition at line 36 of file ComputeNodalAuxBcsThread.C.

37 {
38  const BndNode * bnode = *node_it;
39 
40  BoundaryID boundary_id = bnode->_bnd_id;
41 
42  // prepare variables
43  for (const auto & it : _aux_sys._nodal_vars[_tid])
44  {
45  MooseVariable * var = it.second;
46  var->prepareAux();
47  }
48 
49  Node * node = bnode->_node;
50 
51  if (node->processor_id() == _fe_problem.processor_id())
52  {
53  // Get a map of all active block restricted AuxKernel objects
54  const auto & kernels = _storage.getActiveBoundaryObjects(_tid);
55 
56  // Operate on the node BoundaryID only
57  const auto iter = kernels.find(boundary_id);
58  if (iter != kernels.end())
59  {
60  _fe_problem.reinitNodeFace(node, boundary_id, _tid);
61 
62  for (const auto & aux : iter->second)
63  aux->compute();
64  }
65  }
66 
67  // We are done, so update the solution vector
68  {
69  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
70  // update the solution vector
71  for (const auto & it : _aux_sys._nodal_vars[_tid])
72  {
73  MooseVariable * var = it.second;
74  var->insert(_aux_sys.solution());
75  }
76  }
77 }
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
BoundaryID _bnd_id
boundary id for the node
Definition: BndNode.h:23
Node * _node
pointer to the node
Definition: BndNode.h:21
void insert(NumericVector< Number > &residual) override
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, THREAD_ID tid) override
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
virtual NumericVector< Number > & solution() override
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.
boundary_id_type BoundaryID
Definition: MooseTypes.h:93
void prepareAux() override

◆ operator()()

void ThreadedNodeLoop< ConstBndNodeRange , ConstBndNodeRange::const_iterator >::operator() ( const ConstBndNodeRange 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 postNode(ConstBndNodeRange::const_iterator &node_it)
Called after the node assembly is done (including surface assembling)
virtual void onNode(ConstBndNodeRange::const_iterator &node_it)
Called for each node.

◆ post()

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

Called after the node range loop.

Definition at line 123 of file ThreadedNodeLoop.h.

124 {
125 }

◆ postNode()

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

Definition at line 135 of file ThreadedNodeLoop.h.

136 {
137 }

◆ pre()

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

Called before the node range loop.

Reimplemented in ComputeNodalKernelBCJacobiansThread, and ComputeNodalKernelBcsThread.

Definition at line 117 of file ThreadedNodeLoop.h.

118 {
119 }

Member Data Documentation

◆ _aux_sys

AuxiliarySystem& ComputeNodalAuxBcsThread::_aux_sys
protected

Definition at line 37 of file ComputeNodalAuxBcsThread.h.

Referenced by onNode().

◆ _fe_problem

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

Definition at line 69 of file ThreadedNodeLoop.h.

Referenced by ComputeBoundaryInitialConditionThread::onNode(), and onNode().

◆ _storage

const MooseObjectWarehouse<AuxKernel>& ComputeNodalAuxBcsThread::_storage
protected

Storage object containing active AuxKernel objects.

Definition at line 40 of file ComputeNodalAuxBcsThread.h.

Referenced by onNode().

◆ _tid

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

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