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

using shared ptr

parent d1f4c9ed
......@@ -3,7 +3,7 @@
#include "DGTAssemble.h"
#include "utils/IndentedLogger.hpp"
#include <memory>
class DGTransportAssemble : public DGTAssemble {
public:
......
......@@ -7,14 +7,10 @@
class StochasticTransportProblem : public StochasticProblem {
protected:
Discretization *disc = nullptr;
HybridEllipticAssemble *assemble = nullptr;
shared_ptr<Discretization> disc;
shared_ptr<HybridEllipticAssemble> assemble;
public:
~StochasticTransportProblem() override {
delete disc;
delete assemble;
}
VectorField b = Point(0.0, -1.0, 0.0);
......@@ -46,8 +42,8 @@ private:
public:
StochasticPollution1D() {
disc = new Discretization("RT0_P0", 1, 1);
assemble = new HybridEllipticAssemble(disc, nullptr);
disc = make_shared<Discretization>("RT0_P0", 1, 1);
assemble = make_shared<HybridEllipticAssemble>(disc, nullptr);
}
double ut(double t, const Point &x) const override {
......@@ -76,12 +72,11 @@ private:
public:
StochasticPollutionCosHat1D() {
disc = new Discretization("RT0_P0", 1, 1);
assemble = new HybridEllipticAssemble(disc, nullptr);
disc = make_shared<Discretization>("RT0_P0", 1, 1);
assemble = make_shared<HybridEllipticAssemble>(disc, nullptr);
}
double ut(double t, const Point &x) const override {
// mout << x << endl;
Point midPoint = Point(0.2, 0.0);
double r = dist(midPoint, x);
......@@ -97,13 +92,11 @@ public:
string Name() const override { return "Stochastic Pollution CosHat 2D"; }
};
class StochasticPollution2D : public StochasticTransportProblem {
public:
StochasticPollution2D() {
disc = new Discretization("RT0_P0", 1, 2);
assemble = new HybridEllipticAssemble(disc, nullptr);
disc = make_shared<Discretization>("RT0_P0", 1, 2);
assemble = make_shared<HybridEllipticAssemble>(disc, nullptr);
}
double ut(double t, const Point &x) const override {
......@@ -123,8 +116,8 @@ private:
public:
StochasticPollutionCosHat2D() {
disc = new Discretization("RT0_P0", 1, 2);
assemble = new HybridEllipticAssemble(disc, nullptr);
disc = make_shared<Discretization>("RT0_P0", 1, 2);
assemble = make_shared<HybridEllipticAssemble>(disc, nullptr);
}
double ut(double t, const Point &x) const override {
......@@ -159,8 +152,8 @@ private:
public:
StochasticPollutionMollifiedBar2D() {
disc = new Discretization("RT0_P0", 1, 2);
assemble = new HybridEllipticAssemble(disc, nullptr);
disc = make_shared<Discretization>("RT0_P0", 1, 2);
assemble = make_shared<HybridEllipticAssemble>(disc, nullptr);
}
double ut(double t, const Point &x) const override {
......
......@@ -4,7 +4,7 @@
#include "SampleGenerator.h"
#include "CirculantEmbedding.h"
#include "assemble/HybridEllipticAssemble.h"
#include "problem/StochasticProblemFactory.hpp"
#include "problem/StochasticEllipticProblem.hpp"
class HybridFluxGenerator : public SampleGenerator {
......@@ -70,9 +70,9 @@ public:
explicit HybridFluxGenerator1D(int l, Meshes &meshes) :
HybridFluxGenerator(l, meshes) {
disc = new Discretization("RT0_P0", 1, meshes.dim());
problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
EStochasticProblem::StochasticLaplace1D);
assemble = new HybridEllipticAssemble(disc, problem);
// problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
// EStochasticProblem::StochasticLaplace1D);
// assemble = new HybridEllipticAssemble(disc, problem);
permeabilityGenerator = new CirculantEmbedding1D(l, meshes);
}
};
......@@ -82,9 +82,9 @@ public:
explicit HybridFluxGenerator2D(int l, Meshes &meshes)
: HybridFluxGenerator(l, meshes) {
disc = new Discretization("RT0_P0", 1, meshes.dim());
problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
EStochasticProblem::StochasticLaplace2D);
assemble = new HybridEllipticAssemble(disc, problem);
// problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
// EStochasticProblem::StochasticLaplace2D);
// assemble = new HybridEllipticAssemble(disc, problem);
permeabilityGenerator = new CirculantEmbedding2D(l, meshes);
}
};
......@@ -94,9 +94,9 @@ public:
explicit DeterministicHybridFluxGenerator1D(int l, Meshes &meshes)
: HybridFluxGenerator(l, meshes) {
disc = new Discretization("RT0_P0", 1, meshes.dim());
problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
EStochasticProblem::StochasticLaplace1D);
assemble = new HybridEllipticAssemble(disc, problem);
// problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
// EStochasticProblem::StochasticLaplace1D);
// assemble = new HybridEllipticAssemble(disc, problem);
permeabilityGenerator = new DeterministicPermeabilityGenerator(l, meshes);
}
};
......@@ -106,9 +106,9 @@ public:
explicit DeterministicHybridFluxGenerator2D(int l, Meshes &meshes)
: HybridFluxGenerator(l, meshes) {
disc = new Discretization("RT0_P0", 1, meshes.dim());
problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
EStochasticProblem::StochasticLaplace2D);
assemble = new HybridEllipticAssemble(disc, problem);
// problem = StochasticProblemFactory::CreateFrom<StochasticEllipticProblem>(
// EStochasticProblem::StochasticLaplace2D);
// assemble = new HybridEllipticAssemble(disc, problem);
permeabilityGenerator = new DeterministicPermeabilityGenerator(l, meshes);
}
};
......
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