Version 1.3 - Minor fixes in Progress

This commit is contained in:
dbalazs92 2017-10-29 13:31:44 +01:00
parent 292e1a2b9b
commit 2f644b760e
4 changed files with 57 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai
#include <iostream>
#include "Progress.hh"

View File

@ -6,6 +6,7 @@ Brownian movement in one dimension. Starter pack for data processing course from
* **Balázs Demeter** - *University of Debrecen* - [E-mail](mailto:balazsdemeter92@gmail.com)
* **Balázs Ujvári** - *University of Debrecen* - [E-mail](mailto:balazs.ujvari@science.unideb.hu)
* **Dávid Baranyai** - *University of Debrecen* - [E-mail](mailto:divaldo95@gmail.com)
### Requirements

View File

@ -1,4 +1,4 @@
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai
#ifndef Progress_h
#define Progress_h 1
@ -24,10 +24,19 @@ class Progress {
public:
Progress(Int_t n);
Progress(Int_t n, Double_t p0_Set);
Progress(Int_t n, Double_t p0_Set, Double_t startposition);
~Progress();
void Count(char a);
Double_t GetP0();
Int_t GetSteps();
Double_t GetNext();
Double_t GetPrevious();
void SetP0(double p0_new);
std::vector<Double_t> GetX();
std::vector<Double_t> GetY();
@ -38,6 +47,10 @@ private:
std::vector<Double_t> x;
std::vector<Double_t> y;
Double_t p0;
Double_t preVstate;
Int_t steps;
};
#endif

View File

@ -1,9 +1,21 @@
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári
/// BM1D program. Date: 2017-10-29 Creators: Balázs Demeter, Balázs Ujvári, Dávid Baranyai
#include "Progress.hh"
Progress::Progress(Int_t nP) :
n (nP)
n (nP), p0(1), preVstate(0), steps(0)
{
random1 = new TRandom();
}
Progress::Progress(Int_t nP, Double_t p0_Set) :
n (nP), p0(p0_Set), preVstate(0), steps(0)
{
random1 = new TRandom();
}
Progress::Progress(Int_t nP, Double_t p0_Set, Double_t startposition) :
n (nP), p0(p0_Set), preVstate(startposition), steps(0)
{
random1 = new TRandom();
}
@ -56,6 +68,33 @@ void Progress::Count(char a)
}
}
Double_t Progress::GetNext()
{
preVstate+=fmod(random1->Uniform(),(2*p0)-p0);
steps++;
return preVstate;
}
Double_t Progress::GetPrevious()
{
return preVstate;
}
void Progress::SetP0(Double_t p0_new)
{
p0=p0_new;
}
Double_t Progress::GetP0()
{
return p0;
}
Int_t Progress::GetSteps()
{
return steps;
}
std::vector<Double_t> Progress::GetX()
{
return x;