void ComputeElemAuxVarsThread::onElement(const Elem * elem) { if (_auxs[_tid].activeBlockElementKernels(_subdomain).size() > 0 || _auxs[_tid].activeElementKernels().size() > 0) { _fe_problem.prepare(elem, _tid); _fe_problem.reinitElem(elem, _tid); _fe_problem.reinitMaterials(elem->subdomain_id(), _tid); // block for(std::vector<AuxKernel*>::const_iterator block_element_aux_it = _auxs[_tid].activeBlockElementKernels(_subdomain).begin(); block_element_aux_it != _auxs[_tid].activeBlockElementKernels(_subdomain).end(); ++block_element_aux_it) (*block_element_aux_it)->compute(); // global for(std::vector<AuxKernel *>::const_iterator aux_it = _auxs[_tid].activeElementKernels().begin(); aux_it!=_auxs[_tid].activeElementKernels().end(); aux_it++) (*aux_it)->compute(); _fe_problem.swapBackMaterials(_tid); // update the solution vector { Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); for (std::map<std::string, MooseVariable *>::iterator it = _aux_sys._elem_vars[_tid].begin(); it != _aux_sys._elem_vars[_tid].end(); ++it) { MooseVariable * var = it->second; var->insert(_system.solution()); } } } }
void ComputeElemAuxVarsThread::onElement(const Elem * elem) { if (_aux_kernels.hasActiveBlockObjects(_subdomain, _tid)) { const std::vector<std::shared_ptr<AuxKernel>> & kernels = _aux_kernels.getActiveBlockObjects(_subdomain, _tid); _fe_problem.prepare(elem, _tid); _fe_problem.reinitElem(elem, _tid); // Set up the sentinel so that, even if reinitMaterials() throws, we // still remember to swap back. SwapBackSentinel sentinel(_fe_problem, &FEProblem::swapBackMaterials, _tid, _need_materials); if (_need_materials) _fe_problem.reinitMaterials(elem->subdomain_id(), _tid); for (const auto & aux : kernels) aux->compute(); // update the solution vector { Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); for (const auto & it : _aux_sys._elem_vars[_tid]) { MooseVariable * var = it.second; var->insert(_aux_sys.solution()); } } } }
void ComputeElemAuxBcsThread::operator() (const ConstBndElemRange & range) { ParallelUniqueId puid; _tid = puid.id; for (ConstBndElemRange::const_iterator elem_it = range.begin() ; elem_it != range.end(); ++elem_it) { const BndElement * belem = *elem_it; const Elem * elem = belem->_elem; unsigned short int side = belem->_side; BoundaryID boundary_id = belem->_bnd_id; if (elem->processor_id() == _problem.processor_id()) { // prepare variables for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it) { MooseVariable * var = it->second; var->prepareAux(); } if (_auxs[_tid].elementalBCs(boundary_id).size() > 0) { _problem.prepare(elem, _tid); _problem.reinitElemFace(elem, side, boundary_id, _tid); _problem.reinitMaterialsBoundary(boundary_id, _tid); const std::vector<AuxKernel*> & bcs = _auxs[_tid].elementalBCs(boundary_id); for (std::vector<AuxKernel*>::const_iterator element_bc_it = bcs.begin(); element_bc_it != bcs.end(); ++element_bc_it) (*element_bc_it)->compute(); _problem.swapBackMaterialsFace(_tid); } // update the solution vector { Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it) { MooseVariable * var = it->second; var->insert(_sys.solution()); } } } } }