CEPS  24.01
Cardiac ElectroPhysiology Simulator
DistributedFactory.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 
36 
38 {
39 public:
40 
43 
45  DistributedFactory (CepsUInt globalRows, CepsUInt globalCols,
46  CepsUInt localRows, CepsUInt localCols,
47  const CepsVector<CepsInt>& diagBlockNnz,
48  const CepsVector<CepsInt>& offdiagBlockNnz);
49 
51  DistributedFactory (CepsUInt globalRows, CepsUInt globalCols,
52  CepsUInt localRows, CepsUInt localCols,
53  CepsUInt diagBlockNz, CepsUInt offdiagBlockNz);
54 
57 
59  void
60  setGlobalSizes (CepsUInt globalRows, CepsUInt globalCols);
61 
63  void
64  setLocalSizes (CepsUInt localRows, CepsUInt localCols);
65 
67  void
68  setHaloIndices (CepsIndex *haloRows, CepsUInt nHaloRows, CepsIndex *haloCols, CepsUInt nHaloCols);
69 
81  void
82  setNonZeroTemplate (const CepsIndex *d_nnz, const CepsIndex *o_nnz, CepsInt nbLocalRows);
83 
93  void
95 
97  DVecPtr
98  getDistributedVector () const;
99 
104  DHVecPtr
105  getDistributedHaloVector () const;
106 
108  DMatPtr
109  getDistributedMatrix () const;
110 
111 protected:
112  // Shared by each procs
115 
116  // Proc specific data
119 
124 
129 
131  void
132  initialize ();
133 };
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
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.
std::shared_ptr< DistributedMatrix > DMatPtr
Short typedef for pointer on dist matrix.
std::shared_ptr< DistributedVector > DVecPtr
Short typedef for pointer on distributed vector.
void setHaloIndices(CepsIndex *haloRows, CepsUInt nHaloRows, CepsIndex *haloCols, CepsUInt nHaloCols)
Local halo rows and columns.
CepsIndex m_nHaloCols
local number of halo cols
~DistributedFactory()
Destructor.
CepsIndex * m_haloRows
global indices of halo rows on this proc
void setGlobalSizes(CepsUInt globalRows, CepsUInt globalCols)
Total number of rows and columns.
CepsInt m_o_nz
number of non-zero values on each local row on off-diagonal
CepsInt m_d_nz
number of non-zero values on each local row on diagonal
CepsIndex m_globalRows
global number of rows
DVecPtr getDistributedVector() const
Pointer to created distributed vector.
CepsIndex m_globalCols
global number of columns
DHVecPtr getDistributedHaloVector() const
Pointer on a created distributed vector that has additional memory allocated to enable the exchange o...
void setLocalSizes(CepsUInt localRows, CepsUInt localCols)
Local number of rows and columns.
DMatPtr getDistributedMatrix() const
Pointer to created distributed matrix.
CepsInt * m_o_nnz
number of non-zero values specified for each local row on off-diagonal
CepsInt * m_d_nnz
number of non-zero values specified for each local row on diagonal
void initialize()
Sets some variables.
CepsIndex * m_haloCols
global indices of halo cols on this proc
DistributedFactory()
Default constructor.
CepsIndex m_localRows
local number of rows
CepsIndex m_localCols
local number of columns
void setNonZeroTemplate(const CepsIndex *d_nnz, const CepsIndex *o_nnz, CepsInt nbLocalRows)
Set the non-zero structure of the matrices to create.
CepsIndex m_nHaloRows
local number of halo rows