Commit 68df0e94 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

bug fix for plotting

parent 636438b2
......@@ -21,6 +21,8 @@ void CirculantEmbedding1D::generateFineSample(Vector &fineField) {
}
internalCounter += 1;
internalCounter %= 2;
if (plotting) generatePlot(fineField);
}
// void AssembleTransfer (TransferMatrix& TM) const {
......@@ -45,6 +47,8 @@ void CirculantEmbedding1D::generateCoarseSample(const Vector &fineField, Vector
for (int i = 0; i < coarseRow.n(); ++i)
coarseField(coarseRow, i) /= c.Children();
}
if (plotting) generatePlot(coarseField);
}
vector<complex<double>> CirculantEmbedding1D::generateField() {
......
......@@ -2,10 +2,6 @@
void HybridFluxGenerator::generateFineSample(Vector &fineField) {
MatrixGraphs cellMg1(meshes, dof("cell", 1));
MatrixGraphs cellMg3(meshes, dof("cell", 3));
MatrixGraphs faceMg(meshes, dof("face", 1));
Vector &normalFlux = fineField;
Vector flux(cellMg3[l - meshes.pLevel()]);
Vector perm(cellMg1[l - meshes.pLevel()]);
......@@ -21,6 +17,8 @@ void HybridFluxGenerator::generateFineSample(Vector &fineField) {
newton(*assemble, u);
assemble->setFlux(u, flux);
assemble->SetNormalFlux(u, normalFlux);
if (plotting) generatePlot(flux);
}
void HybridFluxGenerator::generateCoarseSample(const Vector &fineField,
......@@ -36,4 +34,6 @@ void HybridFluxGenerator::generateCoarseSample(const Vector &fineField,
for (int i = 0; i < coarseRow.n(); ++i)
coarseField(coarseRow, i) /= c.Children();
}
// TOD0
// if (plotting) generatePlot(flux);
}
\ No newline at end of file
......@@ -7,22 +7,33 @@
class HybridFluxGenerator : public SampleGenerator {
private:
MatrixGraphs cellMg1;
MatrixGraphs cellMg3;
MatrixGraphs faceMg;
protected:
Discretization *disc = nullptr;
StochasticEllipticProblem *problem = nullptr;
HybridEllipticAssemble *assemble = nullptr;
CirculantEmbedding *permeabilityGenerator = nullptr;
void generateFineSample(Vector &fineField) override;
void generateCoarseSample(const Vector &fineField, Vector &coarseField) override;
void generatePlot(const Vector &sample) override {
string nameFlux = sampleDir +"/flux";
assemble->plotFlux(sample, nameFlux);
plot->celldata(sample, 3);
string nameFlux = sampleDir + "/flux";
plot->vtk_cellvector(nameFlux);
}
public:
explicit HybridFluxGenerator(int l, Meshes &meshes)
: SampleGenerator(l, meshes) {
if(plotting > 0)
plot = new Plot(meshes[l], meshes.dim());
: SampleGenerator(l, meshes),
cellMg1(MatrixGraphs(meshes, dof("cell", 1))),
cellMg3(MatrixGraphs(meshes, dof("cell", 3))),
faceMg(MatrixGraphs(meshes, dof("face", 1))) {
}
~HybridFluxGenerator() {
......@@ -32,9 +43,10 @@ public:
delete permeabilityGenerator;
};
void generateFineSample(Vector &fineField) override;
void generateCoarseSample(const Vector &fineField, Vector &coarseField) override;
void SetPlot(Plot *plotFromMC) override {
permeabilityGenerator->SetPlot(plotFromMC);
plot = plotFromMC;
}
};
class HybridFluxGenerator1D : public HybridFluxGenerator {
......
......@@ -37,14 +37,12 @@ public:
void GetFineSample(Vector &fineField) {
logger->StartMethodMsg();
generateFineSample(fineField);
if (plotting) generatePlot(fineField);
logger->EndMethodMsg();
}
void GetCoarseSample(const Vector &fineField, Vector &coarseField) {
logger->StartMethodMsg();
generateCoarseSample(fineField, coarseField);
if (plotting) generatePlot(coarseField);
logger->EndMethodMsg();
}
......@@ -52,8 +50,8 @@ public:
sampleDir = sampleDirName;
}
void SetPlot(Plot *plot) {
this->plot = plot;
virtual void SetPlot(Plot *plotFromMC) {
plot = plotFromMC;
}
};
......
Markdown is supported
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