Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* Swift, a Fourier spectral solver for MOOSE */ 4 : /* */ 5 : /* Copyright 2024 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "TensorOperatorBase.h" 10 : #include "TensorBuffer.h" 11 : #include "DomainAction.h" 12 : 13 : InputParameters 14 2378 : TensorOperatorBase::validParams() 15 : { 16 2378 : InputParameters params = MooseObject::validParams(); 17 2378 : params.registerBase("TensorOperator"); 18 2378 : params.addPrivateParam<TensorProblem *>("_tensor_problem", nullptr); 19 2378 : params.addPrivateParam<const DomainAction *>("_domain", nullptr); 20 2378 : params.addClassDescription("TensorOperatorBase object."); 21 2378 : return params; 22 0 : } 23 : 24 1188 : TensorOperatorBase::TensorOperatorBase(const InputParameters & parameters) 25 : : MooseObject(parameters), 26 : DependencyResolverInterface(), 27 : SwiftConstantInterface(parameters), 28 : _requested_buffers(), 29 : _supplied_buffers(), 30 2376 : _tensor_problem(*getCheckedPointerParam<TensorProblem *>("_tensor_problem")), 31 2376 : _domain(*getCheckedPointerParam<const DomainAction *>("_domain")), 32 1188 : _x(_domain.getAxis(0)), 33 1188 : _y(_domain.getAxis(1)), 34 1188 : _z(_domain.getAxis(2)), 35 1188 : _i(_domain.getReciprocalAxis(0)), 36 1188 : _j(_domain.getReciprocalAxis(1)), 37 1188 : _k(_domain.getReciprocalAxis(2)), 38 1188 : _imaginary( 39 1188 : torch::tensor(c10::complex<double>(0.0, 1.0), MooseTensor::complexFloatTensorOptions())), 40 1188 : _time(_tensor_problem.subTime()), 41 2376 : _dim(_domain.getDim()) 42 : { 43 1188 : } 44 : 45 : TensorOperatorBase & 46 0 : TensorOperatorBase::getCompute(const std::string & param_name) 47 : { 48 0 : const auto name = getParam<TensorComputeName>(param_name); 49 0 : for (const auto & cmp : _tensor_problem.getComputes()) 50 0 : if (cmp->name() == name) 51 0 : return *cmp; 52 0 : paramError(param_name, "Compute not found."); 53 : }