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 317159 : BlockRestrictable::BlockRestrictable(const BlockRestrictable & object, 14 181421 : const Moose::Kokkos::FunctorCopy &) 15 181421 : : _blk_dual_restrictable(object._blk_dual_restrictable), 16 181421 : _blk_feproblem(object._blk_feproblem), 17 181421 : _blk_mesh(object._blk_mesh), 18 181421 : _boundary_ids(object._boundary_ids), 19 181421 : _blk_tid(object._blk_tid), 20 181421 : _blk_name(object._blk_name), 21 181421 : _blk_dim(object._blk_dim), 22 181421 : _moose_object(object._moose_object) 23 : { 24 317159 : _kokkos_element_ids = object._kokkos_element_ids; 25 317159 : _kokkos_node_ids = object._kokkos_node_ids; 26 317159 : _kokkos_element_side_ids = object._kokkos_element_side_ids; 27 317159 : } 28 : 29 : void 30 7846 : BlockRestrictable::initializeKokkosBlockRestrictable() 31 : { 32 23538 : if (_moose_object->isParamValid("_kokkos_material")) 33 2744 : return; 34 : 35 5102 : const auto & blocks = blockRestricted() ? blockIDs() : meshBlockIDs(); 36 : 37 5102 : const auto * const kokkos_mesh = _blk_mesh->getKokkosMesh(); 38 : 39 5102 : std::vector<ContiguousElementID> element_ids; 40 5102 : std::vector<ContiguousNodeID> node_ids; 41 : 42 11099 : for (const auto block : blocks) 43 : { 44 9264 : element_ids.insert(element_ids.end(), 45 3267 : kokkos_mesh->getSubdomainContiguousElementIDRange(block).begin(), 46 3267 : kokkos_mesh->getSubdomainContiguousElementIDRange(block).end()); 47 5997 : node_ids.insert(node_ids.end(), 48 3267 : kokkos_mesh->getSubdomainContiguousNodeIDs(block).begin(), 49 3267 : kokkos_mesh->getSubdomainContiguousNodeIDs(block).end()); 50 : } 51 : 52 5102 : _kokkos_element_ids = element_ids; 53 : 54 18465 : if (_moose_object->isParamValid("unique_node_execute") && 55 3189 : !_moose_object->getParam<bool>("unique_node_execute")) 56 204 : _kokkos_node_ids = node_ids; 57 : else 58 4898 : _kokkos_node_ids = std::set<ContiguousNodeID>(node_ids.begin(), node_ids.end()); 59 : 60 15306 : if (_moose_object->isParamValid("_material_data_type") && 61 2784 : _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") != 62 5568 : Moose::BLOCK_MATERIAL_DATA && 63 2784 : _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") != 64 : Moose::BOUNDARY_MATERIAL_DATA) 65 : { 66 0 : std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids; 67 : 68 0 : for (const auto eid : element_ids) 69 : { 70 0 : const auto type = kokkos_mesh->getElementInfo(eid).type; 71 : 72 0 : for (const auto side : make_range(kokkos_mesh->getNumSides(type))) 73 0 : element_side_ids.insert({eid, side}); 74 : } 75 : 76 0 : _kokkos_element_side_ids = element_side_ids; 77 0 : } 78 5102 : }