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

#include <ComputeNodalAuxBcsThread.h>

Inheritance diagram for ComputeNodalAuxBcsThread< AuxKernelType >:
[legend]

Public Member Functions

 ComputeNodalAuxBcsThread (FEProblemBase &fe_problem, const MooseObjectWarehouse< AuxKernelType > &storage, const std::vector< std::vector< MooseVariableFEBase *>> &vars)
 
 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< AuxKernelType > & _storage
 Storage object containing active AuxKernel objects. More...
 
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars
 
FEProblemBase_fe_problem
 
THREAD_ID _tid
 

Detailed Description

template<typename AuxKernelType>
class ComputeNodalAuxBcsThread< AuxKernelType >

Definition at line 22 of file ComputeNodalAuxBcsThread.h.

Constructor & Destructor Documentation

◆ ComputeNodalAuxBcsThread() [1/2]

template<typename AuxKernelType >
ComputeNodalAuxBcsThread< AuxKernelType >::ComputeNodalAuxBcsThread ( FEProblemBase fe_problem,
const MooseObjectWarehouse< AuxKernelType > &  storage,
const std::vector< std::vector< MooseVariableFEBase *>> &  vars 
)

Definition at line 19 of file ComputeNodalAuxBcsThread.C.

24  _aux_sys(fe_problem.getAuxiliarySystem()),
25  _storage(storage),
26  _aux_vars(vars)
27 {
28 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
AuxiliarySystem & getAuxiliarySystem()
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars

◆ ComputeNodalAuxBcsThread() [2/2]

template<typename AuxKernelType >
ComputeNodalAuxBcsThread< AuxKernelType >::ComputeNodalAuxBcsThread ( ComputeNodalAuxBcsThread< AuxKernelType > &  x,
Threads::split  split 
)

Definition at line 32 of file ComputeNodalAuxBcsThread.C.

35  _aux_sys(x._aux_sys),
36  _storage(x._storage),
37  _aux_vars(x._aux_vars)
38 {
39 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
static PetscErrorCode Vec x
std::vector< std::string > split(const std::string &str, const std::string &delimiter)
Python like split function for strings.
Definition: MooseUtils.C:784
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars

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

template<typename AuxKernelType >
void ComputeNodalAuxBcsThread< AuxKernelType >::join ( const ComputeNodalAuxBcsThread< AuxKernelType > &  )

Definition at line 82 of file ComputeNodalAuxBcsThread.C.

83 {
84 }

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

template<typename AuxKernelType >
void ComputeNodalAuxBcsThread< AuxKernelType >::onNode ( ConstBndNodeRange::const_iterator &  node_it)
overridevirtual

Called for each node.

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

Definition at line 43 of file ComputeNodalAuxBcsThread.C.

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

◆ 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

template<typename AuxKernelType>
AuxiliarySystem& ComputeNodalAuxBcsThread< AuxKernelType >::_aux_sys
protected

Definition at line 38 of file ComputeNodalAuxBcsThread.h.

◆ _aux_vars

template<typename AuxKernelType>
const std::vector<std::vector<MooseVariableFEBase *> >& ComputeNodalAuxBcsThread< AuxKernelType >::_aux_vars
protected

Definition at line 43 of file ComputeNodalAuxBcsThread.h.

◆ _fe_problem

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

Definition at line 69 of file ThreadedNodeLoop.h.

Referenced by ComputeBoundaryInitialConditionThread::onNode().

◆ _storage

template<typename AuxKernelType>
const MooseObjectWarehouse<AuxKernelType>& ComputeNodalAuxBcsThread< AuxKernelType >::_storage
protected

Storage object containing active AuxKernel objects.

Definition at line 41 of file ComputeNodalAuxBcsThread.h.

◆ _tid

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

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