https://mooseframework.inl.gov
MultiAppGeneralFieldFunctorTransfer.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 
13 #include "KDTree.h"
15 #include "NonADFunctorInterface.h"
16 
24 
25 {
26 public:
28 
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  std::string getDataSourceName(unsigned int var_index) const override
54  {
55  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 
71  const std::vector<MooseFunctorName> _functor_names;
73  std::vector<std::vector<const Moose::Functor<Real> *>> _functors;
75  std::vector<bool> _functor_is_variable;
76 
79 };
An interface for accessing Moose::Functors for systems that do not care about automatic differentiati...
void execute() override
Execute the transfer.
Base class for working with KDTrees in transfers, whether for interpolation or extrapolation.
MultiAppGeneralFieldFunctorTransfer(const InputParameters &parameters)
std::string getDataSourceName(unsigned int var_index) const override
Return a human-readable description of the data source (variable, functor, user object, etc.) used for conflict warning messages.
virtual void evaluateInterpValues(const unsigned int var_index, const std::vector< std::pair< Point, unsigned int >> &incoming_points, std::vector< std::pair< Real, Real >> &outgoing_vals) override
Transfers a functor (can be variable, function, functor material property, spatial UO...
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void buildKDTrees(const unsigned int var_index) override
const std::vector< MooseFunctorName > _functor_names
Names of the source functors.
void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
std::vector< std::unique_ptr< libMesh::PointLocatorBase > > _point_locators
const MooseEnum _extrapolation_behavior
How to determine values where the target mesh does not overlap the source mesh.
std::vector< std::vector< const Moose::Functor< Real > * > > _functors
Pointers to the source functors.
virtual void prepareEvaluationOfInterpValues(const unsigned int var_index) override
void evaluateValues(const unsigned int var_index, const std::vector< std::pair< Point, unsigned int >> &incoming_points, std::vector< std::pair< Real, Real >> &outgoing_vals)
std::vector< bool > _functor_is_variable
Whether the functor is a variable.