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