Line data Source code
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 : // Moose 13 : #include "MooseObject.h" 14 : #include "MooseTypes.h" 15 : #include "SetupInterface.h" 16 : #include "Restartable.h" 17 : #include "PerfGraphInterface.h" 18 : 19 : class SubProblem; 20 : class FEProblemBase; 21 : class FEProblem; 22 : class SystemBase; 23 : 24 : namespace libMesh 25 : { 26 : class System; 27 : class EquationSystems; 28 : } 29 : 30 : /** 31 : * Base class for all Transfer objects. 32 : * 33 : * Transfers are objects that take values from one Application 34 : * or System and put them in another Application or System. 35 : */ 36 : class Transfer : public MooseObject, 37 : public SetupInterface, 38 : public Restartable, 39 : public PerfGraphInterface 40 : { 41 : public: 42 : Transfer(const InputParameters & parameters); 43 10781 : virtual ~Transfer() = default; 44 : 45 : static InputParameters validParams(); 46 : 47 : /** 48 : * Execute the transfer. 49 : */ 50 : virtual void execute() = 0; 51 : 52 : /** 53 : * Method called at the beginning of the simulation for checking integrity or doing 54 : * one-time setup. 55 : */ 56 0 : virtual void initialSetup() {} 57 : 58 : /** 59 : * Small helper function for finding the system containing the variable. 60 : * 61 : * Note that this implies that variable names are unique across all systems! 62 : * 63 : * @param es The EquationSystems object to be searched. 64 : * @param var_name The name of the variable you are looking for. 65 : */ 66 : static libMesh::System * find_sys(libMesh::EquationSystems & es, const std::string & var_name); 67 : 68 : enum DIRECTION 69 : { 70 : TO_MULTIAPP, 71 : FROM_MULTIAPP, 72 : BETWEEN_MULTIAPP 73 : }; 74 : 75 : /// Used to construct InputParameters 76 365963 : static std::string possibleDirections() { return "to_multiapp from_multiapp between_multiapp"; } 77 : 78 : /// The directions this Transfer should be executed on 79 34452 : const MultiMooseEnum & directions() { return _directions; } 80 : 81 : ///@{ 82 : /// The current direction that this Transfer is going in. 83 : /// direction() is to be deprecated for currentDirection() 84 : MooseEnum direction() { return _direction; } 85 : MooseEnum currentDirection() { return _current_direction; } 86 : ///@} 87 : 88 : /// Set this Transfer to be executed in a given direction 89 130241 : void setCurrentDirection(const int direction) 90 : { 91 130241 : _current_direction = direction; 92 130241 : _direction = direction; 93 130241 : } 94 : 95 : protected: 96 : SubProblem & _subproblem; 97 : FEProblemBase & _fe_problem; 98 : SystemBase & _sys; 99 : 100 : THREAD_ID _tid; 101 : 102 : ///@{ 103 : /// The current direction that is being executed for this Transfer. 104 : /// _direction is to be deprecated for _current_direction 105 : MooseEnum _direction; 106 : MooseEnum _current_direction; 107 : ///@} 108 : 109 : /// The directions this Transfer is to be executed on 110 : MultiMooseEnum _directions; 111 : 112 : public: 113 : const static libMesh::Number OutOfMeshValue; 114 : };