https://mooseframework.inl.gov
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 #ifdef NEML2_ENABLED
16 #include "neml2/models/Model.h"
17 #endif
18 
29 {
30 public:
32 
33  MOOSEToNEML2(const InputParameters & params);
34 
35 #ifdef NEML2_ENABLED
36  enum class Mode
37  {
38  VARIABLE,
40  PARAMETER,
41  UNDEFINED
42  };
43 
51  void setMode(Mode) const;
52 
54  Mode getMode() const { return _mode; }
55 
57  virtual void checkMode() const;
58 
60  const std::string & NEML2Name() const { return _raw_name; }
61 
63  const neml2::VariableName & NEML2VariableName() const;
64 
66  const std::string & NEML2ParameterName() const;
67 
69  virtual neml2::Tensor gatheredData() const = 0;
70 
72  void insertInto(neml2::ValueMap &, std::map<std::string, neml2::Tensor> &) const;
73 
74 protected:
76  mutable Mode _mode;
77 
79  mutable neml2::VariableName _neml2_variable;
80 
82  mutable std::string _neml2_parameter;
83 
84 private:
86  const std::string _raw_name;
87 #endif
88 };
neml2::VariableName _neml2_variable
NEML2 input variable to transfer data to.
Definition: MOOSEToNEML2.h:79
void insertInto(neml2::ValueMap &, std::map< std::string, neml2::Tensor > &) const
Insert the gathered data into the NEML2 material model.
Definition: MOOSEToNEML2.C:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Mode _mode
Whether we should insert into NEML2 input variable or NEML2 model parameter.
Definition: MOOSEToNEML2.h:76
void setMode(Mode) const
Change the mode of operation.
Definition: MOOSEToNEML2.C:34
Mode getMode() const
Get the current mode of operation.
Definition: MOOSEToNEML2.h:54
MOOSEToNEML2(const InputParameters &params)
Definition: MOOSEToNEML2.C:23
const neml2::VariableName & NEML2VariableName() const
Name of the NEML2 input variable (only meaningful when _mode == VARIABLE)
Definition: MOOSEToNEML2.C:58
virtual neml2::Tensor gatheredData() const =0
Convert data gathered from MOOSE into neml2::Tensor.
Common interface for inserting gathered MOOSE data into the NEML2 material model. ...
Definition: MOOSEToNEML2.h:28
const std::string & NEML2Name() const
Raw name of the NEML2 variable/parameter.
Definition: MOOSEToNEML2.h:60
static InputParameters validParams()
Definition: MOOSEToNEML2.C:13
const std::string & NEML2ParameterName() const
Name of the NEML2 parameter (only meaningful when _mode == PARAMETER)
Definition: MOOSEToNEML2.C:66
virtual void checkMode() const
Perform error checking after _mode has been set.
Definition: MOOSEToNEML2.C:49
std::string _neml2_parameter
NEML2 parameter to transfer data to.
Definition: MOOSEToNEML2.h:82
const std::string _raw_name
Raw name of the input variable or model parameter.
Definition: MOOSEToNEML2.h:86