22 std::unordered_map<
const DofObject *, std::pair<ADReal, Real>> & dof_to_weighted_gap,
25 const bool normalize_c,
26 const Parallel::Communicator & communicator,
27 const bool send_data_back)
33 using Datum = std::tuple<dof_id_type, ADReal, Real>;
34 std::unordered_map<processor_id_type, std::vector<Datum>> push_data;
36 for (
auto & pr : dof_to_weighted_gap)
38 const auto *
const dof_object = pr.first;
39 const auto proc_id = dof_object->processor_id();
40 if (proc_id == our_proc_id)
43 push_data[proc_id].push_back(
44 std::make_tuple(dof_object->id(), std::move(pr.second.first), pr.second.second));
47 const auto & lm_mesh =
mesh.getMesh();
48 std::unordered_map<processor_id_type, std::vector<const DofObject *>>
49 pid_to_dof_object_for_sending_back;
57 &pid_to_dof_object_for_sending_back,
58 send_data_back](
const processor_id_type pid,
const std::vector<Datum> & sent_data)
60 mooseAssert(pid != our_proc_id,
"We do not send messages to ourself here");
63 for (
auto & [dof_id, weighted_gap, normalization] : sent_data)
65 const auto *
const dof_object =
66 nodal ?
static_cast<const DofObject *
>(lm_mesh.node_ptr(dof_id))
67 : static_cast<const DofObject *>(lm_mesh.elem_ptr(dof_id));
68 mooseAssert(dof_object,
"This should be non-null");
70 pid_to_dof_object_for_sending_back[pid].push_back(dof_object);
71 auto & [our_weighted_gap, our_normalization] = dof_to_weighted_gap[dof_object];
72 our_weighted_gap += weighted_gap;
74 our_normalization += normalization;
84 std::unordered_map<processor_id_type, std::vector<Datum>> push_back_data;
86 for (
const auto & [pid, dof_objects] : pid_to_dof_object_for_sending_back)
88 auto & pid_send_data = push_back_data[pid];
89 pid_send_data.reserve(dof_objects.size());
90 for (
const DofObject *
const dof_object : dof_objects)
92 const auto & [our_weighted_gap, our_normalization] =
93 libmesh_map_find(dof_to_weighted_gap, dof_object);
94 pid_send_data.push_back(
95 std::make_tuple(dof_object->id(), our_weighted_gap, our_normalization));
99 auto sent_back_action_functor =
100 [nodal, our_proc_id, &lm_mesh, &dof_to_weighted_gap, &normalize_c](
101 const processor_id_type libmesh_dbg_var(pid),
const std::vector<Datum> & sent_data)
103 mooseAssert(pid != our_proc_id,
"We do not send messages to ourself here");
106 for (
auto & [dof_id, weighted_gap, normalization] : sent_data)
108 const auto *
const dof_object =
109 nodal ?
static_cast<const DofObject *
>(lm_mesh.node_ptr(dof_id))
110 : static_cast<const DofObject *>(lm_mesh.elem_ptr(dof_id));
111 mooseAssert(dof_object,
"This should be non-null");
112 auto & [our_weighted_gap, our_normalization] = dof_to_weighted_gap[dof_object];
113 our_weighted_gap = weighted_gap;
115 our_normalization = normalization;
void push_parallel_vector_data(const Communicator &comm, MapToVectors &&data, const ActionFunctor &act_on_data)
uint8_t processor_id_type
void libmesh_ignore(const Args &...)
DIE A HORRIBLE DEATH HERE typedef MPI_Comm communicator