CEPS  24.01
Cardiac ElectroPhysiology Simulator
DistributedHaloVector.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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
30 #pragma once
31 
32 
34 
61 {
62 
63  public:
64 
67 
70 
79 
82 
84  void
85  getLocalData() override;
86 
88  void
89  releaseLocalData() override;
90 
102  void
104 
115  void
116  getValues(CepsReal *values, CepsIndex n, const CepsIndex *indices) override;
117 
119  CepsInt
121 
129  CepsReal &
130  operator[](CepsIndex globalIndex) override;
131 
139  CepsReal
140  operator[](CepsIndex globalIndex) const override;
141 
145 
149 
151  void
153 
157  void
158  scale(CepsMathScalar alpha) override;
159 
161  void
162  abs() override;
163 
164 
165  private:
166 
167  void
169 
170 
171  protected:
172 
173  std::map<CepsIndex, CepsIndex> m_globalToLocalMapping;
175 
176  private:
177 
178  PetscVector m_localV;
179 
180 };
181 
183 using DHVecPtr = std::shared_ptr<DistributedHaloVector>;
184 
185 
CepsScalar CepsMathScalar
Real numbers.
Definition: CepsTypes.hpp:133
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
float CepsReal
Need single precision floating point.
Definition: CepsTypes.hpp:100
int32_t CepsInt
Need 32 bit integer.
Definition: CepsTypes.hpp:106
CepsInt CepsIndex
Index rowid etc.
Definition: CepsTypes.hpp:111
std::shared_ptr< DistributedHaloVector > DHVecPtr
Typedef for pointer on Distributed Halo CepsVector.
Extended distributed vectors.
std::map< CepsIndex, CepsIndex > m_globalToLocalMapping
Index mapping.
~DistributedHaloVector() override
Destructor.
void getLocalData() override
Mandatory call before accessing data.
DistributedHaloVector(DistributedHaloVector &v)
Copy constructor.
CepsInt getNbHalo()
number of halo values
DistributedHaloVector(CepsIndex M, CepsIndex m, CepsIndex nbHaloRows, CepsIndex *haloRows)
Constructor.
CepsReal operator[](CepsIndex globalIndex) const override
Array subscription override. Const version.
void scale(CepsMathScalar alpha) override
Multiplies self by alpha.
void getStripeFromNonHalo(DistributedVector &src, CepsInt component, CepsUInt pbDim)
Get data from regular dist vector.
void abs() override
Sets all coeffs to their absolute value.
void getStripe(DistributedHaloVector &u, CepsInt component, CepsUInt pbDim)
Override of DistributedVector::getStripe(...)
DistributedHaloVector & operator=(DistributedVector &v)
Assignment operator.
CepsReal & operator[](CepsIndex globalIndex) override
Array subscription override.
DistributedHaloVector()
Default constructor.
PetscVector m_localV
Local representation of the halo vector.
void releaseLocalData() override
Mandatory call after accessing data.
CepsIndex m_nbHaloRows
Number of halo values that will be received.
DistributedHaloVector & operator=(DistributedHaloVector &v)
Assignment operator.
void getValues(CepsReal *values, CepsIndex n, const CepsIndex *indices) override
Override of parent DistributedVector::getValues(...)
Structure to hold spatially dependant data and distribute it between process.