Chi-Tech
volmesher_predefunpart_utils.cc
Go to the documentation of this file.
2
3#include "chi_runtime.h"
4#include "chi_mpi.h"
5
6
7//###################################################################
8/**Determines if a chi_mesh::UnpartitionedMesh::LightWeightCell is a
9 * neighbor to the current partition for ParMETIS-style partitioning.
10 * This method loops over the faces of the lightweight cell and
11 * determines the partition-id of each the neighbors. If the neighbor
12 * has a partition id equal to that of the current process then
13 * it means this reference cell is a neighbor.*/
17 uint64_t cell_global_id,
18 const std::vector<std::set<uint64_t>>& vertex_subscriptions,
19 const std::vector<int64_t>& cell_partition_ids)
20{
21 //First determine if the cell is a local cell
22 int cell_pid = static_cast<int>(cell_partition_ids[cell_global_id]);
23 if (cell_pid == Chi::mpi.location_id)
24 return true;
25
26 //Now determine if the cell is a ghost cell
27 for (uint64_t vid : lwcell.vertex_ids)
28 for (uint64_t cid : vertex_subscriptions[vid])
29 {
30 if (cid == cell_global_id) continue;
31 int adj_pid = static_cast<int>(cell_partition_ids[cid]);
32 if (adj_pid == Chi::mpi.location_id)
33 return true;
34 }
35
36 return false;
37}
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78
static bool CellHasLocalScope(const chi_mesh::UnpartitionedMesh::LightWeightCell &lwcell, uint64_t cell_global_id, const std::vector< std::set< uint64_t > > &vertex_subscriptions, const std::vector< int64_t > &cell_partition_ids)