GEOS
ToParticleRelation.hpp
Go to the documentation of this file.
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 TotalEnergies
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 
20 #ifndef GEOS_MESH_TOPARTICLERELATION_HPP_
21 #define GEOS_MESH_TOPARTICLERELATION_HPP_
22 
23 #include "InterObjectRelation.hpp"
24 
25 namespace geos
26 {
27 
28 class ParticleManager;
29 
35 template< typename BASETYPE >
37 {
38 public:
39 
41  using base_type = BASETYPE;
42 
49  template< typename ... DIMS >
50  void resize( DIMS... newdims )
51  {
52  m_toParticleRegion.resize( newdims ... );
53  m_toParticleSubRegion.resize( newdims ... );
54  m_toParticleIndex.resize( newdims ... );
55  m_numParticles.resizeDefault( m_toParticleRegion.size(), 0 );
56  }
57 
62  localIndex size() const
63  {
64  return m_toParticleRegion.size();
65  }
66 
72  localIndex size( int const dim ) const
73  {
74  return m_toParticleRegion.size( dim );
75  }
76 
81  void setParticleManager( ParticleManager const & input )
82  {
83  m_particleManager = &input;
84  }
85 
91  {
92  return m_particleManager;
93  }
94 
103 
106 };
107 
110 
113 
124  localIndex const firstIndex,
125  localIndex const er,
126  localIndex const esr,
127  localIndex const ei );
128 
140  localIndex const firstIndex,
141  localIndex const er,
142  localIndex const esr,
143  localIndex const ei );
144 
156  localIndex const firstIndex,
157  localIndex const er,
158  localIndex const esr,
159  localIndex const ei );
160 
172  localIndex const firstIndex,
173  std::vector< localIndex > const & erArray,
174  std::vector< localIndex > const & esrArray,
175  std::vector< localIndex > const & eiArray );
176 
184  int const numToReserve );
185 
186 
187 } /* namespace geos */
188 
189 #endif /* GEOS_MESH_TOPARTICLERELATION_HPP_ */
The ParticleManager class provides an interface to ObjectManagerBase in order to manage ParticleRegio...
A relationship to a particle.
void setParticleManager(ParticleManager const &input)
Set the ParticleRegionManager.
ParticleManager const * m_particleManager
The current ParticleRegionManager.
BASETYPE base_type
The type of the underlying relationship storage object.
localIndex size(int const dim) const
Get the size of a specific dimension of the relationship storage.
BASETYPE m_toParticleRegion
The relationship between object indices and particle regions.
BASETYPE m_toParticleSubRegion
The relationship between object indices and particle subregions.
void resize(DIMS... newdims)
Resize the underlying relationship storage.
array1d< localIndex > m_numParticles
The number of particles associated with the object.
ParticleManager const * getParticleManager() const
Get the ParticleRegionManager.
localIndex size() const
Get the current size of the relationship storage.
BASETYPE m_toParticleIndex
The relationship between object indices and particle indices.
void reserveNeighbors(OrderedVariableToManyParticleRelation &relation, int const numToReserve)
Reserve a set number of entities for a particle to relate to.
void insertMany(OrderedVariableToManyParticleRelation &relation, localIndex const firstIndex, std::vector< localIndex > const &erArray, std::vector< localIndex > const &esrArray, std::vector< localIndex > const &eiArray)
Insert a particle relation for several objects in the relation. Does NOT check for existing membershi...
ToParticleRelation< ArrayOfArrays< localIndex > > OrderedVariableToManyParticleRelation
A ToParticleRelation where each object is related to an arbitrary number of particles.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
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.
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.
ToParticleRelation< array2d< localIndex > > FixedToManyParticleRelation
A ToParticleRelation where each object is related to the same number of particles.
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176
void fastInsert(OrderedVariableToManyParticleRelation &relation, localIndex const firstIndex, localIndex const er, localIndex const esr, localIndex const ei)
Insert a particle relation for an object in the relation. This is slightly faster than "insert" becau...