GEOS
CellBlockABC.hpp
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
16 #ifndef GEOS_CELLBLOCKABC_HPP
17 #define GEOS_CELLBLOCKABC_HPP
18 
19 #include "dataRepository/Group.hpp"
20 #include "mesh/ElementType.hpp"
21 #include "common/DataTypes.hpp"
22 
23 #include <vector>
24 
25 namespace geos
26 {
27 
40 {
41 public:
42 
48  CellBlockABC( string const & name,
49  Group * const parent )
50  :
51  Group( name, parent )
52  { }
53 
60  virtual ElementType getElementType() const = 0;
61 
66  virtual localIndex numNodesPerElement() const = 0;
67 
72  virtual localIndex numEdgesPerElement() const = 0;
73 
78  virtual localIndex numFacesPerElement() const = 0;
79 
84  virtual localIndex numElements() const = 0;
85 
91 
97 
103 
109 
120  template< typename LAMBDA >
121  void forExternalProperties( LAMBDA && lambda ) const
122  {
123  for( auto * wrapperBase: this->getExternalProperties() )
124  {
125  lambda( *wrapperBase );
126  }
127  }
128 
129 private:
140  virtual std::list< dataRepository::WrapperBase const * > getExternalProperties() const = 0;
141 };
142 
143 }
144 
145 #endif //GEOS_CELLBLOCKABC_HPP
virtual localIndex numElements() const =0
Get the number of elements.
void forExternalProperties(LAMBDA &&lambda) const
Helper function to apply a lambda function over all the external properties of the subregion.
virtual localIndex numEdgesPerElement() const =0
Get the number of edges per element.
virtual localIndex numNodesPerElement() const =0
Get the number of nodes per element.
virtual array1d< globalIndex > localToGlobalMap() const =0
Get local to global map.
virtual array2d< localIndex > getElemToFaces() const =0
Get the element-to-faces map.
virtual array2d< localIndex, cells::NODE_MAP_PERMUTATION > getElemToNodes() const =0
Get the element-to-nodes map.
virtual ElementType getElementType() const =0
Get the type of element in this subregion.
virtual localIndex numFacesPerElement() const =0
Get the number of faces per element.
CellBlockABC(string const &name, Group *const parent)
Constructor.
virtual array2d< localIndex > getElemToEdges() const =0
Get the element-to-edges map.
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
ElementType
Denotes type of cell/element shape.
Definition: ElementType.hpp:32
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176