50 {
51
52
53 const char param_file[] = "param_file.petsc";
55
56
57 auto core_log = logging::core::get();
61 core_log->add_sink(
65
66#ifdef ENABLE_PYTHON_BINDING
67 Py_Initialize();
68 np::initialize();
69 MOFEM_LOG(
"EP", Sev::inform) <<
"Python initialised";
70#else
71 MOFEM_LOG(
"EP", Sev::inform) <<
"Python NOT initialised";
72#endif
73
74 core_log->add_sink(
78
79 try {
80
81
82 PetscBool flg = PETSC_TRUE;
85 255, &flg);
86
87 DMType dm_name = "DMMOFEM";
89 DMType dm_name_mg = "DMMOFEM_MG";
91
92
93 moab::Core moab_core;
94 moab::Interface &moab = moab_core;
95
96 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
97 if (pcomm == NULL)
98 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
99
100 PetscBool fully_distributed = PETSC_FALSE;
102 &fully_distributed, PETSC_NULLPTR);
103 if (fully_distributed) {
104 const char *option;
105 if (pcomm->proc_config().proc_size() == 1)
106 option = "";
107 else
108 option = "PARALLEL=READ_PART;"
109 "PARALLEL_RESOLVE_SHARED_ENTS;"
110 "PARTITION=PARALLEL_PARTITION";
112 } else {
115 }
116
117
120
123 0, 3, bit_level0);
124
125
127
131 auto get_adj = [&](
Range ents,
int dim) {
133 CHKERR moab.get_adjacencies(ents, dim,
false, adj,
134 moab::Interface::UNION);
135 return adj;
136 };
138 *meshset_ptr,
141 2));
143 *meshset_ptr,
146 1));
148 *meshset_ptr,
151 0));
152
153
154 CHKERR ep.createCrackSurfaceMeshset();
155 CHKERR ep.createExchangeVectors(Sev::inform);
156
157 CHKERR ep.projectGeometry();
158 CHKERR ep.addCrackSurfaces(
true);
159 CHKERR ep.projectGeometry();
160 }
162
163
165
166#ifdef ENABLE_PYTHON_BINDING
167 if (Py_FinalizeEx() < 0) {
168 exit(120);
169 }
170#endif
171}
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
MoFEMErrorCode DMRegister_MGViaApproxOrders(const char sname[])
Register DM for Multi-Grid via approximation orders.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
static Range getPartEntities(moab::Interface &moab, int part)
static MoFEMErrorCode loadFileRootProcAllRestDistributed(moab::Interface &moab, const char *file_name, int dim, LoadFileFun proc_skin_fun=defaultProcSkinFun, const char *options="PARALLEL=BCAST;PARTITION=")
Root proc has whole mesh, other procs only part of it.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.