GEOSX
CellBlockABC.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 TotalEnergies
8  * Copyright (c) 2020- 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 GEOS_CELLBLOCKABC_HPP
16 #define GEOS_CELLBLOCKABC_HPP
17 
18 #include "dataRepository/Group.hpp"
19 #include "mesh/ElementType.hpp"
20 #include "common/DataTypes.hpp"
21 
22 #include <vector>
23 
24 namespace geos
25 {
26 
39 {
40 public:
41 
47  CellBlockABC( string const & name,
48  Group * const parent )
49  :
50  Group( name, parent )
51  { }
52 
59  virtual ElementType getElementType() const = 0;
60 
65  virtual localIndex numNodesPerElement() const = 0;
66 
71  virtual localIndex numEdgesPerElement() const = 0;
72 
77  virtual localIndex numFacesPerElement() const = 0;
78 
83  virtual localIndex numElements() const = 0;
84 
90 
96 
102 
108 
119  template< typename LAMBDA >
120  void forExternalProperties( LAMBDA && lambda ) const
121  {
122  for( auto * wrapperBase: this->getExternalProperties() )
123  {
124  lambda( *wrapperBase );
125  }
126  }
127 
128 private:
139  virtual std::list< dataRepository::WrapperBase const * > getExternalProperties() const = 0;
140 };
141 
142 }
143 
144 #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:232
ElementType
Denotes type of cell/element shape.
Definition: ElementType.hpp:31
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