Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "ComputeJacobianBlocksThread.h" 11 : 12 : // MOOSE includes 13 : #include "DGKernel.h" 14 : #include "FEProblem.h" 15 : #include "KernelBase.h" 16 : #include "IntegratedBC.h" 17 : 18 : #include "libmesh/threads.h" 19 : #include "libmesh/dof_map.h" 20 : 21 587 : ComputeJacobianBlocksThread::ComputeJacobianBlocksThread(FEProblemBase & fe_problem, 22 : std::vector<JacobianBlock *> & blocks, 23 587 : const std::set<TagID> & tags) 24 587 : : ComputeFullJacobianThread(fe_problem, tags), _blocks(blocks) 25 : { 26 587 : } 27 : 28 : // Splitting Constructor 29 63 : ComputeJacobianBlocksThread::ComputeJacobianBlocksThread(ComputeJacobianBlocksThread & x, 30 63 : Threads::split split) 31 63 : : ComputeFullJacobianThread(x, split), _blocks(x._blocks) 32 : { 33 63 : } 34 : 35 713 : ComputeJacobianBlocksThread::~ComputeJacobianBlocksThread() {} 36 : 37 : void 38 27776 : ComputeJacobianBlocksThread::postElement(const Elem * elem) 39 : { 40 27776 : _dof_indices.clear(); 41 : 42 98608 : for (const auto & block : _blocks) 43 : { 44 70832 : const auto & dof_map = block->_precond_system.get_dof_map(); 45 70832 : dof_map.dof_indices(elem, _dof_indices); 46 : 47 70832 : _fe_problem.addJacobianBlockTags( 48 70832 : block->_jacobian, block->_ivar, block->_jvar, dof_map, _dof_indices, _tags, _tid); 49 : } 50 27776 : } 51 : 52 : void 53 98048 : ComputeJacobianBlocksThread::postInternalSide(const Elem * elem, unsigned int side) 54 : { 55 98048 : if (_dg_warehouse->hasActiveBlockObjects(_subdomain, _tid)) 56 : { 57 384 : _dof_indices.clear(); 58 384 : _dof_neighbor_indices.clear(); 59 : 60 : // Pointer to the neighbor we are currently working on. 61 384 : const Elem * neighbor = elem->neighbor_ptr(side); 62 : 63 : // Get the global id of the element and the neighbor 64 384 : const auto elem_id = elem->id(), neighbor_id = neighbor->id(); 65 : 66 576 : if ((neighbor->active() && (neighbor->level() == elem->level()) && (elem_id < neighbor_id)) || 67 192 : (neighbor->level() < elem->level())) 68 960 : for (const auto & block : _blocks) 69 : { 70 768 : const auto & dof_map = block->_precond_system.get_dof_map(); 71 768 : dof_map.dof_indices(elem, _dof_indices); 72 768 : dof_map.dof_indices(neighbor, _dof_neighbor_indices); 73 : 74 768 : _fe_problem.addJacobianNeighbor(block->_jacobian, 75 768 : block->_ivar, 76 768 : block->_jvar, 77 : dof_map, 78 768 : _dof_indices, 79 768 : _dof_neighbor_indices, 80 : _tags, 81 : _tid); 82 : } 83 : } 84 98048 : }