34 #include <sys/types.h>
54 {
return Max*((
double) rand() / (RAND_MAX));}
88 DIR *dir = opendir(a.
path.c_str());
89 while ((entry = readdir(dir)) != NULL) {
90 if (entry->d_type == DT_DIR){
121 std::ifstream infile((a.
path + a.
clumpNames[
i] +
"/Clump/Clump.txt").c_str(), std::ios::in | std::ios::binary);
123 while (std::getline(infile, line)) {
124 std::istringstream iss(line);
125 std::string substring{};
127 while (std::getline(iss, substring,
',')) val.push_back(substring);
128 a.
pebblesX[
i].push_back(std::stof(val[0]));
129 a.
pebblesY[
i].push_back(std::stof(val[1]));
130 a.
pebblesZ[
i].push_back(std::stof(val[2]));
131 a.
pebblesR[
i].push_back(std::stof(val[3]));
148 std::ifstream infile((a.
path + a.
clumpNames[
i] +
"/Inertia/Mass.txt").c_str(), std::ios::in | std::ios::binary);
151 a.
mass[
i] = std::stof(mass);
167 std::ifstream infile((a.
path + a.
clumpNames[
i] +
"/Inertia/TOI.txt").c_str(), std::ios::in | std::ios::binary);
169 while (std::getline(infile, line)) {
170 std::istringstream iss(line);
171 std::string substring{};
173 while (std::getline(iss, substring,
',')) val.push_back(substring);
174 for (
int k = 0; k < 3; k++) a.
toi[
i].push_back(std::stof(val[k]));
191 std::ifstream infile((a.
path + a.
clumpNames[
i] +
"/Inertia/PD.txt").c_str(), std::ios::in | std::ios::binary);
193 while (std::getline(infile, line)) {
194 std::istringstream iss(line);
195 std::string substring{};
197 while (std::getline(iss, substring,
',')) val.push_back(substring);
198 for (
int k = 0; k < 3; k++) a.
pd[
i].push_back(std::stof(val[k]));
220 std::cout<<
"LOADED CLUMPS"<<std::endl;
223 std::cout << data.
clumpNames[
i] <<
" list of pebbles:" << std::endl;
224 for (
int j = 0; j < data.
pebblesX[
i].size(); j++) {
225 std::cout <<
"Pebble " << j <<
": (" << data.
pebblesX[
i][j] <<
"," << data.
pebblesY[
i][j] <<
","
229 std::cout << data.
clumpNames[
i] <<
" TOI:" << std::endl;
230 std::cout << data.
toi[
i][0] <<
"," << data.
toi[
i][1] <<
"," << data.
toi[
i][2] << std::endl;
231 std::cout << data.
toi[
i][3] <<
"," << data.
toi[
i][4] <<
"," << data.
toi[
i][5] << std::endl;
232 std::cout << data.
toi[
i][6] <<
"," << data.
toi[
i][7] <<
"," << data.
toi[
i][8] << std::endl;
234 std::cout << data.
clumpNames[
i] <<
" Principal directions:" << std::endl;
235 std::cout << data.
pd[
i][0] <<
"," << data.
pd[
i][1] <<
"," << data.
pd[
i][2] << std::endl;
236 std::cout << data.
pd[
i][3] <<
"," << data.
pd[
i][4] <<
"," << data.
pd[
i][5] << std::endl;
237 std::cout << data.
pd[
i][6] <<
"," << data.
pd[
i][7] <<
"," << data.
pd[
i][8] << std::endl;
250 new_data.
pd[clump_index] = new_pd;
264 Vec3D n1, n2, n3, ref;
270 double theta = acos(r1);
271 double phi = 2 * M_PI * r2;
279 theta = acos(2 * r1 - 1);
const std::string getMercuryDPMSourceDir()
This file is used for generating definitions that give access to CMakeVariables from within a cpp fil...
Definition: CMakeDefinitions.cc:32
LL< Log::VERBOSE > VERBOSE
Verbose information.
Definition: Logger.cc:57
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:163
Mdouble X
the vector components
Definition: Vector.h:66
void normalise()
Makes this Vec3D unit length.
Definition: Vector.cc:123
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44
Definition: ClumpInput.h:61
Double2DVector toi
Definition: ClumpInput.h:72
Double2DVector pd
Definition: ClumpInput.h:73
StringVector clumpNames
Definition: ClumpInput.h:65
Double2DVector pebblesX
Definition: ClumpInput.h:67
DoubleVector mass
Definition: ClumpInput.h:66
Double2DVector pebblesZ
Definition: ClumpInput.h:69
Double2DVector pebblesY
Definition: ClumpInput.h:68
Double2DVector pebblesR
Definition: ClumpInput.h:70
std::string path
Definition: ClumpInput.h:64