GEOSX
AggregateElementSubRegion.hpp
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 Total, S.A
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 
15 #ifndef GEOSX_MESH_AGGREGATEELEMENTSUBREGION_HPP_
16 #define GEOSX_MESH_AGGREGATEELEMENTSUBREGION_HPP_
17 
18 #include "ElementSubRegionBase.hpp"
19 #include "InterObjectRelation.hpp"
20 
21 
22 
23 namespace geosx
24 {
25 
26 
33 {
34 public:
35 
38 
42 
48  static const string CatalogName()
49  { return "AggregateCell"; }
50 
55  virtual const string getCatalogName() const override
56  {
58  }
60 
67  template< typename LAMBDA >
68  void forFineCellsInAggregate( localIndex aggregateIndex, LAMBDA lambda )
69  {
70  for( localIndex fineCell = m_nbFineCellsPerCoarseCell[aggregateIndex];
71  fineCell < m_nbFineCellsPerCoarseCell[aggregateIndex+1]; fineCell++ )
72  {
73  lambda( m_fineToCoarse[fineCell] );
74  }
75  }
76 
77 
84  {
85  return m_nbFineCellsPerCoarseCell[aggregateIndex + 1] - m_nbFineCellsPerCoarseCell[aggregateIndex];
86  }
87 
91 
98  AggregateElementSubRegion( string const & name,
99  dataRepository::Group * const parent );
103  virtual ~AggregateElementSubRegion() override;
105 
112  void CreateFromFineToCoarseMap( localIndex nbAggregates,
113  arrayView1d< localIndex const > const & fineToCoarse,
114  arrayView2d< real64 const > const & barycenters );
115 
121  {
122  return m_fineToCoarse;
123  }
124 
125  virtual void CalculateElementGeometricQuantities( NodeManager const & nodeManager,
126  FaceManager const & faceManager ) override
127  {
128  GEOSX_UNUSED_VAR( nodeManager );
129  GEOSX_UNUSED_VAR( faceManager );
130  //TODO ?
131  }
132 
133  virtual void setupRelatedObjectsInRelations( MeshLevel const * const mesh ) override
134  {
135  GEOSX_UNUSED_VAR( mesh );
136  //TODO ?
137  }
138 
142 
149  {
151  static constexpr auto elementVolumeString = "elementVolume";
152  static constexpr auto fineElementsListString = "fineElements";
154  };
156 
157 private:
159  NodeMapType m_toNodesRelation;
160 
162  array1d< localIndex > m_fineToCoarse;
163 
165  array1d< localIndex > m_nbFineCellsPerCoarseCell;
166 };
167 }
168 
169 #endif
localIndex GetNbCellsPerAggregate(localIndex aggregateIndex) const
Gives the number of fine cells of an aggregate coarse cell.
InterObjectRelation< array2d< localIndex > > FixedOneToManyRelation
A relationship from single objects to many other objects, where each object is related to the same nu...
Class facilitating the representation of a multi-level discretization of a MeshBody.
Definition: MeshLevel.hpp:38
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data...
Definition: NodeManager.hpp:47
AggregateElementSubRegion(string const &name, dataRepository::Group *const parent)
Constructor for this class.
virtual ~AggregateElementSubRegion() override
Destructor.
virtual void CalculateElementGeometricQuantities(NodeManager const &nodeManager, FaceManager const &faceManager) override
Calculate the geometric quantities for each element in the subregion.
This class serves to provide a "view" of a multidimensional array.
Definition: ArrayView.hpp:67
virtual const string getCatalogName() const override
Provide a virtual access to CatalogName().
The AggregateElementSubRegion class provides an interface to aggregate fine cells into coarse cells...
void CreateFromFineToCoarseMap(localIndex nbAggregates, arrayView1d< localIndex const > const &fineToCoarse, arrayView2d< real64 const > const &barycenters)
Construct the relation map between fine and coarse cells and order by aggregates. ...
#define GEOSX_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:78
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
void forFineCellsInAggregate(localIndex aggregateIndex, LAMBDA lambda)
Find all the fine cell in a given aggregate coarse cell.
virtual void setupRelatedObjectsInRelations(MeshLevel const *const mesh) override
Link the connectivity maps of the subregion to the managers storing the mesh information.
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data...
Definition: FaceManager.hpp:40
Contains added view access key to be bound with class data member.
static const string CatalogName()
Return the name of the aggregate element sub-region in the object catalog.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
struct to serve as a container for variable strings and keys
const array1d< localIndex > & GetFineToCoarseMap()
Accessor to the relation array between fine and coarse elements.