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

#include <ComputeNodalAuxVarsThread.h>

Inheritance diagram for ComputeNodalAuxVarsThread:
[legend]

Public Member Functions

 ComputeNodalAuxVarsThread (FEProblemBase &fe_problem, const MooseObjectWarehouse< AuxKernel > &storage)
 
 ComputeNodalAuxVarsThread (ComputeNodalAuxVarsThread &x, Threads::split split)
 
void onNode (ConstNodeRange::const_iterator &nd)
 Called for each node. More...
 
void join (const ComputeNodalAuxVarsThread &)
 
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

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 30 of file ComputeNodalAuxVarsThread.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file ComputeNodalAuxVarsThread.C.

28  _aux_sys(fe_problem.getAuxiliarySystem()),
29  _storage(storage)
30 {
31 }
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.
AuxiliarySystem & getAuxiliarySystem()
ComputeNodalAuxVarsThread::ComputeNodalAuxVarsThread ( ComputeNodalAuxVarsThread x,
Threads::split  split 
)

Definition at line 34 of file ComputeNodalAuxVarsThread.C.

37  _aux_sys(x._aux_sys),
38  _storage(x._storage)
39 {
40 }
static PetscErrorCode Vec x
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

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

Definition at line 83 of file ComputeNodalAuxVarsThread.C.

84 {
85 }
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 ComputeNodalAuxVarsThread::onNode ( ConstNodeRange::const_iterator &  node_it)
virtual

Called for each node.

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

Definition at line 43 of file ComputeNodalAuxVarsThread.C.

44 {
45  const Node * node = *node_it;
46 
47  // prepare variables
48  for (const auto & it : _aux_sys._nodal_vars[_tid])
49  {
50  MooseVariable * var = it.second;
51  var->prepareAux();
52  }
53 
54  _fe_problem.reinitNode(node, _tid);
55 
56  // Get a map of all active block restricted AuxKernel objects
57  const auto & block_kernels = _storage.getActiveBlockObjects(_tid);
58 
59  // Loop over all SubdomainIDs for the curnent node, if an AuxKernel is active on this block then
60  // compute it.
61  const auto & block_ids = _aux_sys.mesh().getNodeBlockIds(*node);
62  for (const auto & block : block_ids)
63  {
64  const auto iter = block_kernels.find(block);
65 
66  if (iter != block_kernels.end())
67  for (const auto & aux : iter->second)
68  aux->compute();
69  }
70 
71  // We are done, so update the solution vector
72  {
73  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
74  for (const auto & it : _aux_sys._nodal_vars[_tid])
75  {
76  MooseVariable * var = it.second;
77  var->insert(_aux_sys.solution());
78  }
79  }
80 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.
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:769
virtual NumericVector< Number > & solution() override
virtual MooseMesh & mesh()
Definition: SystemBase.h:102
virtual void reinitNode(const Node *node, THREAD_ID tid) override
void insert(NumericVector< Number > &residual)
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

AuxiliarySystem& ComputeNodalAuxVarsThread::_aux_sys
protected

Definition at line 44 of file ComputeNodalAuxVarsThread.h.

Referenced by onNode().

FEProblemBase& ThreadedNodeLoop< ConstNodeRange , ConstNodeRange::const_iterator >::_fe_problem
protectedinherited
const MooseObjectWarehouse<AuxKernel>& ComputeNodalAuxVarsThread::_storage
protected

Storage object containing active AuxKernel objects.

Definition at line 47 of file ComputeNodalAuxVarsThread.h.

Referenced by onNode().

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

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