GEOSX
DomainPartition.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 Total, S.A
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_MANAGERS_DOMAINPARTITION_HPP_
20 #define GEOSX_MANAGERS_DOMAINPARTITION_HPP_
21 
22 #include "dataRepository/Group.hpp"
23 #include "mesh/MeshBody.hpp"
24 #include "constitutive/ConstitutiveManager.hpp"
26 #include "mpiCommunications/MpiWrapper.hpp"
27 #include "mpiCommunications/NeighborCommunicator.hpp"
28 
29 namespace geosx
30 {
31 
32 class SiloFile;
33 namespace dataRepository
34 {
35 namespace keys
36 {
38 string const partitionManager( "partitionManager" );
39 }
40 }
41 
42 class ObjectManagerBase;
43 class PartitionBase;
44 
52 {
53 public:
59  DomainPartition( std::string const & name,
60  Group * const parent );
61 
65  ~DomainPartition() override;
66 
70  DomainPartition() = delete;
73 
74  DomainPartition( DomainPartition const & ) = delete;
75 
76  DomainPartition( DomainPartition && ) = delete;
77 
78  DomainPartition & operator=( DomainPartition const & ) = delete;
79 
80  DomainPartition & operator=( DomainPartition && ) = delete;
83 
87  virtual void RegisterDataOnMeshRecursive( Group * const meshBodies ) override final;
88 
89  void InitializationOrder( string_array & order ) override final;
90 
97  void GenerateSets();
98 
102 
107  void SetupCommunications( bool use_nonblocking );
108 
123  void AddNeighbors( const unsigned int idim,
124  MPI_Comm & cartcomm,
125  int * ncoords );
127 
128 
134  {
136  static constexpr auto meshBodiesString = "MeshBodies";
138  static constexpr auto constitutiveManagerString = "Constitutive";
139 
141  dataRepository::GroupKey meshBodies = { meshBodiesString };
143  dataRepository::GroupKey constitutiveManager = { constitutiveManagerString };
145  dataRepository::GroupKey communicationManager = { "communicationManager" };
146  }
148  groupKeys;
149 
154  constitutive::ConstitutiveManager const * getConstitutiveManager() const
155  { return this->GetGroup< constitutive::ConstitutiveManager >( groupKeys.constitutiveManager ); }
156 
161  constitutive::ConstitutiveManager * getConstitutiveManager()
162  { return this->GetGroup< constitutive::ConstitutiveManager >( groupKeys.constitutiveManager ); }
163 
168  { return *( this->getParent()->GetGroup< NumericalMethodsManager >( "NumericalMethods" ) ); }
169 
174  { return *( this->getParent()->GetGroup< NumericalMethodsManager >( "NumericalMethods" ) ); }
175 
180  Group const * getMeshBodies() const
181  { return this->GetGroup( groupKeys.meshBodies ); }
182 
188  { return this->GetGroup( groupKeys.meshBodies ); }
189 
195  MeshBody const * getMeshBody( string const & meshName ) const
196  { return this->GetGroup( groupKeys.meshBodies )->GetGroup< MeshBody >( meshName ); }
197 
203  MeshBody * getMeshBody( string const & meshName )
204  { return this->GetGroup( groupKeys.meshBodies )->GetGroup< MeshBody >( meshName ); }
205 
211  MeshBody const * getMeshBody( localIndex const index ) const
212  { return this->GetGroup( groupKeys.meshBodies )->GetGroup< MeshBody >( index ); }
213 
219  MeshBody * getMeshBody( localIndex const index )
220  { return this->GetGroup( groupKeys.meshBodies )->GetGroup< MeshBody >( index ); }
221 
226  std::set< int > & getMetisNeighborList()
227  { return m_metisNeighborList; }
228 
233  std::set< int > const & getMetisNeighborList() const
234  { return m_metisNeighborList; }
235 
240  std::vector< NeighborCommunicator > & getNeighbors()
241  { return m_neighbors; }
242 
247  std::vector< NeighborCommunicator > const & getNeighbors() const
248  { return m_neighbors; };
249 
250 private:
251 
255  std::set< int > m_metisNeighborList;
259  std::vector< NeighborCommunicator > m_neighbors;
260 };
261 
262 } /* namespace geosx */
263 
264 #endif /* GEOSX_MANAGERS_DOMAINPARTITION_HPP_ */
std::vector< NeighborCommunicator > const & getNeighbors() const
Get the neighbor communicators, const version.
MeshBody const * getMeshBody(localIndex const index) const
Get a MeshBody by index, const version.
constitutive::ConstitutiveManager const * getConstitutiveManager() const
Get the constitutive manager, const version.
MeshBody const * getMeshBody(string const &meshName) const
Get a MeshBody by name, const version.
std::vector< NeighborCommunicator > & getNeighbors()
Get the neighbor communicators.
NumericalMethodsManager & getNumericalMethodManager()
std::set< int > & getMetisNeighborList()
Get the metis neighbors indices.
The class is used to manage mesh body.
Definition: MeshBody.hpp:34
std::set< int > const & getMetisNeighborList() const
Get the metis neighbors indices, const version.
Group const * getMeshBodies() const
Get the mesh bodies, const version.
struct to serve as a container for group strings and keys
contains the added group access keys to be bound with class in group hierarchy
MeshBody * getMeshBody(localIndex const index)
Get MeshBody by index.
constitutive::ConstitutiveManager * getConstitutiveManager()
Get the constitutive manager.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
Group * getMeshBodies()
Get the mesh bodies.
std::string string
String type.
Definition: DataTypes.hpp:131
string const partitionManager("partitionManager")
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
T * GetGroup(localIndex index)
Retrieve a sub-group from the current Group using an index.
Definition: Group.hpp:374
MeshBody * getMeshBody(string const &meshName)
Get a MeshBody by name.
NumericalMethodsManager const & getNumericalMethodManager() const