10 push_back(std::unique_ptr<chi_mesh::Cell> new_cell)
40 auto native_location = global_cell_id_to_native_id_map.find(cell_global_index);
42 if (native_location != global_cell_id_to_native_id_map.end())
43 return *local_cells_ref_[native_location->second];
46 auto foreign_location = global_cell_id_to_foreign_id_map.find(cell_global_index);
47 if (foreign_location != global_cell_id_to_foreign_id_map.end())
48 return *ghost_cells_ref_[foreign_location->second];
51 std::stringstream ostr;
52 ostr <<
"chi_mesh::MeshContinuum::cells. Mapping error."
56 throw std::invalid_argument(ostr.str());
64 auto native_location = global_cell_id_to_native_id_map.find(cell_global_index);
66 if (native_location != global_cell_id_to_native_id_map.end())
67 return *local_cells_ref_[native_location->second];
70 auto foreign_location = global_cell_id_to_foreign_id_map.find(cell_global_index);
71 if (foreign_location != global_cell_id_to_foreign_id_map.end())
72 return *ghost_cells_ref_[foreign_location->second];
75 std::stringstream ostr;
76 ostr <<
"chi_mesh::MeshContinuum::cells. Mapping error."
80 throw std::invalid_argument(ostr.str());
87 size_t num_local_cells = local_cells_.size();
88 size_t num_globl_cells = 0;
90 MPI_Allreduce(&num_local_cells,
93 MPI_UNSIGNED_LONG_LONG,
97 return num_globl_cells;
107 std::vector<uint64_t> ids;
108 ids.reserve(GetNumGhosts());
110 for (
auto& cell : ghost_cells_ref_)
111 ids.push_back(cell->global_id_);
124 auto foreign_location =
125 global_cell_id_to_foreign_id_map.find(cell_global_index);
127 if (foreign_location != global_cell_id_to_foreign_id_map.end())
128 return foreign_location->second;
130 std::stringstream ostr;
131 ostr <<
"Grid GetGhostLocalID failed to find cell " << cell_global_index;
133 throw std::invalid_argument(ostr.str());
static chi::MPI_Info & mpi
const int & location_id
Current process rank.
std::map< uint64_t, uint64_t > & global_cell_id_to_foreign_id_map
std::vector< uint64_t > GetGhostGlobalIDs() const
uint64_t GetGhostLocalID(uint64_t cell_global_index) const
chi_mesh::Cell & operator[](uint64_t cell_global_index)
std::vector< std::unique_ptr< chi_mesh::Cell > > & local_cells_ref_
void push_back(std::unique_ptr< chi_mesh::Cell > new_cell)
std::map< uint64_t, uint64_t > & global_cell_id_to_native_id_map
std::vector< std::unique_ptr< chi_mesh::Cell > > & ghost_cells_ref_
size_t GetGlobalNumberOfCells() const