CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
ChainMeshCell.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2022 by Federico Marulli and Simone Sartori *
3  * federico.marulli3@unibo.it simone.sartori5@studio.unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ********************************************************************/
20 
34 #ifndef __CHAINMESHCELL__
35 #define __CHAINMESHCELL__
36 
37 
38 // ===================================================================================================
39 
40 
41 namespace cbl {
42 
43  namespace catalogue {
44 
53  class ChainMeshCell : public Object {
54 
55  protected :
56 
58  std::vector<unsigned int> m_part;
59 
61  std::vector<std::vector<unsigned int>> m_nearCells;
62 
63  public:
64 
69 
75 
86  ChainMeshCell(const int ID, const std::vector<unsigned int> part={}, std::vector<std::vector<unsigned int>> nearCells={})
88 
96  std::shared_ptr<Object> getShared() {
97  return std::make_shared<ChainMeshCell>(*this);
98  }
99 
103  ~ChainMeshCell() = default;
105 
106 
111 
116  std::vector<unsigned int> part() const override
117  { return m_part; }
118 
123  std::vector<std::vector<unsigned int>> nearCells() const override
124  { return m_nearCells; }
126 
127 
132 
137  void set_part(const std::vector<unsigned int> part={}) override
138  { m_part = part; }
139 
144  void set_nearCells(const std::vector<std::vector<unsigned int>> nearCells = {}) override
145  { m_nearCells = nearCells; }
146 
148 
152 
158  bool isSet_part()
159  { return (cbl::isSet(m_part)) ? true : false; }
160 
167  { return (cbl::isSet(m_nearCells)) ? true : false; }
169 
170  };
171  }
172 }
173 
174 #endif
The class ChainMeshCell.
Definition: ChainMeshCell.h:53
ChainMeshCell(const int ID, const std::vector< unsigned int > part={}, std::vector< std::vector< unsigned int >> nearCells={})
constructor that uses comoving coordinates
Definition: ChainMeshCell.h:86
bool isSet_nearCells()
check if the protected member m_nearCells is set
std::vector< std::vector< unsigned int > > nearCells() const override
get the protected member m_nearCells
std::vector< std::vector< unsigned int > > m_nearCells
the cells near the object, sorted for distance
Definition: ChainMeshCell.h:61
~ChainMeshCell()=default
default destructor
bool isSet_part()
check if the protected member m_part is set
std::shared_ptr< Object > getShared()
function that allows copying private variables of the class when an object of class Catalogue is copi...
Definition: ChainMeshCell.h:96
void set_nearCells(const std::vector< std::vector< unsigned int >> nearCells={}) override
set the protected member m_nearCells
void set_part(const std::vector< unsigned int > part={}) override
set the protected member m_part
std::vector< unsigned int > m_part
the particles in the cell
Definition: ChainMeshCell.h:58
ChainMeshCell()
default constructor
Definition: ChainMeshCell.h:74
std::vector< unsigned int > part() const override
get the protected member m_part
The class Object.
Definition: Object.h:132
Object()=default
default constructor
int ID() const
get the member m_radius
Definition: Object.h:843
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
bool isSet(const std::string var)
check if the value of a [string] variable has already been set
Definition: Kernel.h:803