GEOS
ParallelTopologyChange.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_PHYSICSSOLVERS_SURFACEGENERATION_PARALLELTOPOLOGYCHANGE_HPP_
21 #define GEOS_PHYSICSSOLVERS_SURFACEGENERATION_PARALLELTOPOLOGYCHANGE_HPP_
22 
24 
25 #define PARALLEL_TOPOLOGY_CHANGE_METHOD 1
26 
27 namespace geos
28 {
29 class MeshLevel;
30 class NeighborCommunicator;
31 struct ModifiedObjectLists;
32 
33 namespace parallelTopologyChange
34 {
35 
36 void synchronizeTopologyChange( MeshLevel * const mesh,
37  std::vector< NeighborCommunicator > & neighbors,
38  ModifiedObjectLists & modifiedObjects,
39  ModifiedObjectLists & receivedObjects,
40  int mpiCommOrder );
41 
42 
43 
45 {
46  void init( ElementRegionManager const & elemManager )
47  {
48  m_nodes.resize( 0 );
49  m_edges.resize( 0 );
50  m_faces.resize( 0 );
51  m_elements.resize( elemManager.numRegions() );
52  m_elementsView.resize( elemManager.numRegions() );
53  m_elementsData.resize( elemManager.numRegions() );
54  m_size = 0;
55 
56  for( localIndex er=0; er<elemManager.numRegions(); ++er )
57  {
58  ElementRegionBase const & elemRegion = elemManager.getRegion( er );
59  m_elements[er].resize( elemRegion.numSubRegions());
60  m_elementsView[er].resize( elemRegion.numSubRegions());
61  m_elementsData[er].resize( elemRegion.numSubRegions());
62  for( localIndex esr=0; esr<elemRegion.numSubRegions(); ++esr )
63  {
64  m_elementsData[er][esr].resize( 0 );
65  m_elements[er][esr].set( m_elementsData[er][esr] );
66  m_elementsView[er][esr] = m_elementsData[er][esr];
67  }
68  }
69  }
70 
71 
72  localIndex_array m_nodes;
73  localIndex_array m_edges;
74  localIndex_array m_faces;
77 
78  array1d< array1d< localIndex_array > > m_elementsData;
79  buffer_type::size_type m_size;
80 
81 };
82 
84 {
85  void init( buffer_type const & receiveBuffer,
86  ElementRegionManager const & elemManager )
87  {
88  m_bufferPtr = receiveBuffer.data();
89  TopologyChangeStepData::init( elemManager );
90  }
91 
92  buffer_unit_type const * m_bufferPtr;
93 };
94 
95 }
96 
97 }
98 
99 #endif /* GEOS_PHYSICSSOLVERS_SURFACEGENERATION_PARALLELTOPOLOGYCHANGE_HPP_ */
The ElementRegionBase is the base class to manage the data stored at the element level.
localIndex numSubRegions() const
Get the number of subregions in the region.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
array1d< array1d< ReferenceWrapper< VIEWTYPE > > > ElementReferenceAccessor
The ElementViewAccessor at the ElementRegionManager level is a 2D array of ReferenceWrapper around VI...
localIndex numRegions() const
Get number of the regions.
array1d< array1d< VIEWTYPE > > ElementViewAccessor
The ElementViewAccessor at the ElementRegionManager level is an array of array of VIEWTYPE.
T const & getRegion(KEY_TYPE const &key) const
Get a element region.
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:398
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::vector< buffer_unit_type > buffer_type
Type of storage for communication buffers.
Definition: DataTypes.hpp:116
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:109
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176