Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 : #pragma once 11 : 12 : #include "NEML2Utils.h" 13 : #include "InputParameters.h" 14 : 15 : #ifdef NEML2_ENABLED 16 : #include "neml2/models/Model.h" 17 : #endif 18 : 19 : /** 20 : * Common interface for inserting gathered MOOSE data into the NEML2 material model. 21 : * 22 : * This interface handles the insertion into both NEML2 input variable and NEML2 model parameter. 23 : * 24 : * Users are only required to provide the name of the variable/parameter, and we perform a run-time 25 : * introspection of the NEML2 model to determine if the supplied name is for a NEML2 variable or for 26 : * a NEML2 model parameter. 27 : */ 28 : class MOOSEToNEML2 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : MOOSEToNEML2(const InputParameters & params); 34 : 35 : #ifdef NEML2_ENABLED 36 : /// Name of the NEML2 variable/parameter 37 80 : const std::string & NEML2Name() const { return _neml2_name; } 38 : 39 : /// Convert data gathered from MOOSE into neml2::Tensor 40 : virtual neml2::Tensor gatheredData() const = 0; 41 : 42 : /// Insert the gathered data into the NEML2 material model 43 : void insertInto(std::map<std::string, neml2::Tensor> &) const; 44 : 45 : private: 46 : /// Name of the input variable or model parameter 47 : const std::string _neml2_name; 48 : #endif 49 : };