https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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.
 
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.
 

Protected Attributes

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

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.

Member Function Documentation

◆ join()

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

Definition at line 143 of file ComputeElemAuxBcsThread.C.

144{
145}

◆ operator()()

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

Definition at line 46 of file ComputeElemAuxBcsThread.C.

47{
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_sub_id = 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 const auto sub_id = elem->subdomain_id();
75 if (sub_id != last_sub_id)
76 {
78 last_sub_id = sub_id;
79 }
82 _fe_problem.reinitElemFace(elem, side, _tid);
83
84 const Elem * lower_d_elem = _fe_problem.mesh().getLowerDElem(elem, side);
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 }
114
115 _fe_problem.reinitMaterialsFaceOnBoundary(boundary_id, sub_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->determineWhetherCoincidentLowerDCalc();
130 aux->compute();
131 aux->insert();
132 }
133
134 if (_need_materials)
136 }
137 }
138 }
139}
boundary_id_type BoundaryID
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.
void printGeneralExecutionInformation() const
Print list of object types executed and in which order.
const MaterialWarehouse & getInterfaceMaterialsWarehouse() const
virtual void setCurrentBoundaryID(BoundaryID bid, const THREAD_ID tid) override
sets the current boundary ID in assembly
virtual void swapBackMaterialsFace(const THREAD_ID tid)
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
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 swapBackMaterialsNeighbor(const THREAD_ID tid)
void clearActiveMaterialProperties(const THREAD_ID tid)
Clear the active material properties.
void reinitElemFace(const Elem *elem, unsigned int side, BoundaryID, 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 MooseMesh & mesh() override
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 reinitMaterialsFaceOnBoundary(const BoundaryID boundary_id, const SubdomainID blk_id, const THREAD_ID tid, const bool swap_stateful=true, const std::deque< MaterialBase * > *const reinit_mats=nullptr)
reinit materials on element faces on a boundary (internal or external) This specific routine helps us...
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
virtual void subdomainSetup(SubdomainID subdomain, const THREAD_ID tid)
void reinitMaterialsInterface(BoundaryID boundary_id, const THREAD_ID tid, bool swap_stateful=true)
virtual void setCurrentLowerDElem(const Elem *const lower_d_elem, const THREAD_ID tid) override
Set the current lower dimensional element.
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
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:1690
const std::map< BoundaryID, std::vector< std::shared_ptr< T > > > & getActiveBoundaryObjects(THREAD_ID tid=0) const
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,...
processor_id_type processor_id() const

◆ 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 162 of file ComputeElemAuxBcsThread.C.

164{
166 _boundaries_exec_printed.count(boundary_id))
167 return;
168
169 const auto & console = _fe_problem.console();
170 console << "[DBG] Ordering on boundary " << boundary_id << std::endl;
171 std::vector<MooseObject *> objs_ptrs;
172 for (auto & kernel_ptr : kernels)
173 if (kernel_ptr->hasBoundary(boundary_id))
174 objs_ptrs.push_back(dynamic_cast<MooseObject *>(kernel_ptr.get()));
175 std::string list_kernels = ConsoleUtils::mooseObjectVectorToString(objs_ptrs);
176 console << ConsoleUtils::formatString(list_kernels, "[DBG]") << std::endl;
177 _boundaries_exec_printed.insert(boundary_id);
178}
bool hasBoundary(const std::vector< BoundaryID > &boundary_ids1, const std::vector< BoundaryID > &boundary_ids2)
Local function to check to see if any intersection occurs between two vectors.
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
std::set< SubdomainID > _boundaries_exec_printed
Keeps track of which boundaries the loop has reported execution on.
bool shouldPrintExecution(const THREAD_ID tid) const
Check whether the problem should output execution orders at this time.
bool hasActiveObjects(THREAD_ID tid=0) const
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
const ConsoleStream & console() const
Return console handle.
Definition Problem.h:48
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...
std::string mooseObjectVectorToString(const std::vector< MooseObject * > &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
const Elem & get(const ElemType type_in)

◆ printGeneralExecutionInformation()

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

Print list of object types executed and in which order.

Definition at line 149 of file ComputeElemAuxBcsThread.C.

150{
152 {
153 const auto & console = _fe_problem.console();
154 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
155 console << "[DBG] Executing boundary restricted auxkernels on boundary elements on "
156 << execute_on << std::endl;
157 }
158}
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.

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: