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 23 of file ComputeElemAuxBcsThread.h.

Constructor & Destructor Documentation

◆ ComputeElemAuxBcsThread() [1/2]

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

Definition at line 20 of file ComputeElemAuxBcsThread.C.

23  : _problem(problem),
24  _aux_sys(problem.getAuxiliarySystem()),
25  _storage(storage),
26  _need_materials(need_materials)
27 {
28 }
AuxiliarySystem & getAuxiliarySystem()
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

◆ ComputeElemAuxBcsThread() [2/2]

ComputeElemAuxBcsThread::ComputeElemAuxBcsThread ( ComputeElemAuxBcsThread x,
Threads::split  split 
)

Definition at line 31 of file ComputeElemAuxBcsThread.C.

33  : _problem(x._problem),
34  _aux_sys(x._aux_sys),
35  _storage(x._storage),
36  _need_materials(x._need_materials)
37 {
38 }
static PetscErrorCode Vec x
const MooseObjectWarehouse< AuxKernel > & _storage
Storage object containing active AuxKernel objects.

Member Function Documentation

◆ join()

void ComputeElemAuxBcsThread::join ( const ComputeElemAuxBcsThread )

Definition at line 110 of file ComputeElemAuxBcsThread.C.

111 {
112 }

◆ operator()()

void ComputeElemAuxBcsThread::operator() ( const ConstBndElemRange range)

Definition at line 41 of file ComputeElemAuxBcsThread.C.

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

Member Data Documentation

◆ _aux_sys

AuxiliarySystem& ComputeElemAuxBcsThread::_aux_sys
protected

Definition at line 38 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

◆ _need_materials

bool ComputeElemAuxBcsThread::_need_materials
protected

Definition at line 44 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

◆ _problem

FEProblemBase& ComputeElemAuxBcsThread::_problem
protected

Definition at line 37 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

◆ _storage

const MooseObjectWarehouse<AuxKernel>& ComputeElemAuxBcsThread::_storage
protected

Storage object containing active AuxKernel objects.

Definition at line 42 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().

◆ _tid

THREAD_ID ComputeElemAuxBcsThread::_tid
protected

Definition at line 39 of file ComputeElemAuxBcsThread.h.

Referenced by operator()().


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