GEOSX
ObjectManagerBase.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_OBJECTMANAGERBASE_HPP_
20 #define GEOSX_MANAGERS_OBJECTMANAGERBASE_HPP_
21 
22 #include "dataRepository/Group.hpp"
23 #include "common/TimingMacros.hpp"
24 #include "mpiCommunications/NeighborData.hpp"
25 
26 namespace geosx
27 {
28 class SiloFile;
29 
34 {
35 public:
36  ObjectManagerBase() = delete;
37 
43  explicit ObjectManagerBase( std::string const & name,
44  dataRepository::Group * const parent );
45 
49  ~ObjectManagerBase() override;
50 
54 
60 
66 
71  virtual const string getCatalogName() const = 0;
73 
76 
77  virtual localIndex PackSize( string_array const & wrapperNames,
78  arrayView1d< localIndex const > const & packList,
79  integer const recursive,
80  bool on_device = false ) const override;
81 
82  virtual localIndex Pack( buffer_unit_type * & buffer,
83  string_array const & wrapperNames,
84  arrayView1d< localIndex const > const & packList,
85  integer const recursive,
86  bool on_device = false ) const override;
87 
88  virtual localIndex Unpack( buffer_unit_type const * & buffer,
89  arrayView1d< localIndex > & packList,
90  integer const recursive,
91  bool on_device = false ) override;
92 
102  template< bool DOPACK >
104  arrayView1d< localIndex const > const & packList ) const;
105 
111  localIndex UnpackSets( buffer_unit_type const * & buffer );
112 
120  virtual void ViewPackingExclusionList( SortedArray< localIndex > & exclusionList ) const;
121 
129  integer const recursive ) const;
130 
138  virtual localIndex PackGlobalMaps( buffer_unit_type * & buffer,
139  arrayView1d< localIndex const > const & packList,
140  integer const recursive ) const;
141 
145  void SetReceiveLists();
146 
153  {
154  GEOSX_UNUSED_VAR( packList );
155  return 0;
156  }
157 
165  arrayView1d< localIndex const > const & packList ) const
166  {
167  GEOSX_UNUSED_VAR( buffer );
168  GEOSX_UNUSED_VAR( packList );
169  return 0;
170  }
171 
180  virtual localIndex UnpackUpDownMaps( buffer_unit_type const * & buffer,
181  array1d< localIndex > & packList,
182  bool const overwriteUpMaps,
183  bool const overwriteDownMaps )
184  {
185  GEOSX_UNUSED_VAR( buffer );
186  GEOSX_UNUSED_VAR( packList );
187  GEOSX_UNUSED_VAR( overwriteUpMaps );
188  GEOSX_UNUSED_VAR( overwriteDownMaps );
189  return 0;
190  }
191 
199  virtual localIndex UnpackGlobalMaps( buffer_unit_type const * & buffer,
200  localIndex_array & packList,
201  integer const recursive );
202 
209  {
210  buffer_unit_type * buffer = nullptr;
211  return PackParentChildMapsPrivate< false >( buffer, packList );
212  }
213 
221  arrayView1d< localIndex const > const & packList ) const
222  {
223  return PackParentChildMapsPrivate< true >( buffer, packList );
224  }
225 
233  localIndex_array & packList );
234 
235 private:
247  template< bool DOPACK >
248  localIndex PackPrivate( buffer_unit_type * & buffer,
249  string_array const & wrapperNames,
250  arrayView1d< localIndex const > const & packList,
251  integer const recursive,
252  bool on_device ) const;
253 
262  template< bool DOPACK >
263  localIndex PackGlobalMapsPrivate( buffer_unit_type * & buffer,
264  arrayView1d< localIndex const > const & packList,
265  integer const recursive ) const;
266 
274  template< bool DOPACK >
275  localIndex PackParentChildMapsPrivate( buffer_unit_type * & buffer,
276  arrayView1d< localIndex const > const & packList ) const;
277 
278  //**********************************************************************************************************************
279  // functions for compatibility with old data structure
280  // TODO Deprecate or modernize all these suckers
281 
282 public:
283 
288  void moveSets( LvArray::MemorySpace const targetSpace );
289 
294  localIndex resize( localIndex const newSize,
295  const bool /*assignGlobals*/ )
296  {
298  return 0;
299  }
300 
302 
307  void CreateSet( const std::string & newSetName );
308 
316  const array2d< localIndex > & map,
317  const std::string & setName );
325  const array1d< localIndex_array > & map,
326  const std::string & setName );
335  const std::string & setName );
336 
341 
348  void ConstructLocalListOfBoundaryObjects( localIndex_array & objectList ) const;
349 
356  void ConstructGlobalListOfBoundaryObjects( globalIndex_array & objectList ) const;
357 
366  std::vector< std::vector< globalIndex > > & map )
367  {
368  GEOSX_UNUSED_VAR( obj );
369  GEOSX_UNUSED_VAR( map );
370  }
371 
376  void SetGhostRankForSenders( int const neighborRank )
377  {
378  arrayView1d< localIndex const > const ghostsToSend = getNeighborData( neighborRank ).ghostsToSend();
379  array1d< std::pair< globalIndex, int > > & nonLocalGhosts = getNeighborData( neighborRank ).nonLocalGhosts();
380  nonLocalGhosts.clear();
381 
382  for( localIndex const index : ghostsToSend )
383  {
384  integer & owningRank = m_ghostRank[ index ];
385  if( owningRank >= 0 )
386  {
387  nonLocalGhosts.emplace_back( m_localToGlobalMap[ index ], owningRank );
388  }
389  else
390  {
391  owningRank = -1;
392  }
393  }
394  }
395 
401 
407 
415  integer SplitObject( localIndex const indexToSplit,
416  int const rank,
417  localIndex & newIndex );
418 
426  void inheritGhostRankFromParent( std::set< localIndex > const & indices );
427 
433  void CopyObject( localIndex const source, localIndex const destination );
434 
438  void SetMaxGlobalIndex();
439 
447  template< typename TYPE_RELATION >
448  static void FixUpDownMaps( TYPE_RELATION & relation,
449  map< localIndex, array1d< globalIndex > > & unmappedIndices,
450  bool const clearIfUnmapped );
451 
459  template< typename TYPE_RELATION >
460  static void FixUpDownMaps( TYPE_RELATION & relation,
461  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
462  bool const clearIfUnmapped );
463 
471  static void FixUpDownMaps( ArrayOfSets< localIndex > & relation,
472  unordered_map< globalIndex, localIndex > const & globalToLocal,
473  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
474  bool const clearIfUnmapped );
475 
483  static void CleanUpMap( std::set< localIndex > const & targetIndices,
485  arrayView2d< localIndex const > const & downmap );
486 
494  static void CleanUpMap( std::set< localIndex > const & targetIndices,
495  ArrayOfSetsView< localIndex > const & upmap,
496  arrayView2d< localIndex const > const & downmap );
497 
505  static void CleanUpMap( std::set< localIndex > const & targetIndices,
507  arrayView1d< arrayView1d< localIndex const > const > const & downmap );
515  static void CleanUpMap( std::set< localIndex > const & targetIndices,
516  ArrayOfSetsView< localIndex > const & upmap,
517  arrayView1d< arrayView1d< localIndex const > const > const & downmap );
525  static void CleanUpMap( std::set< localIndex > const & targetIndices,
526  ArrayOfSetsView< localIndex > const & upmap,
527  ArrayOfArraysView< localIndex const > const & downmap );
528 
533  virtual void enforceStateFieldConsistencyPostTopologyChange( std::set< localIndex > const & targetIndices );
534 
545  localIndex const lookup )
546  {
547  localIndex rval = lookup;
548 
549  while( parentIndices[rval] != -1 )
550  {
551  rval = parentIndices[rval];
552  }
553 
554  return rval;
555  }
556 
566  template< typename MESH_DATA_TRAIT >
568  registerExtrinsicData( string const & nameOfRegisteringObject )
569  {
570  // These are required to work-around the need for instantiation of
571  // the static constexpr trait components. This will not be required once
572  // we move to c++17.
573 
574  //constexpr typename MESH_DATA_TRAIT::DataType defaultValue = MESH_DATA_TRAIT::defaultValue;
575  // This is required for the Tensor classes.
576  typename MESH_DATA_TRAIT::dataType defaultValue( MESH_DATA_TRAIT::defaultValue );
577 
578  return *(this->registerWrapper< typename MESH_DATA_TRAIT::type >( MESH_DATA_TRAIT::key )->
579  setApplyDefaultValue( defaultValue )->
580  setPlotLevel( MESH_DATA_TRAIT::plotLevel )->
581  setRestartFlags( MESH_DATA_TRAIT::restartFlag )->
582  setDescription( MESH_DATA_TRAIT::description )->
583  setRegisteringObjects( nameOfRegisteringObject ) );
584  }
585 
598  template< typename MESH_DATA_TRAIT0, typename MESH_DATA_TRAIT1, typename ... MESH_DATA_TRAITS >
599  void registerExtrinsicData( string const & nameOfRegisteringObject )
600  {
601  registerExtrinsicData< MESH_DATA_TRAIT0 >( nameOfRegisteringObject );
602  registerExtrinsicData< MESH_DATA_TRAIT1, MESH_DATA_TRAITS... >( nameOfRegisteringObject );
603  }
604 
612  template< typename MESH_DATA_TRAIT >
614  {
615  return this->getWrapper< typename MESH_DATA_TRAIT::type >( MESH_DATA_TRAIT::key )->reference();
616  }
617 
624  template< typename MESH_DATA_TRAIT >
626  {
627  return this->getWrapper< typename MESH_DATA_TRAIT::type >( MESH_DATA_TRAIT::key )->reference();
628  }
629 
636  template< typename MESH_DATA_TRAIT >
637  bool hasExtrinsicData() const
638  {
639  // FIXME c++17 We copy paste the Group::hasWrapper implementation for linking reasons
640  // (the key needs to be defined/declared).
641  // C++17 introduces inline variables and should remove this problem.
642  return this->wrappers()[MESH_DATA_TRAIT::key] != nullptr;
643  }
644 
645 #if 0
646  template< typename MESH_DATA_TRAIT >
648  registerExtrinsicData( string const & nameOfRegisteringObject,
649  MESH_DATA_TRAIT const & extrinisicDataTrait )
650  {
651  // These are required to work-around the need for instantiation of
652  // the static constexpr trait components. This will not be required once
653  // we move to c++17.
654 
655  //constexpr typename MESH_DATA_TRAIT::DataType defaultValue = MESH_DATA_TRAIT::defaultValue;
656  constexpr dataRepository::PlotLevel plotLevel = MESH_DATA_TRAIT::plotLevel;
657  string const description = MESH_DATA_TRAIT::description;
658 
659  // This is required for the Tensor classes.
660  typename MESH_DATA_TRAIT::DataType defaultValue( MESH_DATA_TRAIT::defaultValue );
661 
662  return *(this->registerWrapper< typename MESH_DATA_TRAIT::Type >( extrinisicDataTrait.viewKey )->
663  setApplyDefaultValue( defaultValue )->
664  setPlotLevel( plotLevel )->
665  setDescription( description )->
666  setRegisteringObjects( nameOfRegisteringObject ) );
667  }
668 
669  template< typename MESH_DATA_TRAIT0, typename MESH_DATA_TRAIT1, typename ... MESH_DATA_TRAITS >
670  void registerExtrinsicData( string const & nameOfRegisteringObject,
671  MESH_DATA_TRAIT0 const & extrinisicDataTrait0,
672  MESH_DATA_TRAIT1 const & extrinisicDataTrait1,
673  MESH_DATA_TRAITS && ... extrinisicDataTraits )
674  {
675  registerExtrinsicData< MESH_DATA_TRAIT0 >( nameOfRegisteringObject, extrinisicDataTrait0 );
676  registerExtrinsicData< MESH_DATA_TRAIT1,
677  MESH_DATA_TRAITS... >( nameOfRegisteringObject,
678  extrinisicDataTrait1,
679  std::forward< MESH_DATA_TRAITS >( extrinisicDataTraits )... );
680  }
681 
682  template< typename MESH_DATA_TRAIT >
683  auto const & getExtrinsicData( MESH_DATA_TRAIT const & extrinisicDataTrait ) const
684  {
685  return this->getWrapper< typename MESH_DATA_TRAIT::Type >( extrinisicDataTrait.viewKey )->referenceAsView();
686  }
687 
688  template< typename MESH_DATA_TRAIT >
689  auto & getExtrinsicData( MESH_DATA_TRAIT const & extrinisicDataTrait )
690  {
691  return this->getWrapper< typename MESH_DATA_TRAIT::Type >( extrinisicDataTrait.viewKey )->referenceAsView();
692  }
693 #endif
694 
695  //**********************************************************************************************************************
696 
702  {
704  static constexpr auto adjacencyListString = "adjacencyList";
706  static constexpr auto domainBoundaryIndicatorString = "domainBoundaryIndicator";
708  static constexpr auto externalSetString = "externalSet";
710  static constexpr auto ghostRankString = "ghostRank";
712  static constexpr auto ghostsToReceiveString = "ghostsToReceive";
714  static constexpr auto globalToLocalMapString = "globalToLocalMap";
716  static constexpr auto isExternalString = "isExternal";
718  static constexpr auto localToGlobalMapString = "localToGlobalMap";
719 
721  dataRepository::ViewKey externalSet = { externalSetString };
723  dataRepository::ViewKey ghostRank = { ghostRankString };
725  dataRepository::ViewKey globalToLocalMap = { globalToLocalMapString };
727  dataRepository::ViewKey localToGlobalMap = { localToGlobalMapString };
728  }
731 
737  {
739  static constexpr auto setsString = "sets";
741  static constexpr auto neighborDataString = "neighborData";
743  dataRepository::GroupKey sets = { setsString };
744  }
747 
753 
758  virtual viewKeyStruct const & viewKeys() const { return m_ObjectManagerBaseViewKeys; }
768  virtual groupKeyStruct const & groupKeys() const { return m_ObjectManagerBaseGroupKeys; }
769 
775  { return m_sets; }
776 
781  Group const & sets() const
782  { return m_sets; }
783 
790 
797 
803  {
804  globalIndex const gid = m_localToGlobalMap[ lid ];
806  m_globalToLocalMap[ gid ] = lid;
807  }
808 
814  { return m_localToGlobalMap; }
815 
821  { return m_localToGlobalMap; }
822 
828  { return m_globalToLocalMap; }
829 
836  { return m_globalToLocalMap.at( gid ); }
837 
843  { return this->m_isExternal; }
844 
850  { return this->m_isExternal; }
851 
857  { return this->m_ghostRank; }
858 
864  { return this->m_ghostRank; }
865 
871  NeighborData & getNeighborData( int const rank )
872  { return m_neighborData.at( rank ); }
873 
879  NeighborData const & getNeighborData( int const rank ) const
880  { return m_neighborData.at( rank ); }
881 
886  void addNeighbor( int const rank )
887  {
888  std::string const & rankString = std::to_string( rank );
889  m_neighborData.emplace( std::piecewise_construct, std::make_tuple( rank ), std::make_tuple( rankString, &m_neighborGroup ) );
890  m_neighborGroup.RegisterGroup( rankString, &getNeighborData( rank ) );
891  }
892 
897  void removeNeighbor( int const rank )
898  {
900  m_neighborData.erase( rank );
901  }
902 
908  { return m_maxGlobalIndex; }
909 
916  {
917  return m_domainBoundaryIndicator.toView();
918  }
919 
922  {
923  return m_domainBoundaryIndicator.toViewConst();
924  }
925 
926 protected:
929 
932 
935 
938 
941 
944 
953 
956 
959 
962 
965 };
966 
967 
968 template< typename TYPE_RELATION >
969 void ObjectManagerBase::FixUpDownMaps( TYPE_RELATION & relation,
970  map< localIndex, array1d< globalIndex > > & unmappedIndices,
971  bool const )
972 {
973  GEOSX_MARK_FUNCTION;
974 
975  bool allValuesMapped = true;
976  unordered_map< globalIndex, localIndex > const & globalToLocal = relation.RelatedObjectGlobalToLocal();
977  for( map< localIndex, array1d< globalIndex > >::iterator iter = unmappedIndices.begin();
978  iter != unmappedIndices.end();
979  ++iter )
980  {
981  localIndex const li = iter->first;
982  array1d< globalIndex > const & globalIndices = iter->second;
983  for( localIndex a=0; a<globalIndices.size(); ++a )
984  {
985  if( globalIndices[a] != unmappedLocalIndexValue )
986  {
987  if( relation[li][a] == unmappedLocalIndexValue )
988  {
989  relation[li][a] = globalToLocal.at( globalIndices[a] );
990  }
991  else
992  {
993  allValuesMapped = false;
994  }
995  }
996  GEOSX_ERROR_IF( relation[li][a]==unmappedLocalIndexValue, "Index not set" );
997  }
998  }
999  GEOSX_ERROR_IF( !allValuesMapped, "some values of unmappedIndices were not used" );
1000  unmappedIndices.clear();
1001 }
1002 
1003 
1004 template< typename TYPE_RELATION >
1005 void ObjectManagerBase::FixUpDownMaps( TYPE_RELATION & relation,
1006  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
1007  bool const clearIfUnmapped )
1008 {
1009  GEOSX_MARK_FUNCTION;
1010 
1011  unordered_map< globalIndex, localIndex > const & globalToLocal = relation.RelatedObjectGlobalToLocal();
1012  for( map< localIndex, SortedArray< globalIndex > >::iterator iter = unmappedIndices.begin();
1013  iter != unmappedIndices.end();
1014  ++iter )
1015  {
1016  localIndex const li = iter->first;
1017  if( clearIfUnmapped )
1018  {
1019  relation[li].clear();
1020  }
1021  else
1022  {
1023  SortedArray< globalIndex > const & globalIndices = iter->second;
1024  for( auto const newGlobalIndex : globalIndices )
1025  {
1026  // NOTE: This simply ignores if newGlobalIndex is not found. This is OK if this function is
1027  // used for an upmap and the object shouldn't exist on this rank. There should be a better
1028  // way to check this.
1029  auto iterG2L = globalToLocal.find( newGlobalIndex );
1030  if( iterG2L != globalToLocal.end() )
1031  {
1032  relation[li].insert( iterG2L->second );
1033  }
1034  }
1035  }
1036  }
1037  unmappedIndices.clear();
1038 }
1039 
1040 inline
1042  unordered_map< globalIndex, localIndex > const & globalToLocal,
1043  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
1044  bool const clearIfUnmapped )
1045 {
1046  GEOSX_MARK_FUNCTION;
1047 
1048  for( map< localIndex, SortedArray< globalIndex > >::iterator iter = unmappedIndices.begin();
1049  iter != unmappedIndices.end();
1050  ++iter )
1051  {
1052  localIndex const li = iter->first;
1053  if( clearIfUnmapped )
1054  {
1055  relation.clearSet( li );
1056  }
1057  else
1058  {
1059  SortedArray< globalIndex > const & globalIndices = iter->second;
1060  for( globalIndex const newGlobalIndex : globalIndices )
1061  {
1062  // NOTE: This simply ignores if newGlobalIndex is not found. This is OK if this function is
1063  // used for an upmap and the object shouldn't exist on this rank. There should be a better
1064  // way to check this.
1065  auto iterG2L = globalToLocal.find( newGlobalIndex );
1066  if( iterG2L != globalToLocal.end() )
1067  {
1068  relation.insertIntoSet( li, iterG2L->second );
1069  }
1070  }
1071  }
1072  }
1073  unmappedIndices.clear();
1074 }
1075 
1076 } /* namespace geosx */
1077 
1078 
1083 
1084 #endif /* GEOSX_MANAGERS_OBJECTMANAGERBASE_HPP_ */
localIndex UnpackSets(buffer_unit_type const *&buffer)
Unpack the content of buffer into the sets of the instance.
real64 m_overAllocationFactor
Factor by which to overallocate when adding objects.
unordered_map< int, NeighborData > m_neighborData
A map from rank to the associated NeighborData object.
static localIndex GetParentRecusive(arraySlice1d< localIndex const > const &parentIndices, localIndex const lookup)
Get the upmost parent.
array1d< integer > const & isExternal()
Get the locality information of the objects.
localIndex PackParentChildMapsSize(arrayView1d< localIndex const > const &packList) const
Computes the pack size of the parent/child relations in packList.
array1d< globalIndex > m_localToGlobalMap
Contains the global index of each object.
void clear()
Sets the size of the Array to zero and destroys all the values.
Definition: Array.hpp:408
bool insertIntoSet(INDEX_TYPE const i, T const &val)
Insert a value into the given set.
localIndex globalToLocalMap(globalIndex const gid) const
Retrieves the local index for given global index.
arrayView1d< integer const > getDomainBoundaryIndicator() const
Get the domain boundary indicator.
dataRepository::Wrapper< typename MESH_DATA_TRAIT::type > & registerExtrinsicData(string const &nameOfRegisteringObject)
Register data with this ObjectManagerBase using a dataRepository::Wrapper.
dataRepository::ViewKey ghostRank
View key to ghost ranks.
struct geosx::ObjectManagerBase::viewKeyStruct m_ObjectManagerBaseViewKeys
viewKey struct for the ObjectManagerBase class
virtual localIndex UnpackUpDownMaps(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps)
Unpacks the specific elements in the @ packList.
unordered_map< globalIndex, localIndex > m_globalToLocalMap
Map from object global index to the local index.
void SetMaxGlobalIndex()
Computes the maximum global index allong all the MPI ranks.
#define GEOSX_DECLTYPE_AUTO_RETURN
Doxygen can&#39;t parse a decltype( auto ) return type, using this gets around that.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
virtual localIndex PackGlobalMapsSize(arrayView1d< localIndex const > const &packList, integer const recursive) const
Computes the pack size of the global maps elements in the @ packList.
void moveSets(LvArray::MemorySpace const targetSpace)
Manually move all sets to a memory space.
struct to serve as a container for group strings and keys
localIndex UnpackParentChildMaps(buffer_unit_type const *&buffer, localIndex_array &packList)
Unacks the parent/child relations in packList.
void ConstructGlobalToLocalMap()
Constructs the global to local map.
This class serves to provide a sliced multidimensional interface to the family of LvArray classes...
Definition: ArraySlice.hpp:89
integer SplitObject(localIndex const indexToSplit, int const rank, localIndex &newIndex)
Split object to deal with topology changes.
~ObjectManagerBase() override
Destructor.
void ConstructSetFromSetAndMap(SortedArrayView< localIndex const > const &inputSet, const array2d< localIndex > &map, const std::string &setName)
Builds a new set on this instance given another objects set and the map between them.
GEOSX_DECLTYPE_AUTO_RETURN getExtrinsicData() const
Get a view to the data associated with a trait from this ObjectManagerBase.
globalIndex maxGlobalIndex() const
Get the maximum global index of all objects across all rank. See.
localIndex PackSets(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the elements of each set that actually are in packList.
static constexpr auto isExternalString
String key to the &#39;is external&#39; vector.
static constexpr localIndex unmappedLocalIndexValue
A global variable for the value of a object that has not been assigned a geosx::globalIndex.
Definition: DataTypes.hpp:481
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:349
virtual void enforceStateFieldConsistencyPostTopologyChange(std::set< localIndex > const &targetIndices)
Updates the child and target indices after a topology change.
Group & sets()
Get the group holding the object sets.
virtual const string getCatalogName() const =0
Get the name of the catalog.
localIndex GetNumberOfLocalIndices() const
Get the number of locally owned objects.
void SetGhostRankForSenders(int const neighborRank)
Defines neighborRank ownership for ghost objects.
void inheritGhostRankFromParent(std::set< localIndex > const &indices)
sets the value of m_ghostRank to the value of the objects parent.
constexpr T const * begin() const
arrayView1d< integer const > ghostRank() const
Get the ghost information of each object, const version.
SortedArray< localIndex > & externalSet()
Get the external set.
virtual void resize(localIndex const newSize)
Resize the group and all contained wrappers that resize with parent.
virtual localIndex Pack(buffer_unit_type *&buffer, string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool on_device=false) const override
Pack a list of indices within a list of wrappers.
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
arrayView1d< integer > getDomainBoundaryIndicator()
Get the domain boundary indicator.
wrapperMap const & wrappers() const
Get access to the internal wrapper storage.
Definition: Group.hpp:1109
void SetReceiveLists()
Clear and redefines the ghosts to receive.
static constexpr auto globalToLocalMapString
String key to global->local mao.
dataRepository::ViewKey externalSet
View key to external set.
std::enable_if_t< _NDIM==1 > emplace_back(ARGS &&... args)
Construct a value in place at the end of the array.
Definition: Array.hpp:461
void CopyObject(localIndex const source, localIndex const destination)
Copy object from source to @ destination.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:136
virtual viewKeyStruct const & viewKeys() const
Get the view keys for Group access, const version.
dataRepository::ViewKey globalToLocalMap
View key to global->local map.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
virtual groupKeyStruct const & groupKeys() const
Get the group keys for Group access, const version.
static constexpr auto externalSetString
String key to external set.
array1d< integer > m_ghostRank
Array that holds the ghost information about each object.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
bool hasExtrinsicData() const
Checks if an extrinsic data has been registered.
virtual void ViewPackingExclusionList(SortedArray< localIndex > &exclusionList) const
Inserts in exclusionList the data that shall not be packed.
virtual groupKeyStruct & groupKeys()
Get the group keys for Group access.
This class provides a view into an array of sets like object.
This class provides a view into an array of arrays like object.
static void FixUpDownMaps(TYPE_RELATION &relation, map< localIndex, array1d< globalIndex > > &unmappedIndices, bool const clearIfUnmapped)
Fixing the up/down maps by mapping the unmapped indices.
void addNeighbor(int const rank)
Add a neighbor for rank.
void registerExtrinsicData(string const &nameOfRegisteringObject)
Register a collection of data with this ObjectManagerBase using a dataRepository::Wrapper.
void clearSet(INDEX_TYPE const i)
Clear a set.
GEOSX_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1211
struct geosx::ObjectManagerBase::groupKeyStruct m_ObjectManagerBaseGroupKeys
groupKey struct for the ObjectManagerBase class
virtual viewKeyStruct & viewKeys()
Get the view keys for Group access.
SortedArrayView< localIndex const > externalSet() const
Get the external set, const version.
unordered_map< globalIndex, localIndex > const & globalToLocalMap() const
Get global to local map.
globalIndex m_localMaxGlobalIndex
The maximum global index of any object of all objects on this rank.
virtual void ExtractMapFromObjectForAssignGlobalIndexNumbers(ObjectManagerBase const *const obj, std::vector< std::vector< globalIndex > > &map)
Extract map from object and assign global indices.
geosx::ObjectManagerBase ObjectDataStructureBaseT
Alias to ObjectManagerBase.
virtual localIndex PackUpDownMapsSize(arrayView1d< localIndex const > const &packList) const
Computes the pack size of the specific elements in the @ packList.
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:146
static constexpr auto domainBoundaryIndicatorString
String key to domain boundary indicator.
virtual localIndex PackSize(string_array const &wrapperNames, integer const recursive, bool on_device=false) const
Get the size required to pack a list of wrappers.
virtual localIndex PackSize(string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool on_device=false) const override
Get the size required to pack a list of indices within a list of wrappers.
arrayView1d< integer const > isExternal() const
Get the locality information of the objects.
virtual localIndex PackUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the specific elements in the @ packList.
MemorySpace
An enum containing the available memory spaces.
void ConstructLocalListOfBoundaryObjects(localIndex_array &objectList) const
Computes the (local) index list that are domain boundaries.
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
localIndex PackParentChildMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the parent/child relations in packList.
This class provides the base class/interface for the catalog value objects.
constexpr T * begin() const
Definition: ArrayView.hpp:515
NeighborData & getNeighborData(int const rank)
Get neighbor data for given rank.
const string getName() const
Get group name.
Definition: Group.hpp:1317
This class implements an array of sets like object with contiguous storage.
void updateGlobalToLocalMap(localIndex const lid)
Updates (if needed) the global index for local index lid.
void setRestartFlags(RestartFlags flags)
Set flags that control restart output of this group.
Definition: Group.hpp:1371
void ConstructGlobalListOfBoundaryObjects(globalIndex_array &objectList) const
Computes the (global) index list that are domain boundaries.
#define GEOSX_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:78
Group m_neighborGroup
Group that holds all the NeighborData objects.
void deregisterGroup(std::string const &name)
Removes a child group from this group.
Group m_sets
Group that holds object sets.
array1d< integer > m_isExternal
Array that holds if an object is external.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
static CatalogInterface::CatalogType & GetCatalog()
Acessing the unique instance of this catalog.
NeighborData const & getNeighborData(int const rank) const
Get neighbor data for given rank, const version.
arrayView1d< globalIndex > localToGlobalMap()
Get local to global map.
dataRepository::ViewKey localToGlobalMap
View key to the local->global map.
void CreateSet(const std::string &newSetName)
Creates a new set.
virtual localIndex UnpackGlobalMaps(buffer_unit_type const *&buffer, localIndex_array &packList, integer const recursive)
Unpacks the global maps from buffer.
localIndex resize(localIndex const newSize, const bool)
Resize the group and all contained wrappers that resize with parent.
std::string string
String type.
Definition: DataTypes.hpp:131
static constexpr auto ghostsToReceiveString
String key to ghosts to receive.
#define GEOSX_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:103
static constexpr auto localToGlobalMapString
String key to the local->global map.
array1d< integer > const & ghostRank()
Get the ghost information of each object.
virtual localIndex PackGlobalMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList, integer const recursive) const
Packs the global maps elements in the @ packList.
arrayView1d< globalIndex const > localToGlobalMap() const
Get local to global map, const version.
static void CleanUpMap(std::set< localIndex > const &targetIndices, array1d< SortedArray< localIndex > > &upmap, arrayView2d< localIndex const > const &downmap)
Removes from the list of arrays of upmap all the elements for which the "mirror target array" of down...
constexpr std::enable_if_t< std::is_arithmetic< T >::value, T > max(T const a, T const b)
Definition: math.hpp:46
virtual localIndex Pack(buffer_unit_type *&buffer, string_array const &wrapperNames, integer const recursive, bool on_device=false) const
Pack a list of wrappers to a buffer.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
static constexpr auto adjacencyListString
String key to adjacency list.
virtual localIndex Unpack(buffer_unit_type const *&buffer, arrayView1d< localIndex > &packList, integer const recursive, bool on_device=false) override
Unpack a buffer.
struct to serve as a container for variable strings and keys
GEOSX_DECLTYPE_AUTO_RETURN getExtrinsicData()
Get the data associated with a trait from this ObjectManagerBase.
array1d< integer > m_domainBoundaryIndicator
Domain boundary indicator: 1 means the "index" is on the boundary.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
static constexpr auto ghostRankString
String key to ghost ranks.
Group const & sets() const
Get the group holding the object sets, const version.
T * RegisterGroup(std::string const &name, std::unique_ptr< T > newObject)
Register a new Group as a sub-group of current Group.
Definition: Group.hpp:1550
localIndex GetNumberOfGhosts() const
Get the number of ghost objects.
globalIndex m_maxGlobalIndex
The maximum global index of all objects across all rank.
void removeNeighbor(int const rank)
Remove neighbor for rank.