11 "chi_math::SpatialDiscretization_FV::OrderNodes: " \
12 "Error mapping neighbor cells"
22 const uint64_t local_num_nodes = ref_grid_.local_cells.size();
23 locJ_block_size_.assign(
Chi::mpi.process_count, 0);
24 MPI_Allgather(&local_num_nodes,
27 locJ_block_size_.data(),
33 locJ_block_address_.assign(
Chi::mpi.process_count, 0);
34 uint64_t global_num_nodes = 0;
37 locJ_block_address_[j] = global_num_nodes;
38 global_num_nodes += locJ_block_size_[j];
43 local_base_block_size_ = local_num_nodes;
44 globl_base_block_size_ = global_num_nodes;
47 const auto neighbor_gids = ref_grid_.cells.GetGhostGlobalIDs();
48 std::map<uint64_t, std::vector<uint64_t>> sorted_nb_gids;
49 for (uint64_t gid : neighbor_gids)
51 const auto& cell = ref_grid_.cells[gid];
52 sorted_nb_gids[cell.partition_id_].push_back(gid);
57 const auto query_nb_gids =
63 std::map<uint64_t, std::vector<uint64_t>> mapped_query_nb_gids;
64 for (
const auto& pid_list_pair : query_nb_gids)
66 const uint64_t pid = pid_list_pair.first;
67 const auto& gids = pid_list_pair.second;
69 auto& local_ids = mapped_query_nb_gids[pid];
70 local_ids.reserve(gids.size());
71 for (uint64_t gid : gids)
73 if (not ref_grid_.IsCellLocal(gid))
throw std::logic_error(
MappingError);
75 const auto& local_cell = ref_grid_.cells[gid];
76 local_ids.push_back(local_cell.local_id_);
82 const auto mapped_nb_gids =
89 neighbor_cell_local_ids_.clear();
90 for (
const auto& pid_list_pair : sorted_nb_gids)
94 const auto& pid = pid_list_pair.first;
95 const auto& gid_list = pid_list_pair.second;
96 const auto& lid_list = mapped_nb_gids.at(pid);
98 if (gid_list.size() != lid_list.size())
99 throw std::logic_error(
MappingError + std::string(
" Size-mismatch."));
101 for (
size_t i = 0; i < gid_list.size(); ++i)
102 neighbor_cell_local_ids_.insert(
103 std::make_pair(gid_list[i], lid_list[i]));
105 catch (
const std::out_of_range& oor)
107 throw std::logic_error(
MappingError + std::string(
" OOR."));
111 local_base_block_size_ = ref_grid_.local_cells.size();
112 globl_base_block_size_ = ref_grid_.GetGlobalNumberOfCells();
static chi::MPI_Info & mpi
const MPI_Comm & comm
MPI communicator.
const int & process_count
Total number of processes.
const int & location_id
Current process rank.
std::map< K, std::vector< T > > MapAllToAll(const std::map< K, std::vector< T > > &pid_data_pairs, const MPI_Datatype data_mpi_type, const MPI_Comm communicator=Chi::mpi.comm)