-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathns_data.h
151 lines (113 loc) · 4.44 KB
/
ns_data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
-------------------------------------------------------------------
Copyright (C) 2012-2022, Mohammad Al-Mamun, Mahmudul Hasan Anik,
and Andrew W. Steiner
This file is part of Bamr.
Bamr is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Bamr is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bamr. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------
*/
/** \file ns_data.h
\brief Definition of \ref ns_data
*/
#ifndef NS_DATA_H
#define NS_DATA_H
#include <iostream>
#include <o2scl/table3d.h>
#include "settings.h"
#include "ns_pop.h"
namespace bamr {
/** \brief Neutron star data object
This class is designed so that multiple OpenMP threads can use
the same const instance of this class (i.e. so long as they do
not change the member data).
\future Maybe it would be better to restructure this
object rather than having many vectors of the same size.
*/
class ns_data {
public:
ns_data() {
n_sources=0;
pd.load_data();
pop.get_param_info();
}
virtual ~ns_data() {
}
/// \name Input neutron star data
//@{
/// Input probability distributions
std::vector<o2scl::table3d> source_tables;
/// Alternate input probability distributions
std::vector<o2scl::table3d> source_tables_alt;
/// The names for each source
std::vector<std::string> source_names;
/// The names of the table in the data file
std::vector<std::string> table_names;
/// File names for each source
std::vector<std::string> source_fnames;
/// Alternate file names for each source
std::vector<std::string> source_fnames_alt;
/// Slice names for each source
std::vector<std::string> slice_names;
/// The initial set of neutron star masses
std::vector<double> init_mass_fracs;
/** \brief The number of sources
*/
size_t n_sources;
/** \brief Add a data distribution to the list
*/
virtual int add_data(std::vector<std::string> &sv, bool itive_com);
/** \brief Add a data distribution to the list
*/
virtual int add_data_alt(std::vector<std::string> &sv, bool itive_com);
/// Object to call functions from class ns_pop
ns_pop pop;
/// Object to load mass data from class pop_data
pop_data pd;
/** \brief The LIGO data
*/
o2scl::tensor_grid<> ligo_data_table;
/** \brief Desc
*/
void data_params(std::vector<std::string> &names,
std::vector<std::string> &units,
std::vector<double> &low,
std::vector<double> &high,
std::shared_ptr<settings> set);
/** \brief Desc
*/
void initial_point(std::shared_ptr<settings> set,
std::vector<double> &init);
/** \brief Load input probability distributions
Ensure all MPI ranks read all files while ensuring that
no two ranks simultaneously read the same file.
Let MPI_Size be denoted n. If n is 1, no messages are sent and
the single rank always reads the files in order. When n is
larger than 1, rank 0 still reads the files in order. Rank n-1
begins by reading the second file, rank n-2 begins by reading
the third file, and so on, until there are no more ranks left
which are not reading files or there are no more files left.
After reading, all ranks which read files send a message to
the next rank (in sequence) prompting them to proceed with the
next file. Once each rank has read all of the files, it does
not send or receive any further messages (the number of
messages sent for n>1 is n times the number of files times).
If \ref settings::mpi_load_debug is set to 1, then the various
MPI messages are copied to scr_out, no files are actually
read, and exit() is called after all messages have been sent
and received by all ranks.
*/
virtual void load_mc(std::ostream &scr_out, int mpi_nprocs,
int mpi_rank, std::shared_ptr<settings> set);
//@}
};
}
#endif