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

#include <ComputeElemAuxBcsThread.h>

Public Member Functions

 ComputeElemAuxBcsThread (FEProblemBase &problem, const MooseObjectWarehouse< AuxKernelType > &storage, const std::vector< std::vector< MooseVariableFEBase *>> &vars, 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< AuxKernelType > & _storage
 Storage object containing active AuxKernel objects. More...
 
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars
 
bool _need_materials
 

Detailed Description

template<typename AuxKernelType>
class ComputeElemAuxBcsThread< AuxKernelType >

Definition at line 22 of file ComputeElemAuxBcsThread.h.

Constructor & Destructor Documentation

◆ ComputeElemAuxBcsThread() [1/2]

template<typename AuxKernelType >
ComputeElemAuxBcsThread< AuxKernelType >::ComputeElemAuxBcsThread ( FEProblemBase problem,
const MooseObjectWarehouse< AuxKernelType > &  storage,
const std::vector< std::vector< MooseVariableFEBase *>> &  vars,
bool  need_materials 
)

Definition at line 21 of file ComputeElemAuxBcsThread.C.

26  : _problem(problem),
27  _aux_sys(problem.getAuxiliarySystem()),
28  _storage(storage),
29  _aux_vars(vars),
30  _need_materials(need_materials)
31 {
32 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars
AuxiliarySystem & getAuxiliarySystem()

◆ ComputeElemAuxBcsThread() [2/2]

template<typename AuxKernelType >
ComputeElemAuxBcsThread< AuxKernelType >::ComputeElemAuxBcsThread ( ComputeElemAuxBcsThread< AuxKernelType > &  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),
41  _aux_vars(x._aux_vars),
42  _need_materials(x._need_materials)
43 {
44 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
static PetscErrorCode Vec x
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars

Member Function Documentation

◆ join()

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

Definition at line 112 of file ComputeElemAuxBcsThread.C.

113 {
114 }

◆ operator()()

template<typename AuxKernelType >
void ComputeElemAuxBcsThread< AuxKernelType >::operator() ( const ConstBndElemRange range)

Definition at line 48 of file ComputeElemAuxBcsThread.C.

49 {
50  ParallelUniqueId puid;
51  _tid = puid.id;
52 
53  // Reference to all boundary restricted AuxKernels for the current thread
54  const auto & boundary_kernels = _storage.getActiveBoundaryObjects(_tid);
55 
56  for (const auto & belem : range)
57  {
58  const Elem * elem = belem->_elem;
59  unsigned short int side = belem->_side;
60  BoundaryID boundary_id = belem->_bnd_id;
61 
62  if (elem->processor_id() == _problem.processor_id())
63  {
64  // prepare variables
65  for (auto * var : _aux_vars[_tid])
66  var->prepareAux();
67 
68  // Locate the AuxKernel objects for the current BoundaryID
69  const auto iter = boundary_kernels.find(boundary_id);
70 
71  if (iter != boundary_kernels.end() && !(iter->second.empty()))
72  {
74  _problem.prepare(elem, _tid);
75  _problem.reinitElemFace(elem, side, boundary_id, _tid);
76 
77  if (_need_materials)
78  {
79  std::set<unsigned int> needed_mat_props;
80  for (const auto & aux : iter->second)
81  {
82  const std::set<unsigned int> & mp_deps = aux->getMatPropDependencies();
83  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
84  }
85  _problem.setActiveMaterialProperties(needed_mat_props, _tid);
86  _problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
88  }
89 
90  for (const auto & aux : iter->second)
91  aux->compute();
92 
93  if (_need_materials)
94  {
97  }
98  }
99 
100  // update the solution vector
101  {
102  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
103  for (auto * var : _aux_vars[_tid])
104  var->insert(_aux_sys.solution());
105  }
106  }
107  }
108 }
virtual void prepare(const Elem *elem, THREAD_ID tid) override
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
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.
const std::vector< std::vector< MooseVariableFEBase * > > & _aux_vars
boundary_id_type BoundaryID
virtual void clearActiveMaterialProperties(THREAD_ID tid) override
Clear the active material properties.
NumericVector< Number > & solution() override
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
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
virtual void swapBackMaterialsFace(THREAD_ID tid)

Member Data Documentation

◆ _aux_sys

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

Definition at line 38 of file ComputeElemAuxBcsThread.h.

◆ _aux_vars

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

Definition at line 44 of file ComputeElemAuxBcsThread.h.

◆ _need_materials

template<typename AuxKernelType>
bool ComputeElemAuxBcsThread< AuxKernelType >::_need_materials
protected

Definition at line 46 of file ComputeElemAuxBcsThread.h.

◆ _problem

template<typename AuxKernelType>
FEProblemBase& ComputeElemAuxBcsThread< AuxKernelType >::_problem
protected

Definition at line 37 of file ComputeElemAuxBcsThread.h.

◆ _storage

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

Storage object containing active AuxKernel objects.

Definition at line 42 of file ComputeElemAuxBcsThread.h.

◆ _tid

template<typename AuxKernelType>
THREAD_ID ComputeElemAuxBcsThread< AuxKernelType >::_tid
protected

Definition at line 39 of file ComputeElemAuxBcsThread.h.


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