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 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_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 
1093 
1100 
1108  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1109 
1119  bool const overwriteMap );
1120 
1128  string const fractureRegionName ) const;
1129 
1138  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1139  string const fractureRegionName ) const;
1140 
1150  string const fractureRegionName );
1151 
1156  virtual void outputObjectConnectivity() const override final;
1157 
1158 
1159 private:
1160 
1167  template< bool DO_PACKING >
1168  int packImpl( buffer_unit_type * & buffer,
1169  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1170 
1177  template< bool DO_PACKING >
1178  int packGlobalMapsImpl( buffer_unit_type * & buffer,
1179  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1180 
1187  template< bool DO_PACKING, typename T >
1188  int
1189  packUpDownMapsImpl( buffer_unit_type * & buffer,
1190  T const & packList ) const;
1191 
1192  template< bool DO_PACKING, typename T >
1193  int
1194  packFaceElementToFaceImpl( buffer_unit_type * & buffer,
1195  T const & packList ) const;
1196 
1203  template< typename T >
1204  int unpackImpl( buffer_unit_type const * & buffer,
1205  T & packList );
1206 
1214  template< bool DO_PACKING >
1215  int packFracturedElementsImpl( buffer_unit_type * & buffer,
1216  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1217  string const fractureRegionName ) const;
1218 
1223 
1228  ElementRegionManager & operator=( const ElementRegionManager & );
1229 };
1230 
1231 
1232 template< typename VIEWTYPE, typename LHS >
1234 ElementRegionManager::constructViewAccessor( string const & viewName, string const & neighborName ) const
1235 {
1236  ElementViewAccessor< LHS > viewAccessor;
1237  viewAccessor.resize( numRegions() );
1238  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1239  {
1240  ElementRegionBase const & elemRegion = getRegion( kReg );
1241  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1242 
1243  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1244  {
1245  Group const * group = &elemRegion.getSubRegion( kSubReg );
1246 
1247  if( !neighborName.empty() )
1248  {
1249  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1250  }
1251 
1252  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1253  if( wrapper )
1254  {
1255  viewAccessor[kReg][kSubReg] = wrapper->reference();
1256  }
1257  }
1258  }
1259  return viewAccessor;
1260 }
1261 
1262 
1263 template< typename VIEWTYPE, typename LHS >
1266  constructViewAccessor( string const & viewName, string const & neighborName )
1267 {
1268  ElementViewAccessor< LHS > viewAccessor;
1269  viewAccessor.resize( numRegions() );
1270  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1271  {
1272  ElementRegionBase & elemRegion = getRegion( kReg );
1273  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1274 
1275  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1276  {
1277  Group * group = &elemRegion.getSubRegion( kSubReg );
1278 
1279  if( !neighborName.empty() )
1280  {
1281  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1282  }
1283 
1284  dataRepository::Wrapper< VIEWTYPE > * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1285  if( wrapper )
1286  {
1287  viewAccessor[kReg][kSubReg] = wrapper->reference();
1288  }
1289  }
1290  }
1291  return viewAccessor;
1292 }
1293 
1294 template< typename FIELD_TRAIT >
1296 ElementRegionManager::constructFieldAccessor( string const & neighborName ) const
1297 {
1298  return constructViewAccessor< typename FIELD_TRAIT::type,
1299  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(), neighborName );
1300 }
1301 
1302 
1303 template< typename T, int NDIM, typename PERM >
1306  constructArrayViewAccessor( string const & name, string const & neighborName ) const
1307 {
1308  return constructViewAccessor< Array< T, NDIM, PERM >,
1310  >( name, neighborName );
1311 }
1312 
1313 template< typename VIEWTYPE >
1316  constructReferenceAccessor( string const & viewName, string const & neighborName ) const
1317 {
1319  viewAccessor.resize( numRegions() );
1320  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1321  {
1322  ElementRegionBase const & elemRegion = getRegion( kReg );
1323  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1324 
1325  for( typename dataRepository::indexType kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1326  {
1327  Group const * group = &elemRegion.getSubRegion( kSubReg );
1328 
1329  if( !neighborName.empty() )
1330  {
1331  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1332  }
1333 
1334  if( group->hasWrapper( viewName ) )
1335  {
1336  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1337  }
1338  }
1339  }
1340  return viewAccessor;
1341 }
1342 
1343 template< typename VIEWTYPE >
1346  string const & neighborName )
1347 {
1349  viewAccessor.resize( numRegions() );
1350  for( typename dataRepository::indexType kReg = 0; kReg < numRegions(); ++kReg )
1351  {
1352  ElementRegionBase & elemRegion = getRegion( kReg );
1353  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1354 
1355  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1356  {
1357  Group * group = &elemRegion.getSubRegion( kSubReg );
1358 
1359  if( !neighborName.empty() )
1360  {
1361  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1362  }
1363 
1364  if( group->hasWrapper( viewName ) )
1365  {
1366  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1367  }
1368  }
1369  }
1370  return viewAccessor;
1371 }
1372 
1373 template< typename VIEWTYPE, typename LHS >
1376  constructFullMaterialViewAccessor( string const & viewName,
1377  constitutive::ConstitutiveManager const & cm ) const
1378 {
1379  MaterialViewAccessor< LHS > accessor;
1380  accessor.resize( numRegions() );
1381  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1382  {
1383  ElementRegionBase const & elemRegion = getRegion( kReg );
1384  accessor[kReg].resize( elemRegion.numSubRegions() );
1385 
1386  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1387  {
1388  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1389  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1390 
1391  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1392 
1393  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1394  {
1395  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1396  dataRepository::Group const * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1397  if( constitutiveRelation != nullptr )
1398  {
1399  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1400  if( wrapper )
1401  {
1402  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1403  }
1404  }
1405  }
1406  }
1407  }
1408  return accessor;
1409 }
1410 
1411 template< typename VIEWTYPE, typename LHS >
1414  constructFullMaterialViewAccessor( string const & viewName,
1415  constitutive::ConstitutiveManager const & cm )
1416 {
1417  MaterialViewAccessor< LHS > accessor;
1418  accessor.resize( numRegions() );
1419  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1420  {
1421  ElementRegionBase & elemRegion = getRegion( kReg );
1422  accessor[kReg].resize( elemRegion.numSubRegions() );
1423 
1424  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1425  {
1426  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1427  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1428 
1429  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1430 
1431  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1432  {
1433  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1434  dataRepository::Group * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1435  if( constitutiveRelation != nullptr )
1436  {
1437  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1438  if( wrapper )
1439  {
1440  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1441  }
1442  }
1443  }
1444  }
1445  }
1446  return accessor;
1447 }
1448 
1449 template< typename VIEWTYPE, typename LHS >
1452  arrayView1d< string const > const & regionNames,
1453  string const & materialKeyName,
1454  bool const allowMissingViews ) const
1455 {
1456  ElementViewAccessor< LHS > accessor;
1457 
1458  // Resize the accessor to all regions and subregions
1459  accessor.resize( numRegions() );
1460  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1461  {
1462  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1463  }
1464 
1465  subGroupMap const & regionMap = getRegions();
1466 
1467  // Loop only over regions named and populate according to given material names
1468  for( localIndex k = 0; k < regionNames.size(); ++k )
1469  {
1470  localIndex const er = regionMap.getIndex( regionNames[k] );
1471  if( er >=0 )
1472  {
1473  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1474  ElementRegionBase const & region = getRegion( er );
1475 
1476  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1477  ElementSubRegionBase const & subRegion )
1478  {
1479  string const & materialName = subRegion.getReference< string >( materialKeyName );
1480  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1481 
1482  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1483  if( wrapper )
1484  {
1485  accessor[er][esr] = wrapper->reference();
1486  }
1487  else
1488  {
1489  GEOS_ERROR_IF( !allowMissingViews,
1490  subRegion.getDataContext() <<
1491  ": Material " << constitutiveRelation.getDataContext() <<
1492  " does not contain " << viewName );
1493  }
1494  } );
1495  }
1496  }
1497  return accessor;
1498 }
1499 
1500 template< typename VIEWTYPE, typename LHS >
1503  arrayView1d< string const > const & regionNames,
1504  string const & materialKeyName,
1505  bool const allowMissingViews )
1506 {
1507  ElementViewAccessor< LHS > accessor;
1508 
1509  // Resize the accessor to all regions and subregions
1510  accessor.resize( numRegions() );
1511  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1512  {
1513  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1514  }
1515 
1516  subGroupMap const & regionMap = getRegions();
1517 
1518  // Loop only over regions named and populate according to given material names
1519  for( localIndex k = 0; k < regionNames.size(); ++k )
1520  {
1521  localIndex const er = regionMap.getIndex( regionNames[k] );
1522  if( er >=0 )
1523  {
1524  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1525  ElementRegionBase & region = getRegion( er );
1526 
1527  region.forElementSubRegionsIndex( [&]( localIndex const esr, ElementSubRegionBase & subRegion )
1528  {
1529  string const & materialName = subRegion.getReference< string >( materialKeyName );
1530  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1531 
1532  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1533  if( wrapper )
1534  {
1535  accessor[er][esr] = wrapper->reference();
1536  }
1537  else
1538  {
1539  GEOS_ERROR_IF( !allowMissingViews, region.getDataContext() << ": Material " << materialName
1540  << " does not contain " << viewName );
1541  }
1542  } );
1543  }
1544  }
1545  return accessor;
1546 }
1547 
1548 template< typename FIELD_TRAIT >
1551  arrayView1d< string const > const & materialNames,
1552  bool const allowMissingViews ) const
1553 {
1554  return constructMaterialViewAccessor< typename FIELD_TRAIT::type,
1555  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(),
1556  regionNames,
1557  materialNames,
1558  allowMissingViews );
1559 }
1560 
1561 template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
1563 ElementRegionManager::constructMaterialFieldAccessor( bool const allowMissingViews ) const
1564 {
1565  GEOS_UNUSED_VAR( allowMissingViews );
1566  return constructMaterialViewAccessor< MATERIAL_TYPE, typename FIELD_TRAIT::type,
1567  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key() );
1568 }
1569 
1570 
1571 template< typename T, int NDIM, typename PERM >
1574  constructMaterialArrayViewAccessor( string const & viewName,
1575  arrayView1d< string const > const & regionNames,
1576  string const & materialKeyName,
1577  bool const allowMissingViews ) const
1578 {
1579  return constructMaterialViewAccessor< Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName,
1580  regionNames,
1581  materialKeyName,
1582  allowMissingViews );
1583 }
1584 
1585 template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS >
1588 {
1589  ElementViewAccessor< LHS > accessor( numRegions() );
1590 
1591  // Resize the accessor to all regions and subregions
1592  for( localIndex er = 0; er < numRegions(); ++er )
1593  {
1594  accessor[er].resize( getRegion( er ).numSubRegions() );
1595  }
1596 
1597  // Loop only over regions named and populate according to given material names
1598  for( localIndex er = 0; er < numRegions(); ++er )
1599  {
1600  ElementRegionBase const & region = getRegion( er );
1601 
1602  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1603  ElementSubRegionBase const & subRegion )
1604  {
1605  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1606 
1607  string materialName;
1608  constitutiveGroup.forSubGroups< MATERIALTYPE >( [&]( MATERIALTYPE const & constitutiveRelation )
1609  {
1610  materialName = constitutiveRelation.getName();
1611  if( constitutiveRelation.template hasWrapper( viewName ) ) //NOTE (matteo): I have added this check to allow for the view to be
1612  // missing. I am not sure this is the default behaviour we want though.
1613  {
1614  accessor[er][esr] = constitutiveRelation.template getReference< VIEWTYPE >( viewName );
1615  }
1616  } );
1617  } );
1618  }
1619  return accessor;
1620 }
1621 
1622 template< typename MATERIALTYPE, typename T, int NDIM, typename PERM >
1625 {
1626  return constructMaterialViewAccessor< MATERIALTYPE, Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName );
1627 }
1628 
1629 template< typename CONSTITUTIVE_TYPE >
1631 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const
1632 {
1634  accessor.resize( numRegions() );
1635  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1636  {
1637  ElementRegionBase const & elemRegion = getRegion( kReg );
1638  accessor[kReg].resize( elemRegion.numSubRegions() );
1639 
1640  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1641  {
1642  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1643  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1644  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1645 
1646  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1647  {
1648  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1649 
1650  CONSTITUTIVE_TYPE * const
1651  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1652  if( constitutiveRelation != nullptr )
1653  {
1654  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1655  }
1656  }
1657  }
1658  }
1659  return accessor;
1660 }
1661 
1662 template< typename CONSTITUTIVE_TYPE >
1664 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm )
1665 {
1667  accessor.resize( numRegions() );
1668  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1669  {
1670  ElementRegionBase & elemRegion = getRegion( kReg );
1671  accessor[kReg].resize( elemRegion.numSubRegions() );
1672 
1673  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1674  {
1675  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1676  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1677  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1678 
1679  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1680  {
1681  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1682 
1683  CONSTITUTIVE_TYPE * const
1684  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1685  if( constitutiveRelation != nullptr )
1686  {
1687  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1688  }
1689  }
1690  }
1691  }
1692  return accessor;
1693 }
1694 
1695 }
1696 #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 unpackFaceElementToFace(buffer_unit_type const *&buffer, ElementReferenceAccessor< localIndex_array > &packList, bool const overwriteMap)
Unpack element-to-node and element-to-face maps.
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.
int packFaceElementToFaceSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Get the buffer size needed to pack element-to-node and element-to-face maps.
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...
int packFaceElementToFace(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack element-to-node and element-to-face maps.
virtual void outputObjectConnectivity() const override final
Function to output connectivity in order to assist debugging issues with object connectivity.
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()