LCOV - code coverage report
Current view: top level - include/transfers - MultiAppGeneralFieldFunctorTransfer.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 2 2 100.0 %
Date: 2026-05-29 20:35:17 Functions: 1 1 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             : #include "MultiAppGeneralFieldKDTreeTransferBase.h"
      13             : #include "KDTree.h"
      14             : #include "SolutionInvalidInterface.h"
      15             : #include "NonADFunctorInterface.h"
      16             : 
      17             : /**
      18             :  * Transfers a functor (can be variable, function, functor material property, spatial UO, or PP)
      19             :  * Inside the domain of definition: evaluates the functor with the specified argument
      20             :  * Outside the domain of definition: uses a user-specified extrapolation behavior
      21             :  */
      22             : class MultiAppGeneralFieldFunctorTransfer : public MultiAppGeneralFieldKDTreeTransferBase,
      23             :                                             public NonADFunctorInterface
      24             : 
      25             : {
      26             : public:
      27             :   static InputParameters validParams();
      28             : 
      29             :   MultiAppGeneralFieldFunctorTransfer(const InputParameters & parameters);
      30             : 
      31             :   void initialSetup() override;
      32             :   void execute() override;
      33             : 
      34             : protected:
      35             :   virtual void prepareEvaluationOfInterpValues(const unsigned int var_index) override;
      36             : 
      37             :   // TODO: rename! We are not just interpolating anymore
      38             :   virtual void
      39             :   evaluateInterpValues(const unsigned int var_index,
      40             :                        const std::vector<std::pair<Point, unsigned int>> & incoming_points,
      41             :                        std::vector<std::pair<Real, Real>> & outgoing_vals) override;
      42             : 
      43             : private:
      44             :   /*
      45             :    * Build KD-Trees for each local app for the external values to extrapolate with
      46             :    * @param var_index the index of the variable being transferred
      47             :    * @details fills _local_kdtrees, _local_points and _local_values
      48             :    *          Indexing is: local apps (outer-indexing) OR positions (if using nearest_positions),
      49             :    *          local nodes (inner-indexing)
      50             :    */
      51             :   void buildKDTrees(const unsigned int var_index) override;
      52             : 
      53           6 :   std::string getDataSourceName(unsigned int var_index) const override
      54             :   {
      55           6 :     return "functor '" + _functor_names[var_index] + "'";
      56             :   }
      57             : 
      58             :   /*
      59             :    * Evaluate values (interpolation and extrapolation) for incoming points
      60             :    * @param incoming_points all the points at which we need values
      61             :    * @param outgoing_vals vector containing the values and distances from point to nearest node
      62             :    */
      63             :   void evaluateValues(const unsigned int var_index,
      64             :                       const std::vector<std::pair<Point, unsigned int>> & incoming_points,
      65             :                       std::vector<std::pair<Real, Real>> & outgoing_vals);
      66             : 
      67             :   // Point locators for all source meshes
      68             :   std::vector<std::unique_ptr<libMesh::PointLocatorBase>> _point_locators;
      69             : 
      70             :   /// Names of the source functors
      71             :   const std::vector<MooseFunctorName> _functor_names;
      72             :   /// Pointers to the source functors
      73             :   std::vector<std::vector<const Moose::Functor<Real> *>> _functors;
      74             :   /// Whether the functor is a variable
      75             :   std::vector<bool> _functor_is_variable;
      76             : 
      77             :   /// How to determine values where the target mesh does not overlap the source mesh
      78             :   const MooseEnum _extrapolation_behavior;
      79             : };

Generated by: LCOV version 1.14