GEOS
PartitionDescriptor.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_MESH_PARTITIONDESCRIPTOR_H_
21 #define GEOS_MESH_PARTITIONDESCRIPTOR_H_
22 
23 #include "mesh/mpiCommunications/SpatialPartition.hpp"
24 
25 #include <set>
26 
27 
28 namespace geos
29 {
30 
36 {
37 public:
42  bool hasMetisNeighborList() const { return m_hasMetisNeighborList; }
43 
48  void setHasMetisNeighborList( bool hasMetisNeighborList ) { m_hasMetisNeighborList = hasMetisNeighborList; }
49 
54  std::set< int > const & getMetisNeighborList() const { return m_metisNeighborList; }
55 
60  void setMetisNeighborList( std::vector< int > const & metisNeighborList )
61  {
62  m_metisNeighborList.clear();
63  m_metisNeighborList.insert( metisNeighborList.cbegin(), metisNeighborList.cend() );
64  }
65 
70  bool hasSpatialPartition() const { return !m_hasMetisNeighborList; }
71 
76  void setHasSpatialPartition( bool hasSpatialPartition ) { m_hasMetisNeighborList = !hasSpatialPartition; }
77 
82  SpatialPartition const & getSpatialPartition() const { return m_spatialPartition; }
83 
88  void setSpatialPartition( SpatialPartition const & spatialPartition ) { m_spatialPartition = spatialPartition; }
89 
90 private:
91 
92  bool m_hasMetisNeighborList; //< Indicate if we use metis neighbor list or spatial partition to describe the partition
93  std::set< int > m_metisNeighborList; //< The list of neighbors computed wwith metis
94  SpatialPartition m_spatialPartition; //< The spatial partition
95 };
96 
97 }
98 #endif /* GEOS_MESH_PARTITIONDESCRIPTOR_H_ */
Simple utility to retrieve partition information in case of Metis or Spatial partition.
void setHasMetisNeighborList(bool hasMetisNeighborList)
Sets the boolean that indicates if the partition is described using a Metis Neighbor list.
SpatialPartition const & getSpatialPartition() const
Returns a reference to the spatialPartition.
void setSpatialPartition(SpatialPartition const &spatialPartition)
Sets the spatialPartition.
void setHasSpatialPartition(bool hasSpatialPartition)
Sets the boolean that indicates if the partition is described using a Metis Neighbor list.
std::set< int > const & getMetisNeighborList() const
Gets a reference to the list of metis neighbor list.
bool hasMetisNeighborList() const
indicate if the partition is described using a Metis Neighbor list.
bool hasSpatialPartition() const
indicate if the partition is described using a spatial partition.
void setMetisNeighborList(std::vector< int > const &metisNeighborList)
Sets the list of metis neighbor list.