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

#include <ComputeElemAuxBcsThread.h>

Public Member Functions

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

Protected Member Functions

void printGeneralExecutionInformation () const
 Print list of object types executed and in which order. More...
 
void printBoundaryExecutionInformation (unsigned int boundary_id, const std::vector< std::shared_ptr< AuxKernelType >> &kernels) const
 Print list of specific objects executed and in which order. More...
 

Protected Attributes

FEProblemBase_fe_problem
 
AuxiliarySystem_aux_sys
 
THREAD_ID _tid
 
const MooseObjectWarehouse< AuxKernelType > & _storage
 Storage object containing active AuxKernel objects. More...
 
bool _need_materials
 
std::set< SubdomainID_boundaries_exec_printed
 Keeps track of which boundaries the loop has reported execution on. More...
 

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 fe_problem,
const MooseObjectWarehouse< AuxKernelType > &  storage,
bool  need_materials 
)

Definition at line 22 of file ComputeElemAuxBcsThread.C.

26  : _fe_problem(fe_problem),
27  _aux_sys(fe_problem.getAuxiliarySystem()),
28  _storage(storage),
29  _need_materials(need_materials)
30 {
31 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
AuxiliarySystem & getAuxiliarySystem()

◆ ComputeElemAuxBcsThread() [2/2]

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

Definition at line 35 of file ComputeElemAuxBcsThread.C.

38  _aux_sys(x._aux_sys),
39  _storage(x._storage),
41 {
42 }
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.

Member Function Documentation

◆ join()

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

Definition at line 142 of file ComputeElemAuxBcsThread.C.

143 {
144 }

◆ operator()()

template<typename AuxKernelType >
void ComputeElemAuxBcsThread< AuxKernelType >::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 
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  SubdomainID last_did = Elem::invalid_subdomain_id;
62 
63  // need to update the boundary ID in assembly
65 
66  if (elem->processor_id() == _fe_problem.processor_id())
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  {
73  printBoundaryExecutionInformation(boundary_id, iter->second);
74  auto did = elem->subdomain_id();
75  if (did != last_did)
76  {
78  last_did = did;
79  }
81  _fe_problem.prepare(elem, _tid);
82  _fe_problem.reinitElemFace(elem, side, boundary_id, _tid);
83 
84  const Elem * lower_d_elem = _fe_problem.mesh().getLowerDElem(elem, side);
85  _fe_problem.setCurrentLowerDElem(lower_d_elem, _tid);
86  if (lower_d_elem)
87  _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
88 
89  const Elem * neighbor = elem->neighbor_ptr(side);
90 
91  // The last check here is absolutely necessary otherwise we will attempt to evaluate
92  // neighbor materials on neighbor elements that aren't evaluable, e.g. don't have algebraic
93  // ghosting
94  bool compute_interface =
95  neighbor && neighbor->active() &&
97  _tid);
98 
99  // Set up Sentinel class so that, even if reinitMaterialsFace() throws, we
100  // still remember to swap back during stack unwinding.
102  SwapBackSentinel neighbor_sentinel(
104 
105  if (_need_materials)
106  {
107  std::unordered_set<unsigned int> needed_mat_props;
108  for (const auto & aux : iter->second)
109  {
110  const auto & mp_deps = aux->getMatPropDependencies();
111  needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
112  }
113  _fe_problem.setActiveMaterialProperties(needed_mat_props, _tid);
114 
115  _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
116 
118 
119  if (compute_interface)
120  {
121  _fe_problem.reinitNeighbor(elem, side, _tid);
122  _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
124  }
125  }
126 
127  for (const auto & aux : iter->second)
128  {
129  aux->compute();
130  aux->insert();
131  }
132 
133  if (_need_materials)
135  }
136  }
137  }
138 }
void setActiveMaterialProperties(const std::unordered_set< unsigned int > &mat_prop_ids, const THREAD_ID tid)
Record and set the material properties required by the current computing thread.
void printGeneralExecutionInformation() const
Print list of object types executed and in which order.
void printBoundaryExecutionInformation(unsigned int boundary_id, const std::vector< std::shared_ptr< AuxKernelType >> &kernels) const
Print list of specific objects executed and in which order.
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition: MooseMesh.C:1483
void reinitMaterialsBoundary(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on a boundary
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
virtual void setCurrentLowerDElem(const Elem *const lower_d_elem, const THREAD_ID tid) override
Set the current lower dimensional element.
void reinitMaterialsFace(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on element faces
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void swapBackMaterialsFace(const THREAD_ID tid)
const MaterialWarehouse & getInterfaceMaterialsWarehouse() const
void reinitMaterialsNeighbor(SubdomainID blk_id, const THREAD_ID tid, bool swap_stateful=true, const std::deque< MaterialBase *> *reinit_mats=nullptr)
reinit materials on the neighboring element face
virtual void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID bnd_id, const THREAD_ID tid) override
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
virtual void reinitLowerDElem(const Elem *lower_d_elem, const THREAD_ID tid, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr) override
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
virtual MooseMesh & mesh() override
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
void reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
processor_id_type processor_id() const
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}.

◆ printBoundaryExecutionInformation()

template<typename AuxKernelType >
void ComputeElemAuxBcsThread< AuxKernelType >::printBoundaryExecutionInformation ( unsigned int  boundary_id,
const std::vector< std::shared_ptr< AuxKernelType >> &  kernels 
) const
protected

Print list of specific objects executed and in which order.

Definition at line 161 of file ComputeElemAuxBcsThread.C.

163 {
165  _boundaries_exec_printed.count(boundary_id))
166  return;
167 
168  const auto & console = _fe_problem.console();
169  console << "[DBG] Ordering on boundary " << boundary_id << std::endl;
170  std::vector<MooseObject *> objs_ptrs;
171  for (auto & kernel_ptr : kernels)
172  if (kernel_ptr->hasBoundary(boundary_id))
173  objs_ptrs.push_back(dynamic_cast<MooseObject *>(kernel_ptr.get()));
174  std::string list_kernels = ConsoleUtils::mooseObjectVectorToString(objs_ptrs);
175  console << ConsoleUtils::formatString(list_kernels, "[DBG]") << std::endl;
176  _boundaries_exec_printed.insert(boundary_id);
177 }
std::string mooseObjectVectorToString(const std::vector< MooseObject *> &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
Definition: ConsoleUtils.C:438
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
std::string formatString(std::string message, const std::string &prefix)
Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the st...
Definition: ConsoleUtils.C:422
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
bool hasActiveObjects(THREAD_ID tid=0) const
std::set< SubdomainID > _boundaries_exec_printed
Keeps track of which boundaries the loop has reported execution on.

◆ printGeneralExecutionInformation()

template<typename AuxKernelType >
void ComputeElemAuxBcsThread< AuxKernelType >::printGeneralExecutionInformation ( ) const
protected

Print list of object types executed and in which order.

Definition at line 148 of file ComputeElemAuxBcsThread.C.

149 {
151  {
152  const auto & console = _fe_problem.console();
153  const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
154  console << "[DBG] Executing boundary restricted auxkernels on boundary elements on "
155  << execute_on << std::endl;
156  }
157 }
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
const MooseObjectWarehouse< AuxKernelType > & _storage
Storage object containing active AuxKernel objects.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
const ConsoleStream & console() const
Return console handle.
Definition: Problem.h:48
bool hasActiveObjects(THREAD_ID tid=0) const

Member Data Documentation

◆ _aux_sys

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

Definition at line 37 of file ComputeElemAuxBcsThread.h.

◆ _boundaries_exec_printed

template<typename AuxKernelType>
std::set<SubdomainID> ComputeElemAuxBcsThread< AuxKernelType >::_boundaries_exec_printed
mutableprotected

Keeps track of which boundaries the loop has reported execution on.

Definition at line 53 of file ComputeElemAuxBcsThread.h.

◆ _fe_problem

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

Definition at line 36 of file ComputeElemAuxBcsThread.h.

◆ _need_materials

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

Definition at line 43 of file ComputeElemAuxBcsThread.h.

◆ _storage

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

Storage object containing active AuxKernel objects.

Definition at line 41 of file ComputeElemAuxBcsThread.h.

◆ _tid

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

Definition at line 38 of file ComputeElemAuxBcsThread.h.


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