https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MultiAppGeneralFieldKDTreeTransferBase.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
20{
21public:
23
25
26 void initialSetup() override;
27
28 // Use solution invalid output for these warnings
30
31protected:
32 virtual void prepareEvaluationOfInterpValues(const unsigned int var_index) override;
33
35 bool inBlocks(const std::set<SubdomainID> & blocks,
36 const MooseMesh & mesh,
37 const Elem * elem) const override;
38
39 bool usesMooseAppCoordTransform() const override { return true; }
40 /*
41 * Build KD-Trees for each local app
42 * @param var_index the index of the variable being transferred
43 * @details fills _local_kdtrees, _local_points and _local_values
44 * Indexing is: local apps (outer-indexing) OR positions (if using nearest_positions),
45 * local nodes (inner-indexing)
46 */
47 virtual void buildKDTrees(const unsigned int var_index) = 0;
48
51 void computeNumSources();
52
60 unsigned int getAppIndex(unsigned int kdtree_index, unsigned int app_index_in_tree) const;
61
63 unsigned int getNumAppsPerTree() const;
64
66 unsigned int getNumDivisions() const;
67
75 Point getPointInSourceKDTreeFrame(unsigned int i_source, const Point & pt) const;
76
86 bool checkRestrictionsForSource(const Point & pt,
87 const unsigned int valid_mesh_div,
88 const unsigned int i_from) const;
89
101 void evaluateNearestNodeFromKDTrees(const Point & pt,
102 unsigned int source_index,
103 std::pair<Real, Real> & outgoing_val,
104 bool & point_found);
105
107 std::vector<std::shared_ptr<KDTree>> _local_kdtrees;
108
110 std::vector<std::vector<std::shared_ptr<KDTree>>> _local_positions_kdtrees;
111
113 std::vector<std::vector<Point>> _local_points;
114
116 std::vector<std::vector<Real>> _local_values;
117
120
122 const bool _group_subapps;
123
125 unsigned int _num_sources;
126};
char ** blocks
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Base class for working with KDTrees in transfers, whether for interpolation or extrapolation.
virtual void prepareEvaluationOfInterpValues(const unsigned int var_index) override
bool checkRestrictionsForSource(const Point &pt, const unsigned int valid_mesh_div, const unsigned int i_from) const
Examine all spatial restrictions that could preclude this source from being a valid source for this p...
bool usesMooseAppCoordTransform() const override
Whether this transfer handles non-translation-based transformations, e.g.
unsigned int getNumAppsPerTree() const
Number of applications which contributed nearest-locations to each KD-tree.
std::vector< std::vector< Point > > _local_points
All the nodes that meet the spatial restrictions in all the local source apps.
std::vector< std::shared_ptr< KDTree > > _local_kdtrees
KD-Trees for all the local source apps.
Point getPointInSourceKDTreeFrame(unsigned int i_source, const Point &pt) const
Transform a point into the frame used for KD-tree queries.
unsigned int _num_sources
Number of KD-Trees to create.
unsigned int getAppIndex(unsigned int kdtree_index, unsigned int app_index_in_tree) const
Get the index of the app when inside of a KD-Tree source loop, where multiple applications could be l...
std::vector< std::vector< Real > > _local_values
Values of the variable being transferred at all the points in _local_points.
std::vector< std::vector< std::shared_ptr< KDTree > > > _local_positions_kdtrees
KD-Trees for nodes nearest to a given position on each local source app.
virtual void buildKDTrees(const unsigned int var_index)=0
void computeNumSources()
Pre-compute the number of sources Number of KDTrees used to hold the locations and variable value dat...
unsigned int _num_nearest_points
Number of points to consider.
const bool _group_subapps
Whether to group data when creating the nearest-point regions.
bool inBlocks(const std::set< SubdomainID > &blocks, const MooseMesh &mesh, const Elem *elem) const override
unsigned int getNumDivisions() const
Number of divisions (nearest-positions or source mesh divisions) used when building KD-Trees.
void evaluateNearestNodeFromKDTrees(const Point &pt, unsigned int source_index, std::pair< Real, Real > &outgoing_val, bool &point_found)
Search all local KD-trees for the nearest node/element and update outgoing_val.
void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup.
It is a general field transfer.
bool inBlocks(const std::set< SubdomainID > &blocks, const Elem *elem) const