10 MPI_Comm communicator)
16 MPI_Bcast(&data_count,
22 if (
Chi::mpi.location_id != root) cell_pids.assign(data_count, 0);
26 MPI_Bcast(cell_pids.data(),
27 static_cast<int>(data_count),
38 uint64_t cell_global_id,
39 const std::vector<std::set<uint64_t>>& vertex_subscriptions,
40 const std::vector<int64_t>& cell_partition_ids)
const
44 int cell_pid =
static_cast<int>(cell_partition_ids[cell_global_id]);
45 if (cell_pid == location_id)
return true;
49 for (uint64_t cid : vertex_subscriptions[vid])
51 if (cid == cell_global_id)
continue;
52 int adj_pid =
static_cast<int>(cell_partition_ids[cid]);
53 if (adj_pid == location_id)
return true;
61std::unique_ptr<chi_mesh::Cell>
65 uint64_t partition_id,
69 std::make_unique<chi_mesh::Cell>(raw_cell.
type, raw_cell.
sub_type);
71 cell->global_id_ = global_id;
72 cell->partition_id_ = partition_id;
77 size_t face_counter = 0;
78 for (
auto& raw_face : raw_cell.
faces)
88 vfc = vfc + vertices.
at(fvid);
96 if (face_counter == 0)
108 auto vec_vvc = vertices.
at(fvid) - newFace.
centroid_;
119 const size_t num_face_verts = newFace.
vertex_ids_.size();
120 double total_area = 0.0;
121 for (
size_t fv = 0; fv < num_face_verts; ++fv)
123 size_t fvp1 = (fv < (num_face_verts - 1)) ? fv + 1 : 0;
128 auto leg_m = vertices.
at(fvid_m) - newFace.
centroid_;
129 auto leg_p = vertices.
at(fvid_p) - newFace.
centroid_;
131 auto vn = leg_m.
Cross(leg_p);
133 double area = 0.5 * vn.
Norm();
143 cell->faces_.push_back(newFace);
static chi::MPI_Info & mpi
const int & location_id
Current process rank.
Normal normal_
A list of the vertices.
bool has_neighbor_
Flag indicating whether face has a neighbor.
uint64_t neighbor_id_
Otherwise contains boundary_id.
std::vector< uint64_t > vertex_ids_
Vertex centroid_
The face centroid.
bool CellHasLocalScope(int location_id, 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) const
static void BroadcastPIDs(std::vector< int64_t > &cell_pids, int root, MPI_Comm communicator)
static std::unique_ptr< chi_mesh::Cell > SetupCell(const UnpartitionedMesh::LightWeightCell &raw_cell, uint64_t global_id, uint64_t partition_id, const VertexListHelper &vertices)
virtual const chi_mesh::Vertex & at(uint64_t vid) const =0
std::vector< uint64_t > vertex_ids
const chi_mesh::CellType sub_type
chi_mesh::Vertex centroid
const chi_mesh::CellType type
std::vector< LightWeightFace > faces
Vector3 Cross(const Vector3 &that) const
Vector3 Normalized() const