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

started to remove Level in SampleID

parent fc54d895
......@@ -9,76 +9,89 @@
struct SampleID {
Level level;
private:
Level level;
public:
int fLevel;
int cLevel;
std::string name;
std::string name;
int number;
int number;
bool coarse; // Todo should be; SampleID makes more sense then
bool coarse; // Todo should be; SampleID makes more sense then
SampleID() {}
SampleID() {}
SampleID(Level level, int number, bool coarse, const std::string &name = "U") :
level(level), number(number), coarse(coarse), name(name) {}
SampleID(Level level, int number, bool coarse, const std::string &name = "U") :
level(level), number(number), coarse(coarse), name(name) {
fLevel = level.fine;
cLevel = level.coarse;
}
SampleID(int level, int number, bool coarse, const std::string &name = "U") :
level(Level(level)), number(number), coarse(coarse), name(name) {}
SampleID(int level, int number, bool coarse, const std::string &name = "U") :
level(Level(level)), number(number), coarse(coarse), name(name) {
fLevel = this->level.fine;
cLevel = this->level.coarse;
}
int l() const { return level.ActualLevel(coarse); };
int l() const {
if (coarse) return cLevel;
else return fLevel;
};
std::string IdString(const std::string &name_) const {
return name_ + "." + std::to_string(level.fine)
+ "." + std::to_string((int) coarse)
+ "." + std::to_string(number);
}
std::string IdString(const std::string &name_) const {
return name_ + "." + std::to_string(level.fine)
+ "." + std::to_string((int) coarse)
+ "." + std::to_string(number);
}
std::string IdString() const {
return IdString(name);
}
std::string IdString() const {
return IdString(name);
}
};
struct SampleSolution {
SampleID id;
SampleID id;
public:
double Q;
double Cost;
Vector U;
SampleSolution(IDiscretization *disc, const std::string &name = "U") :
U(Vector((*disc))) {
this->id.name = name;
Init();
}
SampleSolution(IDiscretization *disc, const SampleID &id,
const std::string &name = "U") :
id(id), U(Vector(*disc, id.l())) {
this->id.name = name;
Init();
}
SampleSolution(const Vector &U, const SampleID &id, const std::string &name = "U") :
id(id), U(U) {
this->id.name = name;
}
std::string IdString() const {
return id.IdString();
}
const SampleID& Id() const {
return id;
}
void Init() {
Q = 0.0;
Cost = 0.0;
U = 0.0;
}
double Q;
double Cost;
Vector U;
SampleSolution(IDiscretization *disc, const std::string &name = "U") :
U(Vector((*disc))) {
this->id.name = name;
Init();
}
SampleSolution(IDiscretization *disc, const SampleID &id,
const std::string &name = "U") :
id(id), U(Vector(*disc, id.l())) {
this->id.name = name;
Init();
}
SampleSolution(const Vector &U, const SampleID &id, const std::string &name = "U") :
id(id), U(U) {
this->id.name = name;
}
std::string IdString() const {
return id.IdString();
}
const SampleID &Id() const {
return id;
}
void Init() {
Q = 0.0;
Cost = 0.0;
U = 0.0;
}
};
#endif //SAMPLE_HPP
......@@ -72,9 +72,9 @@ public:
meshes = meshesCreator.Create();
pdeSolver = pdeSolverCreator.Create(*meshes);
fineId.level = level;
fineId.fLevel = level.fine;
fineId.coarse = false;
coarseId.level = level;
coarseId.cLevel = level.coarse;
coarseId.coarse = true;
ctr.parallel = parallel;
ctr.UpdateSampleCounter(dM);
......
......@@ -57,8 +57,8 @@ public:
std::filesystem::create_directory("data/vtu/");
meshes = MeshesCreator("Square").
WithPLevel(testIds.front().level.pLevel).
WithLevel(testIds.back().level.fine).
WithPLevel(testIds.front().cLevel).
WithLevel(testIds.back().fLevel).
Create();
discs = {
......
......@@ -50,8 +50,8 @@ protected:
meshes = MeshesCreator(meshName).
WithOverlap(GetParam().GetOverlap()).
WithPLevel(id.level.pLevel).
WithLevel(id.level.fine).
WithPLevel(id.cLevel).
WithLevel(id.fLevel).
WithCommSplit(commSplit).
WithDistribute("RCB").
Create();
......
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