GEOS
ParticleBlock.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_MESH_PARTICLEBLOCK_HPP_
17 #define GEOS_MESH_PARTICLEBLOCK_HPP_
18 
19 #include "mesh/generators/ParticleBlockABC.hpp"
20 #include "mesh/ParticleType.hpp"
21 
22 #include "dataRepository/Group.hpp"
23 
24 namespace geos
25 {
26 
32 {
33 public:
34 
39 
40  ParticleBlock() = delete;
41 
47  ParticleBlock( string const & name, Group * const parent );
48 
53  ParticleBlock( const ParticleBlock & init ) = delete;
54 
59 
61 
66 
68 
72 
79  void setParticleType( ParticleType particleType );
80 
81  ParticleType getParticleType() const override
82  { return m_particleType; }
83 
85  { return m_particleID; }
86 
91  void setParticleID( array1d< globalIndex > const particleID )
92  { m_particleID = particleID; }
93 
95  { return m_particleCenter; }
96 
101  void setParticleCenter( array2d< real64 > const particleCenter )
102  { m_particleCenter = particleCenter; }
103 
105  { return m_particleVelocity; }
106 
111  void setParticleVelocity( array2d< real64 > const particleVelocity )
112  { m_particleVelocity = particleVelocity; }
113 
115  { return m_particleMaterialDirection; }
116 
121  void setParticleMaterialDirection( array2d< real64 > const particleMaterialDirection )
122  { m_particleMaterialDirection = particleMaterialDirection; }
123 
125  { return m_particleGroup; }
126 
131  void setParticleGroup( array1d< int > const particleGroup )
132  { m_particleGroup = particleGroup; } // TODO: Rename to particleContactGroup
133 
135  { return m_particleSurfaceFlag; }
136 
141  void setParticleSurfaceFlag( array1d< int > const particleSurfaceFlag )
142  { m_particleSurfaceFlag = particleSurfaceFlag; }
143 
145  { return m_particleDamage; }
146 
151  void setParticleDamage( array1d< real64 > const particleDamage )
152  { m_particleDamage = particleDamage; }
153 
155  { return m_particleStrengthScale; }
156 
161  void setParticleStrengthScale( array1d< real64 > const particleStrengthScale )
162  { m_particleStrengthScale = particleStrengthScale; }
163 
165  { return m_particleVolume; }
166 
171  void setParticleVolume( array1d< real64 > const particleVolume )
172  { m_particleVolume = particleVolume; }
173 
175  { return m_particleRVectors; }
176 
181  void setParticleRVectors( array3d< real64 > const particleRVectors )
182  { m_particleRVectors = particleRVectors; }
183 
184  bool hasRVectors() const override
185  { return m_hasRVectors; }
186 
187  localIndex numParticles() const override
188  { return size(); }
189 
198  { return m_localToGlobalMap; }
199 
201  { return m_localToGlobalMap; }
202 
207  void resize( dataRepository::indexType const numParticles ) override final;
208 
210 
215 
217 
218 private:
219 
221  array1d< globalIndex > m_localToGlobalMap;
222 
224  string_array m_externalPropertyNames;
225 
227  array1d< globalIndex > m_particleID;
228 
230  array1d< int > m_particleGroup;
231 
233  array1d< int > m_particleSurfaceFlag;
234 
236  array1d< real64 > m_particleDamage;
237 
239  array1d< real64 > m_particleStrengthScale;
240 
242  array2d< real64 > m_particleCenter;
243 
245  array2d< real64 > m_particleVelocity;
246 
248  array2d< real64 > m_particleMaterialDirection;
249 
251  array1d< real64 > m_particleVolume;
252 
254  ParticleType m_particleType;
255 
257  bool m_hasRVectors;
258 
260  array3d< real64 > m_particleRVectors;
261 
262  std::list< dataRepository::WrapperBase * > getExternalProperties() override
263  {
264  std::list< dataRepository::WrapperBase * > result;
265  for( string const & externalPropertyName : m_externalPropertyNames )
266  {
267  result.push_back( &this->getWrapperBase( externalPropertyName ) );
268  }
269  return result;
270  }
271 };
272 
273 }
274 
275 #endif /* GEOS_MESH_CELLBLOCK_HPP_ */
array1d< real64 > getParticleVolume() const override
Get the list of particle volumes in this subregion.
array1d< globalIndex > getParticleID() const override
Get the list of particle global IDs in this subregion.
void resize(dataRepository::indexType const numParticles) override final
Resize the cell block to hold numParticles.
localIndex numParticles() const override
Get the number of particles.
void setParticleStrengthScale(array1d< real64 > const particleStrengthScale)
Set the list of particle strength scale values in this subregion.
array1d< real64 > getParticleStrengthScale() const override
Get the list of particle strength scale values in this subregion.
ParticleBlock(const ParticleBlock &init)=delete
Copy constructor.
void setParticleRVectors(array3d< real64 > const particleRVectors)
Set the list of particle r-vectors in this subregion.
void setParticleMaterialDirection(array2d< real64 > const particleMaterialDirection)
Set the list of material directions in this subregion.
array1d< globalIndex > localToGlobalMap() const override
Get local to global map.
void setParticleCenter(array2d< real64 > const particleCenter)
Set the list of particle center locations in this subregion.
void setParticleType(ParticleType particleType)
Defines the underlying particle type (hex, tet...)
void setParticleVolume(array1d< real64 > const particleVolume)
Set the list of particle volumes in this subregion.
ParticleType getParticleType() const override
Get the type of particle in this subregion.
ParticleBlock(string const &name, Group *const parent)
Constructor for this class.
arrayView1d< globalIndex > localToGlobalMap()
Get local to global map, non-const version.
array1d< real64 > getParticleDamage() const override
Get the list of particle damage values in this subregion.
array1d< int > getParticleGroup() const override
Get the list of particle group numbers (for contact) in this subregion.
void setParticleID(array1d< globalIndex > const particleID)
Sets the global IDs of particles in this subregion.
void setParticleVelocity(array2d< real64 > const particleVelocity)
Set the list of particle velocities in this subregion.
array2d< real64 > getParticleMaterialDirection() const override
Get the list of particle material directions in this subregion.
array1d< int > getParticleSurfaceFlag() const override
Get the list of particle surface flag values in this subregion.
array2d< real64 > getParticleCenter() const override
Get the list of particle center locations in this subregion.
void setParticleSurfaceFlag(array1d< int > const particleSurfaceFlag)
Set the list of particle surface flags in this subregion.
bool hasRVectors() const override
Query whether this subregion has particles of a type that have r-vectors that depend on the deformati...
void setParticleDamage(array1d< real64 > const particleDamage)
Set the list of particle damage values in this subregion.
array3d< real64 > getParticleRVectors() const override
Get the list of particle r-vectors in this subregion.
void setParticleGroup(array1d< int > const particleGroup)
Set the list of particle group numbers (for contact) in this subregion.
array2d< real64 > getParticleVelocity() const override
Get the list of particle velocities in this subregion.
~ParticleBlock()
Default destructor.
WrapperBase const & getWrapperBase(KEY const &key) const
Return a reference to a WrapperBase stored in this group.
Definition: Group.hpp:1121
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1315
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:58
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:180
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:192
Array< T, 3, PERMUTATION > array3d
Alias for 3D array.
Definition: DataTypes.hpp:208
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85
ParticleType
Denotes type of particle shape/interpolation scheme.
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:176