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;
75 std::vector<std::pair<Real, Real>> & outgoing_vals) = 0;
102 const std::vector<BoundingBox> & local_bboxes,
104 const unsigned int mesh_div,
105 Real & distance)
const;
118 bool inBlocks(
const std::set<SubdomainID> &
blocks,
const Elem * elem)
const;
140 const Point & pt)
const;
145 bool onBoundaries(
const std::set<BoundaryID> & boundaries,
147 const Node * node)
const;
154 bool onBoundaries(
const std::set<BoundaryID> & boundaries,
156 const Elem * elem)
const;
168 bool onBoundaries(
const std::set<BoundaryID> & boundaries,
169 const std::set<SubdomainID> & block_restriction,
172 const Point & pt)
const;
183 const unsigned int i_local,
184 const unsigned int only_from_this_mesh_div)
const;
286 bool detectConflict(Real value_1, Real value_2, Real distance_1, Real distance_2)
const;
306 typedef std::unordered_map<processor_id_type, std::vector<std::pair<Point, unsigned int>>>
402 const unsigned int var_index,
403 std::vector<PointInfo> & pointInfoVec,
404 const std::vector<std::pair<Point, unsigned int>> & point_requests,
405 const std::vector<std::pair<Real, Real>> & incoming_vals,
459 const unsigned int problem_id,
498 static_assert(std::numeric_limits<Real>::has_infinity,
499 "What are you trying to use for Real? It lacks infinity!");
516 template <
typename Output>
535 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
570 std::vector<Output> & )
576 const Elem &,
unsigned int,
unsigned int, std::vector<dof_id_type> &, std::vector<Output> &)
585 std::vector<dof_id_type> &,
586 std::vector<Output> &)
602 template <
typename Val>
612 void insert(
const std::vector<dof_id_type> &,
const DenseVector<Val> &) {}
622 template <
typename Output>
700 std::vector<Output> & )
706 const Elem &,
unsigned int,
unsigned int, std::vector<dof_id_type> &, std::vector<Output> &)
715 std::vector<dof_id_type> &,
716 std::vector<Output> &)
726 std::unique_ptr<libMesh::FunctionBase<Output>>
_backup;
std::vector< BoundingBox > _from_bboxes
Bounding boxes for all source applications.
virtual void evaluateInterpValues(const std::vector< std::pair< Point, unsigned int >> &incoming_points, std::vector< std::pair< Real, Real >> &outgoing_vals)=0
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 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...
void registerConflict(unsigned int problem, dof_id_type dof_id, Point p, Real dist, bool local)
Register a potential value conflict, e.g.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::unordered_map< Point, Number, hash_point >::const_iterator end() const
void eval_mixed_derivatives(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &, std::vector< Output > &)
std::vector< Point > _points_requested
Vector of points requested.
VariableName getFromVarName(unsigned int var_index)
Get the source variable name, with the suffix for array/vector variables.
libMesh::TensorTools::MakeReal< Output >::type RealType
Positions objects are under the hood Reporters.
void locatePointReceivers(const Point point, std::set< processor_id_type > &processors)
std::vector< std::unique_ptr< libMesh::PointLocatorBase > > _from_point_locators
Point locators, useful to examine point location with regards to domain restriction.
virtual void execute() override
Execute the transfer.
MultiAppGeneralFieldTransfer(const InputParameters ¶meters)
Number BetterOutOfMeshValue
DofValueType ValuePushType
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.
std::vector< unsigned int > getGlobalStartAppPerProc() const
Get global index for the first app each processes owns Requires a global communication, must be called on every domain simultaneously.
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.
static InputParameters validParams()
std::vector< Real > _fixed_bbox_size
Set the bounding box sizes manually.
std::vector< const MeshDivision * > _from_mesh_divisions
Division of the origin mesh.
std::vector< const MeshDivision * > _to_mesh_divisions
Division of the target mesh.
unsigned int _var_size
The number of variables to transfer.
std::vector< Point > & points_requested()
Base class for MeshDivision objects.
const Real _default_extrapolation_value
Value to use when no received data is valid for a target location.
bool inMesh(const libMesh::PointLocatorBase *const pl, const Point &pt) 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.
const std::vector< unsigned int > _from_var_components
Origin array/vector variable components.
void eval_old_dofs(const Elem &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
virtual void getAppInfo() override
This method will fill information into the convenience member variables (_to_problems, _from_meshes, etc.)
VariableName getToVarName(unsigned int var_index)
Get the target variable name, with the suffix for array/vector variables.
std::set< BoundaryID > _from_boundaries
Origin boundary(ies) restriction.
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.
const Positions * _nearest_positions_obj
std::unordered_map< processor_id_type, std::vector< PointInfo > > ProcessorToPointInfoVec
A map from pid to a set of point info.
void init_context(libMesh::FEMContext &)
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. ...
void extractOutgoingPoints(const unsigned int var_index, ProcessorToPointVec &outgoing_points)
std::set< SubdomainID > _to_blocks
Target block(s) restriction.
Based class for output objects.
std::unordered_map< processor_id_type, std::vector< std::pair< Point, unsigned int > > > ProcessorToPointVec
A map from pid to a set of points.
void init_context(libMesh::FEMContext &)
Point getMaxToProblemsBBoxDimensions() const
Obtains the max dimensions to scale all points in the mesh.
const Cache & _cache
Data to return for cached points.
uint8_t processor_id_type
dof_id_type dof_object_id
virtual void prepareEvaluationOfInterpValues(const unsigned int var_index)=0
const std::vector< unsigned int > _to_var_components
Target array/vector variable components.
Real bboxMaxDistance(const Point &p, const BoundingBox &bbox) const
Compute max distance.
bool isBetterOutOfMeshValue(Number val)
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...
void insert(dof_id_type, Val)
const bool _use_bounding_boxes
Whether to use bounding boxes to determine the applications that may receive point requests then send...
libMesh::TensorTools::MakeBaseNumber< Output >::type DofValueType
Value request recording base class.
bool acceptPointInOriginMesh(unsigned int i_from, const std::vector< BoundingBox > &local_bboxes, const Point &pt, const unsigned int mesh_div, Real &distance) const
CachedData(const Cache &cache, const libMesh::FunctionBase< Output > &backup, Real default_value)
Constructor.
bool is_grid_projection()
std::set< BoundaryID > _to_boundaries
Target boundary(ies) restriction.
std::vector< unsigned int > _froms_per_proc
Number of source/from applications per processor. This vector is indexed by processor id...
std::vector< std::tuple< unsigned int, dof_id_type, Point, Real > > _received_conflicts
Keeps track of all received conflicts.
MeshDivisionTransferUse
Matching enum for the mesh division behaviors.
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.
Real _bbox_factor
How much we should relax bounding boxes.
bool _error_on_miss
Error out when some points can not be located.
libMesh::TensorTools::MakeBaseNumber< Output >::type DofValueType
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual void checkSiblingsTransferSupported() const override
Siblings transfers fully supported.
Transfers variables on possibly different meshes while conserving a user defined property (Postproces...
bool _search_value_conflicts
Whether to look for conflicts between origin points, multiple valid values for a target point...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::unique_ptr< libMesh::FunctionBase< Output > > _backup
Function to evaluate for uncached points.
std::unordered_map< Point, Number, hash_point >::const_iterator find(const Point &pt) const
RecordRequests * _primary
An unordered map indexed by Point, eg 3 floating point numbers Because floating point rounding errors...
void transferVariable(unsigned int i)
Performs the transfer for the variable of index i.
Output eval_at_node(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &n, bool, const Real)
Gets a value at the node location.
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...
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.
std::vector< BoundingBox > getRestrictedFromBoundingBoxes() const
Get from bounding boxes for given domains and boundaries.
DofValueType ValuePushType
libMesh::TensorTools::MakeReal< Output >::type RealType
void eval_old_dofs(const Elem &, const libMesh::FEType &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
void insert(const std::vector< dof_id_type > &, const DenseVector< Val > &)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _already_output_search_value_conflicts
Whether we already output the search value conflicts.
const MooseEnum & _to_mesh_division_behavior
How to use the target mesh divisions to restrict the transfer.
virtual void postExecute() override
Add some extra work if necessary after execute().
const Real _default_value
Default value when no point is found.
Value request response base class.
std::set< SubdomainID > _from_blocks
Origin block(s) restriction.
const unsigned int _search_value_conflicts_max_log
How many conflicts are output to console.
std::vector< InterpCache > InterpCaches
A vector of such caches, indexed by to_problem.
void extractLocalFromBoundingBoxes(std::vector< BoundingBox > &local_bboxes)
const InputParameters & parameters() const
Get the parameters of the object.
void eval_old_dofs(const Elem &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
void eval_old_dofs(const Elem &, const libMesh::FEType &, unsigned int, unsigned int, std::vector< dof_id_type > &, std::vector< Output > &)
std::vector< MooseVariableFieldBase * > _to_variables
The target variables.
ProcessorToPointInfoVec _processor_to_pointInfoVec
A map from processor to pointInfo vector.
const bool _elemental_boundary_restriction_on_sides
Whether elemental variable boundary restriction is considered by element side or element nodes...
virtual void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup...
void prepareToTransfer()
Initialize supporting attributes like bounding boxes, processor app indexes etc.
CachedData(const CachedData &primary)
Copy constructor.
void eval_mixed_derivatives(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &, std::vector< Output > &)
Output eval_at_node(const libMesh::FEMContext &, unsigned int, unsigned int, const Node &n, bool, const Real)
void setSolutionVectorValues(const unsigned int var_index, const DofobjectToInterpValVec &dofobject_to_valsvec, const InterpCaches &interp_caches)
bool onBoundaries(const std::set< BoundaryID > &boundaries, const MooseMesh &mesh, const Node *node) const
Output eval_at_point(const libMesh::FEMContext &, unsigned int, const Point &n, const Real, bool)
It is a general field transfer.
bool _greedy_search
Whether or not a greedy strategy will be used If true, all the partitions will be checked for a given...
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)
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...
RecordRequests(RecordRequests &primary)
const MooseEnum & _from_mesh_division_behavior
How to use the origin mesh divisions to restrict the transfer.
bool inBlocks(const std::set< SubdomainID > &blocks, const Elem *elem) const
const bool _use_nearest_app
Whether to keep track of the distance from the requested point to the app position.