Commit 763d84e7 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

fixed multilevel plotter test and included it into yml

parent 3da42994
...@@ -50,6 +50,8 @@ program-test: ...@@ -50,6 +50,8 @@ program-test:
script: script:
- cd tests - cd tests
- mpirun -n 4 TestMainProgram - mpirun -n 4 TestMainProgram
- mpirun -n 4 TestMultilevelPlotter
downstream-test: downstream-test:
stage: test stage: test
...@@ -79,5 +81,6 @@ downstream-test: ...@@ -79,5 +81,6 @@ downstream-test:
script: script:
- cd tests - cd tests
- mpirun -n 4 TestMainProgram - mpirun -n 4 TestMainProgram
- mpirun -n 4 TestMultilevelPlotter
...@@ -5,25 +5,29 @@ ...@@ -5,25 +5,29 @@
class TestMultilevelPlotter : public ::Test { class TestMultilevelPlotter : public ::Test {
protected: protected:
shared_ptr<Meshes> meshes; shared_ptr<Meshes> meshes;
int pLevel;
void SetUp() override { void SetUp() override {
meshes = make_shared<Meshes>("UnitSquare", 1, 4); meshes = make_shared<Meshes>("UnitSquare", 1, 4);
plotter = make_shared<MultilevelPlotter>(*meshes); plotter = make_shared<MultilevelPlotter>(*meshes);
pLevel = meshes->pLevel();
// Refactor // // Refactor
logging = new Logging; // logging = new Logging;
logging->initialize(); // logging->initialize();
} }
void TearDown() override { void TearDown() override {
system("rm -rf data/vtk/*"); // Only master checks if files are there, thus only master deletes
if (PPM->master())
system("rm -rf data/vtk/*");
} }
}; };
TEST_F(TestMultilevelPlotter, TestVertexData1D) { TEST_F(TestMultilevelPlotter, TestVertexData1D) {
MatrixGraphs vertexMG(*meshes, dof("vertex", 1)); MatrixGraphs vertexMG(*meshes, dof("vertex", 1));
for (int l = meshes->pLevel(); l <= meshes->Level(); l++) { for (int l = pLevel; l <= meshes->Level(); l++) {
Vector vertexData(vertexMG[l]); Vector vertexData(vertexMG[l - pLevel]);
vertexData = 1.0; vertexData = 1.0;
string name = "VertexData1D_" + to_string(l); string name = "VertexData1D_" + to_string(l);
plotter->PlotVector(name, vertexData, 1, l, "VertexData"); plotter->PlotVector(name, vertexData, 1, l, "VertexData");
...@@ -35,7 +39,7 @@ TEST_F(TestMultilevelPlotter, TestVertexData1D) { ...@@ -35,7 +39,7 @@ TEST_F(TestMultilevelPlotter, TestVertexData1D) {
TEST_F(TestMultilevelPlotter, TestVertexData2D) { TEST_F(TestMultilevelPlotter, TestVertexData2D) {
MatrixGraphs vertexMG(*meshes, dof("vertex", 2)); MatrixGraphs vertexMG(*meshes, dof("vertex", 2));
for (int l = meshes->pLevel(); l <= meshes->Level(); l++) { for (int l = meshes->pLevel(); l <= meshes->Level(); l++) {
Vector vertexData(vertexMG[l]); Vector vertexData(vertexMG[l - pLevel]);
vertexData = 1.0; vertexData = 1.0;
string name = "VertexData2D_" + to_string(l); string name = "VertexData2D_" + to_string(l);
plotter->PlotVector(name, vertexData, 2, l, "VertexData"); plotter->PlotVector(name, vertexData, 2, l, "VertexData");
...@@ -47,7 +51,7 @@ TEST_F(TestMultilevelPlotter, TestVertexData2D) { ...@@ -47,7 +51,7 @@ TEST_F(TestMultilevelPlotter, TestVertexData2D) {
TEST_F(TestMultilevelPlotter, TestCellData1D) { TEST_F(TestMultilevelPlotter, TestCellData1D) {
MatrixGraphs cellMG(*meshes, dof("cell", 1)); MatrixGraphs cellMG(*meshes, dof("cell", 1));
for (int l = meshes->pLevel(); l <= meshes->Level(); l++) { for (int l = meshes->pLevel(); l <= meshes->Level(); l++) {
Vector cellData(cellMG[l]); Vector cellData(cellMG[l - pLevel]);
cellData = 1.0; cellData = 1.0;
string name = "CellData1D_" + to_string(l); string name = "CellData1D_" + to_string(l);
plotter->PlotVector(name, cellData, 1, l, "CellData"); plotter->PlotVector(name, cellData, 1, l, "CellData");
...@@ -59,7 +63,7 @@ TEST_F(TestMultilevelPlotter, TestCellData1D) { ...@@ -59,7 +63,7 @@ TEST_F(TestMultilevelPlotter, TestCellData1D) {
TEST_F(TestMultilevelPlotter, TestCellData2D) { TEST_F(TestMultilevelPlotter, TestCellData2D) {
MatrixGraphs cellMG(*meshes, dof("cell", 2)); MatrixGraphs cellMG(*meshes, dof("cell", 2));
for (int l = meshes->pLevel(); l <= meshes->Level(); l++) { for (int l = meshes->pLevel(); l <= meshes->Level(); l++) {
Vector cellData(cellMG[l]); Vector cellData(cellMG[l - pLevel]);
cellData = 1.0; cellData = 1.0;
string name = "CellData2D_" + to_string(l); string name = "CellData2D_" + to_string(l);
plotter->PlotVector(name, cellData, 2, l, "CellData"); plotter->PlotVector(name, cellData, 2, l, "CellData");
......
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