try {
std::string file_catalogue = "cat.dat";
std::cout << "The coordinates of the first galaxy in the catalogue are: " <<
catalogue1.xx(0) << ", " << catalogue1.yy(0) << ", " << catalogue1.zz(0) << std::endl;
std::cout << "The coordinates of the first galaxy in the catalogue are: " <<
catalogue1[0]->xx() << ", " << catalogue1[0]->yy() << ", " << catalogue1[0]->zz() << std::endl;
std::vector<int> column = {1, 2, 3};
std::ifstream fin; fin.open(file_catalogue.c_str());
cbl::checkIO(fin, file_catalogue);
double X, Y, Z;
std::vector<double> x, y, z;
while (fin >> X >> Y >> Z) {
x.emplace_back(X);
y.emplace_back(Y);
z.emplace_back(Z);
}
fin.clear();
std::vector<std::shared_ptr<cbl::catalogue::Object>> object;
fin.seekg(std::ios::beg);
while (fin >> X >> Y >> Z) {
cbl::comovingCoordinates coord = {X, Y, Z};
auto galaxy = std::make_shared<cbl::catalogue::Galaxy>(coord);
object.emplace_back(galaxy);
}
fin.clear(); fin.close();
{
if (obj->xx()>-70 && obj->xx()<10)
return true;
return false;
};
std::cout <<
"The number of galaxy in catalogue1 is " << catalogue1.
nObjects() << std::endl;
std::cout << "The number of galaxy in catalogue2 is " << catalogue2.nObjects() << std::endl;
std::cout << "The number of galaxy in catalogue3 is " << catalogue3.nObjects() << std::endl;
std::cout <<
"The number of galaxy in catalogue4 is " << catalogue4.
nObjects() << std::endl;
std::cout <<
"The number of galaxy in catalogue5 is " << catalogue5.
nObjects() << std::endl;
}
return 0;
}
int main()
main function to create the logo of the CosmoBolognaLib
void add_objects(std::vector< std::shared_ptr< Object > > sample)
add some objects to the catalogue
Catalogue sub_catalogue(const Var var_name, const double down, const double up, const bool excl=false) const
create a sub-catalogue
size_t nObjects() const
get the number of objects of the catalogue
const char * what() const noexcept override
the error description
std::function< bool(const std::shared_ptr< Object > obj)> mask_function
Definition of a new type to manage mask function.
@ _comoving_
comoving coordinates (x, y, z)
void checkIO(const std::ifstream &fin, const std::string file="NULL")
check if an input file can be opened