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 includes 13 : #include "StochasticReporter.h" 14 : #include "ParallelSolutionStorage.h" 15 : #include "MappingInterface.h" 16 : #include "UserObjectInterface.h" 17 : 18 : /** 19 : * A tool to reduce solution fields to coordinates in the latent space. 20 : */ 21 : class MappingReporter : public StochasticReporter, public MappingInterface 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : MappingReporter(const InputParameters & parameters); 26 : 27 : void initialSetup() override; 28 : virtual void execute() override; 29 220 : virtual void finalize() override {} 30 : 31 : protected: 32 : /// Map the available data in a parallel storage into the latent space 33 : void mapParallelStorageData(); 34 : 35 : /// Map the available data in variables into the latent space 36 : void mapVariableData(); 37 : 38 : /// If we already have solution fields stored from previous runs, we can use their 39 : /// ParallelStorageObject to obtain the corresponding coefficients 40 : const ParallelSolutionStorage * const _parallel_storage; 41 : 42 : /// We only need the sampler to check which coefficients would go to which processor 43 : /// in case a ParallelSolutionStorage is used 44 : Sampler * const _sampler; 45 : 46 : /// The name of the mapping object we would like to use 47 : const UserObjectName & _mapping_name; 48 : /// Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this in initialSetup 49 : VariableMappingBase * _mapping; 50 : 51 : /// The variables we would like to map 52 : const std::vector<VariableName> & _variable_names; 53 : 54 : ///@{ 55 : /// Links to the storage spaces (reporters) where we collect the coefficients 56 : std::vector<std::vector<std::vector<Real>> *> _vector_real_values_parallel_storage; 57 : std::vector<std::vector<Real> *> _vector_real_values; 58 : ///@} 59 : };