https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MOOSEToNEML2.h
Go to the documentation of this file.
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// NEML2 v3 exchanges plain at::Tensor across its C++ API; at::Tensor is available via
16// NEML2Utils.h (which includes ATen) when NEML2 is enabled.
17
28{
29public:
31
32 MOOSEToNEML2(const InputParameters & params);
33
34#ifdef NEML2_ENABLED
36 const std::string & NEML2Name() const { return _neml2_name; }
37
39 virtual at::Tensor gatheredData() const = 0;
40
42 void insertInto(std::map<std::string, at::Tensor> &) const;
43
44private:
46 const std::string _neml2_name;
47#endif
48};
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Common interface for inserting gathered MOOSE data into the NEML2 material model.
const std::string _neml2_name
Name of the input variable or model parameter.
static InputParameters validParams()
const std::string & NEML2Name() const
Name of the NEML2 variable/parameter.
virtual at::Tensor gatheredData() const =0
Convert data gathered from MOOSE into an at::Tensor (shape (batch, *base_shape))
void insertInto(std::map< std::string, at::Tensor > &) const
Insert the gathered data into the NEML2 model input map.