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

adding destructor and bug fix

parent fde26f75
......@@ -3,7 +3,6 @@
MatrixGraphs *PDESolver::CreateSolutionMatrixGraphs() {
createOtherMatrixGraphs();
auto disc = this->GetDisc();
auto discType = typeid(*disc).name();
if (discType == typeid(LagrangeDiscretization).name())
......
......@@ -29,7 +29,7 @@ class PDESolver {
protected:
Meshes &meshes;
MatrixGraphs *solMGraph;
MatrixGraphs *solMGraphs;
PlotMap plotMap;
......@@ -60,16 +60,14 @@ public:
PDESolver(Meshes &meshes, const std::string &quantity, const std::string &costMeasure,
int verbose, int plotting) :
meshes(meshes), quantity(quantity), costMeasure(costMeasure),
verbose(verbose), plotting(plotting) {
createOtherMatrixGraphs();
}
verbose(verbose), plotting(plotting) {}
virtual ~PDESolver() {
delete solMGraph;
if(!solMGraphs) delete solMGraphs;
};
MatrixGraphs* MGraphs() {
return solMGraph;
MatrixGraphs *MGraphs() {
return solMGraphs;
}
void Run(SampleSolution &solution) {
......@@ -117,7 +115,13 @@ public:
const std::string &costMeasure = "size",
int verbose = 1, int plotting = 1) :
PDESolver(meshes, quantity, costMeasure, verbose, plotting),
assemble(assemble) {}
assemble(assemble) {
solMGraphs = CreateSolutionMatrixGraphs();
}
~DummyPDESolver() {
if (!solMGraphs) delete solMGraphs;
}
IAssemble *GetAssemble() const override {
return assemble;
......@@ -144,9 +148,6 @@ private:
IStochasticEllipticAssemble *assemble;
// To plot pressure and flux
// Might be a problem since PDESolver is storing
// meshes related information
MatrixGraphs *fluxMGraphs;
MatrixGraphs *pressureMGraphs;
......@@ -176,9 +177,16 @@ public:
assemble(assemble),
solver(Solver(GetPC(pc), linearSolver)),
newton(Newton(solver)) {
solMGraphs = CreateSolutionMatrixGraphs();
PrintInfo();
}
~EllipticPDESolver() {
if (!solMGraphs) delete solMGraphs;
if (!fluxMGraphs) delete fluxMGraphs;
if (!pressureMGraphs) delete pressureMGraphs;
}
IAssemble *GetAssemble() const override {
return assemble;
}
......@@ -234,11 +242,16 @@ public:
// T(assemble) Todo make T and t0 Problem Properties
solver(Solver(GetPC("PointBlockGaussSeidel"), "GMRES")),
timeInt(TimeIntegrator(solver, -102)) {
solMGraphs = CreateSolutionMatrixGraphs();
config.get("CFL", CFL);
config.get("t0", t0);
config.get("T", T);
}
~TransportPDESolver() {
if (!solMGraphs) delete solMGraphs;
}
IAssemble *GetAssemble() const override {
return assemble;
}
......
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