GEOSX
ElementRegionManager.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 TotalEnergies
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_MESH_ELEMENTREGIONMANAGER_HPP
20 #define GEOS_MESH_ELEMENTREGIONMANAGER_HPP
21 
22 #include "constitutive/ConstitutiveManager.hpp"
23 #include "CellElementRegion.hpp"
24 #include "CellElementSubRegion.hpp"
25 #include "mesh/generators/CellBlockManagerABC.hpp"
28 #include "SurfaceElementRegion.hpp"
29 #include "WellElementRegion.hpp"
30 
31 namespace geos
32 {
33 
34 class MeshManager;
35 
42 {
43 public:
44 
49  {
51  static constexpr auto elementRegionsGroup() { return "elementRegionsGroup"; }
52  };
53 
57  constexpr static int maxNumNodesPerElem = 8;
58 
63  template< typename VIEWTYPE >
65 
71  template< typename VIEWTYPE >
73 
79  template< typename VIEWTYPE >
81 
86  template< typename VIEWTYPE >
88 
94  template< typename VIEWTYPE >
96 
101  template< typename CONSTITUTIVE_TYPE >
103 
108  static string catalogName()
109  { return "ZoneManager"; }
110 
115  virtual string getCatalogName() const override final
116  { return catalogName(); }
117 
123  ElementRegionManager( string const & name, Group * const parent );
124 
128  virtual ~ElementRegionManager() override;
129 
134  template< typename T = ElementSubRegionBase >
136  {
137  localIndex numElem = 0;
138  this->forElementSubRegions< T >( [&]( ElementSubRegionBase const & elementSubRegion )
139  {
140  numElem += elementSubRegion.size();
141  } );
142  return numElem;
143  }
144 
149  void generateMesh( CellBlockManagerABC const & cellBlockManager );
150 
156  void generateWells( CellBlockManagerABC const & cellBlockManager, MeshLevel & meshLevel );
157 
163  void buildSets( NodeManager const & nodeManager );
164 
171  virtual Group * createChild( string const & childKey, string const & childName ) override;
172 // virtual void ReadXMLsub( xmlWrapper::xmlNode const & targetNode ) override;
173 
177  virtual void expandObjectCatalogs() override;
178 
185  virtual void setSchemaDeviations( xmlWrapper::xmlNode schemaRoot,
186  xmlWrapper::xmlNode schemaParent,
187  integer documentationType ) override;
188 
189  using Group::resize;
190 
197  void resize( integer_array const & numElements,
198  string_array const & regionNames,
199  string_array const & elementTypes );
200 
204  virtual void setMaxGlobalIndex() override final;
205 
210  subGroupMap const & getRegions() const
211  {
212  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
213  }
214 
220  {
221  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getSubGroups();
222  }
223 
230  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
231  T const & getRegion( KEY_TYPE const & key ) const
232  {
233  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
234  }
235 
242  template< typename T=ElementRegionBase, typename KEY_TYPE=void >
243  T & getRegion( KEY_TYPE const & key )
244  {
245  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).getGroup< T >( key );
246  }
247 
254  template< typename T=ElementRegionBase >
255  bool hasRegion( string const & name ) const
256  {
257  return this->getGroup( groupKeyStruct::elementRegionsGroup() ).hasGroup< T >( name );
258  }
259 
265  {
266  return this->getRegions().size();
267  }
268 
276 
283  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
284  void forElementRegions( LAMBDA && lambda )
285  {
286  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
287  }
288 
295  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LAMBDA >
296  void forElementRegions( LAMBDA && lambda ) const
297  {
298  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( std::forward< LAMBDA >( lambda ) );
299  }
300 
309  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
310  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
311  {
312  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
313  }
314 
323  template< typename REGIONTYPE = ElementRegionBase, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
324  void forElementRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
325  {
326  this->getGroup( groupKeyStruct::elementRegionsGroup() ).forSubGroups< REGIONTYPE, REGIONTYPES... >( targetRegions, std::forward< LAMBDA >( lambda ) );
327  }
328 
334  template< typename LAMBDA >
335  void forElementRegionsComplete( LAMBDA lambda ) const
336  {
338  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
339  }
340 
346  template< typename LAMBDA >
347  void forElementRegionsComplete( LAMBDA lambda )
348  {
350  WellElementRegion >( std::forward< LAMBDA >( lambda ) );
351  }
352 
359  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
360  void forElementRegionsComplete( LAMBDA lambda )
361  {
362  for( localIndex er=0; er<this->numRegions(); ++er )
363  {
364  ElementRegionBase & elementRegion = this->getRegion( er );
365 
366  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto & castedRegion )
367  {
368  lambda( er, castedRegion );
369  } );
370  }
371  }
372 
379  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LAMBDA >
380  void forElementRegionsComplete( LAMBDA lambda ) const
381  {
382  for( localIndex er=0; er<this->numRegions(); ++er )
383  {
384  ElementRegionBase const & elementRegion = this->getRegion( er );
385 
386  Group::applyLambdaToContainer< REGIONTYPE, REGIONTYPES... >( elementRegion, [&]( auto const & castedRegion )
387  {
388  lambda( er, castedRegion );
389  } );
390  }
391  }
392 
400  template< typename LOOKUP_CONTAINER, typename LAMBDA >
401  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
402  {
404  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
405  }
406 
414  template< typename LOOKUP_CONTAINER, typename LAMBDA >
415  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
416  {
418  WellElementRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
419  }
420 
429  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
430  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda )
431  {
432  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
433  auto & elementRegion )
434  {
435  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
436  } );
437  }
438 
447  template< typename REGIONTYPE, typename ... REGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
448  void forElementRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA lambda ) const
449  {
450  forElementRegions< REGIONTYPE, REGIONTYPES... >( targetRegions, [&] ( localIndex const targetIndex,
451  auto const & elementRegion )
452  {
453  lambda( targetIndex, elementRegion.getIndexInParent(), elementRegion );
454  } );
455  }
456 
462  template< typename LAMBDA >
463  void forElementSubRegions( LAMBDA && lambda )
464  {
466  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
467  }
468 
475  template< typename LAMBDA >
476  void forElementSubRegions( LAMBDA && lambda ) const
477  {
479  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
480  }
481 
489  template< typename LOOKUP_CONTAINER, typename LAMBDA >
490  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
491  {
493  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
494  }
495 
503  template< typename LOOKUP_CONTAINER, typename LAMBDA >
504  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
505  {
507  WellElementSubRegion >( targetRegions, std::forward< LAMBDA >( lambda ) );
508  }
509 
516  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
517  void forElementSubRegions( LAMBDA && lambda )
518  {
519  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
520  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
521  localIndex const,
523  auto & subRegion )
524  {
525  lambda( subRegion );
526  }
527  );
528  }
529 
536  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
537  void forElementSubRegions( LAMBDA && lambda ) const
538  {
539  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >(
540  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const,
541  localIndex const,
542  ElementRegionBase const &,
543  auto const & subRegion )
544  {
545  lambda( subRegion );
546  } );
547  }
548 
557  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
558  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
559  {
560  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
561  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
562  localIndex const,
563  localIndex const,
565  auto & subRegion )
566  {
567  lambda( targetIndex, subRegion );
568  } );
569  }
570 
579  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
580  void forElementSubRegions( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
581  {
582  forElementSubRegionsComplete< SUBREGIONTYPE, SUBREGIONTYPES... >( targetRegions,
583  [lambda = std::forward< LAMBDA >( lambda )]( localIndex const targetIndex,
584  localIndex const,
585  localIndex const,
586  ElementRegionBase const &,
587  auto const & subRegion )
588  {
589  lambda( targetIndex, subRegion );
590  } );
591  }
592 
598  template< typename LAMBDA >
599  void forElementSubRegionsComplete( LAMBDA && lambda ) const
600  {
602  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
603  }
604 
610  template< typename LAMBDA >
611  void forElementSubRegionsComplete( LAMBDA && lambda )
612  {
614  WellElementSubRegion >( std::forward< LAMBDA >( lambda ) );
615  }
616 
624  template< typename LOOKUP_CONTAINER, typename LAMBDA >
625  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
626  {
627  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
628  std::forward< LAMBDA >( lambda ) );
629  }
630 
638  template< typename LOOKUP_CONTAINER, typename LAMBDA >
639  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
640  {
641  forElementSubRegionsComplete< CellElementSubRegion, FaceElementSubRegion, EmbeddedSurfaceSubRegion, WellElementSubRegion >( targetRegions,
642  std::forward< LAMBDA >( lambda ) );
643  }
644 
651  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
652  void forElementSubRegionsComplete( LAMBDA && lambda )
653  {
654  for( localIndex er=0; er<this->numRegions(); ++er )
655  {
656  ElementRegionBase & elementRegion = this->getRegion( er );
657 
658  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
659  {
660  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
661 
662  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
663  {
664  lambda( er, esr, elementRegion, castedSubRegion );
665  } );
666  }
667  }
668  }
669 
676  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LAMBDA >
677  void forElementSubRegionsComplete( LAMBDA && lambda ) const
678  {
679  for( localIndex er=0; er<this->numRegions(); ++er )
680  {
681  ElementRegionBase const & elementRegion = this->getRegion( er );
682 
683  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
684  {
685  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
686 
687  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
688  {
689  lambda( er, esr, elementRegion, castedSubRegion );
690  } );
691  }
692  }
693  }
694 
703  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
704  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda )
705  {
706  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase & elementRegion )
707  {
708  localIndex const er = elementRegion.getIndexInParent();
709 
710  if( er>-1 )
711  {
712  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
713  {
714  ElementSubRegionBase & subRegion = elementRegion.getSubRegion( esr );
715 
716  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto & castedSubRegion )
717  {
718  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
719  } );
720  }
721  }
722  } );
723  }
724 
733  template< typename SUBREGIONTYPE, typename ... SUBREGIONTYPES, typename LOOKUP_CONTAINER, typename LAMBDA >
734  void forElementSubRegionsComplete( LOOKUP_CONTAINER const & targetRegions, LAMBDA && lambda ) const
735  {
736  forElementRegions( targetRegions, [&] ( localIndex const targetIndex, ElementRegionBase const & elementRegion )
737  {
738  localIndex const er = elementRegion.getIndexInParent();
739 
740  if( er>-1 )
741  {
742  for( localIndex esr=0; esr<elementRegion.numSubRegions(); ++esr )
743  {
744  ElementSubRegionBase const & subRegion = elementRegion.getSubRegion( esr );
745 
746  Group::applyLambdaToContainer< SUBREGIONTYPE, SUBREGIONTYPES... >( subRegion, [&]( auto const & castedSubRegion )
747  {
748  lambda( targetIndex, er, esr, elementRegion, castedSubRegion );
749  } );
750  }
751  }
752  } );
753  }
754 
755 
762  template< typename FIELD_TRAIT >
763  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
764  constructFieldAccessor( string const & neighborName = string() ) const;
765 
773  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
774  ElementViewAccessor< LHS >
775  constructViewAccessor( string const & name, string const & neighborName = string() ) const;
776 
784  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
785  ElementViewAccessor< LHS >
786  constructViewAccessor( string const & name, string const & neighborName = string() );
787 
797  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
798  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
799  constructArrayViewAccessor( string const & name, string const & neighborName = string() ) const;
800 
808  template< typename VIEWTYPE >
809  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
810  constructReferenceAccessor( string const & viewName, string const & neighborName = string() ) const;
811 
819  template< typename VIEWTYPE >
820  ElementViewAccessor< ReferenceWrapper< VIEWTYPE > >
821  constructReferenceAccessor( string const & viewName, string const & neighborName = string() );
822 
830  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
831  MaterialViewAccessor< LHS >
832  constructFullMaterialViewAccessor( string const & viewName,
833  constitutive::ConstitutiveManager const & cm ) const;
834 
842  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
843  MaterialViewAccessor< LHS >
844  constructFullMaterialViewAccessor( string const & viewName,
845  constitutive::ConstitutiveManager const & cm );
846 
857  template< typename FIELD_TRAIT >
858  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
860  arrayView1d< string const > const & materialNames,
861  bool const allowMissingViews = false ) const;
862 
872  template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
873  ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > >
874  constructMaterialFieldAccessor( bool const allowMissingViews = false ) const;
875 
876 
888  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
889  ElementViewAccessor< LHS >
890  constructMaterialViewAccessor( string const & viewName,
891  arrayView1d< string const > const & regionNames,
892  string const & materialKeyName,
893  bool const allowMissingViews = false ) const;
894 
906  template< typename VIEWTYPE, typename LHS=VIEWTYPE >
907  ElementViewAccessor< LHS >
908  constructMaterialViewAccessor( string const & viewName,
909  arrayView1d< string const > const & regionNames,
910  string const & materialKeyName,
911  bool const allowMissingViews = false );
912 
924  template< typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
925  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
926  constructMaterialArrayViewAccessor( string const & viewName,
927  arrayView1d< string const > const & regionNames,
928  string const & materialKeyName,
929  bool const allowMissingViews = false ) const;
930 
939  template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS=VIEWTYPE >
940  ElementViewAccessor< LHS >
941  constructMaterialViewAccessor( string const & viewName ) const;
942 
953  template< typename MATERIALTYPE, typename T, int NDIM, typename PERM = defaultLayout< NDIM > >
954  ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > >
955  constructMaterialArrayViewAccessor( string const & viewName ) const;
956 
963  template< typename CONSTITUTIVE_TYPE >
964  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
965  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const;
966 
967 
974  template< typename CONSTITUTIVE_TYPE >
975  ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE >
976  constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm );
977 
978  using Group::packSize;
979  using Group::pack;
986 
992  int packSize( ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
993 
1000  int pack( buffer_unit_type * & buffer,
1001  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1002 
1005 
1012  int unpack( buffer_unit_type const * & buffer,
1014 
1021  int unpack( buffer_unit_type const * & buffer,
1023 
1030 
1038  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1039 
1046  int unpackGlobalMaps( buffer_unit_type const * & buffer,
1048 
1055 
1062 
1070  ElementViewAccessor< arrayView1d< localIndex > > const & packList ) const;
1071 
1079  ElementReferenceAccessor< array1d< localIndex > > const & packList ) const;
1080 
1088  int unpackUpDownMaps( buffer_unit_type const * & buffer,
1090  bool const overwriteMap );
1091 
1099  string const fractureRegionName ) const;
1100 
1109  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1110  string const fractureRegionName ) const;
1111 
1121  string const fractureRegionName );
1122 
1123 
1124 private:
1125 
1132  template< bool DO_PACKING >
1133  int packImpl( buffer_unit_type * & buffer,
1134  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1135 
1142  template< bool DO_PACKING >
1143  int packGlobalMapsImpl( buffer_unit_type * & buffer,
1144  ElementViewAccessor< arrayView1d< localIndex > > const & viewAccessor ) const;
1145 
1152  template< bool DO_PACKING, typename T >
1153  int
1154  packUpDownMapsImpl( buffer_unit_type * & buffer,
1155  T const & packList ) const;
1162  template< typename T >
1163  int unpackImpl( buffer_unit_type const * & buffer,
1164  T & packList );
1165 
1173  template< bool DO_PACKING >
1174  int packFracturedElementsImpl( buffer_unit_type * & buffer,
1175  ElementViewAccessor< arrayView1d< localIndex > > const & packList,
1176  string const fractureRegionName ) const;
1177 
1182 
1187  ElementRegionManager & operator=( const ElementRegionManager & );
1188 
1189 
1190 };
1191 
1192 
1193 template< typename VIEWTYPE, typename LHS >
1195 ElementRegionManager::constructViewAccessor( string const & viewName, string const & neighborName ) const
1196 {
1197  ElementViewAccessor< LHS > viewAccessor;
1198  viewAccessor.resize( numRegions() );
1199  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1200  {
1201  ElementRegionBase const & elemRegion = getRegion( kReg );
1202  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1203 
1204  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1205  {
1206  Group const * group = &elemRegion.getSubRegion( kSubReg );
1207 
1208  if( !neighborName.empty() )
1209  {
1210  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1211  }
1212 
1213  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1214  if( wrapper )
1215  {
1216  viewAccessor[kReg][kSubReg] = wrapper->reference();
1217  }
1218  }
1219  }
1220  return viewAccessor;
1221 }
1222 
1223 
1224 template< typename VIEWTYPE, typename LHS >
1227  constructViewAccessor( string const & viewName, string const & neighborName )
1228 {
1229  ElementViewAccessor< LHS > viewAccessor;
1230  viewAccessor.resize( numRegions() );
1231  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1232  {
1233  ElementRegionBase & elemRegion = getRegion( kReg );
1234  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1235 
1236  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1237  {
1238  Group * group = &elemRegion.getSubRegion( kSubReg );
1239 
1240  if( !neighborName.empty() )
1241  {
1242  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1243  }
1244 
1245  dataRepository::Wrapper< VIEWTYPE > * const wrapper = group->getWrapperPointer< VIEWTYPE >( viewName );
1246  if( wrapper )
1247  {
1248  viewAccessor[kReg][kSubReg] = wrapper->reference();
1249  }
1250  }
1251  }
1252  return viewAccessor;
1253 }
1254 
1255 template< typename FIELD_TRAIT >
1257 ElementRegionManager::constructFieldAccessor( string const & neighborName ) const
1258 {
1259  return constructViewAccessor< typename FIELD_TRAIT::type,
1260  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(), neighborName );
1261 }
1262 
1263 
1264 template< typename T, int NDIM, typename PERM >
1267  constructArrayViewAccessor( string const & name, string const & neighborName ) const
1268 {
1269  return constructViewAccessor< Array< T, NDIM, PERM >,
1271  >( name, neighborName );
1272 }
1273 
1274 template< typename VIEWTYPE >
1277  constructReferenceAccessor( string const & viewName, string const & neighborName ) const
1278 {
1280  viewAccessor.resize( numRegions() );
1281  for( typename dataRepository::indexType kReg=0; kReg<numRegions(); ++kReg )
1282  {
1283  ElementRegionBase const & elemRegion = getRegion( kReg );
1284  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1285 
1286  for( typename dataRepository::indexType kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1287  {
1288  Group const * group = &elemRegion.getSubRegion( kSubReg );
1289 
1290  if( !neighborName.empty() )
1291  {
1292  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1293  }
1294 
1295  if( group->hasWrapper( viewName ) )
1296  {
1297  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1298  }
1299  }
1300  }
1301  return viewAccessor;
1302 }
1303 
1304 template< typename VIEWTYPE >
1307  string const & neighborName )
1308 {
1310  viewAccessor.resize( numRegions() );
1311  for( typename dataRepository::indexType kReg = 0; kReg < numRegions(); ++kReg )
1312  {
1313  ElementRegionBase & elemRegion = getRegion( kReg );
1314  viewAccessor[kReg].resize( elemRegion.numSubRegions() );
1315 
1316  for( typename dataRepository::indexType kSubReg = 0; kSubReg < elemRegion.numSubRegions(); ++kSubReg )
1317  {
1318  Group * group = &elemRegion.getSubRegion( kSubReg );
1319 
1320  if( !neighborName.empty() )
1321  {
1322  group = &group->getGroup( ObjectManagerBase::groupKeyStruct::neighborDataString() ).getGroup( neighborName );
1323  }
1324 
1325  if( group->hasWrapper( viewName ) )
1326  {
1327  viewAccessor[kReg][kSubReg].set( group->getReference< VIEWTYPE >( viewName ) );
1328  }
1329  }
1330  }
1331  return viewAccessor;
1332 }
1333 
1334 template< typename VIEWTYPE, typename LHS >
1337  constructFullMaterialViewAccessor( string const & viewName,
1338  constitutive::ConstitutiveManager const & cm ) const
1339 {
1340  MaterialViewAccessor< LHS > accessor;
1341  accessor.resize( numRegions() );
1342  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1343  {
1344  ElementRegionBase const & elemRegion = getRegion( kReg );
1345  accessor[kReg].resize( elemRegion.numSubRegions() );
1346 
1347  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1348  {
1349  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1350  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1351 
1352  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1353 
1354  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1355  {
1356  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1357  dataRepository::Group const * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1358  if( constitutiveRelation != nullptr )
1359  {
1360  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1361  if( wrapper )
1362  {
1363  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1364  }
1365  }
1366  }
1367  }
1368  }
1369  return accessor;
1370 }
1371 
1372 template< typename VIEWTYPE, typename LHS >
1375  constructFullMaterialViewAccessor( string const & viewName,
1376  constitutive::ConstitutiveManager const & cm )
1377 {
1378  MaterialViewAccessor< LHS > accessor;
1379  accessor.resize( numRegions() );
1380  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1381  {
1382  ElementRegionBase & elemRegion = getRegion( kReg );
1383  accessor[kReg].resize( elemRegion.numSubRegions() );
1384 
1385  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1386  {
1387  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1388  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1389 
1390  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1391 
1392  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1393  {
1394  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1395  dataRepository::Group * const constitutiveRelation = constitutiveGroup.getGroupPointer( constitutiveName );
1396  if( constitutiveRelation != nullptr )
1397  {
1398  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation->getWrapperPointer< VIEWTYPE >( viewName );
1399  if( wrapper )
1400  {
1401  accessor[kReg][kSubReg][matIndex] = wrapper->reference();
1402  }
1403  }
1404  }
1405  }
1406  }
1407  return accessor;
1408 }
1409 
1410 template< typename VIEWTYPE, typename LHS >
1413  arrayView1d< string const > const & regionNames,
1414  string const & materialKeyName,
1415  bool const allowMissingViews ) const
1416 {
1417  ElementViewAccessor< LHS > accessor;
1418 
1419  // Resize the accessor to all regions and subregions
1420  accessor.resize( numRegions() );
1421  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1422  {
1423  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1424  }
1425 
1426  subGroupMap const & regionMap = getRegions();
1427 
1428  // Loop only over regions named and populate according to given material names
1429  for( localIndex k = 0; k < regionNames.size(); ++k )
1430  {
1431  localIndex const er = regionMap.getIndex( regionNames[k] );
1432  if( er >=0 )
1433  {
1434  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1435  ElementRegionBase const & region = getRegion( er );
1436 
1437  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1438  ElementSubRegionBase const & subRegion )
1439  {
1440  string const & materialName = subRegion.getReference< string >( materialKeyName );
1441  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1442 
1443  dataRepository::Wrapper< VIEWTYPE > const * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1444  if( wrapper )
1445  {
1446  accessor[er][esr] = wrapper->reference();
1447  }
1448  else
1449  {
1450  GEOS_ERROR_IF( !allowMissingViews,
1451  subRegion.getDataContext() <<
1452  ": Material " << constitutiveRelation.getDataContext() <<
1453  " does not contain " << viewName );
1454  }
1455  } );
1456  }
1457  }
1458  return accessor;
1459 }
1460 
1461 template< typename VIEWTYPE, typename LHS >
1464  arrayView1d< string const > const & regionNames,
1465  string const & materialKeyName,
1466  bool const allowMissingViews )
1467 {
1468  ElementViewAccessor< LHS > accessor;
1469 
1470  // Resize the accessor to all regions and subregions
1471  accessor.resize( numRegions() );
1472  for( localIndex kReg = 0; kReg < numRegions(); ++kReg )
1473  {
1474  accessor[kReg].resize( getRegion( kReg ).numSubRegions() );
1475  }
1476 
1477  subGroupMap const & regionMap = getRegions();
1478 
1479  // Loop only over regions named and populate according to given material names
1480  for( localIndex k = 0; k < regionNames.size(); ++k )
1481  {
1482  localIndex const er = regionMap.getIndex( regionNames[k] );
1483  if( er >=0 )
1484  {
1485  GEOS_ERROR_IF_EQ_MSG( er, subGroupMap::KeyIndex::invalid_index, "Region not found: " << regionNames[k] );
1486  ElementRegionBase & region = getRegion( er );
1487 
1488  region.forElementSubRegionsIndex( [&]( localIndex const esr, ElementSubRegionBase & subRegion )
1489  {
1490  string const & materialName = subRegion.getReference< string >( materialKeyName );
1491  dataRepository::Group const & constitutiveRelation = subRegion.getConstitutiveModel( materialName );
1492 
1493  dataRepository::Wrapper< VIEWTYPE > * const wrapper = constitutiveRelation.getWrapperPointer< VIEWTYPE >( viewName );
1494  if( wrapper )
1495  {
1496  accessor[er][esr] = wrapper->reference();
1497  }
1498  else
1499  {
1500  GEOS_ERROR_IF( !allowMissingViews, region.getDataContext() << ": Material " << materialName
1501  << " does not contain " << viewName );
1502  }
1503  } );
1504  }
1505  }
1506  return accessor;
1507 }
1508 
1509 template< typename FIELD_TRAIT >
1512  arrayView1d< string const > const & materialNames,
1513  bool const allowMissingViews ) const
1514 {
1515  return constructMaterialViewAccessor< typename FIELD_TRAIT::type,
1516  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key(),
1517  regionNames,
1518  materialNames,
1519  allowMissingViews );
1520 }
1521 
1522 template< typename MATERIAL_TYPE, typename FIELD_TRAIT >
1524 ElementRegionManager::constructMaterialFieldAccessor( bool const allowMissingViews ) const
1525 {
1526  GEOS_UNUSED_VAR( allowMissingViews );
1527  return constructMaterialViewAccessor< MATERIAL_TYPE, typename FIELD_TRAIT::type,
1528  traits::ViewTypeConst< typename FIELD_TRAIT::type > >( FIELD_TRAIT::key() );
1529 }
1530 
1531 
1532 template< typename T, int NDIM, typename PERM >
1535  constructMaterialArrayViewAccessor( string const & viewName,
1536  arrayView1d< string const > const & regionNames,
1537  string const & materialKeyName,
1538  bool const allowMissingViews ) const
1539 {
1540  return constructMaterialViewAccessor< Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName,
1541  regionNames,
1542  materialKeyName,
1543  allowMissingViews );
1544 }
1545 
1546 template< typename MATERIALTYPE, typename VIEWTYPE, typename LHS >
1549 {
1550  ElementViewAccessor< LHS > accessor( numRegions() );
1551 
1552  // Resize the accessor to all regions and subregions
1553  for( localIndex er = 0; er < numRegions(); ++er )
1554  {
1555  accessor[er].resize( getRegion( er ).numSubRegions() );
1556  }
1557 
1558  // Loop only over regions named and populate according to given material names
1559  for( localIndex er = 0; er < numRegions(); ++er )
1560  {
1561  ElementRegionBase const & region = getRegion( er );
1562 
1563  region.forElementSubRegionsIndex( [&]( localIndex const esr,
1564  ElementSubRegionBase const & subRegion )
1565  {
1566  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1567 
1568  string materialName;
1569  constitutiveGroup.forSubGroups< MATERIALTYPE >( [&]( MATERIALTYPE const & constitutiveRelation )
1570  {
1571  materialName = constitutiveRelation.getName();
1572  if( constitutiveRelation.template hasWrapper( viewName ) ) //NOTE (matteo): I have added this check to allow for the view to be
1573  // missing. I am not sure this is the default behaviour we want though.
1574  {
1575  accessor[er][esr] = constitutiveRelation.template getReference< VIEWTYPE >( viewName );
1576  }
1577  } );
1578  } );
1579  }
1580  return accessor;
1581 }
1582 
1583 template< typename MATERIALTYPE, typename T, int NDIM, typename PERM >
1586 {
1587  return constructMaterialViewAccessor< MATERIALTYPE, Array< T, NDIM, PERM >, ArrayView< T const, NDIM, getUSD< PERM > > >( viewName );
1588 }
1589 
1590 template< typename CONSTITUTIVE_TYPE >
1592 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm ) const
1593 {
1595  accessor.resize( numRegions() );
1596  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1597  {
1598  ElementRegionBase const & elemRegion = getRegion( kReg );
1599  accessor[kReg].resize( elemRegion.numSubRegions() );
1600 
1601  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1602  {
1603  ElementSubRegionBase const & subRegion = elemRegion.getSubRegion( kSubReg );
1604  dataRepository::Group const & constitutiveGroup = subRegion.getConstitutiveModels();
1605  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1606 
1607  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1608  {
1609  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1610 
1611  CONSTITUTIVE_TYPE * const
1612  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1613  if( constitutiveRelation != nullptr )
1614  {
1615  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1616  }
1617  }
1618  }
1619  }
1620  return accessor;
1621 }
1622 
1623 template< typename CONSTITUTIVE_TYPE >
1625 ElementRegionManager::constructFullConstitutiveAccessor( constitutive::ConstitutiveManager const & cm )
1626 {
1628  accessor.resize( numRegions() );
1629  for( localIndex kReg=0; kReg<numRegions(); ++kReg )
1630  {
1631  ElementRegionBase & elemRegion = getRegion( kReg );
1632  accessor[kReg].resize( elemRegion.numSubRegions() );
1633 
1634  for( localIndex kSubReg=0; kSubReg<elemRegion.numSubRegions(); ++kSubReg )
1635  {
1636  ElementSubRegionBase & subRegion = elemRegion.getSubRegion( kSubReg );
1637  dataRepository::Group & constitutiveGroup = subRegion.getConstitutiveModels();
1638  accessor[kReg][kSubReg].resize( cm.numSubGroups() );
1639 
1640  for( localIndex matIndex=0; matIndex<cm.numSubGroups(); ++matIndex )
1641  {
1642  string const & constitutiveName = cm.getGroup( matIndex ).getName();
1643 
1644  CONSTITUTIVE_TYPE * const
1645  constitutiveRelation = constitutiveGroup.getGroupPointer< CONSTITUTIVE_TYPE >( constitutiveName );
1646  if( constitutiveRelation != nullptr )
1647  {
1648  accessor[kReg][kSubReg][matIndex] = constitutiveRelation;
1649  }
1650  }
1651  }
1652  }
1653  return accessor;
1654 }
1655 
1656 }
1657 #endif /* GEOS_MESH_ELEMENTREGIONMANAGER_HPP */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:83
#define GEOS_ERROR_IF_EQ_MSG(lhs, rhs, msg)
Raise a hard error if two values are equal.
Definition: Logger.hpp:176
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
Definition: Logger.hpp:107
constexpr static INDEX_TYPE invalid_index
the value of an invalid index
Definition: KeyIndexT.hpp:50
Abstract base class for CellBlockManager.
The ElementRegionBase is the base class to manage the data stored at the element level.
void forElementSubRegionsIndex(LAMBDA &&lambda) const
Apply LAMBDA to the subregions, loop using subregion indices.
localIndex numSubRegions() const
Get the number of subregions in the region.
SUBREGIONTYPE const & getSubRegion(KEY_TYPE const &key) const
Get a reference to a subregion.
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
array1d< array1d< ReferenceWrapper< VIEWTYPE > > > ElementReferenceAccessor
The ElementViewAccessor at the ElementRegionManager level is a 2D array of ReferenceWrapper around VI...
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions that can...
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the specified target element subregions.
void forElementRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the types of element regions.
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions.
int unpackUpDownMaps(buffer_unit_type const *&buffer, ElementReferenceAccessor< localIndex_array > &packList, bool const overwriteMap)
Unpack element-to-node and element-to-face maps.
T & getRegion(KEY_TYPE const &key)
Get a element region.
MaterialViewAccessor< LHS > constructFullMaterialViewAccessor(string const &viewName, constitutive::ConstitutiveManager const &cm) const
This is a const function to construct a MaterialViewAccessor to access the material data.
int packGlobalMaps(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack a buffer.
int unpack(buffer_unit_type const *&buffer, ElementReferenceAccessor< array1d< localIndex > > &packList)
Unpack a buffer.
int packFracturedElementsSize(ElementViewAccessor< arrayView1d< localIndex > > const &packList, string const fractureRegionName) const
Get the buffer size needed to pack the set of fractured elements and the map toEmbSurfaces.
ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructMaterialArrayViewAccessor(string const &viewName, arrayView1d< string const > const &regionNames, string const &materialKeyName, bool const allowMissingViews=false) const
Construct a view accessor for material data, assuming array as storage type.
virtual void setSchemaDeviations(xmlWrapper::xmlNode schemaRoot, xmlWrapper::xmlNode schemaParent, integer documentationType) override
Inform the schema generator of any deviations between the xml and GEOS data structures.
ElementRegionManager(string const &name, Group *const parent)
Constructor.
virtual ~ElementRegionManager() override
Destructor.
virtual void setMaxGlobalIndex() override final
Set the maximum local and global index.
int unpack(buffer_unit_type const *&buffer, ElementViewAccessor< arrayView1d< localIndex > > &packList)
Unpack a buffer.
void forElementSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of the specified su...
int packUpDownMaps(buffer_unit_type *&buffer, ElementReferenceAccessor< array1d< localIndex > > const &packList) const
Pack element-to-node and element-to-face maps.
void forElementRegions(LAMBDA &&lambda)
This function is used to launch kernel function over all the element regions with region type = Eleme...
int pack(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack all the wrappers of all the sub regions of all the regions.
array2d< localIndex > getCellBlockToSubRegionMap(CellBlockManagerABC const &cellBlockManager) const
Produce a map from cell block indices to element region and subregion indices.
void forElementRegionsComplete(LAMBDA lambda)
This function is used to launch kernel function over all the element regions that can be casted to on...
subGroupMap const & getRegions() const
Get a collection of element regions.
ConstitutiveRelationAccessor< CONSTITUTIVE_TYPE > constructFullConstitutiveAccessor(constitutive::ConstitutiveManager const &cm) const
Construct a ConstitutiveRelationAccessor.
void forElementSubRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions th...
ElementViewAccessor< LHS > constructMaterialViewAccessor(string const &viewName, arrayView1d< string const > const &regionNames, string const &materialKeyName, bool const allowMissingViews=false) const
This is a const function to construct a MaterialViewAccessor to access the material data for specifie...
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target element regions.
localIndex numRegions() const
Get number of the regions.
void forElementSubRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the specified target element subregions.
ElementViewAccessor< traits::ViewTypeConst< typename FIELD_TRAIT::type > > constructFieldAccessor(string const &neighborName=string()) const
This is a const function to construct a ElementViewAccessor to access the data registered on the mesh...
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new ElementRegion object as a child of this group.
void forElementSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the element subregions that can be cas...
void forElementRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over all the element regions with region type =...
subGroupMap & getRegions()
Get a collection of element regions.
int unpackFracturedElements(buffer_unit_type const *&buffer, ElementReferenceAccessor< localIndex_array > &packList, string const fractureRegionName)
Unpack set of fractured elements and map toEmbSurfaces to a buffer or get the buffer size.
array1d< array1d< array1d< CONSTITUTIVE_TYPE * > > > ConstitutiveRelationAccessor
The ConstitutiveRelationAccessor at the ElementRegionManager level is a 3D array of CONSTITUTIVE_TYPE...
void forElementRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda) const
This const function is used to launch kernel function over the target element regions with region typ...
int packFracturedElements(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList, string const fractureRegionName) const
Pack set of fractured elements and map toEmbSurfaces to a buffer or get the buffer size.
int unpackGlobalMaps(buffer_unit_type const *&buffer, ElementViewAccessor< ReferenceWrapper< localIndex_array > > &packList)
Unpack a buffer.
void forElementRegions(LOOKUP_CONTAINER const &targetRegions, LAMBDA &&lambda)
This function is used to launch kernel function over the target element regions with region type = El...
void forElementRegionsComplete(LOOKUP_CONTAINER const &targetRegions, LAMBDA lambda)
This function is used to launch kernel function over the specified target element regions with region...
typename ElementViewAccessor< VIEWTYPE >::NestedViewType ElementView
The ElementViewAccessor at the ElementRegionManager level is the type resulting from ElementViewAcces...
int packUpDownMaps(buffer_unit_type *&buffer, ElementViewAccessor< arrayView1d< localIndex > > const &packList) const
Pack element-to-node and element-to-face maps.
virtual void expandObjectCatalogs() override
Expand any catalogs in the data structure.
void forElementRegionsComplete(LAMBDA lambda) const
This const function is used to launch kernel function over all the types of element regions.
localIndex getNumberOfElements() const
Get the number of elements in all ElementSubRegions of type T.
ElementViewAccessor< ArrayView< T const, NDIM, getUSD< PERM > > > constructArrayViewAccessor(string const &name, string const &neighborName=string()) const
This is a function to construct a ElementViewAccessor to access array data registered on the mesh.
int packUpDownMapsSize(ElementReferenceAccessor< array1d< localIndex > > const &packList) const
Get the buffer size needed to pack element-to-node and element-to-face maps.
void forElementSubRegionsComplete(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of all subregion ty...
void forElementSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of all subregion types.
void forElementSubRegions(LAMBDA &&lambda) const
This const function is used to launch kernel function over the element subregions of all the subregio...
void forElementSubRegionsComplete(LAMBDA &&lambda)
This function is used to launch kernel function over all the element subregions that can be casted to...
void forElementSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of all the subregion type...
virtual string getCatalogName() const override final
Virtual access to catalogName()
void forElementSubRegions(LAMBDA &&lambda)
This function is used to launch kernel function over the element subregions of the specified subregio...
void generateMesh(CellBlockManagerABC const &cellBlockManager)
Generate the mesh.
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:41
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:45
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:314
DataContext const & getDataContext() const
Definition: Group.hpp:1322
bool hasWrapper(LOOKUP_TYPE const &lookup) const
Check if a wrapper exists.
Definition: Group.hpp:1181
localIndex getIndexInParent() const
Get the group's index within its parent group.
Definition: Group.hpp:1366
GEOS_DECLTYPE_AUTO_RETURN getReference(LOOKUP_TYPE const &lookup) const
Look up a wrapper and get reference to wrapped object.
Definition: Group.hpp:1252
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:333
static bool applyLambdaToContainer(CONTAINERTYPE &container, LAMBDA &&lambda)
Apply a given functor to a container if the container can be cast to one of the specified types.
Definition: Group.hpp:472
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1294
virtual localIndex packSize(string_array const &wrapperNames, integer const recursive, bool onDevice, parallelDeviceEvents &events) const
Get the size required to pack a list of wrappers.
void forSubGroups(LAMBDA &&lambda)
Apply the given functor to subgroups that can be casted to one of specified types.
Definition: Group.hpp:508
virtual localIndex pack(buffer_unit_type *&buffer, string_array const &wrapperNames, integer const recursive, bool onDevice, parallelDeviceEvents &events) const
Pack a list of wrappers to a buffer.
Wrapper< T > const * getWrapperPointer(LOOKUP_TYPE const &index) const
Retrieve a Wrapper stored in this group.
Definition: Group.hpp:1218
virtual void resize(localIndex const newSize)
Resize the group and all contained wrappers that resize with parent.
T & reference()
Accessor for m_data.
Definition: Wrapper.hpp:580
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:55
pugi::xml_node xmlNode
Definition: xmlWrapper.hpp:57
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:423
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
signed char buffer_unit_type
Type stored in communication buffers.
Definition: DataTypes.hpp:149
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:216
LvArray::ArrayView< T, NDIM, USD, localIndex, LvArray::ChaiBuffer > ArrayView
Multidimensional array view type. See LvArray:ArrayView for details.
Definition: DataTypes.hpp:188
Group key associated with elementRegionsGroup.
struct to serve as a container for group strings and keys
static constexpr char const * neighborDataString()