22 "a container in the Trainer object and back.");
24 "Trainer object that contains the solutions"
25 " for different samples.");
32 _pod_multi_app(hasFromMultiApp()
38 paramError(
"multi_app",
"The Multiapp given is not a PODFullsolveMultiapp!");
48 const dof_id_type n = multi_app->numGlobalApps();
49 for (MooseIndex(n) i = 0; i < n; i++)
51 if (multi_app->hasLocalApp(i))
52 for (
auto var_name : var_names)
53 if (!multi_app->appProblemBase(i).hasVariable(var_name))
54 mooseError(
"Variable '" + var_name +
"' not found on sub-application ", i,
"!");
76 NumericVector<Number> & solution = nl.
solution();
80 for (
unsigned int v_index = 0; v_index < var_names.size(); ++v_index)
87 std::shared_ptr<DenseVector<Real>> tmp = std::make_shared<DenseVector<Real>>();
88 solution.localize(tmp->get_values(), var_dofs);
100 unsigned int counter = 0;
101 for (
unsigned int var_i = 0; var_i < var_names.size(); ++var_i)
106 for (
unsigned int base_i = 0; base_i < var_base_num; ++base_i)
113 NumericVector<Number> & solution = nl.
solution();
125 solution.insert(base_vector, var_dofs);
153 for (MooseIndex(n) i = 0; i < n; i++)
160 NumericVector<Number> & solution = nl.
solution();
164 for (
unsigned int var_i = 0; var_i < var_names.size(); ++var_i)
171 std::shared_ptr<DenseVector<Real>> tmp = std::make_shared<DenseVector<Real>>();
172 solution.localize(tmp->get_values(), var_dofs);
203 NumericVector<Number> & solution = nl.
solution();
215 solution.insert(base_vector, var_dofs);
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
registerMooseObject("StochasticToolsApp", PODSamplerSolutionTransfer)
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
const std::shared_ptr< MultiApp > getToMultiApp() const
const std::shared_ptr< MultiApp > getFromMultiApp() const
bool hasFromMultiApp() const
const std::vector< std::string > & getVarNames() const
unsigned int getBaseSize(unsigned int var_i) const
Getting the base size for variable with index v_ind.
void addSnapshot(unsigned int var_i, unsigned int glob_i, const std::shared_ptr< DenseVector< Real > > &snapshot)
Adding a snapshot for a variable.
const DenseVector< Real > & getBasisVector(unsigned int var_i, unsigned int base_i) const
Getting a basis vector for a given variable.
unsigned int getVariableIndex(unsigned int glob_i) const
Getting appropriate variable index for a global base index.
Transfer solutions from sub-applications to a container in a Trainer.
virtual void execute() override
static InputParameters validParams()
virtual void finalizeFromMultiapp() override
virtual void initialSetup() override
virtual void initializeToMultiapp() override
Methods for transferring data to sub-applications to the master application.
virtual void initializeFromMultiapp() override
Methods used when running in batch mode (see SamplerFullSolveMultiApp)
std::shared_ptr< PODFullSolveMultiApp > _pod_multi_app
The input multiapp casted into a PODFullSolveMultiapp to get access to the specific pod attributes.
virtual void finalizeToMultiapp() override
PODReducedBasisTrainer & _trainer
The trainer object to save the solution vector into or to fetch the artificial solution vectors from.
PODSamplerSolutionTransfer(const InputParameters ¶meters)
virtual void executeToMultiapp() override
virtual void executeFromMultiapp() override
dof_id_type getLocalRowEnd() const
dof_id_type getLocalRowBegin() const
void setSolution(const NumericVector< Number > &soln)
Interface for objects that need to use samplers.
const std::vector< dof_id_type > & getVariableGlobalDoFs()
void setVariableGlobalDoFs(const std::string &var_name)
NumericVector< Number > & solution()
processor_id_type processor_id() const