GEOSX
PartitionDescriptor.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOSX_MESH_PARTITIONDESCRIPTOR_H_
20 #define GEOSX_MESH_PARTITIONDESCRIPTOR_H_
21 
22 #include "mesh/mpiCommunications/SpatialPartition.hpp"
23 
24 #include <set>
25 
26 
27 namespace geos
28 {
29 
35 {
36 public:
41  bool hasMetisNeighborList() const { return m_hasMetisNeighborList; }
42 
47  void setHasMetisNeighborList( bool hasMetisNeighborList ) { m_hasMetisNeighborList = hasMetisNeighborList; }
48 
53  std::set< int > const & getMetisNeighborList() const { return m_metisNeighborList; }
54 
59  void setMetisNeighborList( std::vector< int > const & metisNeighborList )
60  {
61  m_metisNeighborList.clear();
62  m_metisNeighborList.insert( metisNeighborList.cbegin(), metisNeighborList.cend() );
63  }
64 
69  bool hasSpatialPartition() const { return !m_hasMetisNeighborList; }
70 
75  void setHasSpatialPartition( bool hasSpatialPartition ) { m_hasMetisNeighborList = !hasSpatialPartition; }
76 
81  SpatialPartition const & getSpatialPartition() const { return m_spatialPartition; }
82 
87  void setSpatialPartition( SpatialPartition const & spatialPartition ) { m_spatialPartition = spatialPartition; }
88 
89 private:
90 
91  bool m_hasMetisNeighborList; //< Indicate if we use metis neighbor list or spatial partition to describe the partition
92  std::set< int > m_metisNeighborList; //< The list of neighbors computed wwith metis
93  SpatialPartition m_spatialPartition; //< The spatial partition
94 };
95 
96 }
97 #endif /* GEOSX_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.