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 : #pragma once 10 : 11 : // MOOSE includes 12 : #include "MultiAppTransfer.h" 13 : #include "SamplerInterface.h" 14 : 15 : class Sampler; 16 : 17 : /** 18 : * The class creates an additional API to allow Transfers to work when running the 19 : * StochasticTools<FullSolve/Transient>MultiApp objects in batch-mode. 20 : */ 21 : class StochasticToolsTransfer : public MultiAppTransfer, SamplerInterface 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : StochasticToolsTransfer(const InputParameters & parameters); 27 : 28 : ///@{ 29 : /** 30 : * Methods for transferring data from sub-applications to the master application. 31 : **/ 32 : virtual void initializeFromMultiapp(); 33 : virtual void executeFromMultiapp(); 34 : virtual void finalizeFromMultiapp(); 35 : ///@} 36 : 37 : ///@{ 38 : /** 39 : * Methods for transferring data to sub-applications to the master application. 40 : **/ 41 : virtual void initializeToMultiapp(); 42 : virtual void executeToMultiapp(); 43 : virtual void finalizeToMultiapp(); 44 : ///@} 45 : 46 : /** 47 : * Method for setting the app index when running in batch mode. 48 : * 49 : * See StochasticTools<FullSolve/Transient>MultiApp 50 : */ 51 9842 : void setGlobalMultiAppIndex(dof_id_type index) { _app_index = index; } 52 : 53 : /** 54 : * Method for keeping track of the global row index when running in batch mode. 55 : * 56 : * See StochasticTools<FullSolve/Transient>MultiApp 57 : */ 58 39530 : void setGlobalRowIndex(dof_id_type row) { _global_index = row; } 59 : 60 : /** 61 : * Method for keeping track of the row data when running in batch mode. 62 : * 63 : * See StochasticTools<FullSolve/Transient>MultiApp 64 : */ 65 39530 : void setCurrentRow(const std::vector<Real> & row) { _row_data = row; } 66 : 67 : protected: 68 : /// Index for the sub-app that the batch-mode multiapp is working on 69 : dof_id_type _app_index = 0; 70 : /// Index for tracking the row index when using batch mode operation 71 : dof_id_type _global_index = 0; 72 : /// The current row of data (comes from multiapp) 73 : std::vector<Real> _row_data; 74 : 75 : /// Pointer to the Sampler object used by the SamplerTransientMultiApp or SamplerFullSolveMultiApp 76 : Sampler * _sampler_ptr; 77 : };