49 friend mesh::DynamicMeshCartesian2DBuilder;
50 friend mesh::DynamicMeshCartesian3DBuilder;
51 friend mesh::CartesianFaceUniqueIdBuilder;
52 friend class CartesianMeshUniqueIdRenumbering;
62 class NodeUniqueIdComputer2D
66 NodeUniqueIdComputer2D(Int64 base_offset, Int64 nb_node_x)
67 : m_base_offset(base_offset)
68 , m_nb_node_x(nb_node_x)
73 Int64 compute(Int64 x, Int64 y)
75 return m_base_offset + x + y * m_nb_node_x;
78 std::array<Int64, 4> computeForCell(Int64 x, Int64 y)
80 std::array<Int64, 4> node_uids;
81 node_uids[0] = compute(x + 0, y + 0);
82 node_uids[1] = compute(x + 1, y + 0);
83 node_uids[2] = compute(x + 1, y + 1);
84 node_uids[3] = compute(x + 0, y + 1);
98 class CellUniqueIdComputer2D
102 CellUniqueIdComputer2D(Int64 base_offset, Int64 all_nb_cell_x)
103 : m_base_offset(base_offset)
104 , m_all_nb_cell_x(all_nb_cell_x)
109 Int64 compute(Int64 x, Int64 y)
111 return m_base_offset + x + y * m_all_nb_cell_x;
113 Int64x3 compute(Int64 unique_id)
115 Int64 uid = unique_id - m_base_offset;
116 const Int64 y = uid / m_all_nb_cell_x;
117 const Int64 x = uid % m_all_nb_cell_x;
124 Int64 m_all_nb_cell_x;
131 class FaceUniqueIdComputer2D
135 FaceUniqueIdComputer2D(Int64 base_offset, Int64 nb_cell_x, Int64 nb_face_x, Int64 nb_face_dir_x)
136 : m_base_offset(base_offset)
137 , m_nb_cell_x(nb_cell_x)
138 , m_nb_face_x(nb_face_x)
139 , m_nb_face_dir_x(nb_face_dir_x)
145 std::array<Int64, 4> computeForCell(Int64 x, Int64 y)
147 std::array<Int64, 4> face_uids;
150 face_uids[0] = m_base_offset + (x + 0) + ((y + 0) * m_nb_cell_x) + m_nb_face_dir_x;
151 face_uids[2] = m_base_offset + (x + 0) + ((y + 1) * m_nb_cell_x) + m_nb_face_dir_x;
154 face_uids[1] = m_base_offset + (x + 1) + (y + 0) * m_nb_face_x;
155 face_uids[3] = m_base_offset + (x + 0) + (y + 0) * m_nb_face_x;
165 Int64 m_nb_face_dir_x;
172 class NodeUniqueIdComputer3D
176 NodeUniqueIdComputer3D(Int64 base_offset, Int64 nb_node_x, Int64 nb_node_xy)
177 : m_base_offset(base_offset)
178 , m_nb_node_x(nb_node_x)
179 , m_nb_node_xy(nb_node_xy)
184 Int64 compute(Int64 x, Int64 y, Int64 z)
186 return m_base_offset + x + y * m_nb_node_x + z * m_nb_node_xy;
189 std::array<Int64, 8> computeForCell(Int64 x, Int64 y, Int64 z)
191 std::array<Int64, 8> node_uids;
192 node_uids[0] = compute(x + 0, y + 0, z + 0);
193 node_uids[1] = compute(x + 1, y + 0, z + 0);
194 node_uids[2] = compute(x + 1, y + 1, z + 0);
195 node_uids[3] = compute(x + 0, y + 1, z + 0);
196 node_uids[4] = compute(x + 0, y + 0, z + 1);
197 node_uids[5] = compute(x + 1, y + 0, z + 1);
198 node_uids[6] = compute(x + 1, y + 1, z + 1);
199 node_uids[7] = compute(x + 0, y + 1, z + 1);
214 class CellUniqueIdComputer3D
218 CellUniqueIdComputer3D(Int64 base_offset, Int64 all_nb_cell_x, Int64 all_nb_cell_xy)
219 : m_base_offset(base_offset)
220 , m_all_nb_cell_x(all_nb_cell_x)
221 , m_all_nb_cell_xy(all_nb_cell_xy)
227 Int64 compute(Int64 x, Int64 y, Int64 z)
229 return m_base_offset + x + y * m_all_nb_cell_x + z * m_all_nb_cell_xy;
232 Int64x3 compute(Int64 unique_id)
234 Int64 uid = unique_id - m_base_offset;
235 Int64 z = uid / m_all_nb_cell_xy;
236 Int64 v = uid - (z * m_all_nb_cell_xy);
237 Int64 y = v / m_all_nb_cell_x;
238 Int64 x = v % m_all_nb_cell_x;
245 Int64 m_all_nb_cell_x;
246 Int64 m_all_nb_cell_xy;
253 class FaceUniqueIdComputer3D
257 FaceUniqueIdComputer3D(Int64 base_offset, Int64 nb_cell_x, Int64 nb_face_x,
Int64x3 nb_face_dir,
258 Int64 total_nb_face_xy, Int64 total_nb_face_x)
259 : m_base_offset(base_offset)
260 , m_nb_cell_x(nb_cell_x)
261 , m_nb_face_x(nb_face_x)
262 , m_nb_face_dir(nb_face_dir)
263 , m_total_nb_face_xy(total_nb_face_xy)
264 , m_total_nb_face_x(total_nb_face_x)
270 std::array<Int64, 6> computeForCell(Int64 x, Int64 y, Int64 z)
272 std::array<Int64, 6> face_uids;
275 face_uids[0] = (x + 0) + ((y + 0) * m_nb_cell_x) + ((z + 0) * m_nb_face_dir.z) + m_total_nb_face_xy;
276 face_uids[3] = (x + 0) + ((y + 0) * m_nb_cell_x) + ((z + 1) * m_nb_face_dir.z) + m_total_nb_face_xy;
279 face_uids[1] = (x + 0) + ((y + 0) * m_nb_face_x) + ((z + 0) * m_nb_face_dir.x);
280 face_uids[4] = (x + 1) + ((y + 0) * m_nb_face_x) + ((z + 0) * m_nb_face_dir.x);
283 face_uids[2] = (x + 0) + ((y + 0) * m_nb_cell_x) + ((z + 0) * m_nb_face_dir.y) + m_total_nb_face_x;
284 face_uids[5] = (x + 0) + ((y + 1) * m_nb_cell_x) + ((z + 0) * m_nb_face_dir.y) + m_total_nb_face_x;
286 for (Int32 i = 0; i < 6; ++i)
287 face_uids[i] += m_base_offset;
298 Int64 m_total_nb_face_xy;
299 Int64 m_total_nb_face_x;
338 NodeUniqueIdComputer2D getNodeComputer2D(Int64 offset)
const
340 return { offset, m_nb_node.x };
343 NodeUniqueIdComputer3D getNodeComputer3D(Int64 offset)
const
345 return { offset, m_nb_node.x, m_nb_node.x * m_nb_node.y };
348 CellUniqueIdComputer2D getCellComputer2D(Int64 offset)
const
350 return { offset, m_nb_cell.x };
353 CellUniqueIdComputer3D getCellComputer3D(Int64 offset)
const
355 return { offset, m_nb_cell.x, m_nb_cell.x * m_nb_cell.y };
358 FaceUniqueIdComputer2D getFaceComputer2D(Int64 offset)
const
360 Int64x3 nb_face_dir = nbFaceParallelToDirection();
361 return { offset, m_nb_cell.x, m_nb_face.x, nb_face_dir.x };
364 FaceUniqueIdComputer3D getFaceComputer3D(Int64 offset)
const
366 Int64x3 nb_face_dir = nbFaceParallelToDirection();
367 Int64 total_nb_face_xy = (nb_face_dir.x + nb_face_dir.y) * m_nb_cell.z;
368 Int64 total_nb_face_x = (nb_face_dir.x * m_nb_cell.z);
369 return { offset, m_nb_cell.x, m_nb_face.x, nb_face_dir, total_nb_face_xy, total_nb_face_x };
381 Int64x3 m_nb_face_oriented;
383 Int64 m_nb_cell_xy = 0;
384 Int64 m_total_nb_cell = 0;