19 #include "libmesh/threads.h" 21 template <
typename AuxKernelType>
26 : _fe_problem(fe_problem),
27 _aux_sys(fe_problem.getAuxiliarySystem()),
29 _need_materials(need_materials)
34 template <
typename AuxKernelType>
37 : _fe_problem(x._fe_problem),
40 _need_materials(x._need_materials)
44 template <
typename AuxKernelType>
52 const auto & boundary_kernels = _storage.getActiveBoundaryObjects(_tid);
54 printGeneralExecutionInformation();
56 for (
const auto & belem : range)
58 const Elem * elem = belem->_elem;
59 unsigned short int side = belem->_side;
64 _fe_problem.setCurrentBoundaryID(boundary_id, _tid);
66 if (elem->processor_id() == _fe_problem.processor_id())
69 const auto iter = boundary_kernels.find(boundary_id);
71 if (iter != boundary_kernels.end() && !(iter->second.empty()))
73 printBoundaryExecutionInformation(boundary_id, iter->second);
74 auto did = elem->subdomain_id();
77 _fe_problem.subdomainSetup(did, _tid);
80 _fe_problem.setCurrentSubdomainID(elem, _tid);
81 _fe_problem.prepare(elem, _tid);
82 _fe_problem.reinitElemFace(elem, side, boundary_id, _tid);
84 const Elem * lower_d_elem = _fe_problem.mesh().getLowerDElem(elem, side);
85 _fe_problem.setCurrentLowerDElem(lower_d_elem, _tid);
87 _fe_problem.reinitLowerDElem(lower_d_elem, _tid);
89 const Elem * neighbor = elem->neighbor_ptr(side);
94 bool compute_interface =
95 neighbor && neighbor->active() &&
96 _fe_problem.getInterfaceMaterialsWarehouse().hasActiveBoundaryObjects(boundary_id,
107 std::unordered_set<unsigned int> needed_mat_props;
108 for (
const auto & aux : iter->second)
110 const auto & mp_deps = aux->getMatPropDependencies();
111 needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
113 _fe_problem.setActiveMaterialProperties(needed_mat_props, _tid);
115 _fe_problem.reinitMaterialsFace(elem->subdomain_id(), _tid);
117 _fe_problem.reinitMaterialsBoundary(boundary_id, _tid);
119 if (compute_interface)
121 _fe_problem.reinitNeighbor(elem, side, _tid);
122 _fe_problem.reinitMaterialsNeighbor(neighbor->subdomain_id(), _tid);
123 _fe_problem.reinitMaterialsInterface(boundary_id, _tid);
127 for (
const auto & aux : iter->second)
134 _fe_problem.clearActiveMaterialProperties(_tid);
140 template <
typename AuxKernelType>
146 template <
typename AuxKernelType>
150 if (_fe_problem.shouldPrintExecution(_tid) && _storage.hasActiveObjects())
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;
159 template <
typename AuxKernelType>
162 unsigned int boundary_id,
const std::vector<std::shared_ptr<AuxKernelType>> & kernels)
const 164 if (!_fe_problem.shouldPrintExecution(_tid) || !_storage.hasActiveObjects() ||
165 _boundaries_exec_printed.count(boundary_id))
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()));
176 _boundaries_exec_printed.insert(boundary_id);
void operator()(const ConstBndElemRange &range)
std::string mooseObjectVectorToString(const std::vector< MooseObject *> &objs, const std::string &sep=" ")
Routine to output the name of MooseObjects in a string.
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.
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
void join(const ComputeElemAuxBcsThread &)
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void swapBackMaterialsFace(const THREAD_ID tid)
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...
boundary_id_type BoundaryID
virtual void swapBackMaterialsNeighbor(const THREAD_ID tid)
ComputeElemAuxBcsThread(FEProblemBase &fe_problem, const MooseObjectWarehouse< AuxKernelType > &storage, bool need_materials)
The "SwapBackSentinel" class's destructor guarantees that FEProblemBase::swapBackMaterials{Face,Neighbor}() is called even when an exception is thrown from FEProblemBase::reinitMaterials{Face,Neighbor}.