CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Modelling_TwoPointCorrelation.cpp
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2016 by Federico Marulli and Alfonso Veropalumbo *
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 
42 
43 using namespace std;
44 
45 using namespace cbl;
46 using namespace modelling;
47 using namespace modelling::twopt;
48 
49 // ============================================================================================
50 
51 
52 std::shared_ptr<Modelling_TwoPointCorrelation> modelling::twopt::Modelling_TwoPointCorrelation::Create (const std::shared_ptr<measure::twopt::TwoPointCorrelation> twop)
53 {
54  if (twop->twoPType()==measure::twopt::TwoPType::_monopole_)
55  return move(unique_ptr<Modelling_TwoPointCorrelation1D_monopole> (new Modelling_TwoPointCorrelation1D_monopole(twop)));
56 
57  else if (twop->twoPType()==measure::twopt::TwoPType::_2D_Cartesian_)
58  return move(unique_ptr<Modelling_TwoPointCorrelation2D_cartesian> (new Modelling_TwoPointCorrelation2D_cartesian(twop)));
59 
60  else if (twop->twoPType()==measure::twopt::TwoPType::_projected_)
61  return move(unique_ptr<Modelling_TwoPointCorrelation_projected> (new Modelling_TwoPointCorrelation_projected(twop)));
62 
63  else if (twop->twoPType()==measure::twopt::TwoPType::_deprojected_)
64  return move(unique_ptr<Modelling_TwoPointCorrelation_deprojected> (new Modelling_TwoPointCorrelation_deprojected(twop)));
65 
66  else ErrorCBL("no such type of object, or error in the input parameters!", "Create", "Modelling_TwoPointCorrelation.cpp");
67 
68  return NULL;
69 }
70 
71 
72 // ============================================================================================
73 
74 
75 std::shared_ptr<Modelling_TwoPointCorrelation> modelling::twopt::Modelling_TwoPointCorrelation::Create (const measure::twopt::TwoPType twoPType, const std::shared_ptr<data::Data> twop_dataset)
76 {
77  if (twoPType==measure::twopt::TwoPType::_monopole_)
78  return move(unique_ptr<Modelling_TwoPointCorrelation1D_monopole> (new Modelling_TwoPointCorrelation1D_monopole(twop_dataset)));
79 
80  else if (twoPType==measure::twopt::TwoPType::_2D_Cartesian_)
81  return move(unique_ptr<Modelling_TwoPointCorrelation2D_cartesian> (new Modelling_TwoPointCorrelation2D_cartesian(twop_dataset)));
82 
83  else if (twoPType==measure::twopt::TwoPType::_projected_)
84  return move(unique_ptr<Modelling_TwoPointCorrelation_projected> (new Modelling_TwoPointCorrelation_projected(twop_dataset)));
85 
86  else if (twoPType==measure::twopt::TwoPType::_deprojected_)
87  return move(unique_ptr<Modelling_TwoPointCorrelation_deprojected> (new Modelling_TwoPointCorrelation_deprojected(twop_dataset)));
88 
89  else ErrorCBL("no such type of object, or error in the input parameters!", "Create", "Modelling_TwoPointCorrelation.cpp");
90 
91  return NULL;
92 }
93 
94 
95 
The class Modelling_TwoPointCorrelation1D_monopole.
The class Modelling_TwoPointCorrelation2D_cartesian.
The class Modelling_TwoPointCorrelation.
The class Modelling_TwoPointCorrelatoin_deprojected.
The class Modelling_TwoPointCorrelation_projected.
TwoPType
the two-point correlation function type
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
Definition: Kernel.h:780