8#include <kernel/global/gate.hpp>
9#include <kernel/global/vector.hpp>
10#include <kernel/lafem/dense_vector.hpp>
11#include <kernel/lafem/vector_mirror.hpp>
12#include <kernel/lafem/tuple_mirror.hpp>
13#include <kernel/util/omp_util.hpp>
24 template<
typename IdxVector_>
190 template<
typename LocalVector_,
typename Mirror_>
200 typedef typename LocalVectorType::DataType
DataType;
210 typedef typename LocalVectorType::template ContainerTypeByDI<IndexType, IndexType>
IndexVectorType;
320 r += x.second.bytes();
322 r += x.second.bytes();
380 return Index(this->_owner_mirrors.size());
386 return Index(this->_donee_mirrors.size());
400 return this->_owner_ranks.at(i);
414 return this->_donee_ranks.at(i);
431 return this->_owner_mirrors.at(i);
448 return this->_donee_mirrors.at(i);
462 XASSERTM(!this->_all_global_dof_offset.empty(),
"You did not ask to assemble the global dof offsets");
477 XASSERTM(!this->_all_global_dof_counts.empty(),
"You did not ask to assemble the global dof counts");
495 XASSERTM(yes_i_really_want_to_do_this,
"You probably don't want to do this!");
499 "allgather assembly not possible for more than a billion DOFs!");
501 std::size_t num_ranks = std::size_t(this->_comm->
size());
507 this->_all_global_dof_offset.resize(num_ranks, 0);
508 this->_all_global_dof_counts.resize(num_ranks, 0);
511 this->_comm->
allgather(&my_off, 1, this->_all_global_dof_offset.data(), 1);
512 this->_comm->
allgather(&my_nod, 1, this->_all_global_dof_counts.data(), 1);
530 XASSERTM(this->_comm !=
nullptr,
"need a communicator here!");
536 const int my_rank = comm.
rank();
537 const std::vector<int>& neighbor_ranks = gate.
_ranks;
543 this->_local_dof_count = vec_tmpl.size_raw();
544 this->_extra_local_dof_count = extra_local;
545 this->_extra_shared_dof_count = extra_shared;
556 ADPAuxType::alloc_idx_vector(dof_owners, vec_tmpl,
IndexType(my_rank));
559 for(std::size_t i(0); i < neighbor_ranks.size(); ++i)
563 if(neighbor_ranks.at(i) < my_rank)
568 ADPAuxType::update_owners(
IndexType(neighbor_ranks.at(i)), dof_owners, gate.
get_mirrors().at(i));
574 this->_owned_dof_count = ADPAuxType::build_owned_mirror(
IndexType(my_rank), this->_owned_mirror, dof_owners);
583 const bool is_last_process = (this->_comm->
rank()+1 == this->_comm->
size());
588 XASSERTM(this->_owned_dof_count >
Index(0),
"this process has no DOFs!");
601 ADPAuxType::alloc_idx_vector(own_dof_idx, vec_tmpl, ~
IndexType(0));
602 ADPAuxType::build_owned_dofs(
IndexType(my_rank), own_dof_idx, dof_owners, 0u);
605 for(std::size_t i(0); i < neighbor_ranks.size(); ++i)
608 const int neighbor_rank = neighbor_ranks.at(i);
616 if(neighbor_rank < my_rank)
625 if(ADPAuxType::build_owner_mirror(
IndexType(neighbor_rank), owner_mirror, halo_mirror, dof_owners) >
Index(0))
642 Index num_donee_dofs = ADPAuxType::count_donee_dofs(halo_mirror, own_dof_idx);
643 if(num_donee_dofs >
Index(0))
647 ADPAuxType::build_donee_mirror(donee_mirror, halo_mirror, own_dof_idx, 0u);
665 ADPAuxType::alloc_idx_vector(this->_global_dof_idx, vec_tmpl, ~
IndexType(0));
669 ADPAuxType::init_global_dof_idx(this->_global_dof_idx, this->_owned_mirror, this->_global_dof_offset);
679 std::vector<std::vector<IndexType>> recv_bufs(num_neigh_owner);
680 for(
Index i(0); i < num_neigh_owner; ++i)
682 const std::size_t num_idx =
_owner_mirrors.at(i).buffer_size(vec_tmpl);
683 recv_bufs.at(i).resize(num_idx, ~
IndexType(0));
691 std::vector<std::vector<IndexType>> send_bufs(num_neigh_donee);
692 for(
Index i(0); i < num_neigh_donee; ++i)
698 send_bufs.at(i).resize(num_idx, ~
IndexType(0));
699 _get_donee_dofs(send_bufs.at(i),
_donee_mirrors.at(i), this->_global_dof_offset);
704 for(std::size_t i(0u); recv_reqs.
wait_any(i); )
708 ADPAuxType::set_owner_dofs(this->_global_dof_idx, recv_bufs.at(i),
_owner_mirrors.at(i), 0u);
715 std::vector<Index> local_num;
716 ADPAuxType::get_local_dof_count(local_num, this->_global_dof_idx, this->_owned_mirror);
719 std::vector<Index> global_num(local_num.size());
723 std::vector<Index> global_first(local_num.size());
727 std::deque<Index> loc_off, loc_num, glob_first, glob_num;
728 for(
Index i(0), off(0); i <
Index(local_num.size()); ++i)
730 loc_off.push_back(off);
731 loc_num.push_back(local_num[i]);
732 glob_num.push_back(global_num[i]);
733 glob_first.push_back(global_first[i]);
738 this->_block_information = ADPAuxType::build_block_info(this->_global_dof_idx, this->_global_dof_offset,
739 glob_first, glob_num, loc_off, loc_num);
742 template<
typename DT2_>
743 void upload_vector(DT2_* owned_dofs,
const LocalVectorType& local_vector,
744 const DataType* extra_local =
nullptr,
const DataType* extra_shared =
nullptr)
const
747 ADPAuxType::gather(owned_dofs, local_vector, this->_owned_mirror);
750 if(this->_extra_local_dof_count >
Index(0))
752 XASSERT(extra_local !=
nullptr);
755 dst[i] = DT2_(extra_local[i]);
759 if(this->_extra_shared_dof_count >
Index(0))
761 XASSERT(extra_shared !=
nullptr);
762 if(this->_comm->
rank() + 1 == this->_comm->size())
766 dst[i] = DT2_(extra_shared[i]);
771 template<
typename DT2_>
772 void download_vector(
const DT2_* owned_dofs,
LocalVectorType& local_vector,
776 XASSERT(this->_comm !=
nullptr);
779 const std::size_t num_neigh_owner = this->_owner_mirrors.size();
780 const std::size_t num_neigh_donee = this->_donee_mirrors.size();
789 Dist::RequestVector recv_reqs(num_neigh_owner);
790 std::vector<BufferVectorType> recv_bufs(num_neigh_owner);
791 std::vector<Memory::TypedView<DataType>> recv_views(num_neigh_owner);
792 for(std::size_t i(0); i < num_neigh_owner; ++i)
796 recv_bufs.at(i) = this->_owner_mirrors.at(i).create_buffer(local_vector);
798 recv_views.at(i) = recv_bufs.at(i).elements_view_w();
800 recv_reqs[i] = this->_comm->
irecv(recv_views.at(i).get_w(), recv_bufs.at(i).size(), this->_owner_ranks.at(i));
805 Dist::RequestVector send_reqs(num_neigh_donee);
806 std::vector<BufferVectorType> send_bufs(num_neigh_donee);
807 std::vector<Memory::TypedView<DataType>> send_views(num_neigh_donee);
808 for(
Index i(0); i < num_neigh_donee; ++i)
814 _gather(send_bufs.at(i), owned_dofs, mir);
816 send_views.at(i) = send_bufs.at(i).elements_view_r();
818 send_reqs[i] = this->_comm->
isend(send_views.at(i).get_r(), send_bufs.at(i).size(), this->_donee_ranks.at(i));
822 local_vector.format();
825 ADPAuxType::scatter(owned_dofs, local_vector, this->_owned_mirror);
828 for(std::size_t idx(0u); recv_reqs.wait_any(idx); )
831 ADPAuxType::scatter(recv_views.at(idx).get_w(), local_vector, this->_owner_mirrors.at(idx));
838 send_reqs.wait_all();
841 if(this->_extra_local_dof_count >
Index(0))
843 XASSERT(extra_local !=
nullptr);
850 if(this->_extra_shared_dof_count >
Index(0))
852 XASSERT(extra_shared !=
nullptr);
855 if(this->_comm->
rank() + 1 == this->_comm->size())
863 this->_comm->
bcast(extra_shared, std::size_t(this->_extra_shared_dof_count), this->_comm->
size() - 1);
868 static Index _get_donee_dofs(std::vector<IndexType>& send_buf,
869 const LAFEM::VectorMirror<DataType, IndexType>& donee_mir,
Index offset)
871 const Index num_idx = donee_mir.num_indices();
872 const Memory::TypedView<IndexType> mir_idx = donee_mir.indices_view_r();
873 for(
Index j(0); j < num_idx; ++j)
874 send_buf[j] =
IndexType(offset) + mir_idx[j];
879 template<
typename DT2_>
880 static Index _gather(
881 LAFEM::DenseVector<DataType, IndexType>& buffer,
883 const LAFEM::VectorMirror<DataType, IndexType>& mirror)
885 const Index n = mirror.num_indices();
886 const Memory::TypedView<IndexType> idx = mirror.indices_view_r();
887 Memory::TypedView<DataType> buf = buffer.elements_view_w();
888 for(
Index i = 0u; i < n; ++i)
903 template<
typename IT_>
904 class ADPAux<LAFEM::DenseVector<IT_, IT_>>
907 template<
typename DT_>
908 static Index get_local_dof_count(std::vector<Index>& v,
909 const LAFEM::DenseVector<IT_, IT_>& DOXY(global_dof_idx),
910 const LAFEM::VectorMirror<DT_, IT_>& owned_mirror)
912 v.push_back(owned_mirror.num_indices());
916 static String build_block_info(
917 const LAFEM::DenseVector<IT_, IT_>& DOXY(global_dof_idx), Index global_offset,
918 std::deque<Index>& global_first, std::deque<Index>& global_num,
919 std::deque<Index>& local_offset, std::deque<Index>& local_num)
921 String s =
"<Scalar";
922 s +=
" gc=\"" +
stringify(global_num.front()) +
"\"";
923 s +=
" gf=\"" +
stringify(global_first.front()) +
"\"";
924 s +=
" go=\"" +
stringify(global_offset + local_offset.front()) +
"\"";
925 s +=
" lc=\"" +
stringify(local_num.front()) +
"\"";
926 s +=
" lo=\"" +
stringify(local_offset.front()) +
"\"";
929 global_num.pop_front();
930 local_offset.pop_front();
931 local_num.pop_front();
935 template<
typename DT_>
936 static void alloc_idx_vector(LAFEM::DenseVector<IT_, IT_>& idx_vec,
937 const LAFEM::DenseVector<DT_, IT_>& tmpl_vec, IT_ value)
939 idx_vec = LAFEM::DenseVector<IT_, IT_>(tmpl_vec.size(), value);
942 template<
typename DT_>
943 static void update_owners(
const IT_ neighbor_rank,
944 LAFEM::DenseVector<IT_, IT_>& dof_owners,
945 const LAFEM::VectorMirror<DT_, IT_>& mirror)
947 const Index num_indices = mirror.num_indices();
948 const Memory::TypedView<IT_> mir_idx = mirror.indices_view_r();
949 Memory::TypedView<IT_> dof_own = dof_owners.elements_view_rw();
950 for(Index j(0); j < num_indices; ++j)
952 IT_& dof_owner = dof_own[mir_idx[j]];
953 if(neighbor_rank < dof_owner)
954 dof_owner = neighbor_rank;
958 static Index build_owned_dofs(
const IT_ my_rank,
959 LAFEM::DenseVector<IT_, IT_>& owned_dofs,
960 const LAFEM::DenseVector<IT_, IT_>& dof_owners, Index offset)
962 const Index n = dof_owners.size();
963 const Memory::TypedView<IT_> dof_own = dof_owners.elements_view_r();
964 Memory::TypedView<IT_> own_idx = owned_dofs.elements_view_w();
967 for(Index i = 0; i < n; ++i)
969 if(dof_own[i] == my_rank)
970 own_idx[i] = IT_(offset + k++);
976 template<
typename DT_>
977 static Index build_owned_mirror(
const IT_ owner_rank,
978 LAFEM::VectorMirror<DT_, IT_>& owner_mirror,
979 const LAFEM::DenseVector<IT_, IT_>& dof_owners)
982 const Index n = dof_owners.size();
983 const Memory::TypedView<IT_> dof_own = dof_owners.elements_view_r();
984 Index num_owned = 0u;
985 for(Index i = 0; i < n; ++i)
987 if(dof_own[i] == owner_rank)
992 owner_mirror = LAFEM::VectorMirror<DT_, IT_>(n, num_owned);
993 Memory::TypedView<IT_> mir_idx = owner_mirror.indices_view_w();
996 for(Index i = 0, k = 0; i < n; ++i)
998 if(dof_own[i] == owner_rank)
1000 mir_idx[k++] = IT_(i);
1007 template<
typename DT_>
1008 static Index build_owner_mirror(
const IT_ neighbor_rank,
1009 LAFEM::VectorMirror<DT_, IT_>& owner_mirror,
1010 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1011 const LAFEM::DenseVector<IT_, IT_>& dof_owners)
1014 const Index n = halo_mirror.num_indices();
1015 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1016 const Memory::TypedView<IT_> dof_own = dof_owners.elements_view_r();
1019 Index num_owner = 0u;
1020 for(Index i = 0; i < n; ++i)
1022 if(dof_own[halo_idx[i]] == neighbor_rank)
1027 owner_mirror = LAFEM::VectorMirror<DT_, IT_>(dof_owners.size(), num_owner);
1029 if(num_owner <=
Index(0))
1033 Memory::TypedView<IT_> own_idx = owner_mirror.indices_view_rw();
1034 for(IT_ i = 0, k = 0; i < n; ++i)
1036 if(dof_own[halo_idx[i]] == neighbor_rank)
1038 own_idx[k++] = halo_idx[i];
1045 template<
typename DT_>
1046 static Index count_donee_dofs(
1047 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1048 const LAFEM::DenseVector<IT_, IT_>& own_dof_idx)
1051 const Index n = halo_mirror.num_indices();
1052 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1053 const Memory::TypedView<IT_> own_idx = own_dof_idx.elements_view_r();
1056 Index num_donee = 0u;
1057 for(Index i = 0; i < n; ++i)
1059 if(own_idx[halo_idx[i]] != ~IT_(0))
1066 template<
typename DT_>
1067 static Index build_donee_mirror(
1068 LAFEM::VectorMirror<DT_, IT_>& donee_mirror,
1069 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1070 const LAFEM::DenseVector<IT_, IT_>& own_dof_idx, Index offset)
1073 const Index n = halo_mirror.num_indices();
1074 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1075 const Memory::TypedView<IT_> own_idx = own_dof_idx.elements_view_r();
1076 Memory::TypedView<IT_> donee_idx = donee_mirror.indices_view_rw();
1080 for(Index i = 0; i < n; ++i)
1082 if(own_idx[halo_idx[i]] != ~IT_(0))
1084 donee_idx[offset + k++] = own_idx[halo_idx[i]];
1091 template<
typename DT_>
1092 static Index init_global_dof_idx(
1093 LAFEM::DenseVector<IT_, IT_>& global_dof_idx,
1094 const LAFEM::VectorMirror<DT_, IT_>& owned_mirror, Index offset)
1096 Memory::TypedView<IT_> g_dof_idx = global_dof_idx.elements_view_rw();
1097 const Memory::TypedView<IT_> own_idx = owned_mirror.indices_view_r();
1098 const Index n = owned_mirror.num_indices();
1099 for(Index i = 0; i < n; ++i)
1100 g_dof_idx[own_idx[i]] = IT_(offset + i);
1104 template<
typename DT_>
1105 static Index set_owner_dofs(
1106 LAFEM::DenseVector<IT_, IT_>& global_dof_idx,
1107 const std::vector<IT_>& recv_buf,
1108 const LAFEM::VectorMirror<DT_, IT_>& mirror, Index offset)
1110 const Index num_indices = mirror.num_indices();
1111 const Memory::TypedView<IT_> mir_idx = mirror.indices_view_r();
1112 Memory::TypedView<IT_> g_dof_idx = global_dof_idx.elements_view_rw();
1113 for(Index j(0); j < num_indices; ++j)
1114 g_dof_idx[mir_idx[j]] = recv_buf[offset + j];
1118 template<
typename DT_,
typename DT2_>
1119 static Index gather(DT2_* buf,
1120 const LAFEM::DenseVector<DT_, IT_>& vector,
1121 const LAFEM::VectorMirror<DT_, IT_>& mirror)
1123 XASSERT(mirror.size() == vector.size());
1124 const Index n = mirror.num_indices();
1125 const Memory::TypedView<IT_> idx = mirror.indices_view_r();
1126 const Memory::TypedView<DT_> val = vector.elements_view_r();
1127 for(Index i = 0u; i < n; ++i)
1128 buf[i] = DT2_(val[idx[i]]);
1132 template<
typename DT_,
typename DT2_>
1133 static Index scatter(
const DT2_* buf,
1134 LAFEM::DenseVector<DT_, IT_>& vector,
1135 const LAFEM::VectorMirror<DT_, IT_>& mirror)
1137 XASSERT(mirror.size() == vector.size());
1138 const Index n = mirror.num_indices();
1139 const Memory::TypedView<IT_> idx = mirror.indices_view_r();
1140 Memory::TypedView<DT_> val = vector.elements_view_rw();
1141 for(Index i = 0u; i < n; ++i)
1142 val[idx[i]] = DT_(buf[i]);
1149 template<
typename IT_,
int bs_>
1150 class ADPAux<LAFEM::DenseVectorBlocked<IT_, IT_, bs_>>
1153 template<
typename DT_>
1154 static Index get_local_dof_count(std::vector<Index>& v,
1155 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& DOXY(global_dof_idx),
1156 const LAFEM::VectorMirror<DT_, IT_>& owned_mirror)
1158 v.push_back(owned_mirror.num_indices() *
Index(bs_));
1162 static String build_block_info(
1163 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& DOXY(global_dof_idx), Index global_offset,
1164 std::deque<Index>& global_first, std::deque<Index>& global_num,
1165 std::deque<Index>& local_offset, std::deque<Index>& local_num)
1167 String s =
"<Blocked";
1169 s +=
" gc=\"" +
stringify(global_num.front()) +
"\"";
1170 s +=
" gf=\"" +
stringify(global_first.front()) +
"\"";
1171 s +=
" go=\"" +
stringify(global_offset + local_offset.front()) +
"\"";
1172 s +=
" lc=\"" +
stringify(local_num.front()) +
"\"";
1173 s +=
" lo=\"" +
stringify(local_offset.front()) +
"\"";
1176 global_num.pop_front();
1177 local_offset.pop_front();
1178 local_num.pop_front();
1182 template<
typename DT_>
1183 static void alloc_idx_vector(LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& idx_vec,
1184 const LAFEM::DenseVectorBlocked<DT_, IT_, bs_>& tmpl_vec, IT_ value)
1186 idx_vec = LAFEM::DenseVectorBlocked<IT_, IT_, bs_>(tmpl_vec.size(), value);
1189 template<
typename DT_>
1190 static void update_owners(
const IT_ neighbor_rank,
1191 LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& dof_owners,
1192 const LAFEM::VectorMirror<DT_, IT_>& mirror)
1194 const Index num_indices = mirror.num_indices();
1195 const Memory::TypedView<IT_> mir_idx = mirror.indices_view_r();
1196 Memory::TypedView<Tiny::Vector<IT_, bs_>> dof_own = dof_owners.elements_view_rw();
1197 for(Index j(0); j < num_indices; ++j)
1199 auto& dof_owner = dof_own[mir_idx[j]];
1200 if(neighbor_rank < dof_owner[0])
1202 for(
int k = 0; k < bs_; ++k)
1203 dof_owner[k] = neighbor_rank;
1208 static Index build_owned_dofs(
const IT_ my_rank,
1209 LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& owned_dofs,
1210 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& dof_owners, Index offset)
1212 const Index n = dof_owners.size();
1213 const Memory::TypedView<Tiny::Vector<IT_, bs_>> dof_own = dof_owners.elements_view_r();
1214 Memory::TypedView<Tiny::Vector<IT_, bs_>> own_idx = owned_dofs.elements_view_w();
1217 for(Index i = 0; i < n; ++i)
1219 if(dof_own[i][0] == my_rank)
1221 for(
int j = 0; j < bs_; ++j)
1222 own_idx[i][j] = IT_(offset + k++);
1229 template<
typename DT_>
1230 static Index build_owned_mirror(
const IT_ owner_rank,
1231 LAFEM::VectorMirror<DT_, IT_>& owner_mirror,
1232 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& dof_owners)
1235 const Index n = dof_owners.size();
1236 const Memory::TypedView<Tiny::Vector<IT_, bs_>> dof_own = dof_owners.elements_view_r();
1237 Index num_owned = 0u;
1238 for(Index i = 0; i < n; ++i)
1240 if(dof_own[i][0] == owner_rank)
1245 owner_mirror = LAFEM::VectorMirror<DT_, IT_>(n, num_owned);
1246 Memory::TypedView<IT_> mir_idx = owner_mirror.indices_view_w();
1249 for(Index i = 0, k = 0; i < n; ++i)
1251 if(dof_own[i][0] == owner_rank)
1253 mir_idx[k++] = IT_(i);
1257 return num_owned *
Index(bs_);
1260 template<
typename DT_>
1261 static Index build_owner_mirror(
const IT_ neighbor_rank,
1262 LAFEM::VectorMirror<DT_, IT_>& owner_mirror,
1263 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1264 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& dof_owners)
1267 const Index n = halo_mirror.num_indices();
1268 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1269 const Memory::TypedView<Tiny::Vector<IT_, bs_>> dof_own = dof_owners.elements_view_r();
1272 Index num_owner = 0u;
1273 for(Index i = 0; i < n; ++i)
1275 if(dof_own[halo_idx[i]][0] == neighbor_rank)
1280 owner_mirror = LAFEM::VectorMirror<DT_, IT_>(dof_owners.size(), num_owner);
1282 if(num_owner <=
Index(0))
1286 Memory::TypedView<IT_> own_idx = owner_mirror.indices_view_w();
1287 for(IT_ i = 0, k = 0; i < n; ++i)
1289 if(dof_own[halo_idx[i]][0] == neighbor_rank)
1291 own_idx[k++] = halo_idx[i];
1295 return num_owner *
Index(bs_);
1298 template<
typename DT_>
1299 static Index count_donee_dofs(
1300 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1301 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& own_dof_idx)
1304 const Index n = halo_mirror.num_indices();
1305 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1306 const Memory::TypedView<Tiny::Vector<IT_, bs_>> own_idx = own_dof_idx.elements_view_r();
1309 Index num_donee = 0u;
1310 for(Index i = 0; i < n; ++i)
1312 if(own_idx[halo_idx[i]][0] != ~IT_(0))
1313 num_donee +=
Index(bs_);
1319 template<
typename DT_>
1320 static Index build_donee_mirror(
1321 LAFEM::VectorMirror<DT_, IT_>& donee_mirror,
1322 const LAFEM::VectorMirror<DT_, IT_>& halo_mirror,
1323 const LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& own_dof_idx, Index offset)
1326 const Index n = halo_mirror.num_indices();
1327 const Memory::TypedView<IT_> halo_idx = halo_mirror.indices_view_r();
1328 const Memory::TypedView<Tiny::Vector<IT_, bs_>> own_idx = own_dof_idx.elements_view_r();
1329 Memory::TypedView<IT_> donee_idx = donee_mirror.indices_view_w();
1333 for(Index i = 0; i < n; ++i)
1335 if(own_idx[halo_idx[i]][0] != ~IT_(0))
1337 for(
int j = 0; j < bs_; ++j)
1338 donee_idx[offset + k++] = own_idx[halo_idx[i]][j];
1345 template<
typename DT_>
1346 static Index init_global_dof_idx(
1347 LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& global_dof_idx,
1348 const LAFEM::VectorMirror<DT_, IT_>& owned_mirror, Index offset)
1350 Memory::TypedView<Tiny::Vector<IT_, bs_>> g_dof_idx = global_dof_idx.elements_view_w();
1351 const Memory::TypedView<IT_> own_idx = owned_mirror.indices_view_r();
1352 const Index n = owned_mirror.num_indices();
1353 for(Index i = 0; i < n; ++i)
1355 for(
int j = 0; j < bs_; ++j)
1356 g_dof_idx[own_idx[i]][j] = IT_(offset + i*
Index(bs_) +
Index(j));
1358 return n *
Index(bs_);
1361 template<
typename DT_>
1362 static Index set_owner_dofs(
1363 LAFEM::DenseVectorBlocked<IT_, IT_, bs_>& glob_dof_idx,
1364 const std::vector<IT_>& recv_buf,
1365 const LAFEM::VectorMirror<DT_, IT_>& mirror, Index offset)
1367 const Index num_indices = mirror.num_indices();
1368 const Memory::TypedView<IT_> mir_idx = mirror.indices_view_r();
1369 Memory::TypedView<Tiny::Vector<IT_, bs_>> g_dof_idx = glob_dof_idx.elements_view_w();
1370 for(Index i(0); i < num_indices; ++i)
1372 for(
int j = 0; j < bs_; ++j)
1373 g_dof_idx[mir_idx[i]][j] = recv_buf[offset + i*IT_(bs_) + IT_(j)];
1375 return num_indices *
Index(bs_);
1378 template<
typename DT_,
typename DT2_>
1379 static Index gather(DT2_* buf,
1380 const LAFEM::DenseVectorBlocked<DT_, IT_, bs_>& vector,
1381 const LAFEM::VectorMirror<DT_, IT_>& mirror)
1383 XASSERT(mirror.size() == vector.size());
1384 const Index n = mirror.num_indices();
1385 const Memory::TypedView<IT_> idx = mirror.indices_view_r();
1386 const Memory::TypedView<Tiny::Vector<DT_, bs_>> val = vector.elements_view_r();
1387 for(Index i = 0u, k = 0u; i < n; ++i)
1389 for(
int j = 0; j < bs_; ++j, ++k)
1390 buf[k] = DT2_(val[idx[i]][j]);
1392 return n *
Index(bs_);
1395 template<
typename DT_,
typename DT2_>
1396 static Index scatter(
const DT2_* buf,
1397 LAFEM::DenseVectorBlocked<DT_, IT_, bs_>& vector,
1398 const LAFEM::VectorMirror<DT_, IT_>& mirror)
1400 XASSERT(mirror.size() == vector.size());
1401 const Index n = mirror.num_indices();
1402 const Memory::TypedView<IT_> idx = mirror.indices_view_r();
1403 Memory::TypedView<Tiny::Vector<DT_, bs_>> val = vector.elements_view_w();
1404 for(Index i = 0u, k = 0u; i < n; ++i)
1406 for(
int j = 0; j < bs_; ++j, ++k)
1407 val[idx[i]][j] = DT_(buf[k]);
1409 return n *
Index(bs_);
1415 template<
typename FirstIdxVec_,
typename... RestIdxVec_>
1416 class ADPAux<LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>>
1419 typedef typename FirstIdxVec_::IndexType IT_;
1420 typedef ADPAux<FirstIdxVec_> ADPAuxFirst;
1421 typedef ADPAux<LAFEM::TupleVector<RestIdxVec_...>> ADPAuxRest;
1423 template<
typename FirstMirror_,
typename... RestMirror_>
1424 static Index get_local_dof_count_raw(std::vector<Index>& v,
1425 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& global_dof_idx,
1426 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& owned_mirror)
1428 Index n1 = ADPAuxFirst::get_local_dof_count(v, global_dof_idx.first(), owned_mirror.first());
1429 Index n2 = ADPAuxRest::get_local_dof_count_raw(v, global_dof_idx.rest(), owned_mirror.rest());
1434 typename FirstMirror_,
typename... RestMirror_>
1435 static Index get_local_dof_count(std::vector<Index>& v,
1436 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& global_dof_idx,
1437 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& owned_mirror)
1439 v.push_back(get_local_dof_count_raw(v, global_dof_idx, owned_mirror));
1443 static String build_block_info_raw(
1444 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& global_dof_idx, Index global_offset,
1445 std::deque<Index>& global_first, std::deque<Index>& global_num,
1446 std::deque<Index>& local_offset, std::deque<Index>& local_num)
1448 String s = ADPAuxFirst::build_block_info(global_dof_idx.first(), global_offset, global_first, global_num, local_offset, local_num);
1450 s += ADPAuxRest::build_block_info_raw(global_dof_idx.rest(), global_offset, global_first, global_num, local_offset, local_num);
1454 static String build_block_info(
1455 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& global_dof_idx, Index global_offset,
1456 std::deque<Index>& global_first, std::deque<Index>& global_num,
1457 std::deque<Index>& local_offset, std::deque<Index>& local_num)
1461 String slo =
stringify(local_offset.front());
1462 String sgo =
stringify(global_offset + local_offset.front());
1463 String sraw = build_block_info_raw(global_dof_idx, global_offset, global_first, global_num, local_offset, local_num);
1464 String s =
"<Tuple";
1467 s +=
" gc=\"" +
stringify(global_num.front()) +
"\"";
1468 s +=
" gf=\"" +
stringify(global_first.front()) +
"\"";
1469 s +=
" go=\"" + sgo +
"\"";
1470 s +=
" lc=\"" +
stringify(local_num.front()) +
"\"";
1471 s +=
" lo=\"" + slo +
"\">\n";
1475 global_num.pop_front();
1476 local_offset.pop_front();
1477 local_num.pop_front();
1481 template<
typename FirstTmplVector_,
typename... RestTmplVector_>
1482 static void alloc_idx_vector(LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& idx_vec,
1483 const LAFEM::TupleVector<FirstTmplVector_, RestTmplVector_...>& tmpl_vec, IT_ value)
1485 ADPAuxFirst::alloc_idx_vector(idx_vec.first(), tmpl_vec.first(), value);
1486 ADPAuxRest::alloc_idx_vector(idx_vec.rest(), tmpl_vec.rest(), value);
1489 template<
typename FirstMirror_,
typename... RestMirror_>
1490 static void update_owners(
const IT_ neighbor_rank,
1491 LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& dof_owners,
1492 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& mirror)
1494 ADPAuxFirst::update_owners(neighbor_rank, dof_owners.first(), mirror.first());
1495 ADPAuxRest::update_owners(neighbor_rank, dof_owners.rest(), mirror.rest());
1498 static Index build_owned_dofs(
const IT_ my_rank,
1499 LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& owned_dofs,
1500 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& dof_owners, Index offset)
1502 Index n1 = ADPAuxFirst::build_owned_dofs(my_rank, owned_dofs.first(), dof_owners.first(), offset);
1503 Index n2 = ADPAuxRest::build_owned_dofs(my_rank, owned_dofs.rest(), dof_owners.rest(), offset + n1);
1507 template<
typename FirstMirror_,
typename... RestMirror_>
1508 static Index build_owned_mirror(
const IT_ owner_rank,
1509 LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& owner_mirror,
1510 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& dof_owners)
1512 Index n1 = ADPAuxFirst::build_owned_mirror(owner_rank, owner_mirror.first(), dof_owners.first());
1513 Index n2 = ADPAuxRest::build_owned_mirror(owner_rank, owner_mirror.rest(), dof_owners.rest());
1517 template<
typename FirstMirror_,
typename... RestMirror_>
1518 static Index build_owner_mirror(
const IT_ neighbor_rank,
1519 LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& owner_mirror,
1520 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& halo_mirror,
1521 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& dof_owners)
1523 Index n1 = ADPAuxFirst::build_owner_mirror(neighbor_rank, owner_mirror.first(), halo_mirror.first(), dof_owners.first());
1524 Index n2 = ADPAuxRest::build_owner_mirror(neighbor_rank, owner_mirror.rest(), halo_mirror.rest(), dof_owners.rest());
1528 template<
typename FirstMirror_,
typename... RestMirror_>
1529 static Index count_donee_dofs(
1530 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& halo_mirror,
1531 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& own_dof_idx)
1533 Index n1 = ADPAuxFirst::count_donee_dofs(halo_mirror.first(), own_dof_idx.first());
1534 Index n2 = ADPAuxRest::count_donee_dofs(halo_mirror.rest(), own_dof_idx.rest());
1538 template<
typename DT_,
typename FirstMirror_,
typename... RestMirror_>
1539 static Index build_donee_mirror(
1540 LAFEM::VectorMirror<DT_, IT_>& donee_mirror,
1541 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& halo_mirror,
1542 const LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& own_dof_idx, Index offset)
1544 Index n1 = ADPAuxFirst::build_donee_mirror(donee_mirror, halo_mirror.first(), own_dof_idx.first(), offset);
1545 Index n2 = ADPAuxRest::build_donee_mirror(donee_mirror, halo_mirror.rest(), own_dof_idx.rest(), offset + n1);
1549 template<
typename FirstMirror_,
typename... RestMirror_>
1550 static Index init_global_dof_idx(
1551 LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& global_dof_idx,
1552 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& owned_mirror, Index offset)
1554 Index n1 = ADPAuxFirst::init_global_dof_idx(global_dof_idx.first(), owned_mirror.first(), offset);
1555 Index n2 = ADPAuxRest::init_global_dof_idx(global_dof_idx.rest(), owned_mirror.rest(), offset + n1);
1559 template<
typename FirstMirror_,
typename... RestMirror_>
1560 static Index set_owner_dofs(
1561 LAFEM::TupleVector<FirstIdxVec_, RestIdxVec_...>& glob_dof_idx,
1562 const std::vector<IT_>& recv_buf,
1563 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& mirror, Index offset)
1565 Index n1 = ADPAuxFirst::set_owner_dofs(glob_dof_idx.first(), recv_buf, mirror.first(), offset);
1566 Index n2 = ADPAuxRest::set_owner_dofs(glob_dof_idx.rest(), recv_buf, mirror.rest(), offset + n1);
1570 template<
typename DT2_,
1571 typename FirstVector_,
typename... RestVector_,
1572 typename FirstMirror_,
typename... RestMirror_>
1573 static Index gather(DT2_* buf,
1574 const LAFEM::TupleVector<FirstVector_, RestVector_...>& vector,
1575 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& mirror)
1577 Index n1 = ADPAuxFirst::gather(buf, vector.first(), mirror.first());
1578 Index n2 = ADPAuxRest::gather(&buf[n1], vector.rest(), mirror.rest());
1582 template<
typename DT2_,
1583 typename FirstVector_,
typename... RestVector_,
1584 typename FirstMirror_,
typename... RestMirror_>
1585 static Index scatter(
const DT2_* buf,
1586 LAFEM::TupleVector<FirstVector_, RestVector_...>& vector,
1587 const LAFEM::TupleMirror<FirstMirror_, RestMirror_...>& mirror)
1589 Index n1 = ADPAuxFirst::scatter(buf, vector.first(), mirror.first());
1590 Index n2 = ADPAuxRest::scatter(&buf[n1], vector.rest(), mirror.rest());
1597 template<
typename FirstIdxVec_>
1598 class ADPAux<LAFEM::TupleVector<FirstIdxVec_>>
1601 typedef typename FirstIdxVec_::IndexType IT_;
1602 typedef ADPAux<FirstIdxVec_> ADPAuxFirst;
1604 template<
typename FirstMirror_>
1605 static Index get_local_dof_count_raw(std::vector<Index>& v,
1606 const LAFEM::TupleVector<FirstIdxVec_>& global_dof_idx,
1607 const LAFEM::TupleMirror<FirstMirror_>& owned_mirror)
1609 return ADPAuxFirst::get_local_dof_count(v, global_dof_idx.first(), owned_mirror.first());
1612 template<
typename FirstMirror_>
1613 static Index get_local_dof_count(std::vector<Index>& v,
1614 const LAFEM::TupleVector<FirstIdxVec_>& global_dof_idx,
1615 const LAFEM::TupleMirror<FirstMirror_>& owned_mirror)
1617 v.push_back(get_local_dof_count_raw(v, global_dof_idx, owned_mirror));
1621 static String build_block_info_raw(
1622 const LAFEM::TupleVector<FirstIdxVec_>& global_dof_idx, Index global_offset,
1623 std::deque<Index>& global_first, std::deque<Index>& global_num,
1624 std::deque<Index>& local_offset, std::deque<Index>& local_num)
1626 return ADPAuxFirst::build_block_info(global_dof_idx.first(), global_offset, global_first, global_num, local_offset, local_num);
1629 static String build_block_info(
1630 const LAFEM::TupleVector<FirstIdxVec_>& global_dof_idx, Index global_offset,
1631 std::deque<Index>& global_first, std::deque<Index>& global_num,
1632 std::deque<Index>& local_offset, std::deque<Index>& local_num)
1636 String slo =
stringify(local_offset.front());
1637 String sgo =
stringify(global_offset + local_offset.front());
1638 String sraw = build_block_info_raw(global_dof_idx, global_offset, global_first, global_num, local_offset, local_num);
1639 String s =
"<Tuple";
1642 s +=
" gc=\"" +
stringify(global_num.front()) +
"\"";
1643 s +=
" gf=\"" +
stringify(global_first.front()) +
"\"";
1644 s +=
" go=\"" + sgo +
"\"";
1645 s +=
" lc=\"" +
stringify(local_num.front()) +
"\"";
1646 s +=
" lo=\"" + slo +
"\">\n";
1650 global_num.pop_front();
1651 local_offset.pop_front();
1652 local_num.pop_front();
1656 template<
typename FirstTmplVector_>
1657 static void alloc_idx_vector(LAFEM::TupleVector<FirstIdxVec_>& idx_vec,
1658 const LAFEM::TupleVector<FirstTmplVector_>& tmpl_vec, IT_ value)
1660 ADPAuxFirst::alloc_idx_vector(idx_vec.first(), tmpl_vec.first(), value);
1663 template<
typename FirstMirror_>
1664 static void update_owners(
const IT_ neighbor_rank,
1665 LAFEM::TupleVector<FirstIdxVec_>& dof_owners,
1666 const LAFEM::TupleMirror<FirstMirror_>& mirror)
1668 ADPAuxFirst::update_owners(neighbor_rank, dof_owners.first(), mirror.first());
1671 static Index build_owned_dofs(
const IT_ my_rank,
1672 LAFEM::TupleVector<FirstIdxVec_>& owned_dofs,
1673 const LAFEM::TupleVector<FirstIdxVec_>& dof_owners, Index offset)
1675 return ADPAuxFirst::build_owned_dofs(my_rank, owned_dofs.first(), dof_owners.first(), offset);
1678 template<
typename FirstMirror_>
1679 static Index build_owned_mirror(
const IT_ owner_rank,
1680 LAFEM::TupleMirror<FirstMirror_>& owner_mirror,
1681 const LAFEM::TupleVector<FirstIdxVec_>& dof_owners)
1683 return ADPAuxFirst::build_owned_mirror(owner_rank, owner_mirror.first(), dof_owners.first());
1686 template<
typename FirstMirror_>
1687 static Index build_owner_mirror(
const IT_ neighbor_rank,
1688 LAFEM::TupleMirror<FirstMirror_>& owner_mirror,
1689 const LAFEM::TupleMirror<FirstMirror_>& halo_mirror,
1690 const LAFEM::TupleVector<FirstIdxVec_>& dof_owners)
1692 return ADPAuxFirst::build_owner_mirror(neighbor_rank, owner_mirror.first(), halo_mirror.first(), dof_owners.first());
1695 template<
typename FirstMirror_>
1696 static Index count_donee_dofs(
1697 const LAFEM::TupleMirror<FirstMirror_>& halo_mirror,
1698 const LAFEM::TupleVector<FirstIdxVec_>& own_dof_idx)
1700 return ADPAuxFirst::count_donee_dofs(halo_mirror.first(), own_dof_idx.first());
1703 template<
typename DT_,
typename FirstMirror_>
1704 static Index build_donee_mirror(
1705 LAFEM::VectorMirror<DT_, IT_>& donee_mirror,
1706 const LAFEM::TupleMirror<FirstMirror_>& halo_mirror,
1707 const LAFEM::TupleVector<FirstIdxVec_>& own_dof_idx, Index offset)
1709 return ADPAuxFirst::build_donee_mirror(donee_mirror, halo_mirror.first(), own_dof_idx.first(), offset);
1712 template<
typename FirstMirror_>
1713 static Index init_global_dof_idx(
1714 LAFEM::TupleVector<FirstIdxVec_>& global_dof_idx,
1715 const LAFEM::TupleMirror<FirstMirror_>& owned_mirror, Index offset)
1717 return ADPAuxFirst::init_global_dof_idx(global_dof_idx.first(), owned_mirror.first(), offset);
1720 template<
typename FirstMirror_>
1721 static Index set_owner_dofs(
1722 LAFEM::TupleVector<FirstIdxVec_>& glob_dof_idx,
1723 const std::vector<IT_>& recv_buf,
1724 const LAFEM::TupleMirror<FirstMirror_>& mirror, Index offset)
1726 return ADPAuxFirst::set_owner_dofs(glob_dof_idx.first(), recv_buf, mirror.first(), offset);
1729 template<
typename DT2_,
typename FirstVector_,
typename FirstMirror_>
1730 static Index gather(DT2_* buf,
1731 const LAFEM::TupleVector<FirstVector_>& vector,
1732 const LAFEM::TupleMirror<FirstMirror_>& mirror)
1734 return ADPAuxFirst::gather(buf, vector.first(), mirror.first());
1737 template<
typename DT2_,
typename FirstVector_,
typename FirstMirror_>
1738 static Index scatter(
const DT2_* buf,
1739 LAFEM::TupleVector<FirstVector_>& vector,
1740 const LAFEM::TupleMirror<FirstMirror_>& mirror)
1742 return ADPAuxFirst::scatter(buf, vector.first(), mirror.first());
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
void bcast(void *buffer, std::size_t count, const Datatype &datatype, int root) const
Blocking broadcast.
void allreduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking All-Reduce.
int size() const
Returns the size of this communicator.
void exscan(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking Exclusive Scan.
Request irecv(void *buffer, std::size_t count, const Datatype &datatype, int source, int tag=0) const
Nonblocking Receive.
Request isend(const void *buffer, std::size_t count, const Datatype &datatype, int dest, int tag=0) const
Nonblocking Send.
int rank() const
Returns the rank of this process in this communicator.
void allgather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype) const
Blocking gather-to-all.
Communication Request vector class.
bool wait_any(std::size_t &idx, Status &status)
Blocks until one of the active requests has been fulfilled.
void wait_all()
Blocks until all active requests are fulfilled.
Algebraic DOF Partitioning implementation.
LAFEM::DenseVector< DataType, IndexType > BufferVectorType
the type for buffers used by our mirrors
Index _extra_shared_dof_count
number of extra shared dofs; must be equal on all processes
Mirror_ MirrorType
the vector mirror type
String get_block_information() const
Returns the block information of the algebraic dof partitioning as an XML string.
Index _local_dof_count
number of local dofs of this process
void clear()
Resets the whole object.
const std::vector< int > & get_all_global_dof_offsets() const
Returns the all-global-dof-offsets vector.
MirrorType OwnerMirrorType
type of mirror for neighbor owner local dof indices
int get_donee_rank(Index i) const
Returns an donee neighbor rank.
Index get_num_local_dofs() const
Index _extra_local_dof_count
number of extra local dofs; may be different for each process
void assemble_by_gate(const GateType &gate, Index extra_local=0u, Index extra_shared=0u)
Assembles the AlgDofParti object from a given Global::Gate.
std::vector< DoneeMirrorType > _donee_mirrors
rank/mirror-pair of DOF-donee processes
Index _global_dof_offset
global dof offset of this process
Global::Vector< LocalVectorType, MirrorType > GlobalVectorType
the global vector type
LocalVector_ LocalVectorType
the local vector type
Index _global_dof_count
global dof count over all processes
std::vector< int > _owner_ranks
ranks of DOF-owner neighbor processes
Index get_global_dof_offset() const
AlgDofParti()
default constructor
std::vector< int > _all_global_dof_offset
global DOF offsets of all processes,
MirrorType _owned_mirror
mirror for this process's owned DOFs
const std::vector< int > & get_all_global_dof_counts() const
Returns the all-global-dof-counts vector.
void assemble_allgather(bool yes_i_really_want_to_do_this=false)
Assembles the required data for the AlgDofPartiSystem::apply() function.
std::vector< int > _all_global_dof_counts
global DOF counts of all processes,
MirrorType OwnedMirrorType
type of mirror for owned local dof indices
Intern::ADPAux< IndexVectorType > ADPAuxType
auxiliary helper class type
const OwnedMirrorType & get_owned_mirror() const
Returns the Mirror of the owned DOFs.
Index _extra_dof_offset
offset of first extra DOF
const OwnerMirrorType & get_owner_mirror(Index i) const
Returns an owner neighbor mirror.
virtual ~AlgDofParti()=default
virtual destructor
LocalVectorType::template ContainerTypeByDI< IndexType, IndexType > IndexVectorType
the index vector type, this one is required for internal computations
const IndexVectorType & get_global_dof_indices() const
Returns the global-dof-indices array.
std::vector< int > _donee_ranks
ranks of DOF-donee neighbor processes
LocalVectorType::DataType DataType
our data type
AlgDofParti(const AlgDofParti &)=delete
no copy, no problems
Index _owned_dof_count
number of owned dofs of this process
int get_owner_rank(Index i) const
Returns an owner neighbor rank.
String _block_information
a string containing the block information in XML format
std::size_t bytes() const
const Dist::Comm * get_comm() const
Index get_num_owner_neighbors() const
LAFEM::VectorMirror< DataType, IndexType > DoneeMirrorType
type of mirror for neighbor donee owned dof indices
Index get_num_donee_neighbors() const
const DoneeMirrorType & get_donee_mirror(Index i) const
Returns a donee neighbor mirror.
Index get_num_global_dofs() const
Index get_num_owned_dofs() const
Global::Gate< LocalVectorType, MirrorType > GateType
the global gate type
IndexVectorType _global_dof_idx
global dof indices for each local dof
const Dist::Comm * _comm
our communicator
LocalVectorType::IndexType IndexType
our index type
AlgDofParti & operator=(const AlgDofParti &)=delete
no copy, no problems
std::vector< OwnerMirrorType > _owner_mirrors
rank/mirror-pair of DOF-owner processes
Global gate implementation.
const Dist::Comm * get_comm() const
Returns a const pointer to the underlying communicator.
const LocalVector_ & get_freqs() const
Returns a const reference to the frequencies vector.
const std::vector< Mirror_ > & get_mirrors() const
Returns a const reference to the neighbor mirrors vector.
std::vector< int > _ranks
communication ranks
Global vector wrapper class template.
Dense data vector class template.
Handles vector prolongation, restriction and serialization.
String class implementation.
void pop_front()
Removes the first character from the string.
const Operation op_sum(MPI_SUM)
Operation wrapper for MPI_SUM.
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.