Commit d356e49b authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

moving SampleCounter to own file and implementing new constructor

parent e8bb19c3
......@@ -3,6 +3,7 @@ add_library(MONTECARLO STATIC
MultilevelMonteCarlo.cpp
datastructure/Errors.cpp
datastructure/Exponents.cpp
datastructure/SampleCounter.cpp
datastructure/EmpiricMeasures.cpp
datastructure/EmpiricMeasureLevelMaps.cpp
)
......
#include "SampleCounter.hpp"
void SampleCounter::Update() {
M += dM;
dM = 0;
}
\ No newline at end of file
#ifndef SAMPLECOUNTER_HPP
#define SAMPLECOUNTER_HPP
#include "Parallel.hpp"
struct SampleCounter {
int M = 0;
int dM = 0;
int dMComm = 0;
int commSplit = 0;
SampleCounter() {};
SampleCounter(int dM) : dM(dM) {
for (int i = 0; i < ceil(log2(PPM->Size(0))) + 1; i++) {
if (dM >= PPM->Size(i)) {
dMComm = ceil((double) dM / PPM->Size(i));
commSplit = PPM->MaxCommSplit() - i;
break;
}
}
}
// int MonteCarlo::computeCommSplit() {
// PPM->FullSplit();
// std::cout << "test" << endl;
// for (int i = PPM->MaxCommSplit(); i >= 0; i--)
// if (pow(2, i * meshes->dim()) * ctr.dM >= PPM->Size(0))
// std::cout << "i " << i << endl;
//// PPM->SplitCommunicators(i);
// return 0;
// }
SampleCounter(int M, int dM) :
M(M), dM(dM) {}
void Update();
};
#endif //SAMPLECOUNTER_HPP
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment