19 <<
"VolumeMesherExtruder: No extrusion layers have been specified. "
20 <<
"A default single layer will be used with height 1.0 and a single "
22 double dz = 1.0/default_layer_count;
23 for (
int k=0; k<=default_layer_count; k++)
35 double dz = input_layer.height/input_layer.sub_divisions;
37 for (
int k=0; k<input_layer.sub_divisions; k++)
46 <<
"VolumeMesherExtruder: Total number of cell layers is "
56 double z_location = 0.5 * (vertex_layers_[level] + vertex_layers_[level + 1]);
58 auto centroid_projected = centroid;
59 centroid_projected.
z = z_location;
61 return centroid_projected;
69 int px = options.partition_x;
70 int py = options.partition_y;
75 auto xyz_partition_indices = GetCellXYZPartitionID(&n_gcell);
77 int nxi = std::get<0>(xyz_partition_indices);
78 int nyi = std::get<1>(xyz_partition_indices);
79 int nzi = std::get<2>(xyz_partition_indices);
81 return nzi*px*py + nyi*px + nxi;
98 auto projected_centroid = ProjectCentroidToLevel(centroid, z_level);
99 int pid = GetCellKBAPartitionIDFromCentroid(projected_centroid);
104 const size_t last_z_level = vertex_layers_.size() - 1;
105 const size_t z_level_below = z_level - 1;
106 const size_t z_level_above = z_level + 1;
109 std::vector<size_t> z_levels_to_search;
110 z_levels_to_search.reserve(3);
112 z_levels_to_search.push_back(z_level);
113 if (z_level != 0) z_levels_to_search.push_back(z_level_below);
114 if (z_level != (last_z_level-1)) z_levels_to_search.push_back(z_level_above);
118 const auto& vertex_subs =
119 template_unpartitioned_mesh_->GetVertextCellSubscriptions();
121 for (uint64_t cid : vertex_subs[vid])
123 if (cid == template_cell.
local_id_)
continue;
125 auto& candidate_cell =
127 auto& cc_centroid = candidate_cell.centroid_;
129 for (
size_t z : z_levels_to_search)
131 auto projected_centroid = ProjectCentroidToLevel(cc_centroid, z);
132 int pid = GetCellKBAPartitionIDFromCentroid(projected_centroid);
140 for (
size_t z : z_levels_to_search)
142 if (z == z_level)
continue;
144 auto projected_centroid = ProjectCentroidToLevel(template_cell.
centroid_, z);
145 int pid = GetCellKBAPartitionIDFromCentroid(projected_centroid);
159 uint64_t cell_global_id,
161 size_t num_template_cells)
163 const size_t tc_num_verts = template_cell.
vertex_ids_.size();
167 switch (template_cell.
SubType())
177 cell->global_id_ = cell_global_id;
179 cell->partition_id_ = partition_id;
180 cell->centroid_ = ProjectCentroidToLevel(template_cell.
centroid_, z_level);
183 cell->vertex_ids_.reserve(2 * tc_num_verts);
185 cell->vertex_ids_.push_back(tc_vid + z_level * node_z_index_incr_);
188 cell->vertex_ids_.push_back(tc_vid + (z_level + 1) * node_z_index_incr_);
192 for (
auto& face : template_cell.
faces_)
197 newFace.
vertex_ids_[0] = face.vertex_ids_[0] + z_level * node_z_index_incr_;
198 newFace.
vertex_ids_[1] = face.vertex_ids_[1] + z_level * node_z_index_incr_;
199 newFace.
vertex_ids_[2] = face.vertex_ids_[1] + (z_level + 1) * node_z_index_incr_;
200 newFace.
vertex_ids_[3] = face.vertex_ids_[0] + (z_level + 1) * node_z_index_incr_;
222 if (face.has_neighbor_)
225 z_level*num_template_cells;
231 cell->faces_.push_back(newFace);
241 for (
int tv=(
static_cast<int>(tc_num_verts)-1); tv>=0; tv--)
244 + z_level * node_z_index_incr_);
250 vfc = vfc/
static_cast<double>(tc_num_verts);
257 auto vn = va.Cross(vb);
269 (z_level-1)*num_template_cells;
273 cell->faces_.push_back(newFace);
284 newFace.
vertex_ids_.push_back(tc_vid + (z_level + 1) * node_z_index_incr_);
290 vfc = vfc/
static_cast<double>(tc_num_verts);
297 auto vn = va.Cross(vb);
301 if (z_level==(vertex_layers_.size() - 2))
309 (z_level+1)*num_template_cells;
313 cell->faces_.push_back(newFace);
static chi::MPI_Info & mpi
LogStream Log(LOG_LVL level=LOG_0)
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.
std::vector< CellFace > faces_
std::vector< uint64_t > vertex_ids_
LocalCellHandler local_cells
chi_mesh::Vector3 ProjectCentroidToLevel(const chi_mesh::Vector3 ¢roid, size_t level)
bool HasLocalScope(const chi_mesh::Cell &template_cell, const chi_mesh::MeshContinuum &template_continuum, size_t z_level)
int GetCellKBAPartitionIDFromCentroid(chi_mesh::Vector3 ¢roid)
std::unique_ptr< chi_mesh::Cell > MakeExtrudedCell(const chi_mesh::Cell &template_cell, const chi_mesh::MeshContinuum &grid, size_t z_level, uint64_t cell_global_id, int partition_id, size_t num_template_cells)
std::vector< MeshLayer > input_layers_
std::vector< double > vertex_layers_
void SetupLayers(int default_layer_count=1)
Vector3 Cross(const Vector3 &that) const