Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "BlockRestrictable.h" 11 : #include "MooseMesh.h" 12 : 13 338902 : BlockRestrictable::BlockRestrictable(const BlockRestrictable & object, 14 192662 : const Moose::Kokkos::FunctorCopy &) 15 192662 : : _blk_dual_restrictable(object._blk_dual_restrictable), 16 192662 : _blk_feproblem(object._blk_feproblem), 17 192662 : _blk_mesh(object._blk_mesh), 18 192662 : _boundary_ids(object._boundary_ids), 19 192662 : _blk_tid(object._blk_tid), 20 192662 : _blk_name(object._blk_name), 21 192662 : _blk_dim(object._blk_dim), 22 192662 : _moose_object(object._moose_object) 23 : { 24 338902 : _kokkos_element_ids = object._kokkos_element_ids; 25 338902 : _kokkos_node_ids = object._kokkos_node_ids; 26 338902 : _kokkos_element_side_ids = object._kokkos_element_side_ids; 27 338902 : } 28 : 29 : void 30 8816 : BlockRestrictable::initializeKokkosBlockRestrictable() 31 : { 32 26448 : if (_moose_object->isParamValid("_kokkos_material")) 33 2744 : return; 34 : 35 6072 : const auto & blocks = blockRestricted() ? blockIDs() : meshBlockIDs(); 36 : 37 6072 : const auto * const kokkos_mesh = _blk_mesh->getKokkosMesh(); 38 : 39 6072 : std::vector<ContiguousElementID> element_ids; 40 6072 : std::vector<ContiguousNodeID> node_ids; 41 6072 : std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids; 42 : 43 13097 : for (const auto block : blocks) 44 : { 45 10821 : element_ids.insert(element_ids.end(), 46 3796 : kokkos_mesh->getSubdomainContiguousElementIDRange(block).begin(), 47 3796 : kokkos_mesh->getSubdomainContiguousElementIDRange(block).end()); 48 7025 : node_ids.insert(node_ids.end(), 49 3796 : kokkos_mesh->getSubdomainContiguousNodeIDs(block).begin(), 50 3796 : kokkos_mesh->getSubdomainContiguousNodeIDs(block).end()); 51 : 52 21075 : if (_moose_object->isParamValid("_kokkos_flux_kernel")) 53 22618 : for (const auto elem : _blk_mesh->getMesh().active_local_subdomain_elements_ptr_range(block)) 54 : { 55 22389 : const auto eid = kokkos_mesh->getContiguousElementID(elem); 56 : 57 105535 : for (const auto side : make_range(elem->n_sides())) 58 83146 : element_side_ids.insert({eid, side}); 59 229 : } 60 : } 61 : 62 6072 : _kokkos_element_ids = element_ids; 63 : 64 21874 : if (_moose_object->isParamValid("unique_node_execute") && 65 3688 : !_moose_object->getParam<bool>("unique_node_execute")) 66 204 : _kokkos_node_ids = node_ids; 67 : else 68 5868 : _kokkos_node_ids = std::set<ContiguousNodeID>(node_ids.begin(), node_ids.end()); 69 : 70 6072 : _kokkos_element_side_ids = element_side_ids; 71 6072 : }