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 "KokkosMaterial.h" 11 : 12 : class KokkosGenericConstantMaterial final 13 : : public Moose::Kokkos::Material<KokkosGenericConstantMaterial> 14 : { 15 : public: 16 : static InputParameters validParams(); 17 : 18 : KokkosGenericConstantMaterial(const InputParameters & parameters); 19 : 20 235920 : KOKKOS_FUNCTION void computeQpProperties(const unsigned int qp, Datum & datum) const 21 : { 22 479840 : for (unsigned int i = 0; i < _num_props; ++i) 23 : { 24 243920 : auto prop = _props[i](datum, qp); 25 243920 : prop = _prop_values[i]; 26 : } 27 235920 : } 28 : 29 : protected: 30 : // Material property names 31 : const std::vector<std::string> & _prop_names; 32 : // GPU-accessible array of property values 33 : const Moose::Kokkos::Array<Real> _prop_values; 34 : // GPU-accessible array of Kokkos material properties 35 : Moose::Kokkos::Array<Moose::Kokkos::MaterialProperty<Real>> _props; 36 : // Number of properties 37 : const unsigned int _num_props; 38 : };