v0.16.3
Loading...
Searching...
No Matches
mesh_reconstruction.cpp
Go to the documentation of this file.
1/** \file mesh_reconstruction.cpp
2 * \example mesh_reconstruction.cpp
3 */
4#include <MoFEM.hpp>
5#include <iomanip>
6#include "HybridProblem.hpp"
7
8using namespace MoFEM;
9
10struct Example {
13 currentPtr = std::make_unique<Mesh>();
15
18 CHKERR saveStage(*currentPtr, "01_sphere", false);
19
21 CHKERR saveStage(*currentPtr, "02_partitioned", false);
22
24 CHKERR saveStage(*currentPtr, "03_distributed", true);
25
26 for (PetscInt step = 1; step <= stretchSteps; ++step) {
27 CHKERR deformMesh(step);
28 CHKERR saveStage(*currentPtr, "04_ellipsoid", true, step);
29
31 CHKERR saveStage(*currentPtr, "05_reconstructed", false, step);
32
34 CHKERR saveStage(*currentPtr, "06_synchronised", true, step);
35 }
36 MOFEM_LOG("WORLD", Sev::inform)
37 << "Completed " << stretchSteps << " stretch/reconstruction steps";
39 }
40
41private:
42 // Keep each MOAB database alive until its MoFEM interfaces are destroyed.
43 // Keep entity handles stable across reconstruction for DM/storage reuse.
54 std::unique_ptr<Mesh> currentPtr;
56 PetscInt stretchSteps = 10;
57 PetscInt hybridOrder = 2;
58 double twistDegrees = 60;
61 std::array<double, 3> scale{2, 1, .75};
62 std::string script;
63
64 // Complete rank-local work before deciding collectively whether to continue.
67 int error;
68 CHKERR MPI_Allreduce(&local_error, &error, 1, MPI_INT, MPI_MAX,
69 currentPtr->field.get_comm());
70 if (error)
71 SETERRQ(currentPtr->field.get_comm(), error,
72 "Mesh stage failed on an MPI rank");
74 }
75
78 currentPtr->field.getInterface<JsonConfigManager>();
79 char file[PETSC_MAX_PATH_LEN] = "sphere.py";
80 CHKERR PetscOptionsGetString(nullptr, nullptr, "-sdf_file", file,
81 sizeof(file), nullptr);
82 script = file;
83 CHKERR PetscOptionsGetInt(nullptr, nullptr, "-hybrid_order", &hybridOrder,
84 nullptr);
85 if (hybridOrder < 1)
86 SETERRQ(currentPtr->field.get_comm(), MOFEM_INVALID_DATA,
87 "hybrid_order must be positive");
88 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-twist_degrees",
89 &twistDegrees, nullptr);
90 if (!std::isfinite(twistDegrees))
91 SETERRQ(currentPtr->field.get_comm(), MOFEM_INVALID_DATA,
92 "twist_degrees must be finite");
93 CHKERR PetscOptionsGetInt(nullptr, nullptr, "-stretch_steps", &stretchSteps,
94 nullptr);
95 if (stretchSteps < 1)
96 SETERRQ(currentPtr->field.get_comm(), MOFEM_INVALID_DATA,
97 "stretch_steps must be positive");
98 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-cell_size",
99 &settings.cellSize, nullptr);
100 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-facet_size",
101 &settings.facetSize, nullptr);
102 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-facet_distance",
103 &settings.facetDistance, nullptr);
104 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-bounding_radius",
105 &settings.radius, nullptr);
106 for (int d = 0; d != 3; ++d) {
107 const std::string option = std::string("-scale_") + "xyz"[d];
108 CHKERR PetscOptionsGetReal(nullptr, nullptr, option.c_str(), &scale[d],
109 nullptr);
110 if (!std::isfinite(scale[d]) || scale[d] <= 0)
111 SETERRQ(currentPtr->field.get_comm(), MOFEM_INVALID_DATA,
112 "Scaling must be positive");
113 }
115 }
116
119 if (currentPtr->field.get_comm_rank())
122 CHKERR sdf.sdfInit(script);
123 auto cgal = currentPtr->field.getInterface<CGALInterface>();
125 sphere, [&](const auto &point) { return sdf.value(point); }, settings);
126 EntityHandle volume, surface;
127 CHKERR cgal->importMesh(sphere, BitRefLevel().set(0), currentPtr->entities,
128 volume, surface);
129 const int owner = 0;
130 auto *pc =
131 ParallelComm::get_pcomm(&currentPtr->field.get_moab(), MYPCOMM_INDEX);
132 CHKERR currentPtr->field.get_moab().tag_clear_data(
133 pc->part_tag(), currentPtr->entities, &owner);
135 }
136
139 CHKERR currentPtr->hybrid.prepareUpdate();
140 currentPtr->sharingReady = false;
141 currentPtr->registrationChanged = true;
142 auto comm = currentPtr->field.getInterface<CommInterface>();
144 EntityHandle volume, surface;
145 MoFEMErrorCode error = 0;
146 if (currentPtr->field.get_comm_rank())
147 error = currentPtr->field.getInterface<CGALInterface>()->importMesh(
148 sphere, BitRefLevel().set(0), currentPtr->entities, volume, surface);
149 CHKERR agree(error);
150 const int initial_owner = 0;
151 auto &mb = currentPtr->field.get_moab();
152 auto *pc = ParallelComm::get_pcomm(&mb, MYPCOMM_INDEX);
153 CHKERR mb.tag_clear_data(pc->part_tag(), currentPtr->entities,
154 &initial_owner);
155 CHKERR comm->partitionMesh(currentPtr->entities.subset_by_type(MBTET), 3, 2,
156 currentPtr->field.get_comm_size(), nullptr,
157 nullptr, nullptr, QUIET, false, true);
161 }
162
168
169 MoFEMErrorCode deformMesh(PetscInt step) {
171 auto &mb = currentPtr->field.get_moab();
172 const double before = static_cast<double>(step - 1) / stretchSteps;
173 const double after = static_cast<double>(step) / stretchSteps;
174 std::array<double, 3> old_scale, new_scale;
175 for (int d = 0; d != 3; ++d) {
176 old_scale[d] = 1. + before * (scale[d] - 1.);
177 new_scale[d] = 1. + after * (scale[d] - 1.);
178 }
179 // Relative twist between the original unit sphere's x=-1 and x=+1 planes.
180 const double angle_increment =
181 .5 * twistDegrees * std::acos(-1.) / 180. / stretchSteps;
182 for (auto vertex : currentPtr->entities.subset_by_type(MBVERTEX)) {
183 std::array<double, 3> x;
184 CHKERR mb.get_coords(&vertex, 1, x.data());
185 for (int d = 0; d != 3; ++d)
186 x[d] /= old_scale[d];
187 const double angle = angle_increment * x[0];
188 const double c = std::cos(angle), s = std::sin(angle);
189 const std::array<double, 3> rotated{x[0], c * x[1] - s * x[2],
190 s * x[1] + c * x[2]};
191 for (int d = 0; d != 3; ++d)
192 x[d] = new_scale[d] * rotated[d];
193 CHKERR mb.set_coords(&vertex, 1, x.data());
194 }
196 }
197
198 static auto cellKeys(const TetMeshData &mesh) {
199 std::set<std::array<int, 4>> keys;
200 for (const auto &cell : mesh.cells) {
201 std::array<int, 4> ids;
202 for (int d = 0; d != 4; ++d)
203 ids[d] = mesh.vertexIds[cell[d]];
204 std::sort(ids.begin(), ids.end());
205 keys.insert(ids);
206 }
207 return keys;
208 }
209
210 static auto skinKeys(const TetMeshData &mesh) {
211 std::map<std::array<int, 3>, int> incidence;
212 for (const auto &cell : mesh.cells)
213 for (int opposite = 0; opposite != 4; ++opposite) {
214 std::array<int, 3> face;
215 int n = 0;
216 for (int d = 0; d != 4; ++d)
217 if (d != opposite)
218 face[n++] = mesh.vertexIds[cell[d]];
219 std::sort(face.begin(), face.end());
220 ++incidence[face];
221 }
222 std::set<std::array<int, 3>> skin;
223 for (const auto &[face, count] : incidence)
224 if (count == 1)
225 skin.insert(face);
226 return skin;
227 }
228
231 if (!currentPtr->field.get_comm_rank()) {
232 currentPtr->field.getInterface<CGALInterface>()
233 ->getTools()
235 auto changes = [](const auto &before, const auto &after) {
236 const auto retained =
237 std::count_if(before.begin(), before.end(),
238 [&](const auto &key) { return after.count(key); });
239 return std::make_pair(before.size() - retained,
240 after.size() - retained);
241 };
242 const auto cells = changes(cellKeys(sourceMesh), cellKeys(reconstructed));
243 const auto skin = changes(skinKeys(sourceMesh), skinKeys(reconstructed));
244 MOFEM_LOG("WORLD", Sev::inform)
245 << "Step " << step << "/" << stretchSteps << ": tetrahedra removed "
246 << cells.first << ", added " << cells.second
247 << "; skin triangles removed " << skin.first << ", added "
248 << skin.second;
249 }
251 }
252
255 CHKERR currentPtr->hybrid.prepareUpdate();
256 auto source_comm = currentPtr->field.getInterface<CommInterface>();
257 auto output_comm = currentPtr->field.getInterface<CommInterface>();
258 CHKERR source_comm->gatherMesh(currentPtr->entities.subset_by_type(MBTET),
259 sourceMesh);
261 CHKERR output_comm->broadcastMesh(sourceMesh);
262 CHKERR output_comm->broadcastMesh(reconstructed);
263
264 // Keep surviving handles and the parent DM; discard only older lineage.
266 currentPtr->activeBit = BitRefLevel().set(1);
267 currentPtr->sharingReady = false;
268 currentPtr->registrationChanged = true;
269 auto cgal = currentPtr->field.getInterface<CGALInterface>();
270 EntityHandle volume, surface;
271 CHKERR agree(cgal->importMesh(sourceMesh, BitRefLevel().set(0),
272 sourceLineage, volume, surface));
273 CHKERR agree(cgal->importMesh(reconstructed, BitRefLevel().set(1),
274 currentPtr->entities, volume, surface));
276 currentPtr->field.getInterface<MeshRefinement>()->setTopologicalParents(
277 sourceLineage, currentPtr->entities, BitRefLevel().set(1)));
279 output_comm->inheritPartitions(sourceLineage, currentPtr->entities));
284 }
285
286 // Detach obsolete registration before importing into the persistent database.
287 // Full indexed descriptions are still broadcast; this is not delta transport.
290 auto &field = currentPtr->field;
291 auto &mb = field.get_moab();
292 Range geometry;
293 CHKERR mb.get_entities_by_handle(0, geometry);
294 geometry = subtract(geometry, geometry.subset_by_type(MBENTITYSET));
295 // Surviving handles keep their field DOFs. Obsolete lineage is removed
296 // below; the hybrid update prunes field/FE membership to the active set.
297 // BitRefManager's setters add bits. Clear the previous active selector
298 // before assigning this step's source/output bits to surviving handles.
299 const BitRefLevel no_bits;
300 CHKERR mb.tag_clear_data(field.get_basic_entity_data_ptr()->th_RefBitLevel,
301 geometry, &no_bits);
302 const EntityHandle no_parent = 0;
303 CHKERR mb.tag_clear_data(
304 field.getInterface<BitRefManager>()->get_th_RefParentHandle(), geometry,
305 &no_parent);
306 auto *pc = ParallelComm::get_pcomm(&mb, MYPCOMM_INDEX);
307 const unsigned char unshared = 0;
308 CHKERR mb.tag_clear_data(pc->pstatus_tag(), geometry, &unshared);
309 for (auto tag : {pc->sharedp_tag(), pc->sharedps_tag(), pc->sharedh_tag(),
310 pc->sharedhs_tag()}) {
311 const auto error = mb.tag_delete_data(tag, geometry);
312 if (error != MB_SUCCESS && error != MB_TAG_NOT_FOUND)
313 CHKERR error;
314 }
315 Range sets = pc->interface_sets();
316 sets.merge(pc->partition_sets());
317 CHKERR mb.delete_entities(sets);
318 // Recreating this registry clears MOAB's private shared-entity table too.
319 // The mesh, MoFEM core and parent DM remain alive.
320 delete pc;
321 int id = -1;
322 pc = new ParallelComm(&mb, field.get_comm(), &id);
323 if (id != MYPCOMM_INDEX)
324 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
325 "Unexpected ParallelComm index after resetting sharing");
326 CHKERR deleteGeometry(subtract(geometry, currentPtr->entities));
327 sourceLineage.clear();
329 }
330
333 if (remove.empty())
335 auto &field = currentPtr->field;
336 auto &mb = field.get_moab();
337 CHKERR field.remove_ents(remove, QUIET);
338 Range sets;
339 CHKERR mb.get_entities_by_type(0, MBENTITYSET, sets);
340 for (auto set : sets)
341 CHKERR mb.remove_entities(set, remove);
342 for (int dim = 3; dim >= 0; --dim) {
343 const auto batch = remove.subset_by_dimension(dim);
344 if (!batch.empty())
345 CHKERR mb.delete_entities(batch);
346 }
348 }
349
353 auto trim_lineage = [&]() {
355 if (!currentPtr->field.get_comm_rank())
357 auto &field = currentPtr->field;
358 auto &mb = field.get_moab();
359 Range needed = currentPtr->entities;
360 const auto parent_tag =
361 field.getInterface<BitRefManager>()->get_th_RefParentHandle();
362 for (auto entity : currentPtr->entities) {
363 EntityHandle parent = 0;
364 CHKERR mb.tag_get_data(parent_tag, &entity, 1, &parent);
365 if (parent)
366 needed.insert(parent);
367 }
368 for (int dim = 2; dim >= 0; --dim) {
370 CHKERR mb.get_adjacencies(needed.subset_by_dimension(dim + 1), dim,
371 false, closure, moab::Interface::UNION);
372 needed.merge(closure);
373 }
374 const auto remove = subtract(sourceLineage, needed);
375 if (remove.empty())
377 CHKERR deleteGeometry(remove);
378 sourceLineage = intersect(sourceLineage, needed);
380 };
381 CHKERR agree(trim_lineage());
383 }
384
387 auto &field = mesh.field;
388 auto &mb = field.get_moab();
389 auto *pc = ParallelComm::get_pcomm(&mb, MYPCOMM_INDEX);
390 if (!mesh.sharingReady) {
391 CHKERR mesh.hybrid.prepareUpdate();
392 auto retain = [&]() {
394 if (!field.get_comm_rank())
396 const auto cells = mesh.entities.subset_by_type(MBTET);
397 Range owned, vertices, halo;
398 for (auto cell : cells) {
399 int owner;
400 CHKERR mb.tag_get_data(pc->part_tag(), &cell, 1, &owner);
401 if (owner == field.get_comm_rank())
402 owned.insert(cell);
403 }
404 CHKERR mb.get_connectivity(owned, vertices, true);
405 CHKERR mb.get_adjacencies(vertices, 3, false, halo,
406 moab::Interface::UNION);
407 // A reconstructed face inherits its representative parent's owner.
408 // That rank need not own either incident output cell. Keep both cells
409 // for every preferred-owned face as well as the owned-cell halo.
410 Range owned_faces, face_cells;
411 for (auto face : mesh.entities.subset_by_type(MBTRI)) {
412 int owner;
413 CHKERR mb.tag_get_data(pc->part_tag(), &face, 1, &owner);
414 if (owner == field.get_comm_rank())
415 owned_faces.insert(face);
416 }
417 CHKERR mb.get_adjacencies(owned_faces, 3, false, face_cells,
418 moab::Interface::UNION);
419 halo.merge(face_cells);
420 // Select only the active reconstruction, never inactive lineage cells.
421 halo = intersect(halo, cells);
422 for (int dim : {0, 1, 2}) {
424 CHKERR mb.get_adjacencies(halo.subset_by_type(MBTET), dim, false,
425 closure, moab::Interface::UNION);
426 halo.merge(closure);
427 }
428 Range protected_entities = preserve;
429 protected_entities.merge(halo);
430 CHKERR field.getInterface<CommInterface>()->retainPartition(
431 mesh.entities, mesh.activeBit, protected_entities);
432 mesh.entities = halo;
434 };
435 CHKERR agree(retain());
436 CHKERR field.getInterface<BitRefManager>()->setBitRefLevel(
437 mesh.entities, mesh.activeBit, false);
438 CHKERR field.getInterface<CommInterface>()->synchroniseByConnectivity(
439 mesh.entities, 0);
440 mesh.sharingReady = true;
441 }
442 int owned = 0, invalid = 0;
443 for (auto cell : mesh.entities.subset_by_type(MBTET)) {
444 int owner;
445 unsigned char status;
446 CHKERR mb.tag_get_data(pc->part_tag(), &cell, 1, &owner);
447 CHKERR pc->get_pstatus(cell, status);
448 owned += owner == field.get_comm_rank();
449 invalid += owner != field.get_comm_rank() && !(status & PSTATUS_GHOST);
450 }
451 int global_owned, root_cells = mesh.entities.num_of_type(MBTET);
452 CHKERR MPI_Allreduce(&owned, &global_owned, 1, MPI_INT, MPI_SUM,
453 field.get_comm());
454 CHKERR MPI_Bcast(&root_cells, 1, MPI_INT, 0, field.get_comm());
455 auto testing_ptr = field.getInterface<TestingInterface>();
456 const auto zero = TestingInterface::Tolerance{0, 0};
457 CHKERR testing_ptr->checkValue<TestType::SCALAR>(
458 "root retains every owned cell", root_cells, global_owned, zero);
459 CHKERR testing_ptr->checkValue<TestType::SCALAR>(
460 "off-partition residents are ghost cells", invalid, 0, zero);
461 CHKERR pc->check_all_shared_handles();
463 }
464
465 MoFEMErrorCode rebuildHybrid(Mesh &mesh, const std::string &tag) {
467 auto &field = mesh.field;
468 auto &mb = field.get_moab();
469 std::vector<std::array<int, 3>> keys;
470 auto find_interior = [&]() {
472 if (field.get_comm_rank())
474 const auto tets = mesh.entities.subset_by_type(MBTET);
476 CHKERR mb.get_adjacencies(tets, 2, true, faces, moab::Interface::UNION);
477 Skinner skinner(&mb);
478 CHKERR skinner.find_skin(0, tets, false, skin);
479 for (auto face : subtract(faces, skin)) {
480 const EntityHandle *conn;
481 int n;
482 std::array<int, 3> ids;
483 CHKERR mb.get_connectivity(face, conn, n, true);
484 CHKERR mb.tag_get_data(mb.globalId_tag(), conn, 3, ids.data());
485 std::sort(ids.begin(), ids.end());
486 keys.push_back(ids);
487 }
488 if (keys.size() > static_cast<size_t>(INT_MAX) / 3)
489 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
490 "Skeleton exceeds MPI count range");
492 };
493 CHKERR agree(find_interior());
494 int count = keys.size();
495 CHKERR MPI_Bcast(&count, 1, MPI_INT, 0, field.get_comm());
496 keys.resize(count);
497 CHKERR MPI_Bcast(keys.data(), 3 * count, MPI_INT, 0, field.get_comm());
498 const std::set<std::array<int, 3>> interior(keys.begin(), keys.end());
499 Range skeleton;
500 auto select_skeleton = [&]() {
502 for (auto face : mesh.entities.subset_by_type(MBTRI)) {
503 const EntityHandle *conn;
504 int n;
505 std::array<int, 3> ids;
506 CHKERR mb.get_connectivity(face, conn, n, true);
507 CHKERR mb.tag_get_data(mb.globalId_tag(), conn, 3, ids.data());
508 std::sort(ids.begin(), ids.end());
509 if (interior.count(ids))
510 skeleton.insert(face);
511 }
513 };
514 CHKERR agree(select_skeleton());
515 CHKERR mesh.hybrid.build(mesh.entities, skeleton, mesh.activeBit,
516 hybridOrder, mesh.registrationChanged);
517 CHKERR mesh.hybrid.validate(mesh.entities, skeleton, hybridOrder, tag);
518 mesh.registrationChanged = false;
520 }
521
522 MoFEMErrorCode saveStage(Mesh &mesh, const char *stage, bool distributed,
523 PetscInt step = 0) {
525 auto &m_field = mesh.field;
526 const auto &entities = mesh.entities;
527 std::ostringstream name;
528 name << stage;
529 if (step)
530 name << "_" << std::setw(4) << std::setfill('0') << step;
531 name << ".h5m";
532 const auto file = name.str();
534 auto write = [&]() {
536 if (!distributed && m_field.get_comm_rank())
538 auto &mb = m_field.get_moab();
539 EntityHandle selection;
540 CHKERR mb.create_meshset(MESHSET_SET, selection);
541 CHKERR mb.add_entities(selection, entities);
542 Tag summary_tag;
543 CHKERR mb.tag_get_handle("FUN3_HYBRID_COUNTS", 5, MB_TYPE_DOUBLE,
544 summary_tag, MB_TAG_SPARSE | MB_TAG_CREAT);
545 CHKERR mb.tag_set_data(summary_tag, &selection, 1,
546 mesh.hybrid.summary.data());
547 auto pc = ParallelComm::get_pcomm(&mb, MYPCOMM_INDEX);
548 auto tag = pc->part_tag();
549 Range parts;
550 CHKERR mb.get_entities_by_type_and_tag(0, MBENTITYSET, &tag, nullptr, 1,
551 parts);
552 CHKERR mb.add_entities(selection, parts);
553 CHKERR mb.write_file(file.c_str(), "MOAB",
554 distributed ? "PARALLEL=WRITE_PART" : "", &selection,
555 1);
556 CHKERR mb.delete_entities(&selection, 1);
558 };
559 CHKERR agree(write());
560 MOFEM_LOG("WORLD", Sev::inform) << "Saved " << file;
562 }
563};
564
565int main(int argc, char *argv[]) {
567 &argc, &argv, nullptr,
568 "Sphere, partition, stretch, twist and reconstruct a mesh\n");
569 try {
571 {
572 CHKERR DMRegister_MoFEM("DMMOFEM");
573 CHKERR Example().run();
574 }
576 }
579 return 0;
580}
CGALInterfaceImpl & owner
std::vector< std::array< EntityHandle, 3 > > faces
Sorted keys.
FaceSet skin
bool angle
Radians between candidate face and target plane.
WorkMesh mesh
std::vector< int > vertices
std::vector< int > parent
bool closure
The face (f0, f1, w) closes a corner at f0 or f1.
std::vector< Cell > cells
unsigned char status
ParentChildKey key
MPI_Comm comm
moab::Interface & mb
Tag tag
ProjectedField & field
Reusable hybrid algebra and graph validation for FUN-3.
std::string name
int main()
@ QUIET
#define CATCH_ERRORS
Catch errors.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_INVALID_DATA
Definition definitions.h:36
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
#define MOFEM_LOG(channel, severity)
Log.
const double c
speed of light (cm/ns)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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 PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Definition sdf.py:1
MoFEM::CoreTmp<-1 > core
Fun3::HybridProblem hybrid
MoFEM::Interface & field
[Example]
Definition plastic.cpp:209
std::unique_ptr< Mesh > currentPtr
TetMeshData reconstructed
MoFEMErrorCode rebuildHybrid(Mesh &mesh, const std::string &tag)
MoFEMErrorCode deleteGeometry(const Range &remove)
MoFEMErrorCode generateSphere()
CGALTools::ImplicitMeshSettings settings
PetscInt stretchSteps
TetMeshData sourceMesh
TetMeshData sphere
MoFEMErrorCode distributeSphere()
MoFEMErrorCode reconstructOnRoot(PetscInt step)
static auto skinKeys(const TetMeshData &mesh)
MoFEMErrorCode reconstructMesh(PetscInt step)
MoFEMErrorCode saveStage(Mesh &mesh, const char *stage, bool distributed, PetscInt step=0)
MoFEMErrorCode run()
static auto cellKeys(const TetMeshData &mesh)
std::string script
MoFEMErrorCode readOptions()
MoFEMErrorCode synchroniseMesh()
MoFEMErrorCode resetMeshForImport()
MoFEMErrorCode deformMesh(PetscInt step)
MoFEMErrorCode partitionSphere()
PetscInt hybridOrder
MoFEMErrorCode agree(MoFEMErrorCode local_error)
MoFEMErrorCode prepareDistributed(Mesh &mesh, const Range &preserve={})
std::array< double, 3 > scale
Retain the parent/sub-DMs, field DOFs and block storage across mesh edits.
Managing BitRefLevels.
Tag get_th_RefParentHandle() const
virtual CGALTools & getTools()=0
virtual MoFEMErrorCode importMesh(const TetMeshData &data, BitRefLevel bit, Range &entities, EntityHandle &volume, EntityHandle &surface)=0
virtual MoFEMErrorCode reconstructDelaunay(const Range &source_entities, BitRefLevel output_bit, Range &entities, CGALTools::ReconstructionMethod method=CGALTools::ReconstructionMethod::PointDelaunay)=0
void createImplicitMesh(TetMeshData &result, const std::function< double(const std::array< double, 3 > &)> &sdf, const ImplicitMeshSettings &settings) const
Managing BitRefLevels.
MoFEMErrorCode inheritPartitions(const Range &source_entities, const Range &child_entities)
MoFEMErrorCode gatherMesh(const Range &cells, TetMeshData &data, int root=0)
MoFEMErrorCode broadcastMesh(TetMeshData &data, int root=0)
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.
Mesh refinement interface.
MoFEMErrorCode setTopologicalParents(const Range &source_entities, const Range &child_entities, const BitRefLevel &output_bit, int verb=QUIET, const std::map< EntityHandle, EntityHandle > &moved_vertices={})
static MoFEMErrorCode initialise()
Definition SDFPython.cpp:84
static MoFEMErrorCode finalise()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.