GEOSX
ToElementRelation.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 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 
19 #ifndef GEOSX_MESH_TOELEMENTRELATION_HPP_
20 #define GEOSX_MESH_TOELEMENTRELATION_HPP_
21 
22 #include "InterObjectRelation.hpp"
23 
24 namespace geosx
25 {
26 
27 class ElementRegionManager;
28 
34 template< typename BASETYPE >
36 {
37 public:
38 
40  using base_type = BASETYPE;
41 
46 
53  template< typename ... DIMS >
54  void resize( DIMS... newdims );
55 
60  localIndex size() const
61  {
62  return m_toElementRegion.size();
63  }
64 
70  localIndex size( int const dim ) const
71  {
72  return m_toElementRegion.size( dim );
73  }
74 
79  void setElementRegionManager( ElementRegionManager const * const input )
80  {
81  m_elemRegionManager = input;
82  }
83 
89  {
90  return m_elemRegionManager;
91  }
92 
98  BASETYPE m_toElementIndex;
99 
102 };
103 
105 template< typename BASETYPE >
110  m_elemRegionManager( nullptr )
111 {}
112 
113 template< typename BASETYPE >
115 {}
116 
117 template< typename BASETYPE >
118 template< typename ... DIMS >
119 void ToElementRelation< BASETYPE >::resize( DIMS... newdims )
120 {
121  m_toElementRegion.resize( newdims ... );
122  m_toElementSubRegion.resize( newdims ... );
123  m_toElementIndex.resize( newdims ... );
124 }
126 
129 
132 
142 void erase( OrderedVariableToManyElementRelation & relation,
143  localIndex const firstIndex,
144  localIndex const er,
145  localIndex const esr,
146  localIndex const ei );
147 
157 void insert( OrderedVariableToManyElementRelation & relation,
158  localIndex const firstIndex,
159  localIndex const er,
160  localIndex const esr,
161  localIndex const ei );
162 
163 
164 
165 } /* namespace geosx */
166 
167 #endif /* GEOSX_MESH_TOELEMENTRELATION_HPP_ */
void insert(OrderedVariableToManyElementRelation &relation, localIndex const firstIndex, localIndex const er, localIndex const esr, localIndex const ei)
Insert an element relation for an object in the relation.
ElementRegionManager const * m_elemRegionManager
The current ElementRegionManager.
void resize(DIMS... newdims)
Resize the underlying relationship storage.
A relationship to an element.
ToElementRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyElementRelation
A ToElementRelation where each object is related to an arbitrary number of elements.
ToElementRelation()
The default constructor.
ElementRegionManager const * getElementRegionManager() const
Get the ElementRegionManager.
localIndex size() const
Get the current size of the relationship storage.
BASETYPE m_toElementSubRegion
The relationship between object indices and element subregions.
BASETYPE m_toElementIndex
The relationship between object indices and element indices.
BASETYPE m_toElementRegion
The relationship between object indices and element regions.
~ToElementRelation()
The default destructor.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
ToElementRelation< array2d< localIndex > > FixedToManyElementRelation
A ToElementRelation where each object is related to the same number of elements.
localIndex size(int const dim) const
Get the size of a specific dimension of the relationship storage.
void erase(OrderedVariableToManyElementRelation &relation, localIndex const firstIndex, localIndex const er, localIndex const esr, localIndex const ei)
Remove an element relation from an object in the relation.
void setElementRegionManager(ElementRegionManager const *const input)
Set the ElementRegionManager.