GEOS
ElementRegionManager.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_MESH_ELEMENTREGIONMANAGER_HPP
21 #define GEOS_MESH_ELEMENTREGIONMANAGER_HPP
22 
23 #include "constitutive/ConstitutiveManager.hpp"
24 #include "CellElementRegion.hpp"
25 #include "CellElementSubRegion.hpp"
26 #include "mesh/generators/CellBlockManagerABC.hpp"
29 #include "SurfaceElementRegion.hpp"
30 #include "WellElementRegion.hpp"
31 
32 namespace geos
33 {
34 
35 class MeshManager;
36 
43 {
44 public:
45 
50  {
52  static constexpr auto elementRegionsGroup() { return "elementRegionsGroup"; }
53  };
54 
58  constexpr static int maxNumNodesPerElem = 8;
59 
64  template< typename VIEWTYPE >
66 
72  template< typename VIEWTYPE >
74 
80  template< typename VIEWTYPE >
82 
87  template< typename VIEWTYPE >
89 
95  template< typename VIEWTYPE >
97 
102  template< typename CONSTITUTIVE_TYPE >
104 
109  static string catalogName()
110  { return "ZoneManager"; }
111 
116  virtual string getCatalogName() const override final
117  { return catalogName(); }
118 
124  ElementRegionManager( string const & name, Group * const parent );
125 
129  virtual ~ElementRegionManager() override;
130 
135  template< typename T = ElementSubRegionBase >
137  {
138  localIndex numElem = 0;
139  this->forElementSubRegions< T >( [&]( ElementSubRegionBase const & elementSubRegion )
140  {
141  numElem += elementSubRegion.size();
142  } );
143  return numElem;
144  }
145 
150  void generateMesh( CellBlockManagerABC const & cellBlockManager );
151 
157  void generateWells( CellBlockManagerABC const & cellBlockManager, MeshLevel & meshLevel );
158 
164  void buildSets( NodeManager const & nodeManager );
165 
172  virtual Group * createChild( string const & childKey, string const & childName ) override;
173 // virtual void ReadXMLsub( xmlWrapper::xmlNode const & targetNode ) override;
174 
178  virtual void expandObjectCatalogs() override;
179 
186  virtual void setSchemaDeviations( xmlWrapper::xmlNode schemaRoot,
187  xmlWrapper::xmlNode schemaParent,
188  integer documentationType ) override;
189 
190  using Group::resize;
191 
198  void resize( integer_array const & numElements,
199  string_array const & regionNames,
200  string_array const & elementTypes );
201 
205  virtual void setMaxGlobalIndex() override final;
206 
211  subGroupMap const & getRegions() const
212  {
213  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
214  }
215 
221  {
222  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
223  }
224 
231  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
232  T const & getRegion( KEY_TYPE const & key ) const
233  {
234  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
235  }
236 
243  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
244  T & getRegion( KEY_TYPE const & key )
245  {
246  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
247  }
248 
255  template< typename T=ElementRegionBase >
256  bool hasRegion( string const & name ) const
257  {
258  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).hasGroup< T >( name );
259  }
260 
266  {
267  return this->getRegions().size();
268  }
269 
277 
284  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
285  void forElementRegions( LAMBDA && lambda )
286  {
287  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
288  }
289 
296  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
297  void forElementRegions( LAMBDA && lambda ) const
298  {
299  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
300  }
301 
310  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
311  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
312  {
313  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
314  }
315 
324  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
325  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
326  {
327  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
328  }
329 
335  template< typename LAMBDA >
336  void forElementRegionsComplete( LAMBDA lambda ) const
337  {
339  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
340  }
341 
347  template< typename LAMBDA >
348  void forElementRegionsComplete( LAMBDA lambda )
349  {
351  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
352  }
353 
360  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
361  void forElementRegionsComplete( LAMBDA lambda )
362  {
363  for( localIndex er=0; er<this->numRegions(); ++er )
364  {
365  ElementRegionBase & elementRegion = this->getRegion( er );
366 
367  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto & castedRegion )
368  {
369  lambda( er, castedRegion );
370  } );
371  }
372  }
373 
380  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
381  void forElementRegionsComplete( LAMBDA lambda ) const
382  {
383  for( localIndex er=0; er<this->numRegions(); ++er )
384  {
385  ElementRegionBase const & elementRegion = this->getRegion( er );
386 
387  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto const & castedRegion )
388  {
389  lambda( er, castedRegion );
390  } );
391  }
392  }
393 
401  template< typename LOOKUP_CONTAINER, typename LAMBDA >
402  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
403  {
405  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
406  }
407 
415  template< typename LOOKUP_CONTAINER, typename LAMBDA >
416  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
417  {
419  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
420  }
421 
430  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
431  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
432  {
433  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
434  auto & elementRegion )
435  {
436  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
437  } );
438  }
439 
448  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
449  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
450  {
451  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
452  auto const & elementRegion )
453  {
454  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
455  } );
456  }
457 
463  template< typename LAMBDA >
464  void forElementSubRegions( LAMBDA && lambda )
465  {
467  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
468  }
469 
476  template< typename LAMBDA >
477  void forElementSubRegions( LAMBDA && lambda ) const
478  {
480  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
481  }
482 
490  template< typename LOOKUP_CONTAINER, typename LAMBDA >
491  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
492  {
494  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
495  }
496 
504  template< typename LOOKUP_CONTAINER, typename LAMBDA >
505  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
506  {
508  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
509  }
510 
517  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
518  void forElementSubRegions( LAMBDA && lambda )
519  {
520  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
521  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
522  localIndex const,
524  auto & subRegion )
525  {
526  lambda( subRegion );
527  }
528  );
529  }
530 
537  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
538  void forElementSubRegions( LAMBDA && lambda ) const
539  {
540  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
541  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
542  localIndex const,
543  ElementRegionBase const &,
544  auto const & subRegion )
545  {
546  lambda( subRegion );
547  } );
548  }
549 
558  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
559  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
560  {
561  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
562  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
563  localIndex const,
564  localIndex const,
566  auto & subRegion )
567  {
568  lambda( targetIndex, subRegion );
569  } );
570  }
571 
580  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
581  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
582  {
583  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
584  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
585  localIndex const,
586  localIndex const,
587  ElementRegionBase const &,
588  auto const & subRegion )
589  {
590  lambda( targetIndex, subRegion );
591  } );
592  }
593 
599  template< typename LAMBDA >
600  void forElementSubRegionsComplete( LAMBDA && lambda ) const
601  {
603  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
604  }
605 
611  template< typename LAMBDA >
612  void forElementSubRegionsComplete( LAMBDA && lambda )
613  {
615  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
616  }
617 
625  template< typename LOOKUP_CONTAINER, typename LAMBDA >
626  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
627  {
628  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
629  std::forward< LAMBDA >( lambda ) );
630  }
631 
639  template< typename LOOKUP_CONTAINER, typename LAMBDA >
640  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
641  {
642  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
643  std::forward< LAMBDA >( lambda ) );
644  }
645 
652  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
653  void forElementSubRegionsComplete( LAMBDA && lambda )
654  {
655  for( localIndex er=0; er<this->numRegions(); ++er )
656  {
657  ElementRegionBase & elementRegion = this->getRegion( er );
658 
659  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
660  {
661  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
662 
663  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
664  {
665  lambda( er, esr, elementRegion, castedSubRegion );
666  } );
667  }
668  }
669  }
670 
677  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
678  void forElementSubRegionsComplete( LAMBDA && lambda ) const
679  {
680  for( localIndex er=0; er<this->numRegions(); ++er )
681  {
682  ElementRegionBase const & elementRegion = this->getRegion( er );
683 
684  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
685  {
686  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
687 
688  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
689  {
690  lambda( er, esr, elementRegion, castedSubRegion );
691  } );
692  }
693  }
694  }
695 
704  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
705  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
706  {
707  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase & elementRegion )
708  {
709  localIndex const er = elementRegion.getIndexInParent();
710 
711  if( er>-1 )
712  {
713  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
714  {
715  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
716 
717  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
718  {
719  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
720  } );
721  }
722  }
723  } );
724  }
725 
734  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
735  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
736  {
737  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase const & elementRegion )
738  {
739  localIndex const er = elementRegion.getIndexInParent();
740 
741  if( er>-1 )
742  {
743  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
744  {
745  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
746 
747  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
748  {
749  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
750  } );
751  }
752  }
753  } );
754  }
755 
756 
763  template< typename FIELD_TRAIT >
764  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
765  constructFieldAccessor( string const & neighborName = string() ) const;
766 
774  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
775  ElementViewAccessor< LHS >
776  constructViewAccessor( string const & name, string const & neighborName = string() ) const;
777 
785  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
786  ElementViewAccessor< LHS >
787  constructViewAccessor( string const & name, string const & neighborName = string() );
788 
798  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
799  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
800  constructArrayViewAccessor( string const & name, string const & neighborName = string() ) const;
801 
809  template< typename VIEWTYPE >
810  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
811  constructReferenceAccessor( string const & viewName, string const & neighborName = string() ) const;
812 
820  template< typename VIEWTYPE >
821  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
822  constructReferenceAccessor( string const & viewName, string const & neighborName = string() );
823 
831  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
832  MaterialViewAccessor< LHS >
833  constructFullMaterialViewAccessor( string const & viewName,
834  constitutive::ConstitutiveManager const & cm ) const;
835 
843  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
844  MaterialViewAccessor< LHS >
845  constructFullMaterialViewAccessor( string const & viewName,
846  constitutive::ConstitutiveManager const & cm );
847 
858  template< typename FIELD_TRAIT >
859  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
861  arrayView1d< string const > const & materialNames,
862  bool const allowMissingViews = false ) const;
863 
873  template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
874  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
875  constructMaterialFieldAccessor( bool const allowMissingViews = false ) const;
876 
877 
889  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
890  ElementViewAccessor< LHS >
891  constructMaterialViewAccessor( string const & viewName,
892  arrayView1d< string const > const & regionNames,
893  string const & materialKeyName,
894  bool const allowMissingViews = false ) const;
895 
907  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
908  ElementViewAccessor< LHS >
909  constructMaterialViewAccessor( string const & viewName,
910  arrayView1d< string const > const & regionNames,
911  string const & materialKeyName,
912  bool const allowMissingViews = false );
913 
925  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
926  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
927  constructMaterialArrayViewAccessor( string const & viewName,
928  arrayView1d< string const > const & regionNames,
929  string const & materialKeyName,
930  bool const allowMissingViews = false ) const;
931 
940  template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS=VIEWTYPE >
941  ElementViewAccessor< LHS >
942  constructMaterialViewAccessor( string const & viewName ) const;
943 
954  template< typename MATERIALTYPE, typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
955  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
956  constructMaterialArrayViewAccessor( string const & viewName ) const;
957 
964  template< typename CONSTITUTIVE_TYPE >
965  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
966  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const;
967 
968 
975  template< typename CONSTITUTIVE_TYPE >
976  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
977  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm );
978 
979  using Group::packSize;
980  using Group::pack;
987 
993  int packSize( ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
994 
1001  int pack( buffer_unit_type * & buffer,
1002  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1003 
1006 
1013  int unpack( buffer_unit_type const * & buffer,
1015 
1022  int unpack( buffer_unit_type const * & buffer,
1024 
1031 
1039  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1040 
1047  int unpackGlobalMaps( buffer_unit_type const * & buffer,
1049 
1056 
1063 
1071  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1072 
1080  ElementReferenceAccessor< array1d< localIndex > > const & packList ) const;
1081 
1089  int unpackUpDownMaps( buffer_unit_type const * & buffer,
1091  bool const overwriteMap );
1092 
1100  string const fractureRegionName ) const;
1101 
1110  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1111  string const fractureRegionName ) const;
1112 
1122  string const fractureRegionName );
1123 
1124 
1125 private:
1126 
1133  template< bool DO_PACKING >
1134  int packImpl( buffer_unit_type * & buffer,
1135  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1136 
1143  template< bool DO_PACKING >
1144  int packGlobalMapsImpl( buffer_unit_type * & buffer,
1145  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1146 
1153  template< bool DO_PACKING, typename T >
1154  int
1155  packUpDownMapsImpl( buffer_unit_type * & buffer,
1156  T const & packList ) const;
1163  template< typename T >
1164  int unpackImpl( buffer_unit_type const * & buffer,
1165  T & packList );
1166 
1174  template< bool DO_PACKING >
1175  int packFracturedElementsImpl( buffer_unit_type * & buffer,
1176  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1177  string const fractureRegionName ) const;
1178 
1183 
1188  ElementRegionManager & operator=( const ElementRegionManager & );
1189 };
1190 
1191 
1192 template< typename VIEWTYPE, typename LHS >
1194 ElementRegionManager::constructViewAccessor( string const & viewName, string const & neighborName ) const
1195 {
1196  ElementViewAccessor< LHS > viewAccessor;
1197  viewAccessor.resize( numRegions() );
1198  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1199  {
1200  ElementRegionBase const & elemRegion = getRegion( kReg );
1201  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1202 
1203  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1204  {
1205  Group const * group = &elemRegion.getSubRegion( kSubReg );
1206 
1207  if( !neighborName.empty() )
1208  {
1209  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1210  }
1211 
1212  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1213  if( wrapper )
1214  {
1215  viewAccessor[kReg][kSubReg] = wrapper->reference();
1216  }
1217  }
1218  }
1219  return viewAccessor;
1220 }
1221 
1222 
1223 template< typename VIEWTYPE, typename LHS >
1226  constructViewAccessor( string const & viewName, string const & neighborName )
1227 {
1228  ElementViewAccessor< LHS > viewAccessor;
1229  viewAccessor.resize( numRegions() );
1230  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1231  {
1232  ElementRegionBase & elemRegion = getRegion( kReg );
1233  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1234 
1235  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1236  {
1237  Group * group = &elemRegion.getSubRegion( kSubReg );
1238 
1239  if( !neighborName.empty() )
1240  {
1241  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1242  }
1243 
1244  dataRepository::Wrapper< VIEWTYPE > * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1245  if( wrapper )
1246  {
1247  viewAccessor[kReg][kSubReg] = wrapper->reference();
1248  }
1249  }
1250  }
1251  return viewAccessor;
1252 }
1253 
1254 template< typename FIELD_TRAIT >
1256 ElementRegionManager::constructFieldAccessor( string const & neighborName ) const
1257 {
1258  return constructViewAccessor< typename FIELD_TRAIT::type,
1259  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(), neighborName );
1260 }
1261 
1262 
1263 template< typename T, int NDIM, typename PERM >
1266  constructArrayViewAccessor( string const & name, string const & neighborName ) const
1267 {
1268  return constructViewAccessor< Array< T, NDIM, PERM >,
1270  >( name, neighborName );
1271 }
1272 
1273 template< typename VIEWTYPE >
1276  constructReferenceAccessor( string const & viewName, string const & neighborName ) const
1277 {
1279  viewAccessor.resize( numRegions() );
1280  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1281  {
1282  ElementRegionBase const & elemRegion = getRegion( kReg );
1283  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1284 
1285  for( typename dataRepository::indexType kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1286  {
1287  Group const * group = &elemRegion.getSubRegion( kSubReg );
1288 
1289  if( !neighborName.empty() )
1290  {
1291  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1292  }
1293 
1294  if( group->hasWrapper( viewName ) )
1295  {
1296  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1297  }
1298  }
1299  }
1300  return viewAccessor;
1301 }
1302 
1303 template< typename VIEWTYPE >
1306  string const & neighborName )
1307 {
1309  viewAccessor.resize( numRegions() );
1310  for( typename dataRepository::indexType kReg = 0; kReg < numRegions(); ++kReg )
1311  {
1312  ElementRegionBase & elemRegion = getRegion( kReg );
1313  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1314 
1315  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1316  {
1317  Group * group = &elemRegion.getSubRegion( kSubReg );
1318 
1319  if( !neighborName.empty() )
1320  {
1321  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1322  }
1323 
1324  if( group->hasWrapper( viewName ) )
1325  {
1326  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1327  }
1328  }
1329  }
1330  return viewAccessor;
1331 }
1332 
1333 template< typename VIEWTYPE, typename LHS >
1336  constructFullMaterialViewAccessor( string const & viewName,
1337  constitutive::ConstitutiveManager const & cm ) const
1338 {
1339  MaterialViewAccessor< LHS > accessor;
1340  accessor.resize( numRegions() );
1341  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1342  {
1343  ElementRegionBase const & elemRegion = getRegion( kReg );
1344  accessor[kReg].resize( elemRegion.numSubRegions() );
1345 
1346  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1347  {
1348  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1349  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1350 
1351  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1352 
1353  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1354  {
1355  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1356  dataRepository::Group const * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1357  if( constitutiveRelation != nullptr )
1358  {
1359  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1360  if( wrapper )
1361  {
1362  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1363  }
1364  }
1365  }
1366  }
1367  }
1368  return accessor;
1369 }
1370 
1371 template< typename VIEWTYPE, typename LHS >
1374  constructFullMaterialViewAccessor( string const & viewName,
1375  constitutive::ConstitutiveManager const & cm )
1376 {
1377  MaterialViewAccessor< LHS > accessor;
1378  accessor.resize( numRegions() );
1379  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1380  {
1381  ElementRegionBase & elemRegion = getRegion( kReg );
1382  accessor[kReg].resize( elemRegion.numSubRegions() );
1383 
1384  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1385  {
1386  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1387  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1388 
1389  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1390 
1391  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1392  {
1393  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1394  dataRepository::Group * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1395  if( constitutiveRelation != nullptr )
1396  {
1397  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1398  if( wrapper )
1399  {
1400  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1401  }
1402  }
1403  }
1404  }
1405  }
1406  return accessor;
1407 }
1408 
1409 template< typename VIEWTYPE, typename LHS >
1412  arrayView1d< string const > const & regionNames,
1413  string const & materialKeyName,
1414  bool const allowMissingViews ) const
1415 {
1416  ElementViewAccessor< LHS > accessor;
1417 
1418  // Resize the accessor to all regions and subregions
1419  accessor.resize( numRegions() );
1420  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1421  {
1422  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1423  }
1424 
1425  subGroupMap const & regionMap = getRegions();
1426 
1427  // Loop only over regions named and populate according to given material names
1428  for( localIndex k = 0; k < regionNames.size(); ++k )
1429  {
1430  localIndex const er = regionMap.getIndex( regionNames[k] );
1431  if( er >=0 )
1432  {
1433  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1434  ElementRegionBase const & region = getRegion( er );
1435 
1436  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1437  ElementSubRegionBase const & subRegion )
1438  {
1439  string const & materialName = subRegion.getReference< string >( materialKeyName );
1440  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1441 
1442  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1443  if( wrapper )
1444  {
1445  accessor[er][esr] = wrapper->reference();
1446  }
1447  else
1448  {
1449  GEOS_ERROR_IF( !allowMissingViews,
1450  subRegion.getDataContext() <<
1451  ": Material " << constitutiveRelation.getDataContext() <<
1452  " does not contain " << viewName );
1453  }
1454  } );
1455  }
1456  }
1457  return accessor;
1458 }
1459 
1460 template< typename VIEWTYPE, typename LHS >
1463  arrayView1d< string const > const & regionNames,
1464  string const & materialKeyName,
1465  bool const allowMissingViews )
1466 {
1467  ElementViewAccessor< LHS > accessor;
1468 
1469  // Resize the accessor to all regions and subregions
1470  accessor.resize( numRegions() );
1471  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1472  {
1473  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1474  }
1475 
1476  subGroupMap const & regionMap = getRegions();
1477 
1478  // Loop only over regions named and populate according to given material names
1479  for( localIndex k = 0; k < regionNames.size(); ++k )
1480  {
1481  localIndex const er = regionMap.getIndex( regionNames[k] );
1482  if( er >=0 )
1483  {
1484  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1485  ElementRegionBase & region = getRegion( er );
1486 
1487  region.forElementSubRegionsIndex( [&]( localIndex const esr, ElementSubRegionBase & subRegion )
1488  {
1489  string const & materialName = subRegion.getReference< string >( materialKeyName );
1490  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1491 
1492  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1493  if( wrapper )
1494  {
1495  accessor[er][esr] = wrapper->reference();
1496  }
1497  else
1498  {
1499  GEOS_ERROR_IF( !allowMissingViews, region.getDataContext() << ": Material " << materialName
1500  << " does not contain " << viewName );
1501  }
1502  } );
1503  }
1504  }
1505  return accessor;
1506 }
1507 
1508 template< typename FIELD_TRAIT >
1511  arrayView1d< string const > const & materialNames,
1512  bool const allowMissingViews ) const
1513 {
1514  return constructMaterialViewAccessor< typename FIELD_TRAIT::type,
1515  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(),
1516  regionNames,
1517  materialNames,
1518  allowMissingViews );
1519 }
1520 
1521 template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
1523 ElementRegionManager::constructMaterialFieldAccessor( bool const allowMissingViews ) const
1524 {
1525  GEOS_UNUSED_VAR( allowMissingViews );
1526  return constructMaterialViewAccessor< MATERIAL_TYPE, typename FIELD_TRAIT::type,
1527  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key() );
1528 }
1529 
1530 
1531 template< typename T, int NDIM, typename PERM >
1534  constructMaterialArrayViewAccessor( string const & viewName,
1535  arrayView1d< string const > const & regionNames,
1536  string const & materialKeyName,
1537  bool const allowMissingViews ) const
1538 {
1539  return constructMaterialViewAccessor< Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName,
1540  regionNames,
1541  materialKeyName,
1542  allowMissingViews );
1543 }
1544 
1545 template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS >
1548 {
1549  ElementViewAccessor< LHS > accessor( numRegions() );
1550 
1551  // Resize the accessor to all regions and subregions
1552  for( localIndex er = 0; er < numRegions(); ++er )
1553  {
1554  accessor[er].resize( getRegion( er ).numSubRegions() );
1555  }
1556 
1557  // Loop only over regions named and populate according to given material names
1558  for( localIndex er = 0; er < numRegions(); ++er )
1559  {
1560  ElementRegionBase const & region = getRegion( er );
1561 
1562  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1563  ElementSubRegionBase const & subRegion )
1564  {
1565  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1566 
1567  string materialName;
1568  constitutiveGroup.forSubGroups< MATERIALTYPE >( [&]( MATERIALTYPE const & constitutiveRelation )
1569  {
1570  materialName = constitutiveRelation.getName();
1571  if( constitutiveRelation.template hasWrapper( viewName ) ) //NOTE (matteo): I have added this check to allow for the view to be
1572  // missing. I am not sure this is the default behaviour we want though.
1573  {
1574  accessor[er][esr] = constitutiveRelation.template getReference< VIEWTYPE >( viewName );
1575  }
1576  } );
1577  } );
1578  }
1579  return accessor;
1580 }
1581 
1582 template< typename MATERIALTYPE, typename T, int NDIM, typename PERM >
1585 {
1586  return constructMaterialViewAccessor< MATERIALTYPE, Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName );
1587 }
1588 
1589 template< typename CONSTITUTIVE_TYPE >
1591 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const
1592 {
1594  accessor.resize( numRegions() );
1595  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1596  {
1597  ElementRegionBase const & elemRegion = getRegion( kReg );
1598  accessor[kReg].resize( elemRegion.numSubRegions() );
1599 
1600  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1601  {
1602  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1603  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1604  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1605 
1606  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1607  {
1608  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1609 
1610  CONSTITUTIVE_TYPE * const
1611  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1612  if( constitutiveRelation != nullptr )
1613  {
1614  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1615  }
1616  }
1617  }
1618  }
1619  return accessor;
1620 }
1621 
1622 template< typename CONSTITUTIVE_TYPE >
1624 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm )
1625 {
1627  accessor.resize( numRegions() );
1628  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1629  {
1630  ElementRegionBase & elemRegion = getRegion( kReg );
1631  accessor[kReg].resize( elemRegion.numSubRegions() );
1632 
1633  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1634  {
1635  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1636  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1637  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1638 
1639  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1640  {
1641  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1642 
1643  CONSTITUTIVE_TYPE * const
1644  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1645  if( constitutiveRelation != nullptr )
1646  {
1647  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1648  }
1649  }
1650  }
1651  }
1652  return accessor;
1653 }
1654 
1655 }
1656 #endif /* GEOS_MESH_ELEMENTREGIONMANAGER_HPP */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:84
#define GEOS_ERROR_IF_EQ_MSG(lhs, rhs, msg)
Raise a hard error if two values are equal.
Definition: Logger.hpp:211
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:142
constexpr static INDEX_TYPE invalid_index
the value of an invalid index
Definition: KeyIndexT.hpp:51
Abstract base class for CellBlockManager.
The ElementRegionBase is the base class to manage the data stored at the element level.
void forElementSubRegionsIndex(LAMBDA &&lambda) const
Apply LAMBDA to the subregions, loop using subregion indices.
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.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
array1d< array1d< ReferenceWrapper< VIEWTYPE > > > ElementReferenceAccessor
The ElementViewAccessor at the ElementRegionManager level is a 2D array of ReferenceWrapper around VI...
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions that can...
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions.
void forElementRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the types of element regions.
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions.
int unpackUpDownMaps(buffer_unit_type const *&buffer, ElementReferenceAccessor< localIndex_array > &packList, bool const overwriteMap)
Unpack element-to-node and element-to-face maps.
T & getRegion(KEY_TYPE const &key)
Get a element region.
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.
int packGlobalMaps(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack a buffer.
int unpack(buffer_unit_type const *&buffer, ElementReferenceAccessor< array1d< localIndex > > &packList)
Unpack a buffer.
int packFracturedElementsSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList, string const fractureRegionName) const
Get the buffer size needed to pack the set of fractured elements and the map toEmbSurfaces.
ElementViewAccessor< 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.
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.
ElementRegionManager(string const &name, Group *const parent)
Constructor.
virtual ~ElementRegionManager() override
Destructor.
virtual void setMaxGlobalIndex() override final
Set the maximum local and global index.
int unpack(buffer_unit_type const *&buffer, ElementViewAccessor< arrayView1d< localIndex > > &packList)
Unpack a buffer.
void forElementSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of the specified su...
int packUpDownMaps(buffer_unit_type *&buffer, ElementReferenceAccessor< array1d< localIndex > > const &packList) const
Pack element-to-node and element-to-face maps.
void forElementRegions(LAMBDA &&lambda)
This function is used to launch kernel function over all the element regions with region type = Eleme...
int pack(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack all the wrappers of all the sub regions of all the regions.
array2d< localIndex > getCellBlockToSubRegionMap(CellBlockManagerABC const &cellBlockManager) const
Produce a map from cell block indices to element region and subregion indices.
void forElementRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the element regions that can be casted to on...
subGroupMap const & getRegions() const
Get a collection of element regions.
ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE > constructFullConstitutiveAccessor(constitutive::ConstitutiveManager const &cm) const
Construct a ConstitutiveRelationAccessor.
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions th...
ElementViewAccessor< 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...
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target element regions.
localIndex numRegions() const
Get number of the regions.
void forElementSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions.
ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructFieldAccessor(string const &neighborName=string()) const
This is a const function to construct a ElementViewAccessor to access the data registered on the mesh...
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new ElementRegion object as a child of this group.
void forElementSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the element subregions that can be cas...
void forElementRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the element regions with region type =...
subGroupMap & getRegions()
Get a collection of element regions.
int unpackFracturedElements(buffer_unit_type const *&buffer, ElementReferenceAccessor< localIndex_array > &packList, string const fractureRegionName)
Unpack set of fractured elements and map toEmbSurfaces to a buffer or get the buffer size.
array1d< array1d< array1d< CONSTITUTIVE_TYPE * > > > ConstitutiveRelationAccessor
The ConstitutiveRelationAccessor at the ElementRegionManager level is a 3D array of CONSTITUTIVE_TYPE...
void forElementRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the target element regions with region typ...
int packFracturedElements(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList, string const fractureRegionName) const
Pack set of fractured elements and map toEmbSurfaces to a buffer or get the buffer size.
int unpackGlobalMaps(buffer_unit_type const *&buffer, ElementViewAccessor< ReferenceWrapper< localIndex_array > > &packList)
Unpack a buffer.
void forElementRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the target element regions with region type = El...
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target element regions with region...
typename ElementViewAccessor< VIEWTYPE >::NestedViewType ElementView
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
int packUpDownMaps(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack element-to-node and element-to-face maps.
virtual void expandObjectCatalogs() override
Expand any catalogs in the data structure.
void forElementRegionsComplete(LAMBDA lambda) const
This const function is used to launch kernel function over all the types of element regions.
localIndex getNumberOfElements() const
Get the number of elements in all ElementSubRegions of type T.
ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructArrayViewAccessor(string const &name, string const &neighborName=string()) const
This is a function to construct a ElementViewAccessor to access array data registered on the mesh.
int packUpDownMapsSize(ElementReferenceAccessor< array1d< localIndex > > const &packList) const
Get the buffer size needed to pack element-to-node and element-to-face maps.
void forElementSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of all subregion ty...
void forElementSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of all subregion types.
void forElementSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of all the subregio...
void forElementSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over all the element subregions that can be casted to...
void forElementSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of all the subregion type...
virtual string getCatalogName() const override final
Virtual access to catalogName()
void forElementSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of the specified subregio...
void generateMesh(CellBlockManagerABC const &cellBlockManager)
Generate the mesh. Produce an error if a required cellBlock doesn't exist in the source mesh.
void forElementRegionsComplete(LAMBDA lambda) const
This const function is used to launch kernel function over all the element regions that can be casted...
void forElementSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions wi...
void forElementSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions.
array1d< array1d< array1d< VIEWTYPE > > > MaterialViewAccessor
The MaterialViewAccessor at the ElementRegionManager level is a 3D array of VIEWTYPE.
int packGlobalMapsSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the size of the buffer to be packed.
ElementViewAccessor< 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...
int packSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the buffer size needed to pack all the wrappers of all the sub regions of all the regions.
void buildSets(NodeManager const &nodeManager)
Build sets from the node sets.
array1d< array1d< VIEWTYPE > > ElementViewAccessor
The ElementViewAccessor at the ElementRegionManager level is an array of array of VIEWTYPE.
bool hasRegion(string const &name) const
Determines if an ElementRegion with the input name exists.
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda) const
This const function is used to launch kernel function over the specified target element regions.
void resize(integer_array const &numElements, string_array const &regionNames, string_array const &elementTypes)
Set the number of elements for a set of element regions.
constexpr static int maxNumNodesPerElem
int packUpDownMapsSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the buffer size needed to pack element-to-node and element-to-face maps.
static string catalogName()
The function is to return the name of the ElementRegionManager in the object catalog.
ElementViewAccessor< ReferenceWrapper< VIEWTYPE > > constructReferenceAccessor(string const &viewName, string const &neighborName=string()) const
This is a const function to construct a ElementViewAccessor to access the data registered on the mesh...
typename ElementViewAccessor< VIEWTYPE >::NestedViewTypeConst ElementViewConst
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
void generateWells(CellBlockManagerABC const &cellBlockManager, MeshLevel &meshLevel)
Generate the wells.
T const & getRegion(KEY_TYPE const &key) const
Get a element region.
ElementViewAccessor< LHS > constructViewAccessor(string const &name, string const &neighborName=string()) const
This is a const function to construct a ElementViewAccessor to access the data registered on the mesh...
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda) const
This const function is used to launch kernel function over the specified target element regions with ...
void forElementSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions with the...
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.
INDEX_TYPE size() const
function to return the number of entries stored
INDEX_TYPE getIndex(KEY_TYPE const &key) const
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:42
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
The ObjectManagerBase is the base object of all object managers in the mesh data hierachy.
virtual localIndex packUpDownMaps(buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList) const
Packs the specific elements in the @ packList.
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.
virtual localIndex packUpDownMapsSize(arrayView1d< localIndex const > const &packList) const
Computes the pack size of the specific elements in the @ packList.
virtual localIndex unpackUpDownMaps(buffer_unit_type const *&buffer, array1d< localIndex > &packList, bool const overwriteUpMaps, bool const overwriteDownMaps)
Unpacks the specific elements in the @ packList.
This class specializes the element region for the case of a well. This class is also in charge of sta...
This class describes a collection of local well elements and perforations.
T * getGroupPointer(KEY const &key)
Return a pointer to a sub-group of the current Group.
Definition: Group.hpp:317
DataContext const & getDataContext() const
Definition: Group.hpp:1343
bool hasWrapper(LOOKUP_TYPE const &lookup) const
Check if a wrapper exists.
Definition: Group.hpp:1202
localIndex getIndexInParent() const
Get the group's index within its parent group.
Definition: Group.hpp:1387
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1273
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:336
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:482
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1315
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:518
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:1239
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:581
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:58
pugi::xml_node xmlNode
Definition: xmlWrapper.hpp:59
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:383
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:109
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
LvArray::ArrayView< T, NDIM, USD, localIndex, LvArray::ChaiBuffer > ArrayView
Multidimensional array view type. See LvArray:ArrayView for details.
Definition: DataTypes.hpp:148
Group key associated with elementRegionsGroup.
struct to serve as a container for group strings and keys
static constexpr char const * neighborDataString()