https://mooseframework.inl.gov
TorchScriptMaterial.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 #ifdef LIBTORCH_ENABLED
11 
12 #pragma once
13 
14 #include "Material.h"
15 #include "TorchScriptUserObject.h"
16 
22 {
23 public:
25 
27 
28 protected:
29  virtual void initQpStatefulProperties() override;
30  virtual void computeQpProperties() override;
31 
33  const std::vector<std::string> _prop_names;
34 
36  const unsigned int _num_props;
37 
39  const std::vector<PostprocessorName> _input_names;
40 
42  const unsigned int _num_inputs;
43 
46  std::vector<const PostprocessorValue *> _module_inputs;
47 
49  std::vector<GenericMaterialProperty<Real, false> *> _properties;
50 
53 
55  torch::Tensor _input_tensor;
56 
57 private:
62  void computeQpValues();
63 };
64 
65 #endif
std::vector< GenericMaterialProperty< Real, false > * > _properties
Vector of all the properties, for now we don&#39;t support AD.
static InputParameters validParams()
std::vector< const PostprocessorValue * > _module_inputs
The module input parameters stored as postprocessor values.
const unsigned int _num_inputs
Number of inputs to the neural net.
torch::Tensor _input_tensor
Place holder for the inputs to the neural network.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
A user object the loads a torch module using the torch script format and just-in-time compilation...
This material declares properties which are evaluated as based on a torch script neural network...
const TorchScriptUserObject & _torch_script_userobject
The user object that holds the torch module.
const std::vector< PostprocessorName > _input_names
The functions to use for each property.
TorchScriptMaterial(const InputParameters &parameters)
Materials compute MaterialProperties.
Definition: Material.h:34
const unsigned int _num_props
Number of properties that will be defined.
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
const InputParameters & parameters() const
Get the parameters of the object.
void computeQpValues()
A helper method for evaluating the torch script module and populating the material properties...
const std::vector< std::string > _prop_names
Names of the material properties to define.
virtual void computeQpProperties() override
Users must override this method.