From 3f9807a2b8e2f0badae4b246a1ec58e941943a11 Mon Sep 17 00:00:00 2001 From: Michael Sinsbeck <michael@sinsbeck.com> Date: Wed, 24 Aug 2011 09:40:30 +0000 Subject: [PATCH] Replaced paraview output by viplab output git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6539 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh b/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh index 4c8e0aab93..8280d9064a 100644 --- a/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh +++ b/appl/lecture/msm/1p2cvs2p/lensproblem1p2c.hh @@ -153,6 +153,7 @@ class LensProblem : public OnePTwoCBoxProblem<TypeTag> typedef Dune::FieldVector<Scalar, dim> LocalPosition; typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef typename GET_PROP(TypeTag, PTAG(ParameterTree)) Params; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector)) SolutionVector; public: LensProblem(TimeManager &timeManager, @@ -173,6 +174,24 @@ public: infiltrationRate_ = Params::tree().template get<double>("Boundary.InfiltrationRate"); infiltrationStartTime_= 1.0e-9;//The infiltrations starts always after the first time step! infiltrationEndTime_= Params::tree().template get<double>("Boundary.InfiltrationEndTime"); + + + resX_ = 40; + resY_ = 64; + + // Write header for output file + std::ofstream dataFile; + dataFile.open("dumux-out.vgfc"); +// dataFile << "Gridplot" << std::endl; + dataFile << "## This is a DuMuX output for the ViPLab graphics driver. \n"; + dataFile << "## This output file was generated at " << __TIME__ <<", "<< __DATE__<< "\n"; + dataFile << "# x-range " << this->bboxMin()[0] << " " << this->bboxMax()[0] << "\n" ; + dataFile << "# y-range " << this->bboxMin()[1] << " " << this->bboxMax()[1] << "\n" ; + dataFile << "# x-count " << resX_+1 << "\n" ; + dataFile << "# y-count " << resY_+1 << "\n" ; +// dataFile << "# min-color 0 0 0\n"; +// dataFile << "# max-color 255 255 255\n"; + dataFile.close(); } /*! @@ -318,6 +337,41 @@ public: } // \} +// + void writeOutput() + { + //todo: Das hier ist noch nicht fertig. + + Scalar time = this->timeManager().time(); + if (time<0) + return; + SolutionVector &sol = this->model().curSol(); + + std::ofstream dataFile; + dataFile.open("dumux-out.vgfc", std::fstream::app); + + dataFile << "# time "<< time <<"\n" ; + dataFile << "# label Concentration \n"; + dataFile << "# min-color 0 0 0\n"; + dataFile << "# max-color 255 255 255\n"; + + for (int j=0; j < resY_+1; j++) + { + for (int i=0; i < resX_+1; i++) + { + int currentIdx = i*(resY_+1)+j; + dataFile << sol[currentIdx][x1Idx]; + if(i != resX_) // all but last entry + dataFile << " "; + else // write the last entry + { + dataFile << "\n"; + } + } + } + dataFile.close(); + } + private: bool onLeftBoundary_(const GlobalPosition &globalPos) const @@ -358,6 +412,9 @@ private: Scalar infiltrationRate_; Scalar infiltrationStartTime_; Scalar infiltrationEndTime_; + int resX_; + int resY_; + }; } //end namespace -- GitLab