v0.16.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
MoFEM::MeshPCommRegistry Struct Reference

#include "src/interfaces/CommInterface.hpp"

Static Public Member Functions

static auto & getMap ()
 
static auto getOrCreate (moab::Core *core_mesh_ptr)
 
static auto getOrCreate (const boost::shared_ptr< moab::Core > &core_mesh_ptr)
 

Detailed Description

Definition at line 16 of file CommInterface.hpp.

Member Function Documentation

◆ getMap()

static auto & MoFEM::MeshPCommRegistry::getMap ( )
inlinestatic

Definition at line 25 of file CommInterface.hpp.

25 {
26 static std::map<moab::Core *, boost::weak_ptr<ParallelComm>> pcomm_map;
27 return pcomm_map;
28 }

◆ getOrCreate() [1/2]

static auto MoFEM::MeshPCommRegistry::getOrCreate ( const boost::shared_ptr< moab::Core > &  core_mesh_ptr)
inlinestatic
Deprecated:
Do not use this function, use getOrCreate(moab::Core*) instead

Definition at line 56 of file CommInterface.hpp.

56 {
57 return MeshPCommRegistry::getOrCreate(core_mesh_ptr.get());
58 }
static auto getOrCreate(moab::Core *core_mesh_ptr)

◆ getOrCreate() [2/2]

static auto MoFEM::MeshPCommRegistry::getOrCreate ( moab::Core *  core_mesh_ptr)
inlinestatic

Definition at line 30 of file CommInterface.hpp.

30 {
31 auto *mesh_ptr = core_mesh_ptr;
32 auto &pcomm_map = getMap();
33
34 if (auto it = pcomm_map.find(mesh_ptr); it != pcomm_map.end()) {
35 if (auto pcomm_ptr = it->second.lock())
36 return pcomm_ptr;
37 }
38
39 if (auto *raw_pcomm = ParallelComm::get_pcomm(mesh_ptr, MYPCOMM_INDEX)) {
40 auto pcomm_ptr = boost::shared_ptr<ParallelComm>(
41 raw_pcomm, [mesh_ptr](ParallelComm *pcomm) {});
42 pcomm_map[mesh_ptr] = pcomm_ptr;
43 return pcomm_ptr;
44 }
45
46 auto pcomm_ptr = boost::shared_ptr<ParallelComm>(
47 new ParallelComm(mesh_ptr, PETSC_COMM_WORLD),
48 [mesh_ptr](ParallelComm *pcomm) {
49 delete pcomm;
50 return;
51 });
52 return pcomm_ptr;
53 }
#define MYPCOMM_INDEX
default communicator number PCOMM

The documentation for this struct was generated from the following file: