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 "KokkosMaterialBase.h" 11 : 12 : #include "BoundaryRestrictable.h" 13 : 14 : #include "MooseMesh.h" 15 : 16 350305 : BoundaryRestrictable::BoundaryRestrictable(const BoundaryRestrictable & object, 17 197273 : const Moose::Kokkos::FunctorCopy &) 18 197273 : : _bnd_feproblem(object._bnd_feproblem), 19 197273 : _bnd_mesh(object._bnd_mesh), 20 197273 : _bnd_dual_restrictable(object._bnd_dual_restrictable), 21 197273 : _block_ids(object._block_ids), 22 197273 : _bnd_tid(object._bnd_tid), 23 197273 : _bnd_material_data(object._bnd_material_data), 24 197273 : _bnd_nodal(object._bnd_nodal), 25 197273 : _moose_object(object._moose_object) 26 : { 27 350305 : _kokkos_node_ids = object._kokkos_node_ids; 28 350305 : _kokkos_element_side_ids = object._kokkos_element_side_ids; 29 350305 : } 30 : 31 : void 32 8222 : BoundaryRestrictable::initializeKokkosBoundaryRestrictable() 33 : { 34 24666 : if (_moose_object.isParamValid("_kokkos_material")) 35 2744 : return; 36 : 37 5478 : auto & boundaries = boundaryRestricted() ? boundaryIDs() : meshBoundaryIDs(); 38 : 39 5478 : const auto * const kokkos_mesh = _bnd_mesh->getKokkosMesh(); 40 : 41 5478 : if (_bnd_nodal) 42 : { 43 4411 : std::vector<ContiguousNodeID> node_ids; 44 : 45 11245 : for (const auto boundary : boundaries) 46 6834 : node_ids.insert(node_ids.end(), 47 3628 : kokkos_mesh->getBoundaryContiguousNodeIDs(boundary).begin(), 48 3628 : kokkos_mesh->getBoundaryContiguousNodeIDs(boundary).end()); 49 : 50 4411 : _kokkos_node_ids = node_ids; 51 4411 : } 52 : else 53 : { 54 1067 : std::set<Moose::Kokkos::Pair<ContiguousElementID, unsigned int>> element_side_ids; 55 : 56 2944 : for (auto boundary : boundaries) 57 19286 : for (auto elem_id : _bnd_mesh->getBoundaryActiveSemiLocalElemIds(boundary)) 58 : { 59 17409 : const auto elem = _bnd_mesh->elemPtr(elem_id); 60 : 61 17409 : if (elem->processor_id() == _moose_object.processor_id()) 62 23004 : element_side_ids.insert({kokkos_mesh->getContiguousElementID(elem), 63 8353 : _bnd_mesh->sideWithBoundaryID(elem, boundary)}); 64 1877 : } 65 : 66 1067 : _kokkos_element_side_ids = element_side_ids; 67 1067 : } 68 : }