GEOSX
ParticleBlock.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) 2019- 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 GEOSX_MESH_PARTICLEBLOCK_HPP_
16 #define GEOSX_MESH_PARTICLEBLOCK_HPP_
17 
18 #include "mesh/generators/ParticleBlockABC.hpp"
19 #include "mesh/ParticleType.hpp"
20 
21 #include "dataRepository/Group.hpp"
22 
23 namespace geos
24 {
25 
31 {
32 public:
33 
38 
39  ParticleBlock() = delete;
40 
46  ParticleBlock( string const & name, Group * const parent );
47 
52  ParticleBlock( const ParticleBlock & init ) = delete;
53 
58 
60 
65 
67 
71 
78  void setParticleType( ParticleType particleType );
79 
80  ParticleType getParticleType() const override
81  { return m_particleType; }
82 
84  { return m_particleID; }
85 
90  void setParticleID( array1d< globalIndex > const particleID )
91  { m_particleID = particleID; }
92 
94  { return m_particleCenter; }
95 
100  void setParticleCenter( array2d< real64 > const particleCenter )
101  { m_particleCenter = particleCenter; }
102 
104  { return m_particleVelocity; }
105 
110  void setParticleVelocity( array2d< real64 > const particleVelocity )
111  { m_particleVelocity = particleVelocity; }
112 
114  { return m_particleMaterialDirection; }
115 
120  void setParticleMaterialDirection( array2d< real64 > const particleMaterialDirection )
121  { m_particleMaterialDirection = particleMaterialDirection; }
122 
124  { return m_particleGroup; }
125 
130  void setParticleGroup( array1d< int > const particleGroup )
131  { m_particleGroup = particleGroup; } // TODO: Rename to particleContactGroup
132 
134  { return m_particleSurfaceFlag; }
135 
140  void setParticleSurfaceFlag( array1d< int > const particleSurfaceFlag )
141  { m_particleSurfaceFlag = particleSurfaceFlag; }
142 
144  { return m_particleDamage; }
145 
150  void setParticleDamage( array1d< real64 > const particleDamage )
151  { m_particleDamage = particleDamage; }
152 
154  { return m_particleStrengthScale; }
155 
160  void setParticleStrengthScale( array1d< real64 > const particleStrengthScale )
161  { m_particleStrengthScale = particleStrengthScale; }
162 
164  { return m_particleVolume; }
165 
170  void setParticleVolume( array1d< real64 > const particleVolume )
171  { m_particleVolume = particleVolume; }
172 
174  { return m_particleRVectors; }
175 
180  void setParticleRVectors( array3d< real64 > const particleRVectors )
181  { m_particleRVectors = particleRVectors; }
182 
183  bool hasRVectors() const override
184  { return m_hasRVectors; }
185 
186  localIndex numParticles() const override
187  { return size(); }
188 
197  { return m_localToGlobalMap; }
198 
200  { return m_localToGlobalMap; }
201 
206  void resize( dataRepository::indexType const numParticles ) override final;
207 
209 
214 
216 
217 private:
218 
220  array1d< globalIndex > m_localToGlobalMap;
221 
223  string_array m_externalPropertyNames;
224 
226  array1d< globalIndex > m_particleID;
227 
229  array1d< int > m_particleGroup;
230 
232  array1d< int > m_particleSurfaceFlag;
233 
235  array1d< real64 > m_particleDamage;
236 
238  array1d< real64 > m_particleStrengthScale;
239 
241  array2d< real64 > m_particleCenter;
242 
244  array2d< real64 > m_particleVelocity;
245 
247  array2d< real64 > m_particleMaterialDirection;
248 
250  array1d< real64 > m_particleVolume;
251 
253  ParticleType m_particleType;
254 
256  bool m_hasRVectors;
257 
259  array3d< real64 > m_particleRVectors;
260 
261  std::list< dataRepository::WrapperBase * > getExternalProperties() override
262  {
263  std::list< dataRepository::WrapperBase * > result;
264  for( string const & externalPropertyName : m_externalPropertyNames )
265  {
266  result.push_back( &this->getWrapperBase( externalPropertyName ) );
267  }
268  return result;
269  }
270 };
271 
272 }
273 
274 #endif /* GEOSX_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:1100
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
Definition: Group.hpp:1294
localIndex indexType
The default index type for entries the hierarchy.
Definition: Group.hpp:55
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
Definition: DataTypes.hpp:220
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
Definition: DataTypes.hpp:232
Array< T, 3, PERMUTATION > array3d
Alias for 3D array.
Definition: DataTypes.hpp:248
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:432
ParticleType
Denotes type of particle shape/interpolation scheme.
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