CEPS  24.01
Cardiac ElectroPhysiology Simulator
GeometryPartitioner.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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
32 #pragma once
33 
34 #include "common/CepsCommon.hpp"
35 #include "geometry/Geometry.hpp"
37 
40 {
41 public:
43  GeometryPartitioner () = delete;
44 
46  explicit GeometryPartitioner (Geometry *geometry);
47 
49  ~GeometryPartitioner () override;
50 
60  virtual CepsUInt
62 
63 protected:
65  void
67 
69  void
71 
78  void
79  setUpHalo (
80  const CepsVector<CepsInt> &nodeOwnership,
81  const CepsVector<CepsInt> *cellOwnership = nullptr
82  );
83 
85  void
87 
89  void
91 
94  void
95  nodeAttribution(const CepsVector<CepsInt> &nodeOwnership);
96 
99  void
100  cellAttribution();
101 
103  template <CepsUInt _Dim>
104  void
105  addCellToMesh (CepsUInt index, CepsBool isOnBoundary, Mesh *mesh);
106 
108  CepsUInt
109  getDimensionByNodeId (CepsUInt i) const;
110 
112  CepsUInt
113  getDimensionByCellId (CepsUInt i) const;
114 
115 
116 protected:
118 
122 
125 
126  // Node data
132 
137 
139 
142 
143  // Cell data
152 
158 };
std::map< _Key, _Tp, _Compare, _Alloc > CepsMap
C++ map.
Definition: CepsTypes.hpp:196
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Definition: CepsTypes.hpp:209
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
CepsArray< _Type, 4U > CepsArray4
C++ array, 4 elements.
Definition: CepsTypes.hpp:168
std::unordered_multimap< _Key, _Tp, _Hash, _KeyEqual, _Alloc > CepsMultiMap
C++ multimap.
Definition: CepsTypes.hpp:205
Base class for other (big) CEPS classes. All classes can get a pointer to this base class and also co...
Definition: CepsObject.hpp:40
Class is used to compute a geometry (multiple meshes) partitioning.
CepsArray4< CepsUInt > m_nodeOffset
GeomNode offset.
CepsSet< CepsNodeGlobalIndex > m_haloNodes
Indices of local halo nodes.
CepsMap< CepsCellGlobalIndex, CepsSet< CepsCellGlobalIndex > > m_cellCellAdj
lists of adjacent cells
CepsVector< CepsReal > m_coords
GeomNode positions.
CepsUInt getDimensionByCellId(CepsUInt i) const
Get the correct dimension, deduced by cell id.
CepsSet< CepsCellGlobalIndex > m_markedCells
algorithmic flags
CepsMultiMap< CepsNodeGlobalIndex, CepsNodeGlobalIndex > m_coupledNodes
Links between meshes expressed with coupled nodes.
CepsArray4< CepsUInt > m_cellOffset
Cell offset.
GeometryPartitioner()=delete
Deleted constructor.
CepsVector< CepsInt > m_nodeIndices
Node indices for each cell (signed ints for lib compatibility)
void nodeAttribution(const CepsVector< CepsInt > &nodeOwnership)
Creates the lists of nodes in linked geometry according to partition.
virtual CepsUInt computePartition()=0
Calls the partitioning method specified in the Geometry.
CepsUInt getDimensionByNodeId(CepsUInt i) const
Get the correct dimension, deduced by node id.
CepsVector< CepsAttribute > m_cellAttr
Cells attributes for each cell.
CepsSet< CepsNodeGlobalIndex > m_ownedNodes
Indices of local nodes.
CepsVector< CepsChar > m_isBoundary
Indicates which cell is on the boundary.
CepsMap< CepsCellGlobalIndex, CepsMathVertex > m_cellBarycenters
For cells with 1 node on bdry.
void readMeshOnMaster()
Read the Mesh on master process before distribution.
CepsVector< CepsAttribute > m_nodeAttr
Attributes for each node.
CepsVector< CepsUInt > m_nodeIndicesOffset
Offset in m_nodeIndices array for each cell.
void buildCellAdjacency()
For each cell, stores its adjacent cells. (indices before partitioning)
CepsUInt m_nodeIndicesSize
Size of combined lists of nodes per cell.
void buildNodeAdjacency()
For each node, stores its adjacent nodes and cells. (indices before partitioning)
void addCellToMesh(CepsUInt index, CepsBool isOnBoundary, Mesh *mesh)
Create local simplex structures from geometrical data to fill meshes with.
CepsMap< CepsNodeGlobalIndex, CepsSet< CepsCellGlobalIndex > > m_nodeCellAdj
lists of adjacent cells
void broadcastMeshData()
Copies geometrical information from master on all other processes.
CepsVector< CepsUInt > m_nodeAttrOffset
Offset in m_nodeAttr array for each node.
Geometry * m_geom
Linked geometry to partition.
CepsUInt m_nbNodes
Number of nodes in all combined meshes.
CepsUInt m_cellAttrSize
Size of combined lists of attributes per cell.
CepsVector< CepsUInt > m_cellAttrOffset
Offset in m_cellAttr array for each cell.
void setUpHalo(const CepsVector< CepsInt > &nodeOwnership, const CepsVector< CepsInt > *cellOwnership=nullptr)
Register nodes in halo regions, and set up communication matrices of data in halos.
CepsUInt m_nbCells
Number of cells and boundary cells in all combined meshes.
CepsSet< CepsCellGlobalIndex > m_ownedCells
Indices of local cells and boundary cells.
~GeometryPartitioner() override
Destructor.
CepsUInt m_nodeAttrSize
Size of combined lists of attributes per node.
CepsMap< CepsNodeGlobalIndex, CepsSet< CepsNodeGlobalIndex > > m_nodeNodeAdj
lists of adjacent nodes
void cellAttribution()
Creates the lists of cells and bdry cells in geometry according to partition.
Encapsulates all the geometrical data.
Definition: Geometry.hpp:50
Geometrical information of 1,2 or 3D distributed cells.
Definition: Mesh.hpp:57