GEOS
ParticleBlockManager.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 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 
20 #ifndef GEOS_MESH_PARTICLEBLOCKMANAGER_H_
21 #define GEOS_MESH_PARTICLEBLOCKMANAGER_H_
22 
23 #include "mesh/generators/ParticleBlock.hpp"
24 #include "mesh/generators/ParticleBlockManagerABC.hpp"
25 
26 namespace geos
27 {
28 
34 {
35 public:
36 
42  ParticleBlockManager( string const & name, Group * const parent );
43 
44  virtual Group * createChild( string const & childKey, string const & childName ) override;
45 
46  using Group::resize;
47 
53  void resize( integer_array const & numParticles,
54  string_array const & regionNames );
55 
61  ParticleBlock & getParticleBlock( string const & name )
62  {
63  return this->getGroup( viewKeyStruct::particleBlocks() ).getGroup< ParticleBlock >( name );
64  }
65 
66  const Group & getParticleBlocks() const override;
67 
68  Group & getParticleBlocks() override;
69 
76 
82  template< typename LAMBDA >
83  void forParticleSubRegions( LAMBDA lambda )
84  {
85  this->getGroup( viewKeyStruct::particleBlocks ).forSubGroups< ParticleBlock >( lambda );
86  }
87 
88 private:
89 
90  struct viewKeyStruct
91  {
93  static constexpr char const * particleBlocks() { return "particleBlocks"; }
94  };
95 
103  ParticleBlock const & getParticleBlock( localIndex const blockIndex ) const;
104 
109  localIndex numParticleBlocks() const;
110 
111 };
112 
113 }
114 #endif /* GEOS_MESH_PARTICLEBLOCKMANAGER_H_ */
Abstract base class for ParticleBlockManager.
The ParticleBlockManager class provides an interface to ObjectManagerBase in order to manage Particle...
void resize(integer_array const &numParticles, string_array const &regionNames)
Set the number of particles for a set of particle regions.
Group & getParticleBlocks() override
Returns a group containing the cell blocks as ParticleBlockABC instances.
ParticleBlock & getParticleBlock(string const &name)
Get particle block by name.
ParticleBlock & registerParticleBlock(string name)
Registers and returns a particle block of name name.
void forParticleSubRegions(LAMBDA lambda)
Launch kernel function over all the sub-regions.
ParticleBlockManager(string const &name, Group *const parent)
Constructor for ParticleBlockManager object.
virtual Group * createChild(string const &childKey, string const &childName) override
Creates a new sub-Group using the ObjectCatalog functionality.
const Group & getParticleBlocks() const override
Returns a group containing the cell blocks as ParticleBlockABC instances.
T & getGroup(KEY const &key)
Return a reference to a sub-group of the current Group.
Definition: Group.hpp:336
virtual void resize(localIndex const newSize)
Resize the group and all contained wrappers that resize with parent.
array1d< string > string_array
A 1-dimensional array of geos::string types.
Definition: DataTypes.hpp:392
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:383
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:85