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 126168 : BlockRestrictable::BlockRestrictable(const BlockRestrictable & object, 14 102821 : const Moose::Kokkos::FunctorCopy &) 15 102821 : : _blk_dual_restrictable(object._blk_dual_restrictable), 16 102821 : _blk_feproblem(object._blk_feproblem), 17 102821 : _blk_mesh(object._blk_mesh), 18 102821 : _boundary_ids(object._boundary_ids), 19 102821 : _blk_tid(object._blk_tid), 20 102821 : _blk_name(object._blk_name), 21 102821 : _blk_dim(object._blk_dim), 22 102821 : _moose_object(object._moose_object) 23 : { 24 126168 : _kokkos_element_ids = object._kokkos_element_ids; 25 126168 : _kokkos_node_ids = object._kokkos_node_ids; 26 126168 : _kokkos_element_side_ids = object._kokkos_element_side_ids; 27 126168 : } 28 : 29 : void 30 2523 : BlockRestrictable::initializeKokkosBlockRestrictable(const Moose::Kokkos::Mesh * mesh) 31 : { 32 7569 : if (_moose_object->isParamValid("_kokkos_material")) 33 952 : return; 34 : 35 1571 : auto & blocks = blockRestricted() ? blockIDs() : meshBlockIDs(); 36 : 37 1571 : std::set<ContiguousElementID> element_ids; 38 1571 : std::set<ContiguousNodeID> node_ids; 39 : 40 3214 : for (auto block : blocks) 41 : { 42 1643 : element_ids.insert(mesh->getSubdomainContiguousElementIDs(block).begin(), 43 1262 : mesh->getSubdomainContiguousElementIDs(block).end()); 44 1643 : node_ids.insert(mesh->getSubdomainContiguousNodeIDs(block).begin(), 45 1262 : mesh->getSubdomainContiguousNodeIDs(block).end()); 46 : } 47 : 48 1571 : _kokkos_element_ids = element_ids; 49 1571 : _kokkos_node_ids = node_ids; 50 : 51 4713 : if (_moose_object->isParamValid("_material_data_type") && 52 1209 : _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") != 53 2418 : Moose::BLOCK_MATERIAL_DATA && 54 1209 : _moose_object->getParam<Moose::MaterialDataType>("_material_data_type") != 55 : Moose::BOUNDARY_MATERIAL_DATA) 56 : { 57 0 : std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids; 58 : 59 0 : for (const auto eid : element_ids) 60 : { 61 0 : auto type = mesh->getElementInfo(eid).type; 62 : 63 0 : for (unsigned int side = 0; side < mesh->getNumSides(type); ++side) 64 0 : element_side_ids.insert({eid, side}); 65 : } 66 : 67 0 : _kokkos_element_side_ids = element_side_ids; 68 0 : } 69 1571 : }