LCOV - code coverage report
Current view: top level - include/reporters - MappingReporter.h (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: f45d79 Lines: 2 2 100.0 %
Date: 2025-07-25 05:00:46 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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         200 :   virtual void initialize() override {}
      28             :   void initialSetup() override;
      29             :   virtual void execute() override;
      30         200 :   virtual void finalize() override {}
      31             : 
      32             : protected:
      33             :   /// Map the available data in a parallel storage into the latent space
      34             :   void mapParallelStorageData();
      35             : 
      36             :   /// Map the available data in variables into the latent space
      37             :   void mapVariableData();
      38             : 
      39             :   /// If we already have solution fields stored from previous runs, we can use their
      40             :   /// ParallelStorageObject to obtain the corresponding coefficients
      41             :   const ParallelSolutionStorage * const _parallel_storage;
      42             : 
      43             :   /// We only need the sampler to check which coefficients would go to which processor
      44             :   /// in case a ParallelSolutionStorage is used
      45             :   Sampler * const _sampler;
      46             : 
      47             :   /// The name of the mapping object we would like to use
      48             :   const UserObjectName & _mapping_name;
      49             :   /// Link to the mapping object, we need this to be a pointer due to the fact that we can only fetch this in initialSetup
      50             :   VariableMappingBase * _mapping;
      51             : 
      52             :   /// The variables we would like to map
      53             :   const std::vector<VariableName> & _variable_names;
      54             : 
      55             :   ///@{
      56             :   /// Links to the storage spaces (reporters) where we collect the coefficients
      57             :   std::vector<std::vector<std::vector<Real>> *> _vector_real_values_parallel_storage;
      58             :   std::vector<std::vector<Real> *> _vector_real_values;
      59             :   ///@}
      60             : };

Generated by: LCOV version 1.14