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 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 GEOS_MESH_OBJECTMANAGERBASE_HPP_
20 #define GEOS_MESH_OBJECTMANAGERBASE_HPP_
21 
22 #include "dataRepository/Group.hpp"
23 #include "common/TimingMacros.hpp"
24 #include "mpiCommunications/NeighborData.hpp"
25 
26 namespace geos
27 {
28 
33 {
34 public:
35  ObjectManagerBase() = delete;
36 
42  explicit ObjectManagerBase( string const & name,
43  dataRepository::Group * const parent );
44 
48  ~ObjectManagerBase() override;
49 
54 
59 
65 
70  virtual string getCatalogName() const = 0;
72 
75 
76  virtual localIndex packSize( string_array const & wrapperNames,
77  arrayView1d< localIndex const > const & packList,
78  integer const recursive,
79  bool onDevice,
80  parallelDeviceEvents & events ) 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 onDevice,
87  parallelDeviceEvents & events ) const override;
88 
89  virtual localIndex unpack( buffer_unit_type const * & buffer,
90  arrayView1d< localIndex > & packList,
91  integer const recursive,
92  bool onDevice,
93  parallelDeviceEvents & events,
94  MPI_Op op=MPI_REPLACE ) override;
95 
105  template< bool DO_PACKING >
107  arrayView1d< localIndex const > const & packList ) const;
108 
115 
120  void excludeWrappersFromPacking( std::set< string > const & wrapperNames );
121 
129  integer const recursive ) const;
130 
139  arrayView1d< localIndex const > const & packList,
140  integer const recursive ) const;
141 
146 
153  {
154  GEOS_UNUSED_VAR( packList );
155  return 0;
156  }
157 
165  arrayView1d< localIndex const > const & packList ) const
166  {
167  GEOS_UNUSED_VAR( buffer );
168  GEOS_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  GEOS_UNUSED_VAR( buffer );
186  GEOS_UNUSED_VAR( packList );
187  GEOS_UNUSED_VAR( overwriteUpMaps );
188  GEOS_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 packParentChildMapsImpl< false >( buffer, packList );
212  }
213 
221  arrayView1d< localIndex const > const & packList ) const
222  {
223  return packParentChildMapsImpl< true >( buffer, packList );
224  }
225 
233  localIndex_array & packList );
234 
235 private:
247  template< bool DO_PACKING >
248  localIndex packImpl( buffer_unit_type * & buffer,
249  string_array const & wrapperNames,
250  arrayView1d< localIndex const > const & packList,
251  integer const recursive,
252  bool onDevice,
253  parallelDeviceEvents & events ) const;
254 
263  template< bool DO_PACKING >
264  localIndex packGlobalMapsImpl( buffer_unit_type * & buffer,
265  arrayView1d< localIndex const > const & packList,
266  integer const recursive ) const;
267 
275  template< bool DO_PACKING >
276  localIndex packParentChildMapsImpl( buffer_unit_type * & buffer,
277  arrayView1d< localIndex const > const & packList ) const;
278 
279  //**********************************************************************************************************************
280  // functions for compatibility with old data structure
281  // TODO Deprecate or modernize all these suckers
282 
283 public:
284 
289  void moveSets( LvArray::MemorySpace const targetSpace );
290 
295  localIndex resize( localIndex const newSize,
296  const bool /*assignGlobals*/ )
297  {
299  return 0;
300  }
301 
303 
309  SortedArray< localIndex > & createSet( const string & newSetName );
310 
318  const array2d< localIndex > & map,
319  const string & setName );
328  const string & setName );
337  const string & setName );
338 
343 
349 
359  {
360  GEOS_UNUSED_VAR( nodeManager );
361  return {};
362  }
363 
368  void setGhostRankForSenders( int const neighborRank )
369  {
370  arrayView1d< localIndex const > const ghostsToSend = getNeighborData( neighborRank ).ghostsToSend();
371  array1d< std::pair< globalIndex, int > > & nonLocalGhosts = getNeighborData( neighborRank ).nonLocalGhosts();
372  nonLocalGhosts.clear();
373 
374  for( localIndex const index : ghostsToSend )
375  {
376  integer & owningRank = m_ghostRank[ index ];
377  if( owningRank >= 0 )
378  {
379  nonLocalGhosts.emplace_back( m_localToGlobalMap[ index ], owningRank );
380  }
381  else
382  {
383  owningRank = -1;
384  }
385  }
386  }
387 
393 
399 
407  integer splitObject( localIndex const indexToSplit,
408  int const rank,
409  localIndex & newIndex );
410 
418  void inheritGhostRankFromParent( std::set< localIndex > const & indices );
419 
425  void copyObject( localIndex const source, localIndex const destination );
426 
431  void eraseObject( std::set< localIndex > const & indicesToErase );
432 
436  virtual void setMaxGlobalIndex();
437 
445  template< typename TYPE_RELATION >
446  static void fixUpDownMaps( TYPE_RELATION & relation,
447  map< localIndex, array1d< globalIndex > > & unmappedIndices,
448  bool const clearIfUnmapped );
449 
457  template< typename TYPE_RELATION >
458  static void fixUpDownMaps( TYPE_RELATION & relation,
459  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
460  bool const clearIfUnmapped );
461 
469  static void fixUpDownMaps( ArrayOfSets< localIndex > & relation,
470  unordered_map< globalIndex, localIndex > const & globalToLocal,
471  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
472  bool const clearIfUnmapped );
473 
481  static void cleanUpMap( std::set< localIndex > const & targetIndices,
483  arrayView2d< localIndex const > const & downmap );
484 
492  static void cleanUpMap( std::set< localIndex > const & targetIndices,
493  ArrayOfSetsView< localIndex > const & upmap,
494  arrayView2d< localIndex const > const & downmap );
495 
503  static void cleanUpMap( std::set< localIndex > const & targetIndices,
505  arrayView1d< arrayView1d< localIndex const > const > const & downmap );
513  static void cleanUpMap( std::set< localIndex > const & targetIndices,
514  ArrayOfSetsView< localIndex > const & upmap,
515  arrayView1d< arrayView1d< localIndex const > const > const & downmap );
523  static void cleanUpMap( std::set< localIndex > const & targetIndices,
524  ArrayOfSetsView< localIndex > const & upmap,
525  ArrayOfArraysView< localIndex const > const & downmap );
526 
531  virtual void enforceStateFieldConsistencyPostTopologyChange( std::set< localIndex > const & targetIndices );
532 
543  localIndex const lookup )
544  {
545  localIndex rval = lookup;
546 
547  while( parentIndices[rval] != -1 )
548  {
549  rval = parentIndices[rval];
550  }
551 
552  return rval;
553  }
554 
563  template< typename FIELD_TRAIT >
565  registerField( string const & nameOfRegisteringObject )
566  {
567  // These are required to work-around the need for instantiation of
568  // the static constexpr trait components. This will not be required once
569  // we move to c++17.
570 
571  // This is required for the Tensor classes.
572  typename FIELD_TRAIT::dataType defaultValue( FIELD_TRAIT::defaultValue() );
573 
574  return this->registerWrapper< typename FIELD_TRAIT::type >( FIELD_TRAIT::key() ).
575  setApplyDefaultValue( defaultValue ).
576  setPlotLevel( FIELD_TRAIT::plotLevel ).
577  setRestartFlags( FIELD_TRAIT::restartFlag ).
578  setDescription( FIELD_TRAIT::description ).
579  setRegisteringObjects( nameOfRegisteringObject );
580  }
581 
589  template< typename FIELD_TRAIT >
591  typename FIELD_TRAIT::type * newObject )
592  {
593  return registerWrapper( fieldTrait.key(), newObject ).
594  setApplyDefaultValue( fieldTrait.defaultValue() ).
595  setPlotLevel( FIELD_TRAIT::plotLevel ).
596  setRestartFlags( FIELD_TRAIT::restartFlag ).
597  setDescription( FIELD_TRAIT::description );
598  }
599 
612  template< typename FIELD_TRAIT0, typename FIELD_TRAIT1, typename ... FIELD_TRAITS >
613  void registerField( string const & nameOfRegisteringObject )
614  {
615  registerField< FIELD_TRAIT0 >( nameOfRegisteringObject );
616  registerField< FIELD_TRAIT1, FIELD_TRAITS... >( nameOfRegisteringObject );
617  }
618 
625  template< typename FIELD_TRAIT >
627  {
628  return this->getWrapper< typename FIELD_TRAIT::type >( FIELD_TRAIT::key() ).reference();
629  }
630 
637  template< typename FIELD_TRAIT >
639  {
640  return this->getWrapper< typename FIELD_TRAIT::type >( FIELD_TRAIT::key() ).reference();
641  }
642 
649  template< typename FIELD_TRAIT >
650  bool hasField() const
651  {
652  return this->hasWrapper( FIELD_TRAIT::key() );
653  }
654 
655  //**********************************************************************************************************************
656 
662  {
664  static constexpr char const * adjacencyListString() { return "adjacencyList"; }
665 
667  static constexpr char const * domainBoundaryIndicatorString() { return "domainBoundaryIndicator"; }
668 
670  static constexpr char const * externalSetString() { return "externalSet"; }
671 
673  static constexpr char const * ghostRankString() { return "ghostRank"; }
674 
676  static constexpr char const * ghostsToReceiveString() { return "ghostsToReceive"; }
677 
679  static constexpr char const * globalToLocalMapString() { return "globalToLocalMap"; }
680 
682  static constexpr char const * isExternalString() { return "isExternal"; }
683 
685  static constexpr char const * localToGlobalMapString() { return "localToGlobalMap"; }
686 
689 
692 
695 
698  }
701 
707  {
709  static constexpr char const * setsString() { return "sets"; }
710 
712  static constexpr char const * neighborDataString() { return "neighborData"; }
713 
716 
719  }
722 
728 
733  virtual viewKeyStruct const & viewKeys() const { return m_ObjectManagerBaseViewKeys; }
743  virtual groupKeyStruct const & groupKeys() const { return m_ObjectManagerBaseGroupKeys; }
744 
750  { return m_sets; }
751 
756  Group const & sets() const
757  { return m_sets; }
758 
764  SortedArray< localIndex > & getSet( string const & setName )
765  { return m_sets.getReference< SortedArray< localIndex > >( setName ); }
766 
772  SortedArrayView< localIndex const > getSet( string const & setName ) const
773  { return m_sets.getReference< SortedArray< localIndex > >( setName ).toViewConst(); }
774 
781 
788 
794  {
795  globalIndex const gid = m_localToGlobalMap[ lid ];
796  m_localMaxGlobalIndex = std::max( m_localMaxGlobalIndex, gid );
797  m_globalToLocalMap[ gid ] = lid;
798  }
799 
805  { return m_localToGlobalMap; }
806 
812  { return m_localToGlobalMap; }
813 
819  { return m_globalToLocalMap; }
820 
827  { return m_globalToLocalMap.at( gid ); }
828 
834  { return this->m_isExternal; }
835 
841  { return this->m_isExternal; }
842 
848  { return this->m_ghostRank; }
849 
855  { return this->m_ghostRank; }
856 
862  NeighborData & getNeighborData( int const rank )
863  { return m_neighborData.at( rank ); }
864 
870  NeighborData const & getNeighborData( int const rank ) const
871  { return m_neighborData.at( rank ); }
872 
877  void addNeighbor( int const rank )
878  {
879  string const & rankString = std::to_string( rank );
880  m_neighborData.emplace( std::piecewise_construct, std::make_tuple( rank ), std::make_tuple( rankString, &m_neighborGroup ) );
881  m_neighborGroup.registerGroup( rankString, &getNeighborData( rank ) );
882  }
883 
888  void removeNeighbor( int const rank )
889  {
891  m_neighborData.erase( rank );
892  }
893 
899  { return m_localMaxGlobalIndex; }
900 
906  { return m_maxGlobalIndex; }
907 
908 
916  {
918  }
919 
922  {
923  return m_domainBoundaryIndicator.toViewConst();
924  }
925 
926 protected:
929 
931  std::set< string > m_packingExclusionList;
932 
935 
938 
941 
944 
947 
956 
959 
962 
965 
968 };
969 
970 
971 template< typename TYPE_RELATION >
972 void ObjectManagerBase::fixUpDownMaps( TYPE_RELATION & relation,
973  map< localIndex, array1d< globalIndex > > & unmappedIndices,
974  bool const )
975 {
977 
978  bool allValuesMapped = true;
979  unordered_map< globalIndex, localIndex > const & globalToLocal = relation.relatedObjectGlobalToLocal();
980  for( auto & unmappedIndex: unmappedIndices )
981  {
982  localIndex const li = unmappedIndex.first;
983  array1d< globalIndex > const & globalIndices = unmappedIndex.second;
984  for( localIndex a = 0; a < globalIndices.size(); ++a )
985  {
986  if( globalIndices[a] != unmappedLocalIndexValue )
987  {
988  if( relation[li][a] == unmappedLocalIndexValue )
989  {
990  relation[li][a] = globalToLocal.at( globalIndices[a] );
991  }
992  else
993  {
994  allValuesMapped = false;
995  }
996  }
997  GEOS_ERROR_IF( relation[li][a] == unmappedLocalIndexValue, "Index not set" );
998  }
999  }
1000  GEOS_ERROR_IF( !allValuesMapped, "some values of unmappedIndices were not used" );
1001  unmappedIndices.clear();
1002 }
1003 
1004 
1005 template< typename TYPE_RELATION >
1006 void ObjectManagerBase::fixUpDownMaps( TYPE_RELATION & relation,
1007  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
1008  bool const clearIfUnmapped )
1009 {
1011 
1012  unordered_map< globalIndex, localIndex > const & globalToLocal = relation.RelatedObjectGlobalToLocal();
1013  for( map< localIndex, SortedArray< globalIndex > >::iterator iter = unmappedIndices.begin();
1014  iter != unmappedIndices.end();
1015  ++iter )
1016  {
1017  localIndex const li = iter->first;
1018  if( clearIfUnmapped )
1019  {
1020  relation[li].clear();
1021  }
1022  else
1023  {
1024  SortedArray< globalIndex > const & globalIndices = iter->second;
1025  for( auto const newGlobalIndex : globalIndices )
1026  {
1027  // NOTE: This simply ignores if newGlobalIndex is not found. This is OK if this function is
1028  // used for an upmap and the object shouldn't exist on this rank. There should be a better
1029  // way to check this.
1030  auto iterG2L = globalToLocal.find( newGlobalIndex );
1031  if( iterG2L != globalToLocal.end() )
1032  {
1033  relation[li].insert( iterG2L->second );
1034  }
1035  }
1036  }
1037  }
1038  unmappedIndices.clear();
1039 }
1040 
1041 inline
1043  unordered_map< globalIndex, localIndex > const & globalToLocal,
1044  map< localIndex, SortedArray< globalIndex > > & unmappedIndices,
1045  bool const clearIfUnmapped )
1046 {
1048 
1049  for( map< localIndex, SortedArray< globalIndex > >::iterator iter = unmappedIndices.begin();
1050  iter != unmappedIndices.end();
1051  ++iter )
1052  {
1053  localIndex const li = iter->first;
1054  if( clearIfUnmapped )
1055  {
1056  relation.clearSet( li );
1057  }
1058  else
1059  {
1060  SortedArray< globalIndex > const & globalIndices = iter->second;
1061  for( globalIndex const newGlobalIndex : globalIndices )
1062  {
1063  // NOTE: This simply ignores if newGlobalIndex is not found. This is OK if this function is
1064  // used for an upmap and the object shouldn't exist on this rank. There should be a better
1065  // way to check this.
1066  auto iterG2L = globalToLocal.find( newGlobalIndex );
1067  if( iterG2L != globalToLocal.end() )
1068  {
1069  relation.insertIntoSet( li, iterG2L->second );
1070  }
1071  }
1072  }
1073  }
1074  unmappedIndices.clear();
1075 }
1076 
1077 } /* namespace geos */
1078 
1079 
1084 
1085 #endif /* GEOS_MESH_OBJECTMANAGERBASE_HPP_ */
#define GEOS_DECLTYPE_AUTO_RETURN
Doxygen can't parse a decltype( auto ) return type, using this gets around that.
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:83
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:107
geos::ObjectManagerBase ObjectDataStructureBaseT
Alias to ObjectManagerBase.
#define GEOS_MARK_FUNCTION
Mark function with both Caliper and NVTX if enabled.
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
array1d< integer > const & ghostRank()
Get the ghost information of each object.
array1d< integer > m_domainBoundaryIndicator
Domain boundary indicator: 1 means the "index" is on the boundary.
SortedArrayView< localIndex const > getSet(string const &setName) const
Get a set by name, const version.
array1d< integer > & getDomainBoundaryIndicator()
Get the domain boundary indicator.
arrayView1d< integer const > ghostRank() const
Get the ghost information of each object, const version.
NeighborData const & getNeighborData(int const rank) const
Get neighbor data for given rank, const version.
localIndex packParentChildMapsSize(arrayView1d< localIndex const > const &packList) const
Computes the pack size of the parent/child relations in packList.
array1d< integer > m_isExternal
Array that holds if an object is external.
globalIndex m_localMaxGlobalIndex
The maximum global index of any object of all objects on this rank.
NeighborData & getNeighborData(int const rank)
Get neighbor data for given rank.
virtual viewKeyStruct & viewKeys()
Get the view keys for Group access.
virtual localIndex packUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the specific elements in the @ packList.
static void cleanUpMap(std::set< localIndex > const &targetIndices, ArrayOfSetsView< localIndex > const &upmap, ArrayOfArraysView< localIndex const > const &downmap)
Removes from the list of sets of upmap all the elements for which the "mirror target array" of downma...
virtual localIndex packGlobalMapsSize(arrayView1d< localIndex const > const &packList, integer const recursive) const
Computes the pack size of the global maps elements in the @ packList.
globalIndex maxGlobalIndex() const
Get the maximum global index of all objects across all rank. See.
Group m_neighborGroup
Group that holds all the NeighborData objects.
virtual ArrayOfSets< globalIndex > extractMapFromObjectForAssignGlobalIndexNumbers(ObjectManagerBase const &nodeManager)
Extract map from object and assign global indices.
std::set< string > m_packingExclusionList
Names of the wrappers that should not be packed.
static CatalogInterface::CatalogType & getCatalog()
Acessing the unique instance of this catalog.
unordered_map< int, NeighborData > m_neighborData
A map from rank to the associated NeighborData object.
Group m_sets
Group that holds object sets.
GEOS_DECLTYPE_AUTO_RETURN getField() const
Get a view to the field associated with a trait from this ObjectManagerBase.
virtual localIndex pack(buffer_unit_type *&buffer, string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool onDevice, parallelDeviceEvents &events) const override
Pack a list of indices within a list of wrappers.
globalIndex m_maxGlobalIndex
The maximum global index of all objects across all rank.
localIndex unpackSets(buffer_unit_type const *&buffer)
Unpack the content of buffer into the sets of the instance.
array1d< integer > m_ghostRank
Array that holds the ghost information about each object.
arrayView1d< globalIndex > localToGlobalMap()
Get local to global map.
unordered_map< globalIndex, localIndex > const & globalToLocalMap() const
Get global to local map.
void constructSetFromSetAndMap(SortedArrayView< localIndex const > const &inputSet, const array1d< localIndex_array > &map, const string &setName)
Builds a new set on this instance given another objects set and the map between them.
Group const & sets() const
Get the group holding the object sets, const version.
virtual localIndex unpack(buffer_unit_type const *&buffer, arrayView1d< localIndex > &packList, integer const recursive, bool onDevice, parallelDeviceEvents &events, MPI_Op op=MPI_REPLACE) override
Unpack a buffer.
virtual void enforceStateFieldConsistencyPostTopologyChange(std::set< localIndex > const &targetIndices)
Updates the child and target indices after a topology change.
void setGhostRankForSenders(int const neighborRank)
Defines neighborRank ownership for ghost objects.
struct geos::ObjectManagerBase::groupKeyStruct m_ObjectManagerBaseGroupKeys
groupKey struct for the ObjectManagerBase class
static localIndex getParentRecursive(arraySlice1d< localIndex const > const &parentIndices, localIndex const lookup)
Get the upmost parent.
dataRepository::Wrapper< typename FIELD_TRAIT::type > & registerField(FIELD_TRAIT const &fieldTrait, typename FIELD_TRAIT::type *newObject)
Helper function to register fields.
ObjectManagerBase(string const &name, dataRepository::Group *const parent)
Constructor.
virtual string getCatalogName() const =0
Get the name of the catalog.
void constructGlobalToLocalMap()
Constructs the global to local map.
localIndex packParentChildMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the parent/child relations in packList.
virtual localIndex packGlobalMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList, integer const recursive) const
Packs the global maps elements in the @ packList.
Group & sets()
Get the group holding the object sets.
real64 m_overAllocationFactor
Factor by which to overallocate when adding objects.
void moveSets(LvArray::MemorySpace const targetSpace)
Manually move all sets to a memory space.
SortedArray< localIndex > & createSet(const string &newSetName)
Creates a new set.
integer splitObject(localIndex const indexToSplit, int const rank, localIndex &newIndex)
Split object to deal with topology changes.
localIndex globalToLocalMap(globalIndex const gid) const
Retrieves the local index for given global index.
void removeNeighbor(int const rank)
Remove neighbor for rank.
static void cleanUpMap(std::set< localIndex > const &targetIndices, ArrayOfSetsView< localIndex > const &upmap, arrayView2d< localIndex const > const &downmap)
Removes from the list of sets of upmap all the elements for which the "mirror target array" of downma...
virtual viewKeyStruct const & viewKeys() const
Get the view keys for Group access, const version.
SortedArray< localIndex > & getSet(string const &setName)
Get a set by name.
static void cleanUpMap(std::set< localIndex > const &targetIndices, ArrayOfSetsView< localIndex > const &upmap, arrayView1d< arrayView1d< localIndex const > const > const &downmap)
Removes from the list of sets of upmap all the elements for which the "mirror target array" of downma...
virtual void setMaxGlobalIndex()
Computes the maximum global index allong all the MPI ranks.
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.
localIndex unpackParentChildMaps(buffer_unit_type const *&buffer, localIndex_array &packList)
Unacks the parent/child relations in packList.
static void cleanUpMap(std::set< localIndex > const &targetIndices, array1d< SortedArray< localIndex > > &upmap, arrayView1d< arrayView1d< localIndex const > const > const &downmap)
Removes from the list of arrays of upmap all the elements for which the "mirror target array" of down...
void eraseObject(std::set< localIndex > const &indicesToErase)
Erase object from this object manager.
unordered_map< globalIndex, localIndex > m_globalToLocalMap
Map from object global index to the local index.
virtual groupKeyStruct & groupKeys()
Get the group keys for Group access.
virtual localIndex packSize(string_array const &wrapperNames, arrayView1d< localIndex const > const &packList, integer const recursive, bool onDevice, parallelDeviceEvents &events) const override
Get the size required to pack a list of indices within a list of wrappers.
virtual localIndex packUpDownMapsSize(arrayView1d< localIndex const > const &packList) const
Computes the pack size of the specific elements in the @ packList.
arrayView1d< globalIndex const > localToGlobalMap() const
Get local to global map, const version.
virtual localIndex unpackUpDownMaps(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps)
Unpacks the specific elements in the @ packList.
array1d< integer > const & isExternal()
Get the locality information of the objects.
localIndex packSets(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the elements of each set that actually are in packList.
virtual groupKeyStruct const & groupKeys() const
Get the group keys for Group access, const version.
void inheritGhostRankFromParent(std::set< localIndex > const &indices)
sets the value of m_ghostRank to the value of the objects parent.
struct geos::ObjectManagerBase::viewKeyStruct m_ObjectManagerBaseViewKeys
viewKey struct for the ObjectManagerBase class
dataRepository::Wrapper< typename FIELD_TRAIT::type > & registerField(string const &nameOfRegisteringObject)
Register field with this ObjectManagerBase using a dataRepository::Wrapper.
void copyObject(localIndex const source, localIndex const destination)
Copy object from source to @ destination.
void excludeWrappersFromPacking(std::set< string > const &wrapperNames)
Registers wrappers that will be excluded from packing.
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...
static void fixUpDownMaps(TYPE_RELATION &relation, map< localIndex, array1d< globalIndex > > &unmappedIndices, bool const clearIfUnmapped)
Fixing the up/down maps by mapping the unmapped indices.
SortedArrayView< localIndex const > externalSet() const
Get the external set, const version.
arrayView1d< integer const > getDomainBoundaryIndicator() const
Get the domain boundary indicator.
void setReceiveLists()
Clear and redefines the ghosts to receive.
localIndex getNumberOfGhosts() const
Get the number of ghost objects.
SortedArray< localIndex > & externalSet()
Get the external set.
~ObjectManagerBase() override
Destructor.
bool hasField() const
Checks if a field has been registered.
array1d< globalIndex > m_localToGlobalMap
Contains the global index of each object.
localIndex getNumberOfLocalIndices() const
Get the number of locally owned objects.
arrayView1d< integer const > isExternal() const
Get the locality information of the objects.
array1d< globalIndex > constructGlobalListOfBoundaryObjects() const
Computes the (global) index list that are domain boundaries.
void registerField(string const &nameOfRegisteringObject)
Register a collection of fields with this ObjectManagerBase using a dataRepository::Wrapper.
void constructSetFromSetAndMap(SortedArrayView< localIndex const > const &inputSet, ArrayOfArraysView< localIndex const > const &map, const string &setName)
Builds a new set on this instance given another objects set and the map between them.
GEOS_DECLTYPE_AUTO_RETURN getField()
Get the field associated with a trait from this ObjectManagerBase.
globalIndex localMaxGlobalIndex() const
Get the local maximum global index on this rank.
void updateGlobalToLocalMap(localIndex const lid)
Updates (if needed) the global index for local index lid.
void constructSetFromSetAndMap(SortedArrayView< localIndex const > const &inputSet, const array2d< localIndex > &map, const string &setName)
Builds a new set on this instance given another objects set and the map between them.
void addNeighbor(int const rank)
Add a neighbor for rank.
This class provides the base class/interface for the catalog value objects.
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...
void deregisterGroup(string const &name)
Removes a child group from this group.
Wrapper< TBASE > & registerWrapper(string const &name, wrapperMap::KeyIndex::index_type *const rkey=nullptr)
Create and register a Wrapper around a new object.
bool hasWrapper(LOOKUP_TYPE const &lookup) const
Check if a wrapper exists.
Definition: Group.hpp:1181
T & registerGroup(string const &name, std::unique_ptr< T > newObject)
Register a new Group as a sub-group of current Group.
Definition: Group.hpp:197
void setRestartFlags(RestartFlags flags)
Set flags that control restart output of this group.
Definition: Group.hpp:1403
string const & getName() const
Get group name.
Definition: Group.hpp:1308
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1252
virtual localIndex packSize(string_array const &wrapperNames, integer const recursive, bool onDevice, parallelDeviceEvents &events) const
Get the size required to pack a list of wrappers.
virtual localIndex pack(buffer_unit_type *&buffer, string_array const &wrapperNames, integer const recursive, bool onDevice, parallelDeviceEvents &events) const
Pack a list of wrappers to a buffer.
virtual void resize(localIndex const newSize)
Resize the group and all contained wrappers that resize with parent.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:369
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1625
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
array1d< localIndex > localIndex_array
A 1-dimensional array of geos::localIndex types.
Definition: DataTypes.hpp:438
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
LvArray::ArrayOfSetsView< T, INDEX_TYPE const, LvArray::ChaiBuffer > ArrayOfSetsView
View of array of variable-sized sets. See LvArray::ArrayOfSetsView for details.
Definition: DataTypes.hpp:334
constexpr static localIndex unmappedLocalIndexValue
A global variable for the value of a object that has not been assigned a geos::globalIndex.
Definition: DataTypes.hpp:500
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
Definition: DataTypes.hpp:326
double real64
64-bit floating point type.
Definition: DataTypes.hpp:139
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
Definition: DataTypes.hpp:224
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
GEOSX_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
Definition: DataTypes.hpp:128
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
Definition: DataTypes.hpp:307
LvArray::ArrayOfSets< T, INDEX_TYPE, LvArray::ChaiBuffer > ArrayOfSets
Array of variable-sized sets. See LvArray::ArrayOfSets for details.
Definition: DataTypes.hpp:330
LvArray::SortedArrayView< T, localIndex, LvArray::ChaiBuffer > SortedArrayView
A sorted array view of local indices.
Definition: DataTypes.hpp:311
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:149
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Definition: DataTypes.hpp:236
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:216
struct to serve as a container for group strings and keys
static constexpr char const * neighborDataString()
static constexpr char const * setsString()
dataRepository::GroupKey neighborData
View key to the Group holding the neighbor data.
dataRepository::GroupKey sets
View key to the Group holding the object sets.
struct to serve as a container for variable strings and keys
dataRepository::ViewKey localToGlobalMap
View key to the local->global map.
static constexpr char const * domainBoundaryIndicatorString()
dataRepository::ViewKey ghostRank
View key to ghost ranks.
static constexpr char const * ghostsToReceiveString()
static constexpr char const * ghostRankString()
static constexpr char const * isExternalString()
dataRepository::ViewKey externalSet
View key to external set.
static constexpr char const * localToGlobalMapString()
static constexpr char const * globalToLocalMapString()
dataRepository::ViewKey globalToLocalMap
View key to global->local map.
static constexpr char const * externalSetString()
static constexpr char const * adjacencyListString()