16#include "libmesh/generic_projector.h"
17#include "libmesh/meshfree_interpolation.h"
18#include "libmesh/system.h"
19#include "libmesh/mesh_function.h"
20#include "libmesh/parallel_algebra.h"
46 virtual void execute()
override;
90 const std::vector<std::pair<Point, unsigned int>> & incoming_points,
91 std::vector<std::pair<Real, Real>> & outgoing_vals) = 0;
118 const std::vector<BoundingBox> & local_bboxes,
120 const unsigned int mesh_div,
121 Real & distance)
const;
134 bool inBlocks(
const std::set<SubdomainID> &
blocks,
const Elem * elem)
const;
156 const Point & pt)
const;
161 bool onBoundaries(
const std::set<BoundaryID> & boundaries,
163 const Node * node)
const;
170 bool onBoundaries(
const std::set<BoundaryID> & boundaries,
172 const Elem * elem)
const;
185 const std::set<SubdomainID> & block_restriction,
188 const Point & pt)
const;
199 const unsigned int i_local,
200 const unsigned int only_from_this_mesh_div)
const;
305 bool detectConflict(Real value_1, Real value_2, Real distance_1, Real distance_2)
const;
318 void registerConflict(
unsigned int problem, dof_id_type dof_id, Point p, Real dist,
bool local);
325 typedef std::unordered_map<processor_id_type, std::vector<std::pair<Point, unsigned int>>>
420 processor_id_type pid,
421 const unsigned int var_index,
422 std::vector<PointInfo> & pointInfoVec,
423 const std::vector<std::pair<Point, unsigned int>> & point_requests,
424 const std::vector<std::pair<Real, Real>> & incoming_vals,
489 const dof_id_type dof_object_id,
490 const unsigned int problem_id,
529static_assert(std::numeric_limits<Real>::has_infinity,
530 "What are you trying to use for Real? It lacks infinity!");
547template <
typename Output>
601 std::vector<Output> & )
607 const Elem &,
unsigned int,
unsigned int, std::vector<dof_id_type> &, std::vector<Output> &)
616 std::vector<dof_id_type> &,
617 std::vector<Output> &)
633template <
typename Val>
643 void insert(
const std::vector<dof_id_type> &,
const DenseVector<Val> &) {}
653template <
typename Output>
731 std::vector<Output> & )
737 const Elem &,
unsigned int,
unsigned int, std::vector<dof_id_type> &, std::vector<Output> &)
746 std::vector<dof_id_type> &,
747 std::vector<Output> &)
757 std::unique_ptr<libMesh::FunctionBase<Output>>
_backup;
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Value request response base class.
std::unique_ptr< libMesh::FunctionBase< Output > > _backup
Function to evaluate for uncached points.
CachedData(const Cache &cache, const libMesh::FunctionBase< Output > &backup, Real default_value)
Constructor.
Output eval_at_node(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &n, bool, const Real)
Gets a value at the node location.
libMesh::TensorTools::MakeBaseNumber< Output >::type DofValueType
DofValueType ValuePushType
void init_context(libMesh::FEMContext &)
const Cache & _cache
Data to return for cached points.
void eval_old_dofs(const Elem &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
bool is_grid_projection()
Output eval_at_point(const libMesh::FEMContext &, unsigned int, const Point &n, const Real, bool)
Gets a value at a point.
void eval_mixed_derivatives(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &, std::vector< Output > &)
const Real _default_value
Default value when no point is found.
void eval_old_dofs(const Elem &, const libMesh::FEType &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
CachedData(const CachedData &primary)
Copy constructor.
libMesh::TensorTools::MakeReal< Output >::type RealType
void insert(const std::vector< dof_id_type > &, const DenseVector< Val > &)
void insert(dof_id_type, Val)
Value request recording base class.
libMesh::TensorTools::MakeBaseNumber< Output >::type DofValueType
Output eval_at_node(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &n, bool, const Real)
RecordRequests(RecordRequests &primary)
RecordRequests * _primary
std::vector< Point > & points_requested()
void eval_mixed_derivatives(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &, std::vector< Output > &)
void eval_old_dofs(const Elem &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
Output eval_at_point(const libMesh::FEMContext &, unsigned int, const Point &n, const Real, bool)
bool is_grid_projection()
void init_context(libMesh::FEMContext &)
void eval_old_dofs(const Elem &, const libMesh::FEType &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
std::vector< Point > _points_requested
Vector of points requested.
libMesh::TensorTools::MakeReal< Output >::type RealType
DofValueType ValuePushType
Base class for MeshDivision objects.
const InputParameters & parameters() const
Get the parameters of the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
This class provides an interface for common operations on field variables of both FE and FV types wit...
Transfers variables on possibly different meshes while conserving a user defined property (Postproces...
It is a general field transfer.
std::vector< Real > _fixed_bbox_size
Set the bounding box sizes manually.
virtual bool inBlocks(const std::set< SubdomainID > &blocks, const MooseMesh &mesh, const Elem *elem) const
std::set< BoundaryID > _to_boundaries
Target boundary(ies) restriction.
const bool _use_nearest_app
Whether to keep track of the distance from the requested point to the app position.
void prepareToTransfer()
Initialize supporting attributes like bounding boxes, processor app indexes etc.
const MooseEnum _post_transfer_extrapolation
How to post treat after the transfer.
const Positions * _nearest_positions_obj
bool acceptPointMeshDivision(const Point &pt, const unsigned int i_local, const unsigned int only_from_this_mesh_div) const
Whether a point lies inside the mesh division delineated by the MeshDivision object.
bool detectConflict(Real value_1, Real value_2, Real distance_1, Real distance_2) const
Detects whether two source values are valid and equidistant for a desired target location.
void outputValueConflicts(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &distance_caches)
Report on conflicts between overlapping child apps, equidistant origin points etc.
void transferVariable(unsigned int i)
Performs the transfer for the variable of index i.
const Real _default_extrapolation_value
Value to use when no received data is valid for a target location.
virtual void getAppInfo() override
This method will fill information into the convenience member variables (_to_problems,...
std::vector< std::unordered_map< dof_id_type, InterpInfo > > DofobjectToInterpValVec
A vector, indexed by to-problem id, of maps from dof object to interpolation values.
const MooseEnum & _from_mesh_division_behavior
How to use the origin mesh divisions to restrict the transfer.
const MooseEnum & _to_mesh_division_behavior
How to use the target mesh divisions to restrict the transfer.
virtual std::string getDataSourceName(unsigned int var_index) const
Return a human-readable description of the data source (variable, functor, user object,...
void cacheOutgoingPointInfo(const Point point, const dof_id_type dof_object_id, const unsigned int problem_id, ProcessorToPointVec &outgoing_points)
bool _source_app_must_contain_point
Whether the source app mesh must actually contain the points for them to be considered or whether the...
std::vector< unsigned int > getGlobalStartAppPerProc() const
Get global index for the first app each processes owns Requires a global communication,...
static InputParameters validParams()
std::vector< std::unique_ptr< libMesh::PointLocatorBase > > _from_point_locators
Point locators, useful to examine point location with regards to domain restriction.
std::vector< MooseVariableFieldBase * > _to_variables
The target variables.
bool inBlocks(const std::set< SubdomainID > &blocks, const libMesh::PointLocatorBase *const pl, const Point &pt) const
std::vector< unsigned int > _global_app_start_per_proc
First app each processor owns, indexed by processor If no app on the processor, will have a -1 for th...
const std::vector< unsigned int > _from_var_components
Origin array/vector variable components.
void setSolutionVectorValues(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &interp_caches)
std::unordered_map< processor_id_type, std::vector< PointInfo > > ProcessorToPointInfoVec
A map from pid to a set of point info.
bool onBoundaries(const std::set< BoundaryID > &boundaries, const std::set< SubdomainID > &block_restriction, const MooseMesh &mesh, const libMesh::PointLocatorBase *const pl, const Point &pt) const
bool _error_on_miss
Error out when some points can not be located.
bool inBlocks(const std::set< SubdomainID > &blocks, const Elem *elem) const
void cacheIncomingInterpVals(processor_id_type pid, const unsigned int var_index, std::vector< PointInfo > &pointInfoVec, const std::vector< std::pair< Point, unsigned int > > &point_requests, const std::vector< std::pair< Real, Real > > &incoming_vals, DofobjectToInterpValVec &dofobject_to_valsvec, InterpCaches &interp_caches, InterpCaches &distance_caches)
Real _bbox_factor
How much we should relax bounding boxes.
VariableName getToVarName(unsigned int var_index)
Get the target variable name, with the suffix for array/vector variables.
std::vector< BoundingBox > _from_bboxes
Bounding boxes for all source applications.
void registerConflict(unsigned int problem, dof_id_type dof_id, Point p, Real dist, bool local)
Register a potential value conflict, e.g.
virtual void execute() override
Execute the transfer.
bool onBoundaries(const std::set< BoundaryID > &boundaries, const MooseMesh &mesh, const Node *node) const
Real bboxMinDistance(const Point &p, const BoundingBox &bbox) const
Compute minimum distance.
PointIndexedMap InterpCache
A map from Point to interpolation values NOTE: this is not an asynchronous cache.
MeshDivisionTransferUse
Matching enum for the mesh division behaviors.
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)=0
const bool _elemental_boundary_restriction_on_sides
Whether elemental variable boundary restriction is considered by element side or element nodes.
const std::vector< unsigned int > _to_var_components
Target array/vector variable components.
bool acceptPointInOriginMesh(unsigned int i_from, const std::vector< BoundingBox > &local_bboxes, const Point &pt, const unsigned int mesh_div, Real &distance) const
bool closestToPosition(unsigned int pos_index, const Point &pt) const
Whether a point is closest to a position at the index specified than any other position.
virtual void prepareEvaluationOfInterpValues(const unsigned int var_index)=0
std::set< SubdomainID > _from_blocks
Origin block(s) restriction.
virtual void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup.
void extractOutgoingPoints(const unsigned int var_index, ProcessorToPointVec &outgoing_points)
void examineLocalValueConflicts(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &distance_caches)
Remove potential value conflicts that did not materialize because another source was closer Several e...
void locatePointReceivers(const Point point, std::set< processor_id_type > &processors)
ProcessorToPointInfoVec _processor_to_pointInfoVec
A map from processor to pointInfo vector.
virtual void checkSiblingsTransferSupported() const override
Siblings transfers fully supported.
unsigned int _var_size
The number of variables to transfer.
std::vector< std::tuple< unsigned int, dof_id_type, Point, Real > > _local_conflicts
Keeps track of all local equidistant points to requested points, creating an indetermination in which...
const bool _use_bounding_boxes
Whether to use bounding boxes to determine the applications that may receive point requests then send...
Real bboxMaxDistance(const Point &p, const BoundingBox &bbox) const
Compute max distance.
MooseVariableFieldBase * getToVariable(unsigned int var_index) const
Return a pointer to a target variable.
std::vector< const MeshDivision * > _from_mesh_divisions
Division of the origin mesh.
std::set< SubdomainID > _to_blocks
Target block(s) restriction.
std::vector< const MeshDivision * > _to_mesh_divisions
Division of the target mesh.
void examineReceivedValueConflicts(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &distance_caches)
Remove potential value conflicts that did not materialize because another source was closer Several e...
void correctSolutionVectorValues(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &interp_caches)
bool inMesh(const libMesh::PointLocatorBase *const pl, const Point &pt) const
Point getMaxToProblemsBBoxDimensions() const
Obtains the max dimensions to scale all points in the mesh.
const unsigned int _search_value_conflicts_max_log
How many conflicts are output to console.
bool _already_output_search_value_conflicts
Whether we already output the search value conflicts.
bool _greedy_search
Whether or not a greedy strategy will be used If true, all the partitions will be checked for a given...
std::vector< InterpCache > InterpCaches
A vector of such caches, indexed by to_problem.
VariableName getFromVarName(unsigned int var_index) const
Get the source variable name, with the suffix for array/vector variables.
std::vector< std::tuple< unsigned int, dof_id_type, Point, Real > > _received_conflicts
Keeps track of all received conflicts.
std::unordered_map< processor_id_type, std::vector< std::pair< Point, unsigned int > > > ProcessorToPointVec
A map from pid to a set of points.
std::vector< BoundingBox > getRestrictedFromBoundingBoxes() const
Get from bounding boxes for given domains and boundaries.
std::vector< unsigned int > _froms_per_proc
Number of source/from applications per processor. This vector is indexed by processor id.
virtual void postExecute() override
Add some extra work if necessary after execute().
std::set< BoundaryID > _from_boundaries
Origin boundary(ies) restriction.
void extractLocalFromBoundingBoxes(std::vector< BoundingBox > &local_bboxes)
bool _search_value_conflicts
Whether to look for conflicts between origin points, multiple valid values for a target point.
Based class for output objects.
Positions objects are under the hood Reporters.
bool isOutOfMeshValue(Number val)
dof_id_type dof_object_id
An unordered map indexed by Point, eg 3 floating point numbers Because floating point rounding errors...
std::unordered_map< Point, Number, hash_point >::const_iterator end() const
std::unordered_map< Point, Number, hash_point >::const_iterator find(const Point &pt) const