https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VariableMappingBase.h
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#pragma once
11
12#include "StochasticToolsApp.h"
13#include "MooseObject.h"
15
16#include "libmesh/petsc_vector.h"
17#include "libmesh/petsc_matrix.h"
18
24{
25public:
28
30
35 virtual void buildMapping(const VariableName & vname) = 0;
36
44 virtual void map(const VariableName & vname,
45 const DenseVector<Real> & full_order_vector,
46 std::vector<Real> & reduced_order_vector) const = 0;
47
55 virtual void map(const VariableName & vname,
56 const unsigned int global_sample_i,
57 std::vector<Real> & reduced_order_vector) const = 0;
58
66 virtual void inverse_map(const VariableName & vname,
67 const std::vector<Real> & reduced_order_vector,
68 DenseVector<Real> & full_order_vector) const = 0;
69
71 virtual const std::vector<VariableName> & getVariableNames() { return _variable_names; }
72
73protected:
75 void checkIfReadyToUse(const VariableName & libmesh_dbg_var(vname)) const;
76
78 const std::vector<VariableName> & _variable_names;
79
82 std::map<VariableName, bool> & _mapping_ready_to_use;
83};
const InputParameters & parameters() const
An interface class which manages the model data save and load functionalities from moose objects (suc...
This is an abstract base class for objects that provide mapping between a full-order and a latent spa...
virtual const std::vector< VariableName > & getVariableNames()
Get the available variable names in this mapping.
virtual void map(const VariableName &vname, const unsigned int global_sample_i, std::vector< Real > &reduced_order_vector) const =0
Map a full-order solution vector with a given global sample number for a given variable into a reduce...
virtual void inverse_map(const VariableName &vname, const std::vector< Real > &reduced_order_vector, DenseVector< Real > &full_order_vector) const =0
Map a reduced-order vector (from the latent space) back to a full-order solution vector (in DenseVect...
static InputParameters validParams()
const std::vector< VariableName > & _variable_names
Storage for the names of the variables this mapping can handle.
void checkIfReadyToUse(const VariableName &libmesh_dbg_var(vname)) const
Check if we have a mapping for the variable and if it is ready to be used.
virtual void map(const VariableName &vname, const DenseVector< Real > &full_order_vector, std::vector< Real > &reduced_order_vector) const =0
Map a full-order solution vector (in DenseVector format) for a given variable into a reduced-order ve...
std::map< VariableName, bool > & _mapping_ready_to_use
Bool to decide if we already have the mapping built or not to make sure it is not computed multiple t...
virtual void buildMapping(const VariableName &vname)=0
Abstract function for building mapping for a given variable.