Files
katrin-plasma/src/mc_electron/timer.cpp
T
Christian 578d673b65 Moved serial mode to target mcelecron_serial.
Implemented parallelization with mpi.
2019-07-18 14:02:19 +02:00

52 lines
1.1 KiB
C++

//
// timer.cpp
// mc_electron
//
// Created by Christian Reiling on 07.05.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#include <algorithm>
#include "timer.hpp"
#include "read_system.h"
const double Timer::wgtsT2MaxDensity_m3 = load_parameter("wgtsT2MaxDensity_m3");
using namespace std;
/*
Timer::Timer(const Timer& other) {
T2_activity_s = other.T2_activity_s;
offset_time_s = other.offset_time_s;
local_decays = &(*other.local_decays);
global_decays = &(*other.global_decays);
}
Timer& Timer::operator=(const Timer& other) {
Timer tmp(other);
swap(T2_activity_s, tmp.T2_activity_s);
swap(offset_time_s, tmp.offset_time_s);
local_decays = &(*tmp.local_decays);
global_decays = &(*tmp.global_decays);
return *this;
}
*/
void Timer::set_T2_activity_s() {
double r_m = r_WGTS_m;
double l_m = l_WGTS_m;
double V_m3 = pi*r_m*r_m*l_m;
double NT2 = (wgtsT2MaxDensity_m3/2)*V_m3;
T2_activity_s = NT2*decayConstT2_s;
}
double Timer::get_physTime_s() {
return double(calc_total_decays())/T2_activity_s + offset_time_s;
}
long int Timer::calc_total_decays() {
return (*local_decays + *global_decays);
}