https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TorchKernel.C
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 MOOSE_LIBTORCH_ENABLED
11
12// MOOSE includes
13#include "TorchKernel.h"
14
17{
19
20 params.addRequiredParam<UserObjectName>(
21 "assembly", "The TorchAssembly object to use to provide assembly information");
22 params.addRequiredParam<UserObjectName>(
23 "fe", "The TorchFEInterpolation object to use to couple variables");
24
25 return params;
26}
27
29 : GeneralUserObject(parameters),
30 _assembly(_fe_problem.getUserObject<TorchAssembly>("assembly", /*tid=*/0)),
31 _fe(_fe_problem.getUserObject<TorchFEInterpolation>("fe", /*tid=*/0))
32{
33}
34
35void
37{
38 TIME_SECTION("execute", 1, "Torch FEM kernel execution");
39
40 forward();
41}
42
43#endif // MOOSE_LIBTORCH_ENABLED
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
This user object caches assembly information (JxWxT) from MOOSE as a batched at::Tensor for the Torch...
This user object serves as the "interface" for interpolating MOOSE variable values and gradients from...
TorchKernel(const InputParameters &parameters)
Definition TorchKernel.C:28
void execute() override
Execute method.
Definition TorchKernel.C:36
static InputParameters validParams()
Definition TorchKernel.C:16
virtual void forward()=0
The forward operator of this kernel.