CEPS  24.01
Cardiac ElectroPhysiology Simulator
HoldsProcIds.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
31 #pragma once
32 
34 
36 namespace ceps
37 {
46  {
47 
48  public:
49 
51  explicit HoldsProcIds(const CepsProcId& owner, const CepsVector<CepsProcId>& halosPid = {});
52 
54  HoldsProcIds() = default;
55 
57  HoldsProcIds(const HoldsProcIds&) = default;
58 
60  HoldsProcIds(HoldsProcIds&&) noexcept = default;
61 
63  virtual ~HoldsProcIds() = default;
64 
67  operator=(const HoldsProcIds&) = default;
68 
71  operator=(HoldsProcIds&&) noexcept = default;
72 
74  CepsBool
75  isShared() const;
76 
78  void
79  setShared(CepsBool flag);
80 
82  void
83  setOwner(const CepsProcId& pid);
84 
86  const CepsProcId&
87  getOwner() const;
88 
90  void
91  setAsHaloFor(const CepsProcId& pid);
92 
94  CepsBool
95  isHaloFor(const CepsProcId& pid) const;
96 
98  void
99  reset();
100 
101 
102  private:
103 
106 
109 
110  };
111 
112 } // namespace ceps
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
CepsUInt CepsProcId
For CPU indices.
Definition: CepsTypes.hpp:123
Abstract class for objects that contain a CPU Id.
CepsBool isHaloFor(const CepsProcId &pid) const
Detect if this entity is in the halo of.
CepsBool m_isShared
We can know that something is shared, but not by who...
const CepsProcId & getOwner() const
Get owner (processus id) of this entity.
void setShared(CepsBool flag)
Tells if there are halo CPUs.
CepsBool isShared() const
Tells if there are halo CPUs.
CepsVector< CepsProcId > m_procIds
The CPU Ids, first element is owner, other are halos.
HoldsProcIds(HoldsProcIds &&) noexcept=default
Copy constructor.
void setAsHaloFor(const CepsProcId &pid)
Adds pid to the set of halo CPUs
HoldsProcIds()=default
Default constructor.
void setOwner(const CepsProcId &pid)
Set shared between several processes ?
HoldsProcIds(const HoldsProcIds &)=default
Copy constructor.
void reset()
Gives ownership to rank(), removes halos.
A namespace for all utility methods.