https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MOOSEQuantityToNEML2.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 "MOOSEToNEML2.h"
13#include "NEML2Utils.h"
14#include "ElementUserObject.h"
15
16#include "RankTwoTensor.h"
18
22template <typename T, unsigned int state>
24{
25public:
27
29
30#ifndef NEML2_ENABLED
31 void initialize() override {}
32 void execute() override {}
33 void finalize() override {}
34 void threadJoin(const UserObject &) override {}
35#else
36 void initialize() override;
37 void execute() override;
38 void finalize() override {}
39 void threadJoin(const UserObject &) override;
40
41 neml2::Tensor gatheredData() const override;
42
43protected:
44 T qpData(unsigned int) const;
45
48
51 const VariableValue * _var_scalar = nullptr;
52 const VariableValue * _var_scalar_old = nullptr;
53 const Function * _func = nullptr;
54 const MaterialProperty<T> * _mat_prop = nullptr;
56 const VariableValue * _var = nullptr;
57 const VariableValue * _var_old = nullptr;
59
61 bool _batched = false;
62
64 std::vector<T> _buffer;
65#endif
66};
67
68#define defineMOOSEQuantityToNEML2(T) \
69 using MOOSE##T##ToNEML2 = MOOSEQuantityToNEML2<T, 0>; \
70 using MOOSEOld##T##ToNEML2 = MOOSEQuantityToNEML2<T, 1>
75#undef defineMOOSEQuantityToNEML2
defineMOOSEQuantityToNEML2(Real)
OutputTools< Real >::VariableValue VariableValue
Definition MooseTypes.h:348
Base class for function objects.
Definition Function.h:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Gather a MOOSE quantity for insertion into the NEML2 model.
void execute() override
Execute method.
const VariableValue * _var_scalar_old
std::vector< T > _buffer
Intermediate data buffer, filled during the element loop.
bool _batched
Whether the gathered data should be batched.
neml2::Tensor gatheredData() const override
Convert data gathered from MOOSE into neml2::Tensor.
void finalize() override
Finalize.
const MaterialProperty< T > * _mat_prop_old
void initialize() override
Called before execute() is ever called so that data can be cleared.
static InputParameters validParams()
const VariableValue * _var
const VariableValue * _var_scalar
const MaterialProperty< T > * _mat_prop
const VariableValue * _var_old
T qpData(unsigned int) const
const NEML2Utils::MOOSEIOType _type
MOOSE quantity type to read from.
void threadJoin(const UserObject &) override
Must override.
Common interface for inserting gathered MOOSE data into the NEML2 material model.
Base class for user-specific data.
Definition UserObject.h:20