#include <algorithm>
#include <dirent.h>
#include <sys/types.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <sstream>
#include "Math/Matrix.h"
#include <CMakeDefinitions.h>
Go to the source code of this file.
◆ Double2DVector
◆ DoubleVector
loads clump configuration
This module loads clump configuration produced by MClump tool
◆ StringVector
◆ CompareFunction()
bool CompareFunction |
( |
std::string |
a, |
|
|
std::string |
b |
|
) |
| |
Scalar * b
Definition: benchVecAdd.cpp:17
const Scalar * a
Definition: level2_cplx_impl.h:32
References a, and b.
Referenced by LoadConf().
◆ LoadClumps()
// Main function that loads all the necessary files to initiate Clumps
201 std::cout<<
"LOADED CLUMPS"<<std::endl;
202 for (
int i = 0;
i <
data.pebblesX.size();
i++) {
203 std::cout <<
data.clumpNames[
i] <<
" mass:" <<
data.mass[
i] << std::endl;
204 std::cout <<
data.clumpNames[
i] <<
" list of pebbles:" << std::endl;
205 for (
int j = 0;
j <
data.pebblesX[
i].size();
j++) {
206 std::cout <<
"Pebble " <<
j <<
": (" <<
data.pebblesX[
i][
j] <<
"," <<
data.pebblesY[
i][
j] <<
","
207 <<
data.pebblesZ[
i][
j] <<
")," <<
data.pebblesR[
i][
j] << std::endl;
210 std::cout <<
data.clumpNames[
i] <<
" TOI:" << std::endl;
211 std::cout <<
data.toi[
i][0] <<
"," <<
data.toi[
i][1] <<
"," <<
data.toi[
i][2] << std::endl;
212 std::cout <<
data.toi[
i][3] <<
"," <<
data.toi[
i][4] <<
"," <<
data.toi[
i][5] << std::endl;
213 std::cout <<
data.toi[
i][6] <<
"," <<
data.toi[
i][7] <<
"," <<
data.toi[
i][8] << std::endl;
215 std::cout <<
data.clumpNames[
i] <<
" Principal directions:" << std::endl;
216 std::cout <<
data.pd[
i][0] <<
"," <<
data.pd[
i][1] <<
"," <<
data.pd[
i][2] << std::endl;
217 std::cout <<
data.pd[
i][3] <<
"," <<
data.pd[
i][4] <<
"," <<
data.pd[
i][5] << std::endl;
218 std::cout <<
data.pd[
i][6] <<
"," <<
data.pd[
i][7] <<
"," <<
data.pd[
i][8] << std::endl;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
LL< Log::VERBOSE > VERBOSE
Verbose information.
Definition: Logger.cc:36
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
int data[]
Definition: Map_placement_new.cpp:1
#define INFO(i)
Definition: mumps_solver.h:54
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
References data, i, INFO, j, LoadConf(), LoadMass(), LoadPD(), LoadPebbles(), LoadTOI(), logger, and VERBOSE.
Referenced by ChangingTOIParticle::ChangingTOIParticle(), and clumpTest::clumpTest().
◆ LoadConf()
Loading available Clumps and their names
69 DIR *dir = opendir(
a.path.c_str());
70 while ((entry = readdir(dir)) != NULL) {
71 if (entry->d_type == DT_DIR){
72 a.clumpNames.push_back(entry->d_name);
80 a.clumpNames.erase(
a.clumpNames.begin());
81 a.clumpNames.erase(
a.clumpNames.begin());
84 for (
int i = 0;
i<
a.clumpNames.size();
i++) std::cout <<
a.clumpNames[
i] << std::endl;
const std::string getMercuryDPMSourceDir()
This file is used for generating definitions that give access to CMakeVariables from within a cpp fil...
Definition: Configuration/CMakeDefinitions.cc:10
References a, CompareFunction(), getMercuryDPMSourceDir(), and i.
Referenced by LoadClumps().
◆ LoadMass()
Load mass of a clump
126 a.mass.resize(
a.clumpNames.size());
128 for (
int i = 0;
i <
a.clumpNames.size();
i++ ){
129 std::ifstream infile((
a.path +
a.clumpNames[
i] +
"/Inertia/Mass.txt").c_str(), std::ios::in | std::ios::binary);
132 a.mass[
i] = std::stof(mass);
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
References a, i, INFO, logger, and oomph::Global_string_for_annotation::string().
Referenced by LoadClumps().
◆ LoadPD()
Load pre-computed principal directions (PDs) of a clump. Normally MClump tool aligns PDs with the global Cartesian axes.
169 a.pd.resize(
a.clumpNames.size());
171 for (
int i = 0;
i <
a.clumpNames.size();
i++ ){
172 std::ifstream infile((
a.path +
a.clumpNames[
i] +
"/Inertia/PD.txt").c_str(), std::ios::in | std::ios::binary);
174 while (std::getline(infile,
line)) {
175 std::istringstream iss(
line);
178 while (std::getline(iss, substring,
','))
val.push_back(substring);
179 for (
int k = 0;
k < 3;
k++)
a.pd[
i].push_back(std::stof(
val[
k]));
char char char int int * k
Definition: level2_impl.h:374
val
Definition: calibrate.py:119
line
Definition: calibrate.py:103
References a, i, INFO, k, calibrate::line, logger, oomph::Global_string_for_annotation::string(), and calibrate::val.
Referenced by LoadClumps().
◆ LoadPebbles()
Loading pebbles of a clump
96 a.pebblesX.resize(
a.clumpNames.size());
97 a.pebblesY.resize(
a.clumpNames.size());
98 a.pebblesZ.resize(
a.clumpNames.size());
99 a.pebblesR.resize(
a.clumpNames.size());
101 for (
int i = 0;
i <
a.clumpNames.size();
i++ ){
102 std::ifstream infile((
a.path +
a.clumpNames[
i] +
"/Clump/Clump.txt").c_str(), std::ios::in | std::ios::binary);
104 while (std::getline(infile,
line)) {
105 std::istringstream iss(
line);
108 while (std::getline(iss, substring,
','))
val.push_back(substring);
109 a.pebblesX[
i].push_back(std::stof(
val[0]));
110 a.pebblesY[
i].push_back(std::stof(
val[1]));
111 a.pebblesZ[
i].push_back(std::stof(
val[2]));
112 a.pebblesR[
i].push_back(std::stof(
val[3]));
References a, i, INFO, calibrate::line, logger, oomph::Global_string_for_annotation::string(), and calibrate::val.
Referenced by LoadClumps(), and MClump::main().
◆ LoadTOI()
Load tensor of inertia (TOI) of a clump
145 a.toi.resize(
a.clumpNames.size());
147 for (
int i = 0;
i <
a.clumpNames.size();
i++ ){
148 std::ifstream infile((
a.path +
a.clumpNames[
i] +
"/Inertia/TOI.txt").c_str(), std::ios::in | std::ios::binary);
150 while (std::getline(infile,
line)) {
151 std::istringstream iss(
line);
154 while (std::getline(iss, substring,
','))
val.push_back(substring);
155 for (
int k = 0;
k < 3;
k++)
a.toi[
i].push_back(std::stof(
val[
k]));
References a, i, INFO, k, calibrate::line, logger, oomph::Global_string_for_annotation::string(), and calibrate::val.
Referenced by LoadClumps().
◆ RandomDouble()
◆ RotateClump()
◆ UniformRandomPDs()
Generate random (and isotropically distributed) principal directions frame
245 Vec3D n1, n2, n3, ref;
252 double phi = 2 *
M_PI * r2;
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar acos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:138
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:143
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
void normalise()
Makes this Vec3D unit length.
Definition: Vector.cc:103
#define M_PI
Definition: main.h:121
double theta
Definition: two_d_biharmonic.cc:236
References acos(), cos(), Vec3D::cross(), M_PI, Vec3D::normalise(), RandomDouble(), sin(), BiharmonicTestFunctions2::theta, Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by ChangingTOIParticle::setupInitialConditions().