GEOSX
ParticleBlockManager.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 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 
19 #ifndef GEOSX_MESH_PARTICLEBLOCKMANAGER_H_
20 #define GEOSX_MESH_PARTICLEBLOCKMANAGER_H_
21 
22 #include "mesh/generators/ParticleBlock.hpp"
23 #include "mesh/generators/ParticleBlockManagerABC.hpp"
24 
25 namespace geos
26 {
27 
33 {
34 public:
35 
41  ParticleBlockManager( string const & name, Group * const parent );
42 
43  virtual Group * createChild( string const & childKey, string const & childName ) override;
44 
45  using Group::resize;
46 
52  void resize( integer_array const & numParticles,
53  string_array const & regionNames );
54 
60  ParticleBlock & getParticleBlock( string const & name )
61  {
62  return this->getGroup( viewKeyStruct::particleBlocks() ).getGroup< ParticleBlock >( name );
63  }
64 
65  const Group & getParticleBlocks() const override;
66 
67  Group & getParticleBlocks() override;
68 
75 
81  template< typename LAMBDA >
82  void forParticleSubRegions( LAMBDA lambda )
83  {
84  this->getGroup( viewKeyStruct::particleBlocks ).forSubGroups< ParticleBlock >( lambda );
85  }
86 
87 private:
88 
89  struct viewKeyStruct
90  {
92  static constexpr char const * particleBlocks() { return "particleBlocks"; }
93  };
94 
102  ParticleBlock const & getParticleBlock( localIndex const blockIndex ) const;
103 
108  localIndex numParticleBlocks() const;
109 
110 };
111 
112 }
113 #endif /* GEOSX_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:333
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:432
array1d< integer > integer_array
A 1-dimensional array of geos::integer types.
Definition: DataTypes.hpp:423
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125