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 TheWarehouse::Query &query, 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< 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 TheWarehouse::Query _all_kernels_query
 Query for every kernel this loop may run, before restricting to a block or boundary.
 
TheWarehouse::QueryCache< AttribThread, AttribBoundaries > _query_boundary
 
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 23 of file ComputeElemAuxBcsThread.h.

Constructor & Destructor Documentation

◆ ComputeElemAuxBcsThread() [1/2]

template<typename AuxKernelType >
ComputeElemAuxBcsThread< AuxKernelType >::ComputeElemAuxBcsThread ( FEProblemBase &  fe_problem,
const TheWarehouse::Query &  query,
bool  need_materials 
)

Definition at line 24 of file ComputeElemAuxBcsThread.C.

27 : _fe_problem(fe_problem),
28 _aux_sys(fe_problem.getAuxiliarySystem()),
29 _all_kernels_query(query),
30 _query_boundary(query),
31 _need_materials(need_materials)
32{
33}
TheWarehouse::QueryCache< AttribThread, AttribBoundaries > _query_boundary
const TheWarehouse::Query _all_kernels_query
Query for every kernel this loop may run, before restricting to a block or boundary.
AuxiliarySystem & getAuxiliarySystem()

◆ ComputeElemAuxBcsThread() [2/2]

Member Function Documentation

◆ join()

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

Definition at line 146 of file ComputeElemAuxBcsThread.C.

147{
148}

◆ operator()()

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

Definition at line 49 of file ComputeElemAuxBcsThread.C.

50{
52 _tid = puid.id;
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 // Only kernels actually restricted to this boundary - unrestricted ones are already
69 // handled by the block-based element loop.
70 std::vector<AuxKernelType *> kernels;
72 kernels, _tid, std::make_tuple(boundary_id, /*must_be_restricted=*/true));
73
74 if (!kernels.empty())
75 {
76 printBoundaryExecutionInformation(boundary_id, kernels);
77 const auto sub_id = elem->subdomain_id();
78 if (sub_id != last_sub_id)
79 {
81 last_sub_id = sub_id;
82 }
85 _fe_problem.reinitElemFace(elem, side, _tid);
86
87 const Elem * lower_d_elem = _fe_problem.mesh().getLowerDElem(elem, side);
89 if (lower_d_elem)
90 _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
91
92 const Elem * neighbor = elem->neighbor_ptr(side);
93
94 // The last check here is absolutely necessary otherwise we will attempt to evaluate
95 // neighbor materials on neighbor elements that aren't evaluable, e.g. don't have algebraic
96 // ghosting
97 bool compute_interface =
98 neighbor && neighbor->active() &&
100 _tid);
101
102 // Set up Sentinel class so that, even if reinitMaterialsFace() throws, we
103 // still remember to swap back during stack unwinding.
105 SwapBackSentinel neighbor_sentinel(
107
108 if (_need_materials)
109 {
110 std::unordered_set<unsigned int> needed_mat_props;
111 for (const auto & aux : kernels)
112 {
113 const auto & mp_deps = aux->getMatPropDependencies();
114 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
115 }
117
118 _fe_problem.reinitMaterialsFaceOnBoundary(boundary_id, sub_id, _tid);
119
121
122 if (compute_interface)
123 {
124 _fe_problem.reinitNeighbor(elem, side, _tid);
125 _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
127 }
128 }
129
130 for (const auto & aux : kernels)
131 {
132 aux->determineWhetherCoincidentLowerDCalc();
133 aux->compute();
134 aux->insert();
135 }
136
137 if (_need_materials)
139 }
140 }
141 }
142}
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
void printBoundaryExecutionInformation(unsigned int boundary_id, const std::vector< 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:1692
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,...
std::vector< T * > & queryInto(std::vector< T * > &results, Args &&... args)
queryInto executes the query and stores the results in the given vector.
processor_id_type processor_id() const

◆ printBoundaryExecutionInformation()

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

Print list of specific objects executed and in which order.

Definition at line 170 of file ComputeElemAuxBcsThread.C.

172{
174 return;
175
176 const auto & console = _fe_problem.console();
177 console << "[DBG] Ordering on boundary " << boundary_id << std::endl;
178 std::vector<MooseObject *> objs_ptrs;
179 for (auto * kernel_ptr : kernels)
180 if (kernel_ptr->hasBoundary(boundary_id))
181 objs_ptrs.push_back(dynamic_cast<MooseObject *>(kernel_ptr));
182 std::string list_kernels = ConsoleUtils::mooseObjectVectorToString(objs_ptrs);
183 console << ConsoleUtils::formatString(list_kernels, "[DBG]") << std::endl;
184 _boundaries_exec_printed.insert(boundary_id);
185}
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.
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.

◆ printGeneralExecutionInformation()

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

Print list of object types executed and in which order.

Definition at line 152 of file ComputeElemAuxBcsThread.C.

153{
155 return;
156
157 std::vector<AuxKernelType *> all_kernels;
158 _all_kernels_query.clone().condition<AttribThread>(_tid).queryInto(all_kernels);
159 if (all_kernels.empty())
160 return;
161
162 const auto & console = _fe_problem.console();
163 const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
164 console << "[DBG] Executing boundary restricted auxkernels on boundary elements on " << execute_on
165 << std::endl;
166}
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
QueryCache clone() const
clone creates and returns an independent copy of the query in its current state.

Member Data Documentation

◆ _all_kernels_query

template<typename AuxKernelType >
const TheWarehouse::Query ComputeElemAuxBcsThread< AuxKernelType >::_all_kernels_query
protected

Query for every kernel this loop may run, before restricting to a block or boundary.

Only used to list them in the debug execution output; the loop itself queries the cache below.

Definition at line 43 of file ComputeElemAuxBcsThread.h.

◆ _aux_sys

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

Definition at line 38 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 56 of file ComputeElemAuxBcsThread.h.

◆ _fe_problem

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

Definition at line 37 of file ComputeElemAuxBcsThread.h.

◆ _need_materials

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

Definition at line 46 of file ComputeElemAuxBcsThread.h.

◆ _query_boundary

Definition at line 44 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: