v0.16.3
Loading...
Searching...
No Matches
Functions
comm_parent_child.cpp File Reference

Synchronisation of independently constructed simplicial subdivisions. More...

#include <MoFEM.hpp>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Synchronisation of independently constructed simplicial subdivisions.

Parent tetrahedron i has vertices {1, 2, 3 + 2*i, 4 + 2*i}. All parents share edge {1, 2}, which becomes multishared when several ranks own cells. Each producer inserts vertex 1001 at that edge's midpoint and splits each local parent into two tetrahedra. MeshRefinement records their ancestry; CommInterface must match existing copies and supply missing descendants.

Bit levels 0 and 1 select parents and children. Unrelated vertices on level 7 and reversed creation order make local handles differ between ranks. JSON supplies the coordinate scale; CTest runs this suite on 1, 2 and 4 ranks.

Definition in file comm_parent_child.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Load JSON options and execute the same scenario suite on every MPI rank. Each CTest invocation chooses the communicator size. The suite covers the mesh layouts, concurrent/single producers, repeated calls and collective rejection of inconsistent input. Cross-rank conflicts need at least two ranks.

Definition at line 494 of file comm_parent_child.cpp.

494 {
495 MoFEM::Core::Initialize(&argc, &argv, nullptr,
496 "Parent-child communication checks\n");
497 try {
498 {
499 // Initialise JSON options before reading scale; scenario databases below
500 // are independent and reuse the resulting PETSc options.
501 moab::Core mb;
502 MoFEM::Core core(mb, PETSC_COMM_WORLD);
503 CHKERR core.getInterface<JsonConfigManager>()->getSubInterfaceOptions();
504 }
505 double scale = 0;
506 CHKERR PetscOptionsGetReal(nullptr, nullptr, "-synchronisation_scale",
507 &scale, nullptr);
508 CHKERR require(scale > 0, "JSON must supply synchronisation_scale");
509 int size;
510 CHKERR MPI_Comm_size(PETSC_COMM_WORLD, &size);
511 for (const auto &layout :
512 {"distributed", "replicated", "root_complete", "empty", "all_empty"})
513 CHKERR run(layout, -1, 0, scale);
514 CHKERR run("replicated", 0, 0, scale);
515 CHKERR run("replicated", size - 1, 0, scale);
516 CHKERR run("replicated", -1, 1, scale);
517 if (size > 1) {
518 CHKERR run("replicated", -1, 0, scale, true);
519 for (int invalid = 3; invalid != 7; ++invalid)
520 CHKERR run("replicated", -1, invalid, scale);
521 }
522 }
525 return 0;
526}
std::vector< int > size
moab::Interface & mb
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
double scale
Definition plastic.cpp:124
MoFEMErrorCode run(MoFEM::Interface &m_field)
Definition sdf_python.cpp:7
Core (interface) class.
Definition Core.hpp:83
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