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

#include <ComputeElemAuxVarsThread.h>

Inheritance diagram for ComputeElemAuxVarsThread:
[legend]

Public Member Functions

 ComputeElemAuxVarsThread (FEProblemBase &problem, const MooseObjectWarehouse< AuxKernel > &storage, bool need_materials)
 
 ComputeElemAuxVarsThread (ComputeElemAuxVarsThread &x, Threads::split split)
 
virtual ~ComputeElemAuxVarsThread ()
 
virtual void subdomainChanged () override
 Called every time the current subdomain changes (i.e. More...
 
virtual void onElement (const Elem *elem) override
 Assembly of the element (not including surface assembly) More...
 
virtual void post () override
 Called after the element range loop. More...
 
void join (const ComputeElemAuxVarsThread &)
 
virtual void caughtMooseException (MooseException &e) override
 Called if a MooseException is caught anywhere during the computation. More...
 
virtual bool keepGoing () override
 Whether or not the loop should continue. More...
 
virtual void preElement (const Elem *elem) override
 Called before the element assembly. More...
 
virtual void preInternalSide (const Elem *elem, unsigned int side) override
 Called before evaluations on an element internal side. More...
 
virtual void neighborSubdomainChanged () override
 Called every time the neighbor subdomain changes (i.e. More...
 
void operator() (const ConstElemRange &range, bool bypass_threading=false)
 
virtual void pre ()
 Called before the element range loop. More...
 
virtual void postElement (const Elem *elem)
 Called after the element assembly is done (including surface assembling) More...
 
virtual void onBoundary (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing boundary assembling. More...
 
virtual void postInternalSide (const Elem *elem, unsigned int side)
 Called after evaluations on an element internal side. More...
 
virtual void onInternalSide (const Elem *elem, unsigned int side)
 Called when doing internal edge assembling. More...
 
virtual void onInterface (const Elem *elem, unsigned int side, BoundaryID bnd_id)
 Called when doing interface assembling. More...
 

Protected Attributes

AuxiliarySystem_aux_sys
 
const MooseObjectWarehouse< AuxKernel > & _aux_kernels
 Storage object containing active AuxKernel objects. More...
 
bool _need_materials
 
FEProblemBase_fe_problem
 
MooseMesh_mesh
 
THREAD_ID _tid
 
SubdomainID _subdomain
 The subdomain for the current element. More...
 
SubdomainID _old_subdomain
 The subdomain for the last element. More...
 
SubdomainID _neighbor_subdomain
 The subdomain for the current neighbor. More...
 
SubdomainID _old_neighbor_subdomain
 The subdomain for the last neighbor. More...
 

Detailed Description

Definition at line 29 of file ComputeElemAuxVarsThread.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file ComputeElemAuxVarsThread.C.

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

Definition at line 36 of file ComputeElemAuxVarsThread.C.

39  _aux_sys(x._aux_sys),
42 {
43 }
FEProblemBase & _fe_problem
const MooseObjectWarehouse< AuxKernel > & _aux_kernels
Storage object containing active AuxKernel objects.
ComputeElemAuxVarsThread::~ComputeElemAuxVarsThread ( )
virtual

Definition at line 45 of file ComputeElemAuxVarsThread.C.

45 {}

Member Function Documentation

virtual void ThreadedElementLoop< ConstElemRange >::caughtMooseException ( MooseException e)
overridevirtualinherited

Called if a MooseException is caught anywhere during the computation.

The single input parameter taken is a MooseException object.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

void ComputeElemAuxVarsThread::join ( const ComputeElemAuxVarsThread )

Definition at line 121 of file ComputeElemAuxVarsThread.C.

122 {
123 }
virtual bool ThreadedElementLoop< ConstElemRange >::keepGoing ( )
inlineoverridevirtualinherited

Whether or not the loop should continue.

Returns
true to keep going, false to stop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 50 of file ThreadedElementLoop.h.

50 { return !_fe_problem.hasException(); }
virtual bool hasException()
Whether or not an exception has occurred.
virtual void ThreadedElementLoop< ConstElemRange >::neighborSubdomainChanged ( )
overridevirtualinherited

Called every time the neighbor subdomain changes (i.e.

the subdomain of this neighbor is not the same as the subdomain of the last neighbor). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

virtual void ThreadedElementLoopBase< ConstElemRange >::onBoundary ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing boundary assembling.

Parameters
elem- The element we are checking is on the boundary.
side- The side of the element in question.
bnd_id- ID of the boundary we are at

Reimplemented in ComputeMaterialsObjectThread, ComputeUserObjectsThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeResidualThread, and ComputeMarkerThread.

void ComputeElemAuxVarsThread::onElement ( const Elem *  elem)
overridevirtual

Assembly of the element (not including surface assembly)

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 82 of file ComputeElemAuxVarsThread.C.

83 {
85  {
86  const std::vector<std::shared_ptr<AuxKernel>> & kernels =
88  _fe_problem.prepare(elem, _tid);
90 
91  // Set up the sentinel so that, even if reinitMaterials() throws, we
92  // still remember to swap back.
94 
95  if (_need_materials)
96  _fe_problem.reinitMaterials(elem->subdomain_id(), _tid);
97 
98  for (const auto & aux : kernels)
99  aux->compute();
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 }
virtual void prepare(const Elem *elem, THREAD_ID tid) override
Class for stuff related to variables.
Definition: MooseVariable.h:43
const MooseObjectWarehouse< AuxKernel > & _aux_kernels
Storage object containing active AuxKernel objects.
virtual void reinitElem(const Elem *elem, THREAD_ID tid) override
virtual void reinitMaterials(SubdomainID blk_id, THREAD_ID tid, bool swap_stateful=true)
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
virtual void swapBackMaterials(THREAD_ID tid)
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
virtual NumericVector< Number > & solution() override
bool hasActiveBlockObjects(THREAD_ID tid=0) const
SubdomainID _subdomain
The subdomain for the current element.
void insert(NumericVector< Number > &residual)
The "SwapBackSentinel" class&#39;s destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.
virtual void ThreadedElementLoopBase< ConstElemRange >::onInterface ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id 
)
virtualinherited

Called when doing interface assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
bnd_id- ID of the interface we are at

Reimplemented in ComputeJacobianThread, and ComputeResidualThread.

virtual void ThreadedElementLoopBase< ConstElemRange >::onInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called when doing internal edge assembling.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented in ComputeMaterialsObjectThread, ComputeUserObjectsThread, ComputeIndicatorThread, ComputeJacobianThread, ComputeResidualThread, and ComputeMarkerThread.

void ThreadedElementLoopBase< ConstElemRange >::operator() ( const ConstElemRange &  range,
bool  bypass_threading = false 
)
inherited
void ComputeElemAuxVarsThread::post ( )
overridevirtual

Called after the element range loop.

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 114 of file ComputeElemAuxVarsThread.C.

115 {
118 }
virtual void clearActiveMaterialProperties(THREAD_ID tid) override
Clear the active material properties.
virtual void clearActiveElementalMooseVariables(THREAD_ID tid) override
Clear the active elemental MooseVariable.
virtual void ThreadedElementLoopBase< ConstElemRange >::postElement ( const Elem *  elem)
virtualinherited

Called after the element assembly is done (including surface assembling)

Parameters
elem- active element

Reimplemented in ComputeJacobianBlocksThread, ComputeJacobianThread, ComputeIndicatorThread, ComputeResidualThread, and ComputeMarkerThread.

virtual void ThreadedElementLoopBase< ConstElemRange >::postInternalSide ( const Elem *  elem,
unsigned int  side 
)
virtualinherited

Called after evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'
virtual void ThreadedElementLoopBase< ConstElemRange >::pre ( )
virtualinherited

Called before the element range loop.

virtual void ThreadedElementLoop< ConstElemRange >::preElement ( const Elem *  elem)
overridevirtualinherited

Called before the element assembly.

Parameters
elem- active element

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

virtual void ThreadedElementLoop< ConstElemRange >::preInternalSide ( const Elem *  elem,
unsigned int  side 
)
overridevirtualinherited

Called before evaluations on an element internal side.

Parameters
elem- Element we are on
side- local side number of the element 'elem'

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

void ComputeElemAuxVarsThread::subdomainChanged ( )
overridevirtual

Called every time the current subdomain changes (i.e.

the subdomain of this element is not the same as the subdomain of the last element). Beware of over-using this! You might think that you can do some expensive stuff in here and get away with it... but there are applications that have TONS of subdomains....

Reimplemented from ThreadedElementLoopBase< ConstElemRange >.

Definition at line 48 of file ComputeElemAuxVarsThread.C.

49 {
51 
52  // prepare variables
53  for (const auto & it : _aux_sys._elem_vars[_tid])
54  {
55  MooseVariable * var = it.second;
56  var->prepareAux();
57  }
58 
59  std::set<MooseVariable *> needed_moose_vars;
60  std::set<unsigned int> needed_mat_props;
61 
63  {
64  const std::vector<std::shared_ptr<AuxKernel>> & kernels =
66  for (const auto & aux : kernels)
67  {
68  aux->subdomainSetup();
69  const std::set<MooseVariable *> & mv_deps = aux->getMooseVariableDependencies();
70  const std::set<unsigned int> & mp_deps = aux->getMatPropDependencies();
71  needed_moose_vars.insert(mv_deps.begin(), mv_deps.end());
72  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
73  }
74  }
75 
76  _fe_problem.setActiveElementalMooseVariables(needed_moose_vars, _tid);
77  _fe_problem.setActiveMaterialProperties(needed_mat_props, _tid);
79 }
virtual void setActiveElementalMooseVariables(const std::set< MooseVariable * > &moose_vars, THREAD_ID tid) override
Set the MOOSE variables to be reinited on each element.
virtual void prepareMaterials(SubdomainID blk_id, THREAD_ID tid)
Add the MooseVariables that the current materials depend on to the dependency list.
Class for stuff related to variables.
Definition: MooseVariable.h:43
const MooseObjectWarehouse< AuxKernel > & _aux_kernels
Storage object containing active AuxKernel objects.
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.
virtual void subdomainSetup(SubdomainID subdomain, THREAD_ID tid)
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
const std::map< SubdomainID, std::vector< std::shared_ptr< T > > > & getActiveBlockObjects(THREAD_ID tid=0) const
bool hasActiveBlockObjects(THREAD_ID tid=0) const
SubdomainID _subdomain
The subdomain for the current element.

Member Data Documentation

const MooseObjectWarehouse<AuxKernel>& ComputeElemAuxVarsThread::_aux_kernels
protected

Storage object containing active AuxKernel objects.

Definition at line 50 of file ComputeElemAuxVarsThread.h.

Referenced by onElement(), and subdomainChanged().

AuxiliarySystem& ComputeElemAuxVarsThread::_aux_sys
protected

Definition at line 47 of file ComputeElemAuxVarsThread.h.

Referenced by onElement(), and subdomainChanged().

FEProblemBase& ThreadedElementLoop< ConstElemRange >::_fe_problem
protectedinherited
MooseMesh& ThreadedElementLoopBase< ConstElemRange >::_mesh
protectedinherited

Definition at line 141 of file ThreadedElementLoopBase.h.

bool ComputeElemAuxVarsThread::_need_materials
protected

Definition at line 52 of file ComputeElemAuxVarsThread.h.

Referenced by onElement().

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_neighbor_subdomain
protectedinherited

The subdomain for the current neighbor.

Definition at line 151 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_neighbor_subdomain
protectedinherited

The subdomain for the last neighbor.

Definition at line 154 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_old_subdomain
protectedinherited

The subdomain for the last element.

Definition at line 148 of file ThreadedElementLoopBase.h.

SubdomainID ThreadedElementLoopBase< ConstElemRange >::_subdomain
protectedinherited
THREAD_ID ThreadedElementLoopBase< ConstElemRange >::_tid
protectedinherited

Definition at line 142 of file ThreadedElementLoopBase.h.

Referenced by ComputeFullJacobianThread::computeFaceJacobian(), ComputeJacobianThread::computeFaceJacobian(), ComputeFullJacobianThread::computeInternalFaceJacobian(), ComputeJacobianThread::computeInternalFaceJacobian(), ComputeFullJacobianThread::computeInternalInterFaceJacobian(), ComputeJacobianThread::computeInternalInterFaceJacobian(), ComputeFullJacobianThread::computeJacobian(), ComputeJacobianThread::computeJacobian(), ComputeResidualThread::onBoundary(), ComputeJacobianThread::onBoundary(), ComputeUserObjectsThread::onBoundary(), ComputeMaterialsObjectThread::onBoundary(), ComputeMarkerThread::onElement(), ComputeElemDampingThread::onElement(), onElement(), ComputeResidualThread::onElement(), ComputeJacobianThread::onElement(), ComputeIndicatorThread::onElement(), ComputeUserObjectsThread::onElement(), ComputeMaterialsObjectThread::onElement(), ComputeResidualThread::onInterface(), ComputeJacobianThread::onInterface(), ComputeJacobianThread::onInternalSide(), ComputeResidualThread::onInternalSide(), ComputeIndicatorThread::onInternalSide(), ComputeMaterialsObjectThread::onInternalSide(), ComputeUserObjectsThread::onInternalSide(), ComputeMarkerThread::post(), post(), ComputeMaterialsObjectThread::post(), ComputeIndicatorThread::post(), ComputeResidualThread::post(), ComputeJacobianThread::post(), ComputeUserObjectsThread::post(), ComputeResidualThread::postElement(), ComputeJacobianThread::postElement(), ComputeJacobianBlocksThread::postElement(), ComputeMarkerThread::subdomainChanged(), subdomainChanged(), ComputeResidualThread::subdomainChanged(), ComputeJacobianThread::subdomainChanged(), ComputeIndicatorThread::subdomainChanged(), ComputeMaterialsObjectThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().


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