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 #include "common/TypeDispatch.hpp"
33 
34 namespace geos
35 {
36 
37 class MeshManager;
38 
45 {
46 public:
47 
52  {
54  static constexpr auto elementRegionsGroup() { return "elementRegionsGroup"; }
55  };
56 
60  constexpr static int maxNumNodesPerElem = 8;
61 
66  template< typename VIEWTYPE >
68 
74  template< typename VIEWTYPE >
76 
82  template< typename VIEWTYPE >
84 
89  template< typename VIEWTYPE >
91 
97  template< typename VIEWTYPE >
99 
104  template< typename CONSTITUTIVE_TYPE >
106 
111  static string catalogName()
112  { return "ZoneManager"; }
113 
118  virtual string getCatalogName() const override final
119  { return catalogName(); }
120 
126  ElementRegionManager( string const & name, Group * const parent );
127 
131  virtual ~ElementRegionManager() override;
132 
137  template< typename T = ElementSubRegionBase >
139  {
140  localIndex numElem = 0;
141  this->forElementSubRegions< T >( [&]( ElementSubRegionBase const & elementSubRegion )
142  {
143  numElem += elementSubRegion.size();
144  } );
145  return numElem;
146  }
147 
152  void generateMesh( CellBlockManagerABC const & cellBlockManager );
153 
159  void generateWells( CellBlockManagerABC const & cellBlockManager, MeshLevel & meshLevel );
160 
166  void buildSets( NodeManager const & nodeManager );
167 
174  virtual Group * createChild( string const & childKey, string const & childName ) override;
175 // virtual void ReadXMLsub( xmlWrapper::xmlNode const & targetNode ) override;
176 
180  virtual void expandObjectCatalogs() override;
181 
188  virtual void setSchemaDeviations( xmlWrapper::xmlNode schemaRoot,
189  xmlWrapper::xmlNode schemaParent,
190  integer documentationType ) override;
191 
192  using Group::resize;
193 
200  void resize( integer_array const & numElements,
201  string_array const & regionNames,
202  string_array const & elementTypes );
203 
207  virtual void setMaxGlobalIndex() override final;
208 
213  subGroupMap const & getRegions() const
214  {
215  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
216  }
217 
223  {
224  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
225  }
226 
233  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
234  T const & getRegion( KEY_TYPE const & key ) const
235  {
236  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
237  }
238 
245  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
246  T & getRegion( KEY_TYPE const & key )
247  {
248  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
249  }
250 
257  template< typename T=ElementRegionBase >
258  bool hasRegion( string const & name ) const
259  {
260  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).hasGroup< T >( name );
261  }
262 
268  {
269  return this->getRegions().size();
270  }
271 
279 
286  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
287  void forElementRegions( LAMBDA && lambda )
288  {
289  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
290  }
291 
298  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
299  void forElementRegions( LAMBDA && lambda ) const
300  {
301  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
302  }
303 
312  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
313  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
314  {
315  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
316  }
317 
326  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
327  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
328  {
329  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
330  }
331 
337  template< typename LAMBDA >
338  void forElementRegionsComplete( LAMBDA lambda ) const
339  {
341  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
342  }
343 
349  template< typename LAMBDA >
350  void forElementRegionsComplete( LAMBDA lambda )
351  {
353  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
354  }
355 
362  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
363  void forElementRegionsComplete( LAMBDA lambda )
364  {
365  for( localIndex er=0; er<this->numRegions(); ++er )
366  {
367  ElementRegionBase & elementRegion = this->getRegion( er );
368 
369  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto & castedRegion )
370  {
371  lambda( er, castedRegion );
372  } );
373  }
374  }
375 
382  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
383  void forElementRegionsComplete( LAMBDA lambda ) const
384  {
385  for( localIndex er=0; er<this->numRegions(); ++er )
386  {
387  ElementRegionBase const & elementRegion = this->getRegion( er );
388 
389  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto const & castedRegion )
390  {
391  lambda( er, castedRegion );
392  } );
393  }
394  }
395 
403  template< typename LOOKUP_CONTAINER, typename LAMBDA >
404  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
405  {
407  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
408  }
409 
417  template< typename LOOKUP_CONTAINER, typename LAMBDA >
418  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
419  {
421  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
422  }
423 
432  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
433  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
434  {
435  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
436  auto & elementRegion )
437  {
438  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
439  } );
440  }
441 
450  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
451  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
452  {
453  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
454  auto const & elementRegion )
455  {
456  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
457  } );
458  }
459 
465  template< typename LAMBDA >
466  void forElementSubRegions( LAMBDA && lambda )
467  {
469  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
470  }
471 
478  template< typename LAMBDA >
479  void forElementSubRegions( LAMBDA && lambda ) const
480  {
482  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
483  }
484 
492  template< typename LOOKUP_CONTAINER, typename LAMBDA >
493  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
494  {
496  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
497  }
498 
506  template< typename LOOKUP_CONTAINER, typename LAMBDA >
507  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
508  {
510  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
511  }
512 
519  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
520  void forElementSubRegions( LAMBDA && lambda )
521  {
522  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
523  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
524  localIndex const,
526  auto & subRegion )
527  {
528  lambda( subRegion );
529  }
530  );
531  }
532 
539  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
540  void forElementSubRegions( LAMBDA && lambda ) const
541  {
542  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
543  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
544  localIndex const,
545  ElementRegionBase const &,
546  auto const & subRegion )
547  {
548  lambda( subRegion );
549  } );
550  }
551 
560  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
561  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
562  {
563  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
564  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
565  localIndex const,
566  localIndex const,
568  auto & subRegion )
569  {
570  lambda( targetIndex, subRegion );
571  } );
572  }
573 
582  template< typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
583  void forElementSubRegions( types::TypeList< SUBREGIONTYPES... >, LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
584  {
585  forElementSubRegionsComplete< SUBREGIONTYPES... >( targetRegions,
586  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
587  localIndex const,
588  localIndex const,
590  auto & subRegion )
591  {
592  lambda( targetIndex, subRegion );
593  } );
594  }
595 
604  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
605  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
606  {
607  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
608  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
609  localIndex const,
610  localIndex const,
611  ElementRegionBase const &,
612  auto const & subRegion )
613  {
614  lambda( targetIndex, subRegion );
615  } );
616  }
617 
623  template< typename LAMBDA >
624  void forElementSubRegionsComplete( LAMBDA && lambda ) const
625  {
627  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
628  }
629 
635  template< typename LAMBDA >
636  void forElementSubRegionsComplete( LAMBDA && lambda )
637  {
639  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
640  }
641 
649  template< typename LOOKUP_CONTAINER, typename LAMBDA >
650  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
651  {
652  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
653  std::forward< LAMBDA >( lambda ) );
654  }
655 
663  template< typename LOOKUP_CONTAINER, typename LAMBDA >
664  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
665  {
666  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
667  std::forward< LAMBDA >( lambda ) );
668  }
669 
676  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
677  void forElementSubRegionsComplete( LAMBDA && lambda )
678  {
679  for( localIndex er=0; er<this->numRegions(); ++er )
680  {
681  ElementRegionBase & elementRegion = this->getRegion( er );
682 
683  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
684  {
685  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
686 
687  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
688  {
689  lambda( er, esr, elementRegion, castedSubRegion );
690  } );
691  }
692  }
693  }
694 
701  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
702  void forElementSubRegionsComplete( LAMBDA && lambda ) const
703  {
704  for( localIndex er=0; er<this->numRegions(); ++er )
705  {
706  ElementRegionBase const & elementRegion = this->getRegion( er );
707 
708  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
709  {
710  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
711 
712  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
713  {
714  lambda( er, esr, elementRegion, castedSubRegion );
715  } );
716  }
717  }
718  }
719 
728  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
729  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
730  {
731  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase & elementRegion )
732  {
733  localIndex const er = elementRegion.getIndexInParent();
734 
735  if( er>-1 )
736  {
737  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
738  {
739  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
740 
741  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
742  {
743  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
744  } );
745  }
746  }
747  } );
748  }
749 
758  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
759  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
760  {
761  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase const & elementRegion )
762  {
763  localIndex const er = elementRegion.getIndexInParent();
764 
765  if( er>-1 )
766  {
767  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
768  {
769  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
770 
771  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
772  {
773  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
774  } );
775  }
776  }
777  } );
778  }
779 
780 
787  template< typename FIELD_TRAIT >
788  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
789  constructFieldAccessor( string const & neighborName = string() ) const;
790 
798  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
799  ElementViewAccessor< LHS >
800  constructViewAccessor( string const & name, string const & neighborName = string() ) const;
801 
809  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
810  ElementViewAccessor< LHS >
811  constructViewAccessor( string const & name, string const & neighborName = string() );
812 
822  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
823  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
824  constructArrayViewAccessor( string const & name, string const & neighborName = string() ) const;
825 
833  template< typename VIEWTYPE >
834  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
835  constructReferenceAccessor( string const & viewName, string const & neighborName = string() ) const;
836 
844  template< typename VIEWTYPE >
845  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
846  constructReferenceAccessor( string const & viewName, string const & neighborName = string() );
847 
855  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
856  MaterialViewAccessor< LHS >
857  constructFullMaterialViewAccessor( string const & viewName,
858  constitutive::ConstitutiveManager const & cm ) const;
859 
867  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
868  MaterialViewAccessor< LHS >
869  constructFullMaterialViewAccessor( string const & viewName,
870  constitutive::ConstitutiveManager const & cm );
871 
882  template< typename FIELD_TRAIT >
883  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
884  constructMaterialFieldAccessor( string_array const & regionNames,
885  string_array const & materialNames,
886  bool const allowMissingViews = false ) const;
887 
897  template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
898  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
899  constructMaterialFieldAccessor( bool const allowMissingViews = false ) const;
900 
901 
913  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
914  ElementViewAccessor< LHS >
915  constructMaterialViewAccessor( string const & viewName,
916  string_array const & regionNames,
917  string const & materialKeyName,
918  bool const allowMissingViews = false ) const;
919 
931  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
932  ElementViewAccessor< LHS >
933  constructMaterialViewAccessor( string const & viewName,
934  string_array const & regionNames,
935  string const & materialKeyName,
936  bool const allowMissingViews = false );
937 
949  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
950  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
951  constructMaterialArrayViewAccessor( string const & viewName,
952  string_array const & regionNames,
953  string const & materialKeyName,
954  bool const allowMissingViews = false ) const;
955 
964  template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS=VIEWTYPE >
965  ElementViewAccessor< LHS >
966  constructMaterialViewAccessor( string const & viewName ) const;
967 
978  template< typename MATERIALTYPE, typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
979  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
980  constructMaterialArrayViewAccessor( string const & viewName ) const;
981 
988  template< typename CONSTITUTIVE_TYPE >
989  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
990  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const;
991 
992 
999  template< typename CONSTITUTIVE_TYPE >
1000  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
1001  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm );
1002 
1003  using Group::packSize;
1004  using Group::pack;
1011 
1017  int packSize( ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1018 
1025  int pack( buffer_unit_type * & buffer,
1026  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1027 
1030 
1037  int unpack( buffer_unit_type const * & buffer,
1039 
1046  int unpack( buffer_unit_type const * & buffer,
1048 
1055 
1063  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1064 
1071  int unpackGlobalMaps( buffer_unit_type const * & buffer,
1073 
1080 
1087 
1095  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1096 
1104  ElementReferenceAccessor< array1d< localIndex > > const & packList ) const;
1105 
1113  int unpackUpDownMaps( buffer_unit_type const * & buffer,
1115  bool const overwriteMap );
1116 
1117 
1124 
1132  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1133 
1143  bool const overwriteMap );
1144 
1152  string const fractureRegionName ) const;
1153 
1162  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1163  string const fractureRegionName ) const;
1164 
1174  string const fractureRegionName );
1175 
1180  virtual void outputObjectConnectivity() const override final;
1181 
1182 
1183 private:
1184 
1191  template< bool DO_PACKING >
1192  int packImpl( buffer_unit_type * & buffer,
1193  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1194 
1201  template< bool DO_PACKING >
1202  int packGlobalMapsImpl( buffer_unit_type * & buffer,
1203  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1204 
1211  template< bool DO_PACKING, typename T >
1212  int
1213  packUpDownMapsImpl( buffer_unit_type * & buffer,
1214  T const & packList ) const;
1215 
1216  template< bool DO_PACKING, typename T >
1217  int
1218  packFaceElementToFaceImpl( buffer_unit_type * & buffer,
1219  T const & packList ) const;
1220 
1227  template< typename T >
1228  int unpackImpl( buffer_unit_type const * & buffer,
1229  T & packList );
1230 
1238  template< bool DO_PACKING >
1239  int packFracturedElementsImpl( buffer_unit_type * & buffer,
1240  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1241  string const fractureRegionName ) const;
1242 
1247 
1252  ElementRegionManager & operator=( const ElementRegionManager & );
1253 };
1254 
1255 
1256 template< typename VIEWTYPE, typename LHS >
1258 ElementRegionManager::constructViewAccessor( string const & viewName, string const & neighborName ) const
1259 {
1260  ElementViewAccessor< LHS > viewAccessor;
1261  viewAccessor.resize( numRegions() );
1262  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1263  {
1264  ElementRegionBase const & elemRegion = getRegion( kReg );
1265  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1266 
1267  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1268  {
1269  Group const * group = &elemRegion.getSubRegion( kSubReg );
1270 
1271  if( !neighborName.empty() )
1272  {
1273  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1274  }
1275 
1276  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1277  if( wrapper )
1278  {
1279  viewAccessor[kReg][kSubReg] = wrapper->reference();
1280  }
1281  }
1282  }
1283  return viewAccessor;
1284 }
1285 
1286 
1287 template< typename VIEWTYPE, typename LHS >
1290  constructViewAccessor( string const & viewName, string const & neighborName )
1291 {
1292  ElementViewAccessor< LHS > viewAccessor;
1293  viewAccessor.resize( numRegions() );
1294  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1295  {
1296  ElementRegionBase & elemRegion = getRegion( kReg );
1297  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1298 
1299  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1300  {
1301  Group * group = &elemRegion.getSubRegion( kSubReg );
1302 
1303  if( !neighborName.empty() )
1304  {
1305  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1306  }
1307 
1308  dataRepository::Wrapper< VIEWTYPE > * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1309  if( wrapper )
1310  {
1311  viewAccessor[kReg][kSubReg] = wrapper->reference();
1312  }
1313  }
1314  }
1315  return viewAccessor;
1316 }
1317 
1318 template< typename FIELD_TRAIT >
1320 ElementRegionManager::constructFieldAccessor( string const & neighborName ) const
1321 {
1322  return constructViewAccessor< typename FIELD_TRAIT::type,
1323  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(), neighborName );
1324 }
1325 
1326 
1327 template< typename T, int NDIM, typename PERM >
1330  constructArrayViewAccessor( string const & name, string const & neighborName ) const
1331 {
1332  return constructViewAccessor< Array< T, NDIM, PERM >,
1334  >( name, neighborName );
1335 }
1336 
1337 template< typename VIEWTYPE >
1340  constructReferenceAccessor( string const & viewName, string const & neighborName ) const
1341 {
1343  viewAccessor.resize( numRegions() );
1344  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1345  {
1346  ElementRegionBase const & elemRegion = getRegion( kReg );
1347  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1348 
1349  for( typename dataRepository::indexType kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1350  {
1351  Group const * group = &elemRegion.getSubRegion( kSubReg );
1352 
1353  if( !neighborName.empty() )
1354  {
1355  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1356  }
1357 
1358  if( group->hasWrapper( viewName ) )
1359  {
1360  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1361  }
1362  }
1363  }
1364  return viewAccessor;
1365 }
1366 
1367 template< typename VIEWTYPE >
1370  string const & neighborName )
1371 {
1373  viewAccessor.resize( numRegions() );
1374  for( typename dataRepository::indexType kReg = 0; kReg < numRegions(); ++kReg )
1375  {
1376  ElementRegionBase & elemRegion = getRegion( kReg );
1377  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1378 
1379  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1380  {
1381  Group * group = &elemRegion.getSubRegion( kSubReg );
1382 
1383  if( !neighborName.empty() )
1384  {
1385  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1386  }
1387 
1388  if( group->hasWrapper( viewName ) )
1389  {
1390  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1391  }
1392  }
1393  }
1394  return viewAccessor;
1395 }
1396 
1397 template< typename VIEWTYPE, typename LHS >
1400  constructFullMaterialViewAccessor( string const & viewName,
1401  constitutive::ConstitutiveManager const & cm ) const
1402 {
1403  MaterialViewAccessor< LHS > accessor;
1404  accessor.resize( numRegions() );
1405  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1406  {
1407  ElementRegionBase const & elemRegion = getRegion( kReg );
1408  accessor[kReg].resize( elemRegion.numSubRegions() );
1409 
1410  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1411  {
1412  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1413  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1414 
1415  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1416 
1417  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1418  {
1419  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1420  dataRepository::Group const * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1421  if( constitutiveRelation != nullptr )
1422  {
1423  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1424  if( wrapper )
1425  {
1426  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1427  }
1428  }
1429  }
1430  }
1431  }
1432  return accessor;
1433 }
1434 
1435 template< typename VIEWTYPE, typename LHS >
1438  constructFullMaterialViewAccessor( string const & viewName,
1439  constitutive::ConstitutiveManager const & cm )
1440 {
1441  MaterialViewAccessor< LHS > accessor;
1442  accessor.resize( numRegions() );
1443  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1444  {
1445  ElementRegionBase & elemRegion = getRegion( kReg );
1446  accessor[kReg].resize( elemRegion.numSubRegions() );
1447 
1448  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1449  {
1450  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1451  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1452 
1453  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1454 
1455  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1456  {
1457  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1458  dataRepository::Group * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1459  if( constitutiveRelation != nullptr )
1460  {
1461  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1462  if( wrapper )
1463  {
1464  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1465  }
1466  }
1467  }
1468  }
1469  }
1470  return accessor;
1471 }
1472 
1473 template< typename VIEWTYPE, typename LHS >
1476  string_array const & regionNames,
1477  string const & materialKeyName,
1478  bool const allowMissingViews ) const
1479 {
1480  ElementViewAccessor< LHS > accessor;
1481 
1482  // Resize the accessor to all regions and subregions
1483  accessor.resize( numRegions() );
1484  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1485  {
1486  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1487  }
1488 
1489  subGroupMap const & regionMap = getRegions();
1490 
1491  // Loop only over regions named and populate according to given material names
1492  for( size_t k = 0; k < regionNames.size(); ++k )
1493  {
1494  localIndex const er = regionMap.getIndex( regionNames[k] );
1495  if( er >=0 )
1496  {
1497  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1498  ElementRegionBase const & region = getRegion( er );
1499 
1500  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1501  ElementSubRegionBase const & subRegion )
1502  {
1503  string const & materialName = subRegion.getReference< string >( materialKeyName );
1504  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1505 
1506  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1507  if( wrapper )
1508  {
1509  accessor[er][esr] = wrapper->reference();
1510  }
1511  else
1512  {
1513  GEOS_ERROR_IF( !allowMissingViews,
1514  subRegion.getDataContext() <<
1515  ": Material " << constitutiveRelation.getDataContext() <<
1516  " does not contain " << viewName );
1517  }
1518  } );
1519  }
1520  }
1521  return accessor;
1522 }
1523 
1524 template< typename VIEWTYPE, typename LHS >
1527  string_array const & regionNames,
1528  string const & materialKeyName,
1529  bool const allowMissingViews )
1530 {
1531  ElementViewAccessor< LHS > accessor;
1532 
1533  // Resize the accessor to all regions and subregions
1534  accessor.resize( numRegions() );
1535  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1536  {
1537  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1538  }
1539 
1540  subGroupMap const & regionMap = getRegions();
1541 
1542  // Loop only over regions named and populate according to given material names
1543  for( size_t k = 0; k < regionNames.size(); ++k )
1544  {
1545  localIndex const er = regionMap.getIndex( regionNames[k] );
1546  if( er >=0 )
1547  {
1548  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1549  ElementRegionBase & region = getRegion( er );
1550 
1551  region.forElementSubRegionsIndex( [&]( localIndex const esr, ElementSubRegionBase & subRegion )
1552  {
1553  string const & materialName = subRegion.getReference< string >( materialKeyName );
1554  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1555 
1556  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1557  if( wrapper )
1558  {
1559  accessor[er][esr] = wrapper->reference();
1560  }
1561  else
1562  {
1563  GEOS_ERROR_IF( !allowMissingViews, region.getDataContext() << ": Material " << materialName
1564  << " does not contain " << viewName );
1565  }
1566  } );
1567  }
1568  }
1569  return accessor;
1570 }
1571 
1572 template< typename FIELD_TRAIT >
1575  string_array const & materialNames,
1576  bool const allowMissingViews ) const
1577 {
1578  return constructMaterialViewAccessor< typename FIELD_TRAIT::type,
1579  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(),
1580  regionNames,
1581  materialNames,
1582  allowMissingViews );
1583 }
1584 
1585 template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
1587 ElementRegionManager::constructMaterialFieldAccessor( bool const allowMissingViews ) const
1588 {
1589  GEOS_UNUSED_VAR( allowMissingViews );
1590  return constructMaterialViewAccessor< MATERIAL_TYPE, typename FIELD_TRAIT::type,
1591  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key() );
1592 }
1593 
1594 
1595 template< typename T, int NDIM, typename PERM >
1598  constructMaterialArrayViewAccessor( string const & viewName,
1599  string_array const & regionNames,
1600  string const & materialKeyName,
1601  bool const allowMissingViews ) const
1602 {
1603  return constructMaterialViewAccessor< Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName,
1604  regionNames,
1605  materialKeyName,
1606  allowMissingViews );
1607 }
1608 
1609 template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS >
1612 {
1613  ElementViewAccessor< LHS > accessor( numRegions() );
1614 
1615  // Resize the accessor to all regions and subregions
1616  for( localIndex er = 0; er < numRegions(); ++er )
1617  {
1618  accessor[er].resize( getRegion( er ).numSubRegions() );
1619  }
1620 
1621  // Loop only over regions named and populate according to given material names
1622  for( localIndex er = 0; er < numRegions(); ++er )
1623  {
1624  ElementRegionBase const & region = getRegion( er );
1625 
1626  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1627  ElementSubRegionBase const & subRegion )
1628  {
1629  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1630 
1631  string materialName;
1632  constitutiveGroup.forSubGroups< MATERIALTYPE >( [&]( MATERIALTYPE const & constitutiveRelation )
1633  {
1634  materialName = constitutiveRelation.getName();
1635  if( constitutiveRelation.template hasWrapper<>( viewName ) ) //NOTE (matteo): I have added this check to allow for the view to be
1636  // missing. I am not sure this is the default behaviour we want
1637  // though.
1638  {
1639  accessor[er][esr] = constitutiveRelation.template getReference< VIEWTYPE >( viewName );
1640  }
1641  } );
1642  } );
1643  }
1644  return accessor;
1645 }
1646 
1647 template< typename MATERIALTYPE, typename T, int NDIM, typename PERM >
1650 {
1651  return constructMaterialViewAccessor< MATERIALTYPE, Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName );
1652 }
1653 
1654 template< typename CONSTITUTIVE_TYPE >
1656 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const
1657 {
1659  accessor.resize( numRegions() );
1660  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1661  {
1662  ElementRegionBase const & elemRegion = getRegion( kReg );
1663  accessor[kReg].resize( elemRegion.numSubRegions() );
1664 
1665  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1666  {
1667  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1668  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1669  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1670 
1671  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1672  {
1673  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1674 
1675  CONSTITUTIVE_TYPE * const
1676  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1677  if( constitutiveRelation != nullptr )
1678  {
1679  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1680  }
1681  }
1682  }
1683  }
1684  return accessor;
1685 }
1686 
1687 template< typename CONSTITUTIVE_TYPE >
1689 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm )
1690 {
1692  accessor.resize( numRegions() );
1693  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1694  {
1695  ElementRegionBase & elemRegion = getRegion( kReg );
1696  accessor[kReg].resize( elemRegion.numSubRegions() );
1697 
1698  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1699  {
1700  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1701  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1702  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1703 
1704  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1705  {
1706  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1707 
1708  CONSTITUTIVE_TYPE * const
1709  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1710  if( constitutiveRelation != nullptr )
1711  {
1712  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1713  }
1714  }
1715  }
1716  }
1717  return accessor;
1718 }
1719 
1720 }
1721 #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.
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.
ElementViewAccessor< LHS > constructMaterialViewAccessor(string const &viewName, string_array 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 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...
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...
ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructMaterialArrayViewAccessor(string const &viewName, string_array const &regionNames, string const &materialKeyName, bool const allowMissingViews=false) const
Construct a view accessor for material data, assuming array as storage type.
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.
ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructMaterialFieldAccessor(string_array const &regionNames, string_array const &materialNames, bool const allowMissingViews=false) const
This is a const function to construct a MaterialViewAccessor to access the material data for specifie...
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 forElementSubRegions(types::TypeList< SUBREGIONTYPES... >, LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions with the...
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.
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:299
DataContext const & getDataContext() const
Definition: Group.hpp:1345
bool hasWrapper(LOOKUP_TYPE const &lookup) const
Check if a wrapper exists.
Definition: Group.hpp:1204
localIndex getIndexInParent() const
Get the group's index within its parent group.
Definition: Group.hpp:1389
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1275
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:318
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:464
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1317
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:500
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:1241
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:588
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:58
camp::list< Ts... > TypeList
Construct a list of types.
pugi::xml_node xmlNode
Definition: xmlWrapper.hpp:59
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:188
stdVector< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:401
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:200
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:391
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:84
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:81
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:117
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:184
LvArray::ArrayView< T, NDIM, USD, localIndex, LvArray::ChaiBuffer > ArrayView
Multidimensional array view type. See LvArray:ArrayView for details.
Definition: DataTypes.hpp:156
Group key associated with elementRegionsGroup.
struct to serve as a container for group strings and keys
static constexpr char const * neighborDataString()