GEOSX
ParticleManager.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_PARTICLEREGIONMANAGER_HPP
20 #define GEOSX_MESH_PARTICLEREGIONMANAGER_HPP
21 
22 #include "generators/ParticleBlock.hpp"
24 #include "constitutive/ConstitutiveManager.hpp"
25 #include "ParticleRegion.hpp"
26 #include "ParticleSubRegion.hpp"
29 
30 namespace geos
31 {
32 
33 class MeshManager;
34 class DomainPartition;
35 
42 {
43 public:
44 
49  {
51  static constexpr auto particleRegionsGroup() { return "particleRegionsGroup"; }
52  };
53 
58  template< typename VIEWTYPE >
60 
66  template< typename VIEWTYPE >
68 
74  template< typename VIEWTYPE >
76 
81  template< typename VIEWTYPE >
83 
89  template< typename VIEWTYPE >
91 
96  template< typename CONSTITUTIVE_TYPE >
98 
103  static string catalogName()
104  { return "ParticleManager"; }
105 
110  virtual string getCatalogName() const override final
111  { return ParticleManager::catalogName(); }
112 
118  ParticleManager( string const & name, Group * const parent );
119 
123  virtual ~ParticleManager() override;
124 
129  template< typename T = ParticleSubRegionBase >
131  {
132  localIndex numParticle = 0;
133  this->forParticleSubRegions< T >( [&]( ParticleSubRegionBase const & particleSubRegion )
134  {
135  numParticle += particleSubRegion.size();
136  } );
137  return numParticle;
138  }
139 
140 // void Initialize( ){}
141 
146  void generateMesh( ParticleBlockManagerABC & particleBlockManager );
147 
154  virtual Group * createChild( string const & childKey, string const & childName ) override;
155 // virtual void ReadXMLsub( xmlWrapper::xmlNode const & targetNode ) override;
156 
160  virtual void expandObjectCatalogs() override;
161 
168  virtual void setSchemaDeviations( xmlWrapper::xmlNode schemaRoot,
169  xmlWrapper::xmlNode schemaParent,
170  integer documentationType ) override;
171 
172  using Group::resize;
173 
180  void resize( integer_array const & numParticles,
181  string_array const & regionNames,
182  string_array const & particleTypes );
183 
187  virtual void setMaxGlobalIndex() override final;
188 
193  subGroupMap const & getRegions() const
194  {
195  return this->getGroup( groupKeyStruct::particleRegionsGroup() ).getSubGroups();
196  }
197 
203  {
204  return this->getGroup( groupKeyStruct::particleRegionsGroup() ).getSubGroups();
205  }
206 
212  template< typename T=ParticleRegionBase, typename KEY_TYPE=void >
213  T const & getRegion( KEY_TYPE const & key ) const
214  {
215  return this->getGroup( groupKeyStruct::particleRegionsGroup() ).getGroup< T >( key );
216  }
217 
223  template< typename T=ParticleRegionBase, typename KEY_TYPE=void >
224  T & getRegion( KEY_TYPE const & key )
225  {
226  return this->getGroup( groupKeyStruct::particleRegionsGroup() ).getGroup< T >( key );
227  }
228 
235  template< typename T=ParticleRegionBase >
236  bool hasRegion( string const & name ) const
237  {
238  return this->getGroup( groupKeyStruct::particleRegionsGroup() ).hasGroup< T >( name );
239  }
240 
246  {
247  return this->getRegions().size();
248  }
249 
255 
262  template< typename REGIONTYPE = ParticleRegionBase, typename ... REGIONTYPES, typename LAMBDA >
263  void forParticleRegions( LAMBDA && lambda )
264  {
265  this->getGroup( groupKeyStruct::particleRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
266  }
267 
274  template< typename REGIONTYPE = ParticleRegionBase, typename ... REGIONTYPES, typename LAMBDA >
275  void forParticleRegions( LAMBDA && lambda ) const
276  {
277  this->getGroup( groupKeyStruct::particleRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
278  }
279 
288  template< typename REGIONTYPE = ParticleRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
289  void forParticleRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
290  {
291  this->getGroup( groupKeyStruct::particleRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
292  }
293 
302  template< typename REGIONTYPE = ParticleRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
303  void forParticleRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
304  {
305  this->getGroup( groupKeyStruct::particleRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
306  }
307 
313  template< typename LAMBDA >
314  void forParticleRegionsComplete( LAMBDA lambda ) const
315  {
316  forParticleRegionsComplete< ParticleRegion >( std::forward< LAMBDA >( lambda ) );
317  }
318 
324  template< typename LAMBDA >
325  void forParticleRegionsComplete( LAMBDA lambda )
326  {
327  forParticleRegionsComplete< ParticleRegion >( std::forward< LAMBDA >( lambda ) );
328  }
329 
336  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
337  void forParticleRegionsComplete( LAMBDA lambda )
338  {
339  for( localIndex er=0; er<this->numRegions(); ++er )
340  {
341  ParticleRegionBase & particleRegion = this->getRegion( er );
342 
343  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( particleRegion, [&]( auto & castedRegion )
344  {
345  lambda( er, castedRegion );
346  } );
347  }
348  }
349 
356  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
357  void forParticleRegionsComplete( LAMBDA lambda ) const
358  {
359  for( localIndex er=0; er<this->numRegions(); ++er )
360  {
361  ParticleRegionBase const & particleRegion = this->getRegion( er );
362 
363  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( particleRegion, [&]( auto const & castedRegion )
364  {
365  lambda( er, castedRegion );
366  } );
367  }
368  }
369 
377  template< typename LOOKUP_CONTAINER, typename LAMBDA >
378  void forParticleRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
379  {
380  forParticleRegionsComplete< ParticleRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
381  }
382 
390  template< typename LOOKUP_CONTAINER, typename LAMBDA >
391  void forParticleRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
392  {
393  forParticleRegionsComplete< ParticleRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
394  }
395 
404  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
405  void forParticleRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
406  {
407  forParticleRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
408  auto & particleRegion )
409  {
410  lambda( targetIndex, particleRegion.getIndexInParent(), particleRegion );
411  } );
412  }
413 
422  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
423  void forParticleRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
424  {
425  forParticleRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
426  auto const & particleRegion )
427  {
428  lambda( targetIndex, particleRegion.getIndexInParent(), particleRegion );
429  } );
430  }
431 
437  template< typename LAMBDA >
438  void forParticleSubRegions( LAMBDA && lambda )
439  {
440  forParticleSubRegions< ParticleSubRegion >( std::forward< LAMBDA >( lambda ) );
441  }
442 
449  template< typename LAMBDA >
450  void forParticleSubRegions( LAMBDA && lambda ) const
451  {
452  forParticleSubRegions< ParticleSubRegion >( std::forward< LAMBDA >( lambda ) );
453  }
454 
462  template< typename LOOKUP_CONTAINER, typename LAMBDA >
463  void forParticleSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
464  {
465  forParticleSubRegions< ParticleSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
466  }
467 
475  template< typename LOOKUP_CONTAINER, typename LAMBDA >
476  void forParticleSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
477  {
478  forParticleSubRegions< ParticleSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
479  }
480 
487  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
488  void forParticleSubRegions( LAMBDA && lambda )
489  {
490  forParticleSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
491  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
492  localIndex const,
494  auto & subRegion )
495  {
496  lambda( subRegion );
497  }
498  );
499  }
500 
507  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
508  void forParticleSubRegions( LAMBDA && lambda ) const
509  {
510  forParticleSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
511  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
512  localIndex const,
513  ParticleRegionBase const &,
514  auto const & subRegion )
515  {
516  lambda( subRegion );
517  } );
518  }
519 
528  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
529  void forParticleSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
530  {
531  forParticleSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
532  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
533  localIndex const,
534  localIndex const,
536  auto & subRegion )
537  {
538  lambda( targetIndex, subRegion );
539  } );
540  }
541 
550  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
551  void forParticleSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
552  {
553  forParticleSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
554  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
555  localIndex const,
556  localIndex const,
557  ParticleRegionBase const &,
558  auto const & subRegion )
559  {
560  lambda( targetIndex, subRegion );
561  } );
562  }
563 
569  template< typename LAMBDA >
570  void forParticleSubRegionsComplete( LAMBDA && lambda ) const
571  {
572  forParticleSubRegionsComplete< ParticleSubRegion >( std::forward< LAMBDA >( lambda ) );
573  }
574 
580  template< typename LAMBDA >
581  void forParticleSubRegionsComplete( LAMBDA && lambda )
582  {
583  forParticleSubRegionsComplete< ParticleSubRegion >( std::forward< LAMBDA >( lambda ) );
584  }
585 
593  template< typename LOOKUP_CONTAINER, typename LAMBDA >
594  void forParticleSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
595  {
596  forParticleSubRegionsComplete< ParticleSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
597  }
598 
606  template< typename LOOKUP_CONTAINER, typename LAMBDA >
607  void forParticleSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
608  {
609  forParticleSubRegionsComplete< ParticleSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
610  }
611 
618  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
619  void forParticleSubRegionsComplete( LAMBDA && lambda )
620  {
621  for( localIndex er=0; er<this->numRegions(); ++er )
622  {
623  ParticleRegionBase & particleRegion = this->getRegion( er );
624 
625  for( localIndex esr=0; esr<particleRegion.numSubRegions(); ++esr )
626  {
627  ParticleSubRegionBase & subRegion = particleRegion.getSubRegion( esr );
628 
629  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
630  {
631  lambda( er, esr, particleRegion, castedSubRegion );
632  } );
633  }
634  }
635  }
636 
643  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
644  void forParticleSubRegionsComplete( LAMBDA && lambda ) const
645  {
646  for( localIndex er=0; er<this->numRegions(); ++er )
647  {
648  ParticleRegionBase const & particleRegion = this->getRegion( er );
649 
650  for( localIndex esr=0; esr<particleRegion.numSubRegions(); ++esr )
651  {
652  ParticleSubRegionBase const & subRegion = particleRegion.getSubRegion( esr );
653 
654  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
655  {
656  lambda( er, esr, particleRegion, castedSubRegion );
657  } );
658  }
659  }
660  }
661 
670  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
671  void forParticleSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
672  {
673  forParticleRegions( targetRegions, [&] ( localIndex const targetIndex, ParticleRegionBase & particleRegion )
674  {
675  localIndex const er = particleRegion.getIndexInParent();
676 
677  if( er>-1 )
678  {
679  for( localIndex esr=0; esr<particleRegion.numSubRegions(); ++esr )
680  {
681  ParticleSubRegionBase & subRegion = particleRegion.getSubRegion( esr );
682 
683  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
684  {
685  lambda( targetIndex, er, esr, particleRegion, castedSubRegion );
686  } );
687  }
688  }
689  } );
690  }
691 
700  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
701  void forParticleSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
702  {
703  forParticleRegions( targetRegions, [&] ( localIndex const targetIndex, ParticleRegionBase const & particleRegion )
704  {
705  localIndex const er = particleRegion.getIndexInParent();
706 
707  if( er>-1 )
708  {
709  for( localIndex esr=0; esr<particleRegion.numSubRegions(); ++esr )
710  {
711  ParticleSubRegionBase const & subRegion = particleRegion.getSubRegion( esr );
712 
713  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
714  {
715  lambda( targetIndex, er, esr, particleRegion, castedSubRegion );
716  } );
717  }
718  }
719  } );
720  }
721 
722 
729  template< typename FIELD_TRAIT >
730  ParticleViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
731  constructFieldAccessor( string const & neighborName = string() ) const;
732 
740  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
741  ParticleViewAccessor< LHS >
742  constructViewAccessor( string const & name, string const & neighborName = string() ) const;
743 
751  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
752  ParticleViewAccessor< LHS >
753  constructViewAccessor( string const & name, string const & neighborName = string() );
754 
764  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
765  ParticleViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
766  constructArrayViewAccessor( string const & name, string const & neighborName = string() ) const;
767 
775  template< typename VIEWTYPE >
776  ParticleViewAccessor< ReferenceWrapper< VIEWTYPE > >
777  constructReferenceAccessor( string const & viewName, string const & neighborName = string() ) const;
778 
786  template< typename VIEWTYPE >
787  ParticleViewAccessor< ReferenceWrapper< VIEWTYPE > >
788  constructReferenceAccessor( string const & viewName, string const & neighborName = string() );
789 
797  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
798  MaterialViewAccessor< LHS >
799  constructFullMaterialViewAccessor( string const & viewName,
800  constitutive::ConstitutiveManager const & cm ) const;
801 
809  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
810  MaterialViewAccessor< LHS >
811  constructFullMaterialViewAccessor( string const & viewName,
812  constitutive::ConstitutiveManager const & cm );
813 
824  template< typename FIELD_TRAIT >
825  ParticleViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
827  arrayView1d< string const > const & materialNames,
828  bool const allowMissingViews = false ) const;
829 
839  template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
840  ParticleViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
841  constructMaterialFieldAccessor( bool const allowMissingViews = false ) const;
842 
854  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
855  ParticleViewAccessor< LHS >
856  constructMaterialViewAccessor( string const & viewName,
857  arrayView1d< string const > const & regionNames,
858  string const & materialKeyName,
859  bool const allowMissingViews = false ) const;
860 
872  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
873  ParticleViewAccessor< LHS >
874  constructMaterialViewAccessor( string const & viewName,
875  arrayView1d< string const > const & regionNames,
876  string const & materialKeyName,
877  bool const allowMissingViews = false );
878 
890  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
891  ParticleViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
892  constructMaterialArrayViewAccessor( string const & viewName,
893  arrayView1d< string const > const & regionNames,
894  string const & materialKeyName,
895  bool const allowMissingViews = false ) const;
896 
905  template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS=VIEWTYPE >
906  ParticleViewAccessor< LHS >
907  constructMaterialViewAccessor( string const & viewName ) const;
908 
919  template< typename MATERIALTYPE, typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
920  ParticleViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
921  constructMaterialArrayViewAccessor( string const & viewName ) const;
922 
929  template< typename CONSTITUTIVE_TYPE >
930  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
931  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const;
932 
933 
940  template< typename CONSTITUTIVE_TYPE >
941  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
942  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm );
943 
944  using Group::packSize;
945  using Group::pack;
949 
956  int PackSize( string_array const & wrapperNames,
957  ParticleViewAccessor< arrayView1d< localIndex > > const & packList ) const;
958 
966  int Pack( buffer_unit_type * & buffer,
967  string_array const & wrapperNames,
968  ParticleViewAccessor< arrayView1d< localIndex > > const & packList ) const;
969 
972 
979  int Unpack( buffer_unit_type const * & buffer,
981 
988  int Unpack( buffer_unit_type const * & buffer,
990 
997 
1005  ParticleViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1006 
1013  int UnpackGlobalMaps( buffer_unit_type const * & buffer,
1015 
1019  void updateMaps();
1020 
1021 
1022 private:
1023 
1031  template< bool DOPACK >
1032  int PackPrivate( buffer_unit_type * & buffer,
1033  string_array const & wrapperNames,
1034  ParticleViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1035 
1042  template< bool DOPACK >
1043  int PackGlobalMapsPrivate( buffer_unit_type * & buffer,
1044  ParticleViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1045 
1052  template< typename T >
1053  int unpackPrivate( buffer_unit_type const * & buffer,
1054  T & packList );
1055 
1059  ParticleManager( const ParticleManager & );
1060 
1065  ParticleManager & operator=( const ParticleManager & );
1066 
1067 };
1068 
1069 
1070 template< typename VIEWTYPE, typename LHS >
1072 ParticleManager::constructViewAccessor( string const & viewName, string const & neighborName ) const
1073 {
1074  ParticleViewAccessor< LHS > viewAccessor;
1075  viewAccessor.resize( numRegions() );
1076  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1077  {
1078  ParticleRegionBase const & particleRegion = getRegion( kReg );
1079  viewAccessor[kReg].resize( particleRegion.numSubRegions() );
1080 
1081  for( typename dataRepository::indexType kSubReg = 0; kSubReg < particleRegion.numSubRegions(); ++kSubReg )
1082  {
1083  Group const * group = &particleRegion.getSubRegion( kSubReg );
1084 
1085  if( !neighborName.empty() )
1086  {
1087  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1088  }
1089 
1090  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1091  if( wrapper )
1092  {
1093  viewAccessor[kReg][kSubReg] = wrapper->reference();
1094  }
1095  }
1096  }
1097  return viewAccessor;
1098 }
1099 
1100 
1101 template< typename VIEWTYPE, typename LHS >
1103 ParticleManager::constructViewAccessor( string const & viewName, string const & neighborName )
1104 {
1105  ParticleViewAccessor< LHS > viewAccessor;
1106  viewAccessor.resize( numRegions() );
1107  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1108  {
1109  ParticleRegionBase & particleRegion = getRegion( kReg );
1110  viewAccessor[kReg].resize( particleRegion.numSubRegions() );
1111 
1112  for( typename dataRepository::indexType kSubReg = 0; kSubReg < particleRegion.numSubRegions(); ++kSubReg )
1113  {
1114  Group * group = &particleRegion.getSubRegion( kSubReg );
1115 
1116  if( !neighborName.empty() )
1117  {
1118  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1119  }
1120 
1121  dataRepository::Wrapper< VIEWTYPE > * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1122  if( wrapper )
1123  {
1124  viewAccessor[kReg][kSubReg] = wrapper->reference();
1125  }
1126  }
1127  }
1128  return viewAccessor;
1129 }
1130 
1131 template< typename FIELD_TRAIT >
1133 ParticleManager::constructFieldAccessor( string const & neighborName ) const
1134 {
1135  return constructViewAccessor< typename FIELD_TRAIT::type,
1136  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(), neighborName );
1137 }
1138 
1139 template< typename T, int NDIM, typename PERM >
1141 ParticleManager::constructArrayViewAccessor( string const & name, string const & neighborName ) const
1142 {
1143  return constructViewAccessor< Array< T, NDIM, PERM >,
1145  >( name, neighborName );
1146 }
1147 
1148 template< typename VIEWTYPE >
1150 ParticleManager::constructReferenceAccessor( string const & viewName, string const & neighborName ) const
1151 {
1153  viewAccessor.resize( numRegions() );
1154  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1155  {
1156  ParticleRegionBase const & particleRegion = getRegion( kReg );
1157  viewAccessor[kReg].resize( particleRegion.numSubRegions() );
1158 
1159  for( typename dataRepository::indexType kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1160  {
1161  Group const * group = &particleRegion.getSubRegion( kSubReg );
1162 
1163  if( !neighborName.empty() )
1164  {
1165  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1166  }
1167 
1168  if( group->hasWrapper( viewName ) )
1169  {
1170  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1171  }
1172  }
1173  }
1174  return viewAccessor;
1175 }
1176 
1177 template< typename VIEWTYPE >
1179 ParticleManager::constructReferenceAccessor( string const & viewName, string const & neighborName )
1180 {
1182  viewAccessor.resize( numRegions() );
1183  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1184  {
1185  ParticleRegionBase & particleRegion = getRegion( kReg );
1186  viewAccessor[kReg].resize( particleRegion.numSubRegions() );
1187 
1188  for( typename dataRepository::indexType kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1189  {
1190  Group * group = &particleRegion.getSubRegion( kSubReg );
1191 
1192  if( !neighborName.empty() )
1193  {
1194  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1195  }
1196 
1197  if( group->hasWrapper( viewName ) )
1198  {
1199  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1200  }
1201  }
1202  }
1203  return viewAccessor;
1204 }
1205 
1206 template< typename VIEWTYPE, typename LHS >
1209  constitutive::ConstitutiveManager const & cm ) const
1210 {
1211  MaterialViewAccessor< LHS > accessor;
1212  accessor.resize( numRegions() );
1213  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1214  {
1215  ParticleRegionBase const & particleRegion = getRegion( kReg );
1216  accessor[kReg].resize( particleRegion.numSubRegions() );
1217 
1218  for( localIndex kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1219  {
1220  ParticleSubRegionBase const & subRegion = particleRegion.getSubRegion( kSubReg );
1221  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1222 
1223  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1224 
1225  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1226  {
1227  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1228  dataRepository::Group const * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1229  if( constitutiveRelation != nullptr )
1230  {
1231  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1232  if( wrapper )
1233  {
1234  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1235  }
1236  }
1237  }
1238  }
1239  }
1240  return accessor;
1241 }
1242 
1243 template< typename VIEWTYPE, typename LHS >
1246  constitutive::ConstitutiveManager const & cm )
1247 {
1248  MaterialViewAccessor< LHS > accessor;
1249  accessor.resize( numRegions() );
1250  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1251  {
1252  ParticleRegionBase & particleRegion = getRegion( kReg );
1253  accessor[kReg].resize( particleRegion.numSubRegions() );
1254 
1255  for( localIndex kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1256  {
1257  ParticleSubRegionBase & subRegion = particleRegion.getSubRegion( kSubReg );
1258  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1259 
1260  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1261 
1262  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1263  {
1264  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1265  dataRepository::Group * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1266  if( constitutiveRelation != nullptr )
1267  {
1268  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1269  if( wrapper )
1270  {
1271  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1272  }
1273  }
1274  }
1275  }
1276  }
1277  return accessor;
1278 }
1279 
1280 template< typename VIEWTYPE, typename LHS >
1283  arrayView1d< string const > const & regionNames,
1284  string const & materialKeyName,
1285  bool const allowMissingViews ) const
1286 {
1287  ParticleViewAccessor< LHS > accessor;
1288 
1289  // Resize the accessor to all regions and subregions
1290  accessor.resize( numRegions() );
1291  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1292  {
1293  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1294  }
1295 
1296  subGroupMap const & regionMap = getRegions();
1297 
1298  // Loop only over regions named and populate according to given material names
1299  for( localIndex k = 0; k < regionNames.size(); ++k )
1300  {
1301  localIndex const er = regionMap.getIndex( regionNames[k] );
1302  if( er >=0 )
1303  {
1304  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1305  ParticleRegionBase const & region = getRegion( er );
1306 
1307  region.forParticleSubRegionsIndex( [&]( localIndex const esr,
1308  ParticleSubRegionBase const & subRegion )
1309  {
1310  string const & materialName = subRegion.getReference< string >( materialKeyName );
1311  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1312 
1313  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1314  if( wrapper )
1315  {
1316  accessor[er][esr] = wrapper->reference();
1317  }
1318  else
1319  {
1320  GEOS_ERROR_IF( !allowMissingViews, "Material " << materialKeyName[k] << " does not contain " << viewName );
1321  }
1322  } );
1323  }
1324  }
1325  return accessor;
1326 }
1327 
1328 template< typename VIEWTYPE, typename LHS >
1331  arrayView1d< string const > const & regionNames,
1332  string const & materialKeyName,
1333  bool const allowMissingViews )
1334 {
1335  ParticleViewAccessor< LHS > accessor;
1336 
1337  // Resize the accessor to all regions and subregions
1338  accessor.resize( numRegions() );
1339  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1340  {
1341  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1342  }
1343 
1344  subGroupMap const & regionMap = getRegions();
1345 
1346  // Loop only over regions named and populate according to given material names
1347  for( localIndex k = 0; k < regionNames.size(); ++k )
1348  {
1349  localIndex const er = regionMap.getIndex( regionNames[k] );
1350  if( er >=0 )
1351  {
1352  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1353  ParticleRegionBase & region = getRegion( er );
1354 
1355  region.forParticleSubRegionsIndex( [&]( localIndex const esr, ParticleSubRegionBase & subRegion )
1356  {
1357  string const & materialName = subRegion.getReference< string >( materialKeyName );
1358  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1359 
1360  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1361  if( wrapper )
1362  {
1363  accessor[er][esr] = wrapper->reference();
1364  }
1365  else
1366  {
1367  GEOS_ERROR_IF( !allowMissingViews, "Material " << materialName << " does not contain " << viewName );
1368  }
1369  } );
1370  }
1371  }
1372  return accessor;
1373 }
1374 
1375 template< typename FIELD_TRAIT >
1378  arrayView1d< string const > const & materialNames,
1379  bool const allowMissingViews ) const
1380 {
1381  return constructMaterialViewAccessor< typename FIELD_TRAIT::type,
1382  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(),
1383  regionNames,
1384  materialNames,
1385  allowMissingViews );
1386 }
1387 
1388 template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
1390 ParticleManager::constructMaterialFieldAccessor( bool const allowMissingViews ) const
1391 {
1392  GEOS_UNUSED_VAR( allowMissingViews );
1393  return constructMaterialViewAccessor< MATERIAL_TYPE, typename FIELD_TRAIT::type,
1394  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key() );
1395 }
1396 
1397 template< typename T, int NDIM, typename PERM >
1400  arrayView1d< string const > const & regionNames,
1401  string const & materialKeyName,
1402  bool const allowMissingViews ) const
1403 {
1404  return constructMaterialViewAccessor< Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName,
1405  regionNames,
1406  materialKeyName,
1407  allowMissingViews );
1408 }
1409 
1410 template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS >
1412 ParticleManager::constructMaterialViewAccessor( string const & viewName ) const
1413 {
1415 
1416  // Resize the accessor to all regions and subregions
1417  for( localIndex er = 0; er < numRegions(); ++er )
1418  {
1419  accessor[er].resize( getRegion( er ).numSubRegions() );
1420  }
1421 
1422  // Loop only over regions named and populate according to given material names
1423  for( localIndex er = 0; er < numRegions(); ++er )
1424  {
1425  ParticleRegionBase const & region = getRegion( er );
1426 
1427  region.forParticleSubRegionsIndex( [&]( localIndex const esr,
1428  ParticleSubRegionBase const & subRegion )
1429  {
1430  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1431 
1432  string materialName;
1433  constitutiveGroup.forSubGroups< MATERIALTYPE >( [&]( MATERIALTYPE const & constitutiveRelation )
1434  {
1435  materialName = constitutiveRelation.getName();
1436  if( constitutiveRelation.template hasWrapper( viewName ) ) //NOTE (matteo): I have added this check to allow for the view to be
1437  // missing. I am not sure this is the default behaviour we want though.
1438  {
1439  accessor[er][esr] = constitutiveRelation.template getReference< VIEWTYPE >( viewName );
1440  }
1441  } );
1442  } );
1443  }
1444  return accessor;
1445 }
1446 
1447 template< typename MATERIALTYPE, typename T, int NDIM, typename PERM >
1450 {
1451  return constructMaterialViewAccessor< MATERIALTYPE, Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName );
1452 }
1453 
1454 template< typename CONSTITUTIVE_TYPE >
1456 ParticleManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const
1457 {
1459  accessor.resize( numRegions() );
1460  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1461  {
1462  ParticleRegionBase const & particleRegion = getRegion( kReg );
1463  accessor[kReg].resize( particleRegion.numSubRegions() );
1464 
1465  for( localIndex kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1466  {
1467  ParticleSubRegionBase const & subRegion = particleRegion.getSubRegion( kSubReg );
1468  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1469  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1470 
1471  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1472  {
1473  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1474 
1475  CONSTITUTIVE_TYPE * const
1476  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1477  if( constitutiveRelation != nullptr )
1478  {
1479  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1480  }
1481  }
1482  }
1483  }
1484  return accessor;
1485 }
1486 
1487 template< typename CONSTITUTIVE_TYPE >
1489 ParticleManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm )
1490 {
1492  accessor.resize( numRegions() );
1493  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1494  {
1495  ParticleRegionBase & particleRegion = getRegion( kReg );
1496  accessor[kReg].resize( particleRegion.numSubRegions() );
1497 
1498  for( localIndex kSubReg=0; kSubReg<particleRegion.numSubRegions(); ++kSubReg )
1499  {
1500  ParticleSubRegionBase & subRegion = particleRegion.getSubRegion( kSubReg );
1501  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1502  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1503 
1504  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1505  {
1506  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1507 
1508  CONSTITUTIVE_TYPE * const
1509  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1510  if( constitutiveRelation != nullptr )
1511  {
1512  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1513  }
1514  }
1515  }
1516  }
1517  return accessor;
1518 }
1519 
1520 }
1521 #endif /* GEOSX_MESH_PARTICLEREGIONMANAGER_HPP */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:83
#define GEOS_ERROR_IF_EQ_MSG(lhs, rhs, msg)
Raise a hard error if two values are equal.
Definition: Logger.hpp:176
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:107
constexpr static INDEX_TYPE invalid_index
the value of an invalid index
Definition: KeyIndexT.hpp:50
INDEX_TYPE size() const
function to return the number of entries stored
INDEX_TYPE getIndex(KEY_TYPE const &key) const
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
virtual localIndex packGlobalMapsSize(arrayView1d< localIndex const > const &packList, integer const recursive) const
Computes the pack size of the global maps elements in the @ packList.
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 localIndex packGlobalMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList, integer const recursive) const
Packs the global maps elements in the @ packList.
virtual localIndex unpackGlobalMaps(buffer_unit_type const *&buffer, localIndex_array &packList, integer const recursive)
Unpacks the global maps from buffer.
Abstract base class for ParticleBlockManager.
The ParticleManager class provides an interface to ObjectManagerBase in order to manage ParticleRegio...
void forParticleSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over the particle subregions of all subregion t...
ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE > constructFullConstitutiveAccessor(constitutive::ConstitutiveManager const &cm) const
Construct a ConstitutiveRelationAccessor.
void resize(integer_array const &numParticles, string_array const &regionNames, string_array const &particleTypes)
Set the number of particles for a set of particle regions.
virtual void setSchemaDeviations(xmlWrapper::xmlNode schemaRoot, xmlWrapper::xmlNode schemaParent, integer documentationType) override
Inform the schema generator of any deviations between the xml and GEOS data structures.
virtual void expandObjectCatalogs() override
Expand any catalogs in the data structure.
void forParticleRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the target particle regions with region ty...
void forParticleSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the particle subregions of all the subregi...
void updateMaps()
Updates the globalToLocal and localToGlobal maps.
MaterialViewAccessor< LHS > constructFullMaterialViewAccessor(string const &viewName, constitutive::ConstitutiveManager const &cm) const
This is a const function to construct a MaterialViewAccessor to access the material data.
void forParticleSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target particle subregions.
array1d< array1d< array1d< VIEWTYPE > > > MaterialViewAccessor
The MaterialViewAccessor at the ParticleManager level is a 3D array of VIEWTYPE.
bool hasRegion(string const &name) const
Determines if a ParticleRegion with the input name exists.
void forParticleSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the particle subregions of all the subregion typ...
virtual void setMaxGlobalIndex() override final
Set the maximum local and global index.
ParticleViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructFieldAccessor(string const &neighborName=string()) const
This is a const function to construct a ParticleViewAccessor to access the data registered on the mes...
void forParticleSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target particle subregions w...
void forParticleRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the particle regions that can be casted to o...
int PackGlobalMaps(buffer_unit_type *&buffer, ParticleViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack a buffer.
int Unpack(buffer_unit_type const *&buffer, ParticleViewAccessor< arrayView1d< localIndex > > &packList)
Unpack a buffer.
void forParticleSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over all the particle subregions that can be casted t...
void generateMesh(ParticleBlockManagerABC &particleBlockManager)
Generate the mesh.
array1d< array1d< VIEWTYPE > > ParticleViewAccessor
The ParticleViewAccessor at the ParticleManager level is an array of array of VIEWTYPE.
void forParticleRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the particle regions with region type ...
static string catalogName()
The function is to return the name of the ParticleManager in the object catalog.
subGroupMap const & getRegions() const
Get a collection of particle regions.
void forParticleRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda) const
This const function is used to launch kernel function over the specified target particle regions.
localIndex numParticleBlocks() const
Get the number of particle blocks.
void forParticleSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the particle subregions of the specified s...
void forParticleSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target particle subregions that ca...
void forParticleSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the particle subregions of the specified subregi...
void forParticleRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target particle regions.
localIndex numRegions() const
Get the number of regions.
ParticleViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructArrayViewAccessor(string const &name, string const &neighborName=string()) const
This is a function to construct a ParticleViewAccessor to access array data registered on the mesh.
T & getRegion(KEY_TYPE const &key)
Get a particle region.
void forParticleSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over the particle subregions of all subregion types.
ParticleViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructMaterialFieldAccessor(arrayView1d< string const > const &regionNames, arrayView1d< string const > const &materialNames, bool const allowMissingViews=false) const
This is a const function to construct a MaterialViewAccessor to access the material data for specifie...
ParticleViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructMaterialArrayViewAccessor(string const &viewName, arrayView1d< string const > const &regionNames, string const &materialKeyName, bool const allowMissingViews=false) const
Construct a view accessor for material data, assuming array as storage type.
T const & getRegion(KEY_TYPE const &key) const
Get a particle region.
void forParticleSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the particle subregions that can be ca...
int UnpackGlobalMaps(buffer_unit_type const *&buffer, ParticleViewAccessor< ReferenceWrapper< localIndex_array > > &packList)
Unpack a buffer.
virtual string getCatalogName() const override final
Virtual access to catalogName()
void forParticleSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target particle subregions.
ParticleViewAccessor< LHS > constructViewAccessor(string const &name, string const &neighborName=string()) const
This is a const function to construct a ParticleViewAccessor to access the data registered on the mes...
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new ParticleRegion object as a child of this group.
void forParticleRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the types of particle regions.
int PackSize(string_array const &wrapperNames, ParticleViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the buffer size needed to pack a list of wrappers.
void forParticleRegionsComplete(LAMBDA lambda) const
This const function is used to launch kernel function over all the particle regions that can be caste...
void forParticleSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target particle subregions with th...
ParticleManager(string const &name, Group *const parent)
Constructor.
subGroupMap & getRegions()
Get a collection of particle regions.
void forParticleRegionsComplete(LAMBDA lambda) const
This const function is used to launch kernel function over all the types of particle regions.
void forParticleSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target particle subregions t...
void forParticleSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target particle subregions.
int Unpack(buffer_unit_type const *&buffer, ParticleReferenceAccessor< array1d< localIndex > > &packList)
Unpack a buffer.
typename ParticleViewAccessor< VIEWTYPE >::NestedViewTypeConst ParticleViewConst
The ParticleViewAccessor at the ParticleManager level is the type resulting from ParticleViewAccessor...
void forParticleRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the target particle regions with region type = P...
void forParticleRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda) const
This const function is used to launch kernel function over the specified target particle regions with...
ParticleViewAccessor< ReferenceWrapper< VIEWTYPE > > constructReferenceAccessor(string const &viewName, string const &neighborName=string()) const
This is a const function to construct a ParticleViewAccessor to access the data registered on the mes...
void forParticleRegions(LAMBDA &&lambda)
This function is used to launch kernel function over all the particle regions with region type = Part...
int Pack(buffer_unit_type *&buffer, string_array const &wrapperNames, ParticleViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack a list of wrappers to a buffer.
ParticleViewAccessor< LHS > constructMaterialViewAccessor(string const &viewName, arrayView1d< string const > const &regionNames, string const &materialKeyName, bool const allowMissingViews=false) const
This is a const function to construct a MaterialViewAccessor to access the material data for specifie...
array1d< array1d< ReferenceWrapper< VIEWTYPE > > > ParticleReferenceAccessor
The ParticleViewAccessor at the ParticleManager level is a 2D array of ReferenceWrapper around VIEWTY...
typename ParticleViewAccessor< VIEWTYPE >::NestedViewType ParticleView
The ParticleViewAccessor at the ParticleManager level is the type resulting from ParticleViewAccessor...
void forParticleSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target particle subregions.
void forParticleRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target particle regions with regio...
localIndex getNumberOfParticles() const
Get the number of particles in all ParticleSubRegions of type T.
int PackGlobalMapsSize(ParticleViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the size of the buffer to be packed.
virtual ~ParticleManager() override
Destructor.
array1d< array1d< array1d< CONSTITUTIVE_TYPE * > > > ConstitutiveRelationAccessor
The ConstitutiveRelationAccessor at the ParticleManager level is a 3D array of CONSTITUTIVE_TYPE.
The ParticleRegionBase is the base class to manage the data stored at the particle level.
localIndex numSubRegions() const
Get the number of subregions in the region.
SUBREGIONTYPE const & getSubRegion(KEY_TYPE const &key) const
Get a reference to a subregion.
void forParticleSubRegionsIndex(LAMBDA &&lambda) const
Apply LAMBDA to the subregions, loop using subregion indices.
T const & getConstitutiveModel(string const &name) const
Get a pointer to the constitutive model.
dataRepository::Group const & getConstitutiveModels() const
Get the group in which the constitutive models of this subregion are registered.
T * getGroupPointer(KEY const &key)
Return a pointer to a sub-group of the current Group.
Definition: Group.hpp:314
bool hasWrapper(LOOKUP_TYPE const &lookup) const
Check if a wrapper exists.
Definition: Group.hpp:1181
localIndex getIndexInParent() const
Get the group's index within its parent group.
Definition: Group.hpp:1366
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1252
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:333
static bool applyLambdaToContainer(CONTAINERTYPE &container, LAMBDA &&lambda)
Apply a given functor to a container if the container can be cast to one of the specified types.
Definition: Group.hpp:472
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1294
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.
void forSubGroups(LAMBDA &&lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
Definition: Group.hpp:508
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.
Wrapper< T > const * getWrapperPointer(LOOKUP_TYPE const &index) const
Retrieve a Wrapper stored in this group.
Definition: Group.hpp:1218
virtual void resize(localIndex const newSize)
Resize the group and all contained wrappers that resize with parent.
T & reference()
Accessor for m_data.
Definition: Wrapper.hpp:580
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:55
pugi::xml_node xmlNode
Definition: xmlWrapper.hpp:57
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:423
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:149
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
LvArray::ArrayView< T, NDIM, USD, localIndex, LvArray::ChaiBuffer > ArrayView
Multidimensional array view type. See LvArray:ArrayView for details.
Definition: DataTypes.hpp:188
struct to serve as a container for group strings and keys
static constexpr char const * neighborDataString()
Group key associated with particleRegionsGroup.
static constexpr auto particleRegionsGroup()