v0.16.3
Loading...
Searching...
No Matches
reconstruct_delaunay.cpp
Go to the documentation of this file.
1/** \file reconstruct_delaunay.cpp
2 * \brief Fixtures and independent H5M checks for the serial reconstruction tool.
3 */
4#include <MoFEM.hpp>
5#include <filesystem>
6#include <numeric>
7using namespace MoFEM;
8
9namespace {
10MoFEMErrorCode require(bool condition, const char *message) {
12 if (!condition)
13 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID, "%s", message);
15}
16
17MoFEMErrorCode fixture(const std::string &variant) {
19 moab::Core mb;
20 MoFEM::CoreTmp<-1> core(mb);
21 MoFEM::Interface &m_field = core;
22 auto sets = m_field.getInterface<MeshsetsManager>();
23 const bool surface_case =
24 variant == "surface" || variant == "folded" || variant == "roundoff";
26 mesh.points = {
27 {-1, 0, 0}, {1, 0, 0}, {0, 1, 0}, {.1, .25, .4}, {.1, .25, -.4}};
28 if (variant == "nonconvex") {
29 mesh.points[3] = {3, 3, 1};
30 mesh.points[4] = {3, 3, -1};
31 }
32 mesh.vertexIds = {1, 2, 3, 4, 5};
33 mesh.cells = {{0, 1, 2, 3}, {0, 1, 2, 4}};
34 if (surface_case) {
35 mesh.points = {{0, 0, 0}, {2, 0, 0}, {1.5, 1, 0}, {0, 1, 0}, {.5, .4, 1}};
36 mesh.cells = {{0, 1, 3, 4}, {1, 2, 3, 4}};
37 }
38 if (variant == "folded")
39 mesh.points[2][2] = -.02;
40 if (variant == "roundoff")
41 mesh.points[2][2] = -3.1803435954086316e-17;
42 if (variant == "edge") {
43 mesh.points[3][2] = 1.;
44 mesh.points[4][2] = -1.;
45 mesh.cells = {{0, 1, 3, 4}, {1, 2, 3, 4}, {2, 0, 3, 4}};
46 }
47 if (variant == "internal") {
48 mesh.points = {{0, 0, 0}, {2, 0, 0}, {1.5, 1, 0},
49 {0, 1, 0}, {.5, .4, 2}, {.5, .4, -2}};
50 mesh.vertexIds = {1, 2, 3, 4, 5, 6};
51 mesh.cells = {{0, 1, 3, 4}, {1, 2, 3, 4}, {0, 1, 3, 5}, {1, 2, 3, 5}};
52 }
54 EntityHandle volume, surface;
55 CHKERR m_field.getInterface<CGALInterface>()->importMesh(
56 mesh, BitRefLevel().set(0), source, volume, surface);
57 const auto vertices = source.subset_by_type(MBVERTEX);
58 const auto cells = source.subset_by_type(MBTET);
59 auto add = [&](int id, CubitBCType type, const std::string &name,
60 const Range &members) {
62 CHKERR sets->addMeshset(type, id, name);
63 const auto set = sets->getCubitMeshsetPtr(id, type)->getMeshset();
64 CHKERR mb.add_entities(set, members);
65 const int value = id + 100;
66 Tag tag;
67 CHKERR mb.tag_get_handle("RECONSTRUCTION_METADATA", 1, MB_TYPE_INTEGER, tag,
68 MB_TAG_SPARSE | MB_TAG_CREAT);
69 CHKERR mb.tag_set_data(tag, &set, 1, &value);
71 };
72 CHKERR add(11, BLOCKSET, "MATERIAL",
73 variant == "materials" ? Range(cells.front(), cells.front())
74 : cells);
75 CHKERR sets->setAttributes(BLOCKSET, 11, {3.25, 7.});
76 CHKERR add(12, BLOCKSET, "OVERLAP", cells);
77 auto face = [&](std::array<int, 3> corners, Range &result) {
79 std::array<EntityHandle, 3> conn;
80 for (int n = 0; n != 3; ++n)
81 conn[n] = vertices[corners[n]];
82 CHKERR mb.get_adjacencies(conn.data(), 3, 2, false, result,
83 moab::Interface::INTERSECT);
84 CHKERR require(result.size() == 1, "Missing fixture face");
86 };
87 Range boundary, side;
88 CHKERR face({0, 1, 3}, boundary);
89 CHKERR face({1, 2, 4}, side);
90 if (variant == "internal") {
91 boundary.clear();
92 side.clear();
93 CHKERR face({0, 1, 4}, boundary);
94 CHKERR face({1, 2, 5}, side);
95 }
96 if (surface_case) {
97 Range other;
98 CHKERR face({1, 2, 3}, other);
99 boundary.merge(other);
100 side = boundary;
101 }
102 CHKERR add(20, BLOCKSET, "BOUNDARY", boundary);
103 Range curve;
104 const EntityHandle endpoints[] = {vertices[variant == "edge" ? 3 : 0],
105 vertices[variant == "edge" ? 4 : 1]};
106 CHKERR mb.get_adjacencies(endpoints, 2, 1, false, curve,
107 moab::Interface::INTERSECT);
108 CHKERR add(21, BLOCKSET, "CURVE", curve);
109 CHKERR add(30, SIDESET, "LOAD", side);
110 if (surface_case) {
111 const auto set = sets->getCubitMeshsetPtr(30, SIDESET)->getMeshset();
112 EntityHandle reverse;
113 CHKERR mb.create_meshset(MESHSET_SET, reverse);
114 CHKERR mb.add_entities(reverse, side);
115 CHKERR mb.remove_entities(set, side);
116 CHKERR mb.add_entities(set, &reverse, 1);
117 Tag sense;
118 const int value = -1;
119 CHKERR mb.tag_get_handle("NEUSET_SENSE", 1, MB_TYPE_INTEGER, sense,
120 MB_TAG_SPARSE | MB_TAG_CREAT);
121 CHKERR mb.tag_set_data(sense, &reverse, 1, &value);
122 }
123 const EntityHandle *conn;
124 int count;
125 Tag orientation;
126 CHKERR mb.tag_get_handle("RECONSTRUCTION_SIDE_ORDER", 3, MB_TYPE_HANDLE,
127 orientation, MB_TAG_SPARSE | MB_TAG_CREAT);
128 for (auto side_entity : side) {
129 CHKERR mb.get_connectivity(side_entity, conn, count, true);
130 CHKERR mb.tag_set_data(orientation, &side_entity, 1, conn);
131 }
132 CHKERR add(40, NODESET, "FIXED", Range(vertices.front(), vertices.front()));
133 if (variant == "crack" || variant == "internal") {
134 Range crack;
135 CHKERR face(variant == "internal" ? std::array<int, 3>{0, 1, 3}
136 : std::array<int, 3>{0, 1, 2},
137 crack);
138 if (variant == "internal") {
139 Range other;
140 CHKERR face({1, 2, 3}, other);
141 crack.merge(other);
142 }
143 CHKERR add(50, BLOCKSET, "CRACK", crack);
144 }
145 if (variant == "missing") {
146 const int zero = 0;
147 const auto vertex = vertices.back();
148 CHKERR mb.tag_set_data(mb.globalId_tag(), &vertex, 1, &zero);
149 }
150 if (variant == "duplicate") {
151 const int duplicate = 1;
152 const auto vertex = vertices.back();
153 CHKERR mb.tag_set_data(mb.globalId_tag(), &vertex, 1, &duplicate);
154 }
155 Tag original_id;
156 CHKERR mb.tag_get_handle("RECONSTRUCTION_ORIGINAL_ID", 1, MB_TYPE_INTEGER,
157 original_id, MB_TAG_SPARSE | MB_TAG_CREAT);
158 for (auto vertex : vertices) {
159 int id;
160 CHKERR mb.tag_get_data(mb.globalId_tag(), &vertex, 1, &id);
161 CHKERR mb.tag_set_data(original_id, &vertex, 1, &id);
162 }
163 if (variant == "raw")
164 CHKERR m_field.getInterface<BitRefManager>()->lambdaBitRefLevel(
165 source, [](EntityHandle, BitRefLevel &bit) { bit.reset(); });
166 // This unrelated level must be excluded from the output mesh. Its ID still
167 // participates in assigning missing input IDs before reconstruction.
168 ReadUtilIface *reader;
169 CHKERR mb.query_interface(reader);
170 EntityHandle unrelated;
171 std::vector<double *> x;
172 CHKERR reader->get_node_coords(3, 1, 0, unrelated, x);
173 for (auto array : x)
174 array[0] = 4.;
175 const int id = 100;
176 CHKERR mb.tag_set_data(mb.globalId_tag(), &unrelated, 1, &id);
177 CHKERR m_field.getInterface<BitRefManager>()->setEntitiesBitRefLevel(
178 Range(unrelated, unrelated), BitRefLevel().set(7));
179 if (variant == "quadratic") {
180 EntityHandle meshset;
181 CHKERR mb.create_meshset(MESHSET_SET, meshset);
182 CHKERR mb.add_entities(meshset, subtract(source, vertices));
183 CHKERR mb.convert_entities(meshset, true, false, false);
184 CHKERR mb.delete_entities(&meshset, 1);
185 for (auto cell : cells) {
186 CHKERR mb.get_connectivity(cell, conn, count, false);
187 CHKERR require(count == 10, "Expected ten-node fixture tetrahedra");
188 }
189 Range mid_nodes;
190 CHKERR mb.get_connectivity(cells, mid_nodes, false);
191 mid_nodes = subtract(mid_nodes, vertices);
192 for (auto node : mid_nodes) {
193 double xyz[3];
194 CHKERR mb.get_coords(&node, 1, xyz);
195 xyz[0] += 0.25;
196 CHKERR mb.set_coords(&node, 1, xyz);
197 }
198 }
199 CHKERR mb.write_file((variant + ".h5m").c_str(), "MOAB");
201}
202
203MoFEMErrorCode check(const std::string &file, int output_bit,
204 const std::string &fixture_case) {
206 const bool surface_patch = fixture_case == "surface" ||
207 fixture_case == "folded" ||
208 fixture_case == "roundoff";
209 const bool internal_sheet = fixture_case == "internal";
210 const bool triangular_crack = fixture_case == "crack";
211 const int expected_cells =
212 internal_sheet ? 4 : (surface_patch || triangular_crack ? 2 : 3);
213 moab::Core mb;
214 CHKERR mb.load_file(file.c_str());
215 MoFEM::CoreTmp<-1> core(mb);
216 MoFEM::Interface &m_field = core;
217 auto bits = m_field.getInterface<BitRefManager>();
218 auto sets = m_field.getInterface<MeshsetsManager>();
219 Range source, output, unrelated;
220 CHKERR bits->getEntitiesByRefLevel(BitRefLevel().set(0), BitRefLevel().set(),
221 source);
222 CHKERR bits->getEntitiesByRefLevel(BitRefLevel().set(output_bit),
223 BitRefLevel().set(), output);
224 CHKERR bits->getEntitiesByRefLevel(BitRefLevel().set(7), BitRefLevel().set(),
225 unrelated);
226 Range all;
227 CHKERR mb.get_entities_by_handle(0, all);
228 all = subtract(all, all.subset_by_type(MBENTITYSET));
229 CHKERR require((output_bit == 0 || source.empty()) && unrelated.empty() &&
230 all == output &&
231 output.num_of_type(MBTET) == expected_cells,
232 "Saved mesh contains entities outside the output level");
233 Range attached;
234 CHKERR mb.get_connectivity(subtract(output, output.subset_by_type(MBVERTEX)),
235 attached, false);
236 CHKERR require(subtract(attached, output).empty(),
237 "Output omitted attached higher-order nodes");
239 CHKERR mb.get_connectivity(output.subset_by_type(MBTET), vertices, true);
240 std::set<int> ids;
241 std::vector<std::array<double, 3>> original{
242 {-1, 0, 0}, {1, 0, 0}, {0, 1, 0}, {.1, .25, .4}, {.1, .25, -.4}};
243 if (surface_patch)
244 original = {{0, 0, 0}, {2, 0, 0}, {1.5, 1, 0}, {0, 1, 0}, {.5, .4, 1}};
245 if (fixture_case == "folded")
246 original[2][2] = -.02;
247 if (fixture_case == "roundoff")
248 original[2][2] = -3.1803435954086316e-17;
249 if (internal_sheet)
250 original = {{0, 0, 0}, {2, 0, 0}, {1.5, 1, 0},
251 {0, 1, 0}, {.5, .4, 2}, {.5, .4, -2}};
252 CHKERR require(vertices.size() == original.size(),
253 "Output contains missing or unrelated vertices");
254 int n = 0;
255 Tag original_id;
256 CHKERR mb.tag_get_handle("RECONSTRUCTION_ORIGINAL_ID", original_id);
257 for (auto vertex : vertices) {
258 std::array<double, 3> x;
259 int id;
260 CHKERR mb.get_coords(&vertex, 1, x.data());
261 CHKERR mb.tag_get_data(mb.globalId_tag(), &vertex, 1, &id);
262 CHKERR require(x == original[n++] && id > 0 && ids.insert(id).second,
263 "Source coordinates or vertex IDs changed");
264 int previous_id;
265 CHKERR mb.tag_get_data(original_id, &vertex, 1, &previous_id);
266 CHKERR require(
267 previous_id > 0 ? id == previous_id : id == 101,
268 "Valid IDs were renumbered or missing IDs were not assigned");
269 }
270 for (auto cell : output.subset_by_type(MBTET)) {
271 const EntityHandle *conn;
272 int count;
273 std::array<std::array<double, 3>, 4> x;
274 CHKERR mb.get_connectivity(cell, conn, count, true);
275 CHKERR require(count == 4, "Invalid reconstructed tetrahedron");
276 CHKERR mb.get_coords(conn, 4, x[0].data());
277 for (int i = 1; i != 4; ++i)
278 for (int d = 0; d != 3; ++d)
279 x[i][d] -= x[0][d];
280 const double determinant =
281 x[1][0] * (x[2][1] * x[3][2] - x[2][2] * x[3][1]) -
282 x[1][1] * (x[2][0] * x[3][2] - x[2][2] * x[3][0]) +
283 x[1][2] * (x[2][0] * x[3][1] - x[2][1] * x[3][0]);
284 CHKERR require(determinant > 0, "Nonpositive reconstructed tetrahedron");
285 }
286 for (auto entity : output) {
287 const auto type = mb.type_from_handle(entity);
288 if (type == MBEDGE || type == MBTRI) {
289 const EntityHandle *conn;
290 int count;
291 CHKERR mb.get_connectivity(entity, conn, count, true);
292 CHKERR require(count == (type == MBEDGE ? 2 : 3),
293 "Invalid output edge or face");
294 }
295 EntityHandle parent;
297 CHKERR mb.tag_get_data(bits->get_th_RefParentHandle(), &entity, 1, &parent);
298 CHKERR mb.tag_get_data(bits->get_th_RefBitLevel(), &entity, 1, &bit);
299 CHKERR require(!parent && bit == BitRefLevel().set(output_bit),
300 "Output retained ancestry or another bit level");
301 }
302 Tag metadata;
303 CHKERR mb.tag_get_handle("RECONSTRUCTION_METADATA", metadata);
304 Tag name_tag;
305 int name_bytes;
306 CHKERR mb.tag_get_handle("NAME", name_tag);
307 CHKERR mb.tag_get_bytes(name_tag, name_bytes);
308 std::map<int, std::string> expected_names{{11, "MATERIAL"}, {12, "OVERLAP"},
309 {20, "BOUNDARY"}, {21, "CURVE"},
310 {30, "LOAD"}, {40, "FIXED"}};
311 if (internal_sheet || triangular_crack)
312 expected_names.emplace(50, "CRACK");
313 for (auto it = sets->getBegin(); it != sets->getEnd(); ++it) {
314 const int id = it->getMeshsetId();
315 const auto set = it->getMeshset();
316 int value;
317 CHKERR mb.tag_get_data(metadata, &set, 1, &value);
318 CHKERR require(value == id + 100, "Meshset metadata changed");
319 // CubitMeshSets caches names only for BLOCKSETs; inspect the persisted tag
320 // directly for SIDESET/NODESET names as well.
321 std::vector<char> name(name_bytes + 1, 0);
322 CHKERR mb.tag_get_data(name_tag, &set, 1, name.data());
323 CHKERR require(std::string(name.data()) == expected_names.at(id),
324 "Meshset name changed");
325 Range members;
326 CHKERR mb.get_entities_by_handle(set, members, true);
327 CHKERR require(
328 subtract(subtract(members, members.subset_by_type(MBENTITYSET)), output)
329 .empty(),
330 "Meshset contains entities outside the output mesh");
331 members = intersect(members, output);
332 if (id == 11 || id == 12)
333 CHKERR require(members.num_of_type(MBTET) == expected_cells,
334 "Volume/overlapping meshset lost reconstructed cells");
335 else if (id == 20 || id == 30)
336 CHKERR require(members.num_of_type(MBTRI) == (surface_patch ? 2 : 1) &&
337 members.num_of_type(MBTET) == 0,
338 "Surface classification changed");
339 else if (id == 21)
340 CHKERR require(members.num_of_type(MBEDGE) == 1 &&
341 members.num_of_type(MBTRI) == 0 &&
342 members.num_of_type(MBTET) == 0,
343 "Standalone curve membership changed");
344 else if (id == 50)
345 CHKERR require(members.num_of_type(MBTRI) == (triangular_crack ? 1 : 2) &&
346 members.num_of_type(MBTET) == 0,
347 "Internal crack meshset membership changed");
348 else if (id == 40)
349 CHKERR require(members == Range(vertices.front(), vertices.front()),
350 "Explicit nodeset membership changed");
351 }
352 const auto material = sets->getCubitMeshsetPtr(11, BLOCKSET);
353 std::vector<double> attributes;
354 CHKERR material->getAttributes(attributes);
355 CHKERR require(material->getName() == "MATERIAL" &&
356 attributes == std::vector<double>{3.25, 7.},
357 "Meshset names or material attributes changed");
358 Range side;
359 CHKERR mb.get_entities_by_type(
360 sets->getCubitMeshsetPtr(30, SIDESET)->getMeshset(), MBTRI, side, true);
361 Tag order;
362 if (!surface_patch)
363 CHKERR mb.tag_get_handle("RECONSTRUCTION_SIDE_ORDER", order);
364 const auto active_side = intersect(side, output);
365 auto retained_diagonal = [&](EntityHandle face) {
366 const EntityHandle *conn;
367 int count;
368 CHK_MOAB_THROW(mb.get_connectivity(face, conn, count, true),
369 "Read reconstructed face");
370 std::array<EntityHandle, 3> key{conn[0], conn[1], conn[2]};
371 std::sort(key.begin(), key.end());
372 return key == std::array<EntityHandle, 3>{vertices[0], vertices[1],
373 vertices[3]} ||
374 key == std::array<EntityHandle, 3>{vertices[1], vertices[2],
375 vertices[3]};
376 };
377 if (surface_patch) {
378 CHKERR require(
379 std::none_of(active_side.begin(), active_side.end(), retained_diagonal),
380 "Fixture did not change the preserved surface triangulation");
381 Range skin_vertices;
382 CHKERR mb.get_connectivity(active_side, skin_vertices, true);
383 CHKERR require(skin_vertices.size() == 4,
384 "Surface reconstruction changed the preserved node set");
385 const auto set = sets->getCubitMeshsetPtr(30, SIDESET)->getMeshset();
386 Range nested, direct, members;
387 CHKERR mb.get_entities_by_type(set, MBENTITYSET, nested, false);
388 CHKERR mb.get_entities_by_type(set, MBTRI, direct, false);
389 CHKERR require(nested.size() == 1 && direct.empty(),
390 "Sideset hierarchy was flattened into forward membership");
391 const auto reverse = nested.front();
392 Tag sense;
393 int value;
394 CHKERR mb.tag_get_handle("NEUSET_SENSE", sense);
395 CHKERR mb.tag_get_data(sense, &reverse, 1, &value);
396 CHKERR mb.get_entities_by_type(reverse, MBTRI, members);
397 CHKERR require(value == -1 && intersect(members, output) == active_side,
398 "Reverse sideset descendants or sense were lost");
399 }
400 auto normal = [](moab::Interface &mesh, const EntityHandle *nodes,
401 std::array<double, 3> &n) {
403 std::array<std::array<double, 3>, 3> x;
404 CHKERR mesh.get_coords(nodes, 3, x[0].data());
405 for (int d = 0; d != 3; ++d) {
406 x[1][d] -= x[0][d];
407 x[2][d] -= x[0][d];
408 }
409 for (int d = 0; d != 3; ++d)
410 n[d] = x[1][(d + 1) % 3] * x[2][(d + 2) % 3] -
411 x[1][(d + 2) % 3] * x[2][(d + 1) % 3];
413 };
414 std::array<double, 3> source_normal;
415 if (surface_patch) {
416 moab::Core reference;
417 CHKERR reference.load_file((fixture_case + ".h5m").c_str());
418 Tag reference_order;
419 Range original_sides;
420 CHKERR reference.tag_get_handle("RECONSTRUCTION_SIDE_ORDER",
421 reference_order);
422 CHKERR reference.get_entities_by_type_and_tag(0, MBTRI, &reference_order,
423 nullptr, 1, original_sides);
424 std::array<EntityHandle, 3> nodes;
425 const auto face = original_sides.front();
426 CHKERR reference.tag_get_data(reference_order, &face, 1, nodes.data());
427 CHKERR normal(reference, nodes.data(), source_normal);
428 }
429 for (auto face : active_side) {
430 std::array<EntityHandle, 3> expected;
431 const EntityHandle *conn;
432 int count;
433 CHKERR mb.get_connectivity(face, conn, count, true);
434 if (!surface_patch) {
435 CHKERR mb.tag_get_data(order, &face, 1, expected.data());
436 CHKERR require(count == 3 &&
437 std::equal(expected.begin(), expected.end(), conn),
438 "Sideset face orientation changed");
439 } else {
440 std::array<double, 3> a;
441 CHKERR normal(mb, conn, a);
442 CHKERR require(
443 std::inner_product(a.begin(), a.end(), source_normal.begin(), 0.) > 0,
444 "Reconstructed sideset has the wrong orientation");
445 }
446 }
447 if (internal_sheet) {
448 Range faces, new_faces, new_nodes;
449 CHKERR mb.get_entities_by_type(
450 sets->getCubitMeshsetPtr(50, BLOCKSET)->getMeshset(), MBTRI, faces);
451 new_faces = intersect(faces, output);
452 CHKERR mb.get_connectivity(new_faces, new_nodes, true);
453 CHKERR require(
454 new_faces.size() == 2 && new_nodes.size() == 4 &&
455 std::none_of(new_faces.begin(), new_faces.end(),
456 retained_diagonal) &&
457 new_nodes == Range(vertices[0], vertices[3]),
458 "Internal sheet did not preserve its nodes through a diagonal flip");
459 for (auto face : new_faces) {
460 Range cells;
461 CHKERR mb.get_adjacencies(&face, 1, 3, false, cells);
462 CHKERR require(intersect(cells, output).num_of_type(MBTET) == 2,
463 "Reconstructed crack is not an internal surface");
464 }
465 }
466 MOFEM_LOG("WORLD", Sev::inform) << "Verified reconstructed checkpoint";
468}
469
472 {
473 moab::Core mb;
474 MoFEM::CoreTmp<-1> core(mb);
475 core.getInterface<JsonConfigManager>();
476 }
477 char stage[32] = "prepare", output[PETSC_MAX_PATH_LEN] = "reconstructed.h5m";
478 PetscInt output_bit = 0;
479 char fixture_case[32] = "valid";
480 CHKERR PetscOptionsGetString(nullptr, nullptr, "-fixture_case", fixture_case,
481 sizeof(fixture_case), nullptr);
482 CHKERR PetscOptionsGetString(nullptr, nullptr, "-fixture_stage", stage,
483 sizeof(stage), nullptr);
484 CHKERR PetscOptionsGetString(nullptr, nullptr, "-output_file", output,
485 sizeof(output), nullptr);
486 // Level of the saved mesh; the tools squash it to 0 unless -shift false.
487 CHKERR PetscOptionsGetInt(nullptr, nullptr, "-saved_bit", &output_bit,
488 nullptr);
489 if (std::string(stage) == "prepare") {
490 for (const auto &name : {"valid",
491 "missing",
492 "raw",
493 "surface",
494 "internal",
495 "folded",
496 "roundoff",
497 "zero_angle",
498 "quadratic",
499 "repeat",
500 "crack",
501 "edge",
502 "materials",
503 "nonconvex",
504 "duplicate",
505 "occupied",
506 "invalid_bit",
507 "angle",
508 "invalid_angle",
509 "constrained_surface",
510 "constrained_internal",
511 "constrained_crack",
512 "constrained_edge"}) {
513 const auto file = std::string(name) + "_out.h5m";
514 std::filesystem::remove(file);
515 std::filesystem::remove(file + ".tmp.h5m");
516 }
517 for (const auto &variant :
518 {"valid", "missing", "raw", "surface", "internal", "folded",
519 "roundoff", "quadratic", "crack", "edge", "materials", "nonconvex",
520 "duplicate"})
521 CHKERR fixture(variant);
522 } else if (std::string(stage) == "check") {
523 CHKERR check(output, output_bit, fixture_case);
524 } else if (std::string(stage) == "failures") {
525 for (const auto &name :
526 {"crack", "edge", "materials", "nonconvex", "duplicate", "occupied",
527 "invalid_bit", "angle", "invalid_angle", "constrained_edge"})
528 CHKERR require(!std::filesystem::exists(std::string(name) + "_out.h5m"),
529 "Rejected input published an output file");
530 } else {
531 SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA, "Unknown fixture stage");
532 }
534}
535} // namespace
536
537int main(int argc, char *argv[]) {
538 MoFEM::Core::Initialize(&argc, &argv, nullptr,
539 "Serial reconstruction fixture/checkpoint checks\n");
540 try {
541 CHKERR run();
542 }
545 return 0;
546}
std::vector< std::array< EntityHandle, 3 > > faces
Sorted keys.
TetMeshData result
std::vector< int > source
int boundary
FaceSet crack
WorkMesh mesh
std::vector< int > vertices
std::vector< int > parent
std::vector< Cell > cells
ParentChildKey key
moab::Interface & mb
Tag tag
std::vector< double > empty
One value per component.
std::string type
It it
Definition Schur.cpp:2568
std::string name
int main()
constexpr double a
#define CATCH_ERRORS
Catch errors.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ NODESET
@ SIDESET
@ BLOCKSET
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
@ MOFEM_INVALID_DATA
Definition definitions.h:36
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
constexpr int order
#define MOFEM_LOG(channel, severity)
Log.
auto bit
set bit
FTensor::Index< 'i', SPACE_DIM > i
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< 32 > CubitBCType
Definition Types.hpp:52
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
MoFEMErrorCode run(MoFEM::Interface &m_field)
Definition sdf_python.cpp:7
Managing BitRefLevels.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
Deprecated interface functions.
Interface for managing meshsets containing materials and boundary conditions.
std::vector< std::array< double, 3 > > points
Definition CGALTools.hpp:17
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.