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

#include <ComputeElemAuxBcsThread.h>

Public Member Functions

 ComputeElemAuxBcsThread (FEProblemBase &problem, const MooseObjectWarehouse< AuxKernel > &storage, bool need_materials)
 
 ComputeElemAuxBcsThread (ComputeElemAuxBcsThread &x, Threads::split split)
 
void operator() (const ConstBndElemRange &range)
 
void join (const ComputeElemAuxBcsThread &)
 

Protected Attributes

FEProblemBase_problem
 
AuxiliarySystem_aux_sys
 
THREAD_ID _tid
 
const MooseObjectWarehouse< AuxKernel > & _storage
 Storage object containing active AuxKernel objects. More...
 
bool _need_materials
 

Detailed Description

Definition at line 29 of file ComputeElemAuxBcsThread.h.

Constructor & Destructor Documentation

ComputeElemAuxBcsThread::ComputeElemAuxBcsThread ( FEProblemBase problem,
const MooseObjectWarehouse< AuxKernel > &  storage,
bool  need_materials 
)

Definition at line 25 of file ComputeElemAuxBcsThread.C.

28  : _problem(problem),
29  _aux_sys(problem.getAuxiliarySystem()),
30  _storage(storage),
31  _need_materials(need_materials)
32 {
33 }
AuxiliarySystem & getAuxiliarySystem()
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.
ComputeElemAuxBcsThread::ComputeElemAuxBcsThread ( ComputeElemAuxBcsThread x,
Threads::split  split 
)

Definition at line 36 of file ComputeElemAuxBcsThread.C.

38  : _problem(x._problem),
39  _aux_sys(x._aux_sys),
40  _storage(x._storage),
42 {
43 }
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

Member Function Documentation

void ComputeElemAuxBcsThread::join ( const ComputeElemAuxBcsThread )

Definition at line 115 of file ComputeElemAuxBcsThread.C.

116 {
117 }
void ComputeElemAuxBcsThread::operator() ( const ConstBndElemRange range)

Definition at line 46 of file ComputeElemAuxBcsThread.C.

47 {
48  ParallelUniqueId puid;
49  _tid = puid.id;
50 
51  // Reference to all boundary restricted AuxKernels for the current thread
52  const auto & boundary_kernels = _storage.getActiveBoundaryObjects(_tid);
53 
54  for (const auto & belem : range)
55  {
56  const Elem * elem = belem->_elem;
57  unsigned short int side = belem->_side;
58  BoundaryID boundary_id = belem->_bnd_id;
59 
60  if (elem->processor_id() == _problem.processor_id())
61  {
62  // prepare variables
63  for (const auto & it : _aux_sys._elem_vars[_tid])
64  {
65  MooseVariable * var = it.second;
66  var->prepareAux();
67  }
68 
69  // Locate the AuxKernel objects for the current BoundaryID
70  const auto iter = boundary_kernels.find(boundary_id);
71 
72  if (iter != boundary_kernels.end() && !(iter->second.empty()))
73  {
74  _problem.setCurrentSubdomainID(elem, _tid);
75  _problem.prepare(elem, _tid);
76  _problem.reinitElemFace(elem, side, boundary_id, _tid);
77 
78  if (_need_materials)
79  {
80  std::set<unsigned int> needed_mat_props;
81  for (const auto & aux : iter->second)
82  {
83  const std::set<unsigned int> & mp_deps = aux->getMatPropDependencies();
84  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
85  }
86  _problem.setActiveMaterialProperties(needed_mat_props, _tid);
87  _problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
88  _problem.reinitMaterialsBoundary(boundary_id, _tid);
89  }
90 
91  for (const auto & aux : iter->second)
92  aux->compute();
93 
94  if (_need_materials)
95  {
98  }
99  }
100 
101  // update the solution vector
102  {
103  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
104  for (const auto & it : _aux_sys._elem_vars[_tid])
105  {
106  MooseVariable * var = it.second;
107  var->insert(_aux_sys.solution());
108  }
109  }
110  }
111  }
112 }
virtual void prepare(const Elem *elem, THREAD_ID tid) override
Class for stuff related to variables.
Definition: MooseVariable.h:43
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void reinitMaterialsBoundary(BoundaryID boundary_id, THREAD_ID tid, bool swap_stateful=true)
virtual void setActiveMaterialProperties(const std::set< unsigned int > &mat_prop_ids, THREAD_ID tid) override
Record and set the material properties required by the current computing thread.
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
virtual void clearActiveMaterialProperties(THREAD_ID tid) override
Clear the active material properties.
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.
virtual NumericVector< Number > & solution() override
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid) override
virtual void reinitMaterialsFace(SubdomainID blk_id, THREAD_ID tid, bool swap_stateful=true)
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid) override
void insert(NumericVector< Number > &residual)
virtual void swapBackMaterialsFace(THREAD_ID tid)
boundary_id_type BoundaryID
Definition: MooseTypes.h:75

Member Data Documentation

AuxiliarySystem& ComputeElemAuxBcsThread::_aux_sys
protected

Definition at line 44 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

bool ComputeElemAuxBcsThread::_need_materials
protected

Definition at line 50 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

FEProblemBase& ComputeElemAuxBcsThread::_problem
protected

Definition at line 43 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

const MooseObjectWarehouse<AuxKernel>& ComputeElemAuxBcsThread::_storage
protected

Storage object containing active AuxKernel objects.

Definition at line 48 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

THREAD_ID ComputeElemAuxBcsThread::_tid
protected

Definition at line 45 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().


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