GCC Code Coverage Report


Directory: ./
File: Core/mpiInfo.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 7 8 87.5%
Branches: 0 0 -%

Line Branch Exec Source
1 // ______ ______ _ _ _____ ______
2 // | ____| ____| | (_)/ ____| | ____|
3 // | |__ | |__ | | _| (___ ___| |__
4 // | __| | __| | | | |\___ \ / __| __|
5 // | | | |____| |____| |____) | (__| |____
6 // |_| |______|______|_|_____/ \___|______|
7 // Finite Elements for Life Sciences and Engineering
8 //
9 // License: LGL2.1 License
10 // FELiScE default license: LICENSE in root folder
11 //
12 // Main authors: J. Foulon & J-F. Gerbeau & V. Martin
13 //
14
15 /*!
16 \file mpiInfo.hpp
17 \brief Contains besic info about mpi things, such as rankProc, petsc communicator, numproc.
18 */
19
20 #ifndef _MPIINFO_HPP
21 #define _MPIINFO_HPP
22
23 // System includes
24
25 // External includes
26 #include <mpi.h>
27
28 // Project includes
29 #include "Core/singleton.hpp"
30 #include "Core/shared_pointers.hpp"
31
32 namespace felisce {
33
34 class MpiInfo
35 : public Singleton<MpiInfo> {
36
37 friend class Singleton<MpiInfo>;
38
39 private:
40 //Disable default copy-constructor and copy-assignement.
41 //If copy-constructor is needed, proper copy of ElementFieldDynamicValueMap has
42 //to be written.
43 MpiInfo(const MpiInfo &);
44 MpiInfo(MpiInfo &);
45 MpiInfo& operator=(const MpiInfo&);
46 MpiInfo& operator=(MpiInfo&);
47
48 protected:
49 458 MpiInfo(const std::size_t /*instanceIndex*/ = 0) {}
50
51 virtual ~MpiInfo()= default;
52 public:
53 /// Pointer definition of MpiInfo
54 FELISCE_CLASS_POINTER_DEFINITION(MpiInfo);
55
56 127414 static MPI_Comm& petscComm() {
57 127414 return instance().m_petscComm;
58 }
59 4520521 static int& rankProc() {
60 4520521 return instance().m_rankProc;
61 }
62 389313 static int& numProc() {
63 389313 return instance().m_numProc;
64 }
65 private:
66 //! Parallel informations
67 MPI_Comm m_petscComm;
68 int m_rankProc;
69 int m_numProc;
70 };
71 }
72 #endif
73