CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
CatalogueChainMesh.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2010 by Federico Marulli *
3  * federico.marulli3@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 #include "Catalogue.h"
35 
36 #ifndef __CATALOGUECHAINMESH__
37 #define __CATALOGUECHAINMESH__
38 
39 namespace cbl {
40 
41  namespace catalogue {
42 
51  class CatalogueChainMesh : public Catalogue {
52 
53  private :
54 
55  // size of cells in CatalogueChainMesh
56  double m_cellsize;
57 
59  std::vector<std::vector<double>> m_lim;
60 
62  std::shared_ptr<cbl::catalogue::Catalogue> m_part_catalogue;
63 
65  std::shared_ptr<cbl::catalogue::Catalogue> m_part_catalogue2={};
66 
68  unsigned int m_dimension;
69 
70  public :
75  CatalogueChainMesh () = default;
76 
82  CatalogueChainMesh (const CatalogueChainMesh& obj) : Catalogue (obj) {
83  m_cellsize = obj.m_cellsize;
84  m_lim = obj.m_lim;
85  m_part_catalogue = obj.m_part_catalogue;
86  m_part_catalogue2 = obj.m_part_catalogue2;
87  m_dimension = obj.m_dimension;
88  };
89 
95  CatalogueChainMesh (CatalogueChainMesh&& obj) : Catalogue (obj) {
96  m_cellsize = std::move(obj.m_cellsize);
97  m_lim = std::move(obj.m_lim);
98  m_part_catalogue = std::move(obj.m_part_catalogue);
99  m_part_catalogue2 = std::move(obj.m_part_catalogue2);
100  m_dimension = std::move(obj.m_dimension);
101  };
102 
109  CatalogueChainMesh& operator=(const CatalogueChainMesh& obj)
110  {
112  m_cellsize = obj.m_cellsize;
113  m_lim = obj.m_lim;
114  m_part_catalogue = obj.m_part_catalogue;
115  m_part_catalogue2 = obj.m_part_catalogue2;
116  m_dimension = obj.m_dimension;
117  return *this;
118  }
119 
126  CatalogueChainMesh& operator=(CatalogueChainMesh&& obj) noexcept
127  {
128  if (this == &obj) return *this;
130  m_cellsize = std::move(obj.m_cellsize);
131  m_lim = std::move(obj.m_lim);
132  m_part_catalogue = std::move(obj.m_part_catalogue);
133  m_part_catalogue2 = std::move(obj.m_part_catalogue2);
134  m_dimension = std::move(obj.m_dimension);
135  return *this;
136  }
137 
141  ~CatalogueChainMesh () = default;
142 
156  CatalogueChainMesh (std::vector<catalogue::Var> variables, double cellsize, std::shared_ptr<cbl::catalogue::Catalogue> cat, std::shared_ptr<cbl::catalogue::Catalogue> cat2={});
157 
158 
163 
164 
170  std::vector<unsigned int> Closer_object (const std::vector<double> pos);
171 
179  std::vector<unsigned int> Close_objects (const std::vector<double> pos, const double rMax, const double rMin=0.);
180 
188  unsigned int Count_objects (const std::vector<double> pos, const double rMax, const double rMin=0.);
189 
195  std::vector<unsigned int> N_nearest_objects (const std::vector<double> pos, const unsigned int N);
196 
202  std::vector<unsigned int> N_nearest_objects (const unsigned int obj, const unsigned int N);
203 
208  std::vector<std::vector<unsigned int>> N_nearest_objects_cat (const unsigned int N);
209 
210 
215  void deletePart (const unsigned int index);
216 
222  void deletePart (const unsigned int i, const unsigned int p);
223 
225 
230  double cellsize() const { return m_cellsize; }
231 
236  std::vector<std::vector<double>> lim() const {return m_lim; }
237 
242  unsigned int dimension() const {return m_dimension; }
243 
244  };
245  }
246 }
247 
248 #endif
The class Catalogue
Catalogue()=default
default constructor
Catalogue & operator=(const Catalogue &obj)
copy assignment for the Catalogue class
Definition: Catalogue.h:786
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38