v0.16.3
Loading...
Searching...
No Matches
CouplerInterface.hpp
Go to the documentation of this file.
1/** \file CouplerInterface.hpp
2 * \brief Interpolate fixed-length double tags between selected volume meshes.
3 */
4#ifndef MOFEM_COUPLER_INTERFACE_HPP
5#define MOFEM_COUPLER_INTERFACE_HPP
6
8
9namespace MoFEM {
10
11/** All operations are collective on the Core communicator, in the same order.
12 * Selections contain linear tets/hexes; geometry must remain fixed until close.
13 * This is interpolation/recovery, not conservative or constitutive transport.
14 * The interface is available without MBCoupler, but transfers then fail explicitly.
15 */
17 ~CouplerInterface() override = default;
27
28 struct Selection {
30 /// Borrowed sharing/ownership metadata. -1 denotes unshared local entities.
31 /// Multi-rank distributed recovery requires resolved ParallelComm sharing.
33 };
34 struct Options {
37 /// Physical search distance = max(absoluteTolerance, relativeTolerance*L).
38 double relativeTolerance = 1.e-10;
39 double absoluteTolerance = 0.;
41 };
42 struct TagMap {
43 std::string sourceTag, targetTag;
45 /// -1 transfers all components; otherwise select one zero-based component.
46 int component = -1;
47 };
48 struct Report {
49 /// Disjoint local owned target sets. A failed fallback remains missing.
51 unsigned long long globalLocated = 0, globalFallback = 0, globalMissing = 0;
52 };
53 struct Transfer;
54 struct Locations;
55 using TransferPtr = boost::shared_ptr<Transfer>;
56 using LocationsPtr = boost::shared_ptr<const Locations>;
57
58 /// Build a source-only search. Source elements require unique positive GLOBAL_IDs.
60 const Options &options,
61 TransferPtr &transfer) = 0;
62 /// Cache locations independently of tags; starting a new backend batch
63 /// invalidates older locations even if the replacement search fails.
64 /// Missing points are reported here; transferTags applies the missing policy.
65 virtual MoFEMErrorCode locateTargets(const TransferPtr &transfer,
66 const Selection &target,
67 LocationsPtr &locations,
68 Report &report) = 0;
69 /** Stage all maps before writing any target. New tags are sparse without a
70 * default; existing definitions/defaults are preserved. KEEP requires finite
71 * existing data on each miss (explicit sparse data or a declared default).
72 * Recoverable publication failures restore previous target values.
73 */
74 virtual MoFEMErrorCode transferTags(const TransferPtr &transfer,
75 const LocationsPtr &locations,
76 const std::vector<TagMap> &tags,
77 Report &report) = 0;
78 /// Idempotent explicit close; invalidate aliases. Destructors never call MPI.
80};
81
82template <>
84
85} // namespace MoFEM
86#endif
Report & report
std::vector< int > source
const Field * target
MoFEM interface.
#define MYPCOMM_INDEX
default communicator number PCOMM
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
CouplerInterface * createInterface< CouplerInterface >(const Core &core)
Construct the coupling implementation for MoFEM's interface factory.
Core (interface) class.
Definition Core.hpp:83
Target-to-source matches tied to one generation of the backend point cache.
double relativeTolerance
Physical search distance = max(absoluteTolerance, relativeTolerance*L).
Range locatedEntities
Disjoint local owned target sets. A failed fallback remains missing.
int component
-1 transfers all components; otherwise select one zero-based component.
Source selection, search backend and routing state shared by location batches.
~CouplerInterface() override=default
boost::shared_ptr< const Locations > LocationsPtr
virtual MoFEMErrorCode destroyTransfer(TransferPtr &transfer)=0
Idempotent explicit close; invalidate aliases. Destructors never call MPI.
virtual MoFEMErrorCode locateTargets(const TransferPtr &transfer, const Selection &target, LocationsPtr &locations, Report &report)=0
virtual MoFEMErrorCode createTransfer(const Selection &source, const Options &options, TransferPtr &transfer)=0
Build a source-only search. Source elements require unique positive GLOBAL_IDs.
virtual MoFEMErrorCode transferTags(const TransferPtr &transfer, const LocationsPtr &locations, const std::vector< TagMap > &tags, Report &report)=0
boost::shared_ptr< Transfer > TransferPtr
base class for all interface classes