LCOV - code coverage report
Current view: top level - include/transfers - MultiAppNearestNodeTransfer.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 1 1 100.0 %
Date: 2025-07-17 01:28:37 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             : // MOOSE includes
      13             : #include "MultiAppConservativeTransfer.h"
      14             : 
      15             : namespace libMesh
      16             : {
      17             : class DofObject;
      18             : }
      19             : class MooseAppCoordTransform;
      20             : 
      21             : /**
      22             :  * Copy the value to the target domain from the nearest node in the source domain.
      23             :  */
      24             : class MultiAppNearestNodeTransfer : public MultiAppConservativeTransfer
      25             : {
      26             : public:
      27             :   static InputParameters validParams();
      28             : 
      29             :   MultiAppNearestNodeTransfer(const InputParameters & parameters);
      30             : 
      31             :   virtual void execute() override;
      32             : 
      33             : protected:
      34             :   /**
      35             :    * Return the distance between the given point and the farthest corner of the
      36             :    * given bounding box.
      37             :    * @param p The point to evaluate all distances from.
      38             :    * @param bbox The bounding box to evaluate the distance to.
      39             :    * @return The maximum distance between the point p and the eight corners of
      40             :    * the bounding box bbox.
      41             :    */
      42             :   Real bboxMaxDistance(const Point & p, const libMesh::BoundingBox & bbox);
      43             : 
      44             :   /**
      45             :    * Return the distance between the given point and the nearest corner of the
      46             :    * given bounding box.
      47             :    * @param p The point to evaluate all distances from.
      48             :    * @param bbox The bounding box to evaluate the distance to.
      49             :    * @return The minimum distance between the point p and the eight corners of
      50             :    * the bounding box bbox.
      51             :    */
      52             :   Real bboxMinDistance(const Point & p, const libMesh::BoundingBox & bbox);
      53             : 
      54             :   /**
      55             :    * Get nearest node candidates.
      56             :    * @param local_entities: space locations and their associated elements
      57             :    * @param local_comps: comp num for the unknowns on DofObject. It is useful
      58             :    * for higher order method
      59             :    */
      60             :   void getLocalEntitiesAndComponents(MooseMesh * mesh,
      61             :                                      std::vector<std::pair<Point, DofObject *>> & local_entities,
      62             :                                      std::vector<unsigned int> & local_comps,
      63             :                                      bool nodal,
      64             :                                      bool constant);
      65             : 
      66             :   /// If true then node connections will be cached
      67             :   bool _fixed_meshes;
      68             : 
      69             :   /// Used to cache nodes
      70             :   std::map<dof_id_type, Node *> & _node_map;
      71             : 
      72             :   /// Used to cache distances
      73             :   std::map<dof_id_type, Real> & _distance_map;
      74             : 
      75             :   // These variables allow us to cache nearest node info
      76             :   bool & _neighbors_cached;
      77             :   std::map<processor_id_type, std::vector<unsigned int>> & _cached_froms;
      78             :   std::map<processor_id_type, std::vector<dof_id_type>> & _cached_dof_ids;
      79             :   std::map<std::pair<unsigned int, dof_id_type>, unsigned int> & _cached_from_inds;
      80             :   std::map<std::pair<unsigned int, dof_id_type>, unsigned int> & _cached_qp_inds;
      81             : 
      82             : private:
      83         196 :   bool usesMooseAppCoordTransform() const override { return true; }
      84             : 
      85             :   /// Target local nodes for receiving a nodal variable
      86             :   std::vector<Node *> _target_local_nodes;
      87             : 
      88             :   /**
      89             :    * Get the local nodes on the target boundary for the transfer
      90             :    * @param to_problem_id index of the problem this transfer is sending to
      91             :    * @return target local nodes receiving the transferred values
      92             :    */
      93             :   const std::vector<Node *> & getTargetLocalNodes(const unsigned int to_problem_id);
      94             : };

Generated by: LCOV version 1.14