22 std::vector<Vertex> zverts;
23 zverts.reserve(vertices.size());
24 for (
double z_coord : vertices)
25 zverts.emplace_back(0.0,0.0,z_coord);
28 auto umesh = std::make_shared<chi_mesh::UnpartitionedMesh>();
33 size_t Nz = vertices.size();
35 umesh->GetMeshOptions().ortho_Nx = 1;
36 umesh->GetMeshOptions().ortho_Ny = 1;
37 umesh->GetMeshOptions().ortho_Nz = Nz-1;
38 umesh->GetMeshOptions().boundary_id_map[4] =
"ZMAX";
39 umesh->GetMeshOptions().boundary_id_map[5] =
"ZMIN";
41 umesh->GetVertices().reserve(Nz);
42 for (
auto& vertex : zverts)
43 umesh->GetVertices().push_back(vertex);
46 for (
size_t c=0; c<(zverts.size()-1); ++c)
51 cell->vertex_ids = {c,c+1};
60 if (c == (zverts.size()-2)) rite_face.
neighbor = 4;
62 cell->faces.push_back(left_face);
63 cell->faces.push_back(rite_face);
68 umesh->ComputeCentroidsAndCheckQuality();
69 umesh->BuildMeshConnectivity();
74 handler.SetSurfaceMesher(std::make_shared<chi_mesh::SurfaceMesherPredefined>());
75 handler.SetVolumeMesher(std::make_shared<
97 std::vector<double>& vertices_1d_x,
98 std::vector<double>& vertices_1d_y)
101 "Empty vertex list.");
107 auto umesh = std::make_shared<chi_mesh::UnpartitionedMesh>();
112 size_t Nx = vertices_1d_x.size();
113 size_t Ny = vertices_1d_y.size();
115 umesh->GetMeshOptions().ortho_Nx = Nx-1;
116 umesh->GetMeshOptions().ortho_Ny = Ny-1;
117 umesh->GetMeshOptions().ortho_Nz = 1;
118 umesh->GetMeshOptions().boundary_id_map[0] =
"XMAX";
119 umesh->GetMeshOptions().boundary_id_map[1] =
"XMIN";
120 umesh->GetMeshOptions().boundary_id_map[2] =
"YMAX";
121 umesh->GetMeshOptions().boundary_id_map[3] =
"YMIN";
123 typedef std::vector<uint64_t> VecIDs;
124 std::vector<VecIDs> vertex_ij_to_i_map(Ny,VecIDs(Nx));
125 umesh->GetVertices().reserve(Nx * Ny);
127 for (
size_t i=0; i<Ny; ++i)
129 for (
size_t j=0; j<Nx; ++j)
131 vertex_ij_to_i_map[i][j] = k++;
132 umesh->GetVertices().emplace_back(vertices_1d_x[j],
139 auto& vmap = vertex_ij_to_i_map;
140 for (
size_t i=0; i<(Ny-1); ++i)
142 for (
size_t j=0; j<(Nx-1); ++j)
146 CellType::QUADRILATERAL);
155 cell->vertex_ids = {vmap[i][j],vmap[i][j+1],vmap[i+1][j+1],vmap[i+1][j]};
157 for (
int v=0; v<4; ++v)
162 face.
vertex_ids = std::vector<uint64_t>{cell->vertex_ids[v],
163 cell->vertex_ids[v+1]};
165 face.
vertex_ids = std::vector<uint64_t>{cell->vertex_ids[v],
166 cell->vertex_ids[0]};
169 if (j == (Nx-2) and v == 1) face.
neighbor = 0;
170 if (j == 0 and v == 3) face.
neighbor = 1;
171 if (i == (Ny-2) and v == 2) face.
neighbor = 2;
172 if (i == 0 and v == 0) face.
neighbor = 3;
174 cell->faces.push_back(face);
177 umesh->AddCell(cell);
181 umesh->ComputeCentroidsAndCheckQuality();
182 umesh->BuildMeshConnectivity();
187 handler.SetSurfaceMesher(std::make_shared<chi_mesh::SurfaceMesherPredefined>());
188 handler.SetVolumeMesher(std::make_shared<
191 handler.GetSurfaceMesher().Execute();
211 std::vector<double>& vertices_1d_x,
212 std::vector<double>& vertices_1d_y,
213 std::vector<double>& vertices_1d_z)
216 vertices_1d_y.empty() or
217 vertices_1d_z.empty(),
"Empty vertex list.");
223 auto umesh = std::make_shared<chi_mesh::UnpartitionedMesh>();
228 size_t Nx = vertices_1d_x.size();
229 size_t Ny = vertices_1d_y.size();
230 size_t Nz = vertices_1d_z.size();
232 umesh->GetMeshOptions().ortho_Nx = Nx-1;
233 umesh->GetMeshOptions().ortho_Ny = Ny-1;
234 umesh->GetMeshOptions().ortho_Nz = Nz-1;
235 umesh->GetMeshOptions().boundary_id_map[0] =
"XMAX";
236 umesh->GetMeshOptions().boundary_id_map[1] =
"XMIN";
237 umesh->GetMeshOptions().boundary_id_map[2] =
"YMAX";
238 umesh->GetMeshOptions().boundary_id_map[3] =
"YMIN";
239 umesh->GetMeshOptions().boundary_id_map[4] =
"ZMAX";
240 umesh->GetMeshOptions().boundary_id_map[5] =
"ZMIN";
247 typedef std::vector<uint64_t> VecIDs;
248 typedef std::vector<VecIDs> VecVecIDs;
249 std::vector<VecVecIDs> vertex_ijk_to_i_map(Ny);
250 for (
auto& vec : vertex_ijk_to_i_map)
251 vec.resize(Nx,VecIDs(Nz));
253 umesh->GetVertices().reserve(Nx * Ny * Nz);
255 for (
size_t i=0; i<Ny; ++i)
257 for (
size_t j=0; j<Nx; ++j)
259 for (
size_t k=0; k<Nz; ++k)
261 vertex_ijk_to_i_map[i][j][k] = c++;
262 umesh->GetVertices().emplace_back(vertices_1d_x[j],
270 auto& vmap = vertex_ijk_to_i_map;
271 for (
size_t i=0; i<(Ny-1); ++i)
273 for (
size_t j=0; j<(Nx-1); ++j)
275 for (
size_t k=0; k<(Nz-1); ++k)
279 CellType::HEXAHEDRON);
281 cell->vertex_ids = std::vector<uint64_t>
302 cell->faces.push_back(face);
314 cell->faces.push_back(face);
326 cell->faces.push_back(face);
338 cell->faces.push_back(face);
350 cell->faces.push_back(face);
362 cell->faces.push_back(face);
365 umesh->AddCell(cell);
370 umesh->ComputeCentroidsAndCheckQuality();
371 umesh->BuildMeshConnectivity();
376 handler.SetSurfaceMesher(std::make_shared<chi_mesh::SurfaceMesherPredefined>());
377 handler.SetVolumeMesher(std::make_shared<
380 handler.GetSurfaceMesher().Execute();
#define ChiLogicalErrorIf(condition, message)
static std::vector< chi_mesh::UnpartMeshPtr > unpartitionedmesh_stack
size_t CreateUnpartitioned3DOrthoMesh(std::vector< double > &vertices_1d_x, std::vector< double > &vertices_1d_y, std::vector< double > &vertices_1d_z)
size_t CreateUnpartitioned1DOrthoMesh(std::vector< double > &vertices_1d)
MeshHandler & GetCurrentHandler()
size_t CreateUnpartitioned2DOrthoMesh(std::vector< double > &vertices_1d_x, std::vector< double > &vertices_1d_y)
std::vector< uint64_t > vertex_ids