8 #include "unittests_common.hh"
12 void PolyhedralMeshBase::generatePolyhedralMesh(
PolyhedralMesh& _mesh) {
14 Vec3d p1(0.0, 0.0, 0.0);
15 Vec3d p2(1.0, 0.0, 0.0);
16 Vec3d p3(1.0, 1.0, 0.0);
17 Vec3d p4(0.0, 1.0, 0.0);
19 Vec3d p5(0.0, 0.0, 1.0);
20 Vec3d p6(1.0, 0.0, 1.0);
21 Vec3d p7(1.0, 1.0, 1.0);
22 Vec3d p8(0.0, 1.0, 1.0);
24 Vec3d p9(0.0, 0.0, 2.0);
25 Vec3d p10(1.0, 0.0, 2.0);
26 Vec3d p11(1.0, 1.0, 2.0);
27 Vec3d p12(0.0, 1.0, 2.0);
44 std::vector<VertexHandle> vertices;
45 vertices.push_back(v1); vertices.push_back(v2);
46 vertices.push_back(v3); vertices.push_back(v4);
47 FaceHandle f1 = _mesh.add_face(vertices);
50 vertices.push_back(v5); vertices.push_back(v6);
51 vertices.push_back(v7); vertices.push_back(v8);
52 FaceHandle f2 = _mesh.add_face(vertices);
55 vertices.push_back(v2); vertices.push_back(v6);
56 vertices.push_back(v7); vertices.push_back(v3);
57 FaceHandle f3 = _mesh.add_face(vertices);
60 vertices.push_back(v1); vertices.push_back(v4);
61 vertices.push_back(v8); vertices.push_back(v5);
62 FaceHandle f4 = _mesh.add_face(vertices);
65 vertices.push_back(v4); vertices.push_back(v3);
66 vertices.push_back(v7); vertices.push_back(v8);
67 FaceHandle f5 = _mesh.add_face(vertices);
70 vertices.push_back(v6); vertices.push_back(v5);
71 vertices.push_back(v1); vertices.push_back(v2);
72 FaceHandle f6 = _mesh.add_face(vertices);
75 std::vector<HalfFaceHandle> halffaces;
76 halffaces.push_back(_mesh.halfface_handle(f1, 1)); halffaces.push_back(_mesh.halfface_handle(f2, 0));
77 halffaces.push_back(_mesh.halfface_handle(f3, 1)); halffaces.push_back(_mesh.halfface_handle(f4, 1));
78 halffaces.push_back(_mesh.halfface_handle(f5, 1)); halffaces.push_back(_mesh.halfface_handle(f6, 0));
79 _mesh.add_cell(halffaces);
82 vertices.push_back(v9); vertices.push_back(v10);
83 vertices.push_back(v11); vertices.push_back(v12);
84 FaceHandle f7 = _mesh.add_face(vertices);
87 vertices.push_back(v10); vertices.push_back(v11);
88 vertices.push_back(v7); vertices.push_back(v6);
89 FaceHandle f8 = _mesh.add_face(vertices);
92 vertices.push_back(v5); vertices.push_back(v8);
93 vertices.push_back(v12); vertices.push_back(v9);
94 FaceHandle f9 = _mesh.add_face(vertices);
97 vertices.push_back(v8); vertices.push_back(v7);
98 vertices.push_back(v11); vertices.push_back(v12);
99 FaceHandle f10 = _mesh.add_face(vertices);
102 vertices.push_back(v10); vertices.push_back(v9);
103 vertices.push_back(v5); vertices.push_back(v6);
104 FaceHandle f11 = _mesh.add_face(vertices);
107 halffaces.push_back(_mesh.halfface_handle(f2, 1)); halffaces.push_back(_mesh.halfface_handle(f7, 0));
108 halffaces.push_back(_mesh.halfface_handle(f8, 1)); halffaces.push_back(_mesh.halfface_handle(f9, 1));
109 halffaces.push_back(_mesh.halfface_handle(f10, 1)); halffaces.push_back(_mesh.halfface_handle(f11, 0));
110 _mesh.add_cell(halffaces);
113 void HexahedralMeshBase::generateHexahedralMesh(
HexahedralMesh& _mesh) {
115 Vec3d p1(0.0, 0.0, 0.0);
116 Vec3d p2(1.0, 0.0, 0.0);
117 Vec3d p3(1.0, 1.0, 0.0);
118 Vec3d p4(0.0, 1.0, 0.0);
120 Vec3d p5(0.0, 0.0, 1.0);
121 Vec3d p6(1.0, 0.0, 1.0);
122 Vec3d p7(1.0, 1.0, 1.0);
123 Vec3d p8(0.0, 1.0, 1.0);
125 Vec3d p9(0.0, 0.0, 2.0);
126 Vec3d p10(1.0, 0.0, 2.0);
127 Vec3d p11(1.0, 1.0, 2.0);
128 Vec3d p12(0.0, 1.0, 2.0);
145 std::vector<VertexHandle> vertices;
146 vertices.push_back(v1); vertices.push_back(v2);
147 vertices.push_back(v3); vertices.push_back(v4);
148 FaceHandle f0 = _mesh.add_face(vertices);
151 vertices.push_back(v5); vertices.push_back(v6);
152 vertices.push_back(v7); vertices.push_back(v8);
153 FaceHandle f1 = _mesh.add_face(vertices);
156 vertices.push_back(v2); vertices.push_back(v6);
157 vertices.push_back(v7); vertices.push_back(v3);
158 FaceHandle f2 = _mesh.add_face(vertices);
161 vertices.push_back(v1); vertices.push_back(v5);
162 vertices.push_back(v8); vertices.push_back(v4);
163 FaceHandle f3 = _mesh.add_face(vertices);
166 vertices.push_back(v1); vertices.push_back(v2);
167 vertices.push_back(v6); vertices.push_back(v5);
168 FaceHandle f4 = _mesh.add_face(vertices);
171 vertices.push_back(v4); vertices.push_back(v3);
172 vertices.push_back(v7); vertices.push_back(v8);
173 FaceHandle f5 = _mesh.add_face(vertices);
176 std::vector<HalfFaceHandle> halffaces;
177 halffaces.push_back(_mesh.halfface_handle(f0, 1)); halffaces.push_back(_mesh.halfface_handle(f1, 0));
178 halffaces.push_back(_mesh.halfface_handle(f2, 1)); halffaces.push_back(_mesh.halfface_handle(f3, 0));
179 halffaces.push_back(_mesh.halfface_handle(f4, 0)); halffaces.push_back(_mesh.halfface_handle(f5, 1));
180 _mesh.add_cell(halffaces);
183 vertices.push_back(v9); vertices.push_back(v10);
184 vertices.push_back(v11); vertices.push_back(v12);
185 FaceHandle f6 = _mesh.add_face(vertices);
188 vertices.push_back(v6); vertices.push_back(v10);
189 vertices.push_back(v11); vertices.push_back(v7);
190 FaceHandle f7 = _mesh.add_face(vertices);
193 vertices.push_back(v5); vertices.push_back(v9);
194 vertices.push_back(v12); vertices.push_back(v8);
195 FaceHandle f8 = _mesh.add_face(vertices);
198 vertices.push_back(v5); vertices.push_back(v6);
199 vertices.push_back(v10); vertices.push_back(v9);
200 FaceHandle f9 = _mesh.add_face(vertices);
203 vertices.push_back(v8); vertices.push_back(v7);
204 vertices.push_back(v11); vertices.push_back(v12);
205 FaceHandle f10 = _mesh.add_face(vertices);
208 halffaces.push_back(_mesh.halfface_handle(f1, 1)); halffaces.push_back(_mesh.halfface_handle(f6, 0));
209 halffaces.push_back(_mesh.halfface_handle(f7, 1)); halffaces.push_back(_mesh.halfface_handle(f8, 0));
210 halffaces.push_back(_mesh.halfface_handle(f9, 0)); halffaces.push_back(_mesh.halfface_handle(f10, 1));
211 _mesh.add_cell(halffaces);
virtual VertexHandle add_vertex()
Override of empty add_vertex function.