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

moved plotting to dgtransport and added sample directory

parent 126969fa
......@@ -62,27 +62,6 @@ public:
void SetGamma(Scalar gamma) {
this->gamma = gamma;
}
void VtkPlotting_cell(double t, const Vector &u, char *filename) const {
Vector u_tmp(u);
for (cell c = u_tmp.cells(); c != u_tmp.cells_end(); ++c) {
DGElement elem(*disc, u_tmp, c);
Scalar U = 0.0;
double a = 0;
for (int q = 0; q < elem.nQ(); ++q) {
double w = elem.QWeight(q);
U += w * elem.Value(q, u);
a += w;
}
U *= (1 / a);
row r = u.find_row(c());
u_tmp(r)[0] = U;
}
plot->celldata(u_tmp, 1);
NumberName("U", filename, step);
plot->vtk_celldata(filename, 0);
plot->gnu_celldata(filename, 0);
}
};
#endif
......@@ -10,6 +10,8 @@ public:
StochasticTransportProblem *problem;
PDELogger *logger;
string sampleDir = "";
double flux_alpha = 1.0;
double diffusion = 0.0;
......@@ -251,6 +253,29 @@ public:
VtkPlotting_cell(t, u, filename);
}
void VtkPlotting_cell(double t, const Vector &u, char *filename) const {
Vector u_tmp(u);
for (cell c = u_tmp.cells(); c != u_tmp.cells_end(); ++c) {
DGElement elem(*disc, u_tmp, c);
Scalar U = 0.0;
double a = 0;
for (int q = 0; q < elem.nQ(); ++q) {
double w = elem.QWeight(q);
U += w * elem.Value(q, u);
a += w;
}
U *= (1 / a);
row r = u.find_row(c());
u_tmp(r)[0] = U;
}
plot->celldata(u_tmp, 1);
string name = "";
name = name.append(sampleDir).append("/U");
NumberName(const_cast<char *>(name.c_str()), filename, step);
plot->vtk_celldata(filename, 0);
plot->gnu_celldata(filename, 0);
}
void PrintMatrixInfo(Matrix &A, int diagonal) const override {
for (cell c = A.cells(); c != A.cells_end(); ++c) {
DGElement elem(*disc, A, c);
......
......@@ -88,8 +88,7 @@ protected:
void mkSampleDir(int m) {
string pathToData = "data/vtk/";
string sampleDirName = mkSampleDirName(m);
int status = mkdir(const_cast<char *> ((pathToData + sampleDirName).c_str()),
0777);
int status = mkdir(const_cast<char *> ((pathToData.append(sampleDirName)).c_str()),0777);
}
string buildName(int m, string name, const string &suffix = "") {
......
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