v0.15.5
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 18 of file CommInterface.hpp.

18 {
19 static std::map<moab::Core *, boost::weak_ptr<ParallelComm>> pcomm_map;
20 return pcomm_map;
21 }

◆ 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 49 of file CommInterface.hpp.

49 {
50 return MeshPCommRegistry::getOrCreate(core_mesh_ptr.get());
51 }
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 23 of file CommInterface.hpp.

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

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