From 56db512298463862c53a3bdc702f5aba26be1235 Mon Sep 17 00:00:00 2001 From: Klaus <klaus.boehnlein@tu-dresden.de> Date: Thu, 26 Aug 2021 13:58:50 +0200 Subject: [PATCH] Adjust VTKWriter for different Levels --- src/dune-microstructure.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/dune-microstructure.cc b/src/dune-microstructure.cc index 4d956315..0b1a20b0 100644 --- a/src/dune-microstructure.cc +++ b/src/dune-microstructure.cc @@ -65,7 +65,6 @@ using namespace MatrixOperations; ////////////////////////////////////////////////////////////////////// // Helper functions for Table-Output ////////////////////////////////////////////////////////////////////// - /*! Center-aligns string within a field of width w. Pads with blank spaces to enforce alignment. */ std::string center(const std::string s, const int w) { @@ -1516,20 +1515,22 @@ int main(int argc, char *argv[]) ////////////////////////////////////////////////////////////////////////////////////////////// // Write result to VTK file ////////////////////////////////////////////////////////////////////////////////////////////// + std::string VTKOutputName = "CellProblem-result"; + VTKWriter<GridView> vtkWriter(gridView_CE); vtkWriter.addVertexData( correctorFunction_1, - VTK::FieldInfo("corrector phi_1", VTK::FieldInfo::Type::vector, dim)); //TODO FOR EACH LEVEL! + VTK::FieldInfo("Corrector phi_1 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim)); vtkWriter.addVertexData( correctorFunction_2, - VTK::FieldInfo("corrector phi_2", VTK::FieldInfo::Type::vector, dim)); + VTK::FieldInfo("Corrector phi_2 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim)); vtkWriter.addVertexData( correctorFunction_3, - VTK::FieldInfo("corrector phi_3", VTK::FieldInfo::Type::vector, dim)); - vtkWriter.write("CellProblem-result"); - std::cout << "wrote data to file: CellProblem-result" << std::endl; // better with string for output name.. - + VTK::FieldInfo("Corrector phi_3 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim)); + vtkWriter.write( VTKOutputName + "-level"+ std::to_string(level)); + std::cout << "wrote data to file: " + VTKOutputName + "-level" + std::to_string(level) << std::endl; + levelCounter++; } // Level-Loop End @@ -1592,7 +1593,6 @@ int main(int argc, char *argv[]) { std::visit([tableWidth](auto&& arg){std::cout << center(prd(arg,5,1),tableWidth) << " | ";}, v); std::visit([tableWidth, &log](auto&& arg){log << center(prd(arg,5,1),tableWidth) << " & ";}, v); - StorageCount2++; if(StorageCount2 % 7 == 0 ) { @@ -1602,6 +1602,5 @@ int main(int argc, char *argv[]) } - log.close(); } -- GitLab