From 5d144c00dd59cb287844af92757b9d843e9945c6 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Wed, 24 Sep 2008 08:57:28 +0000 Subject: [PATCH] * Added static VtkWriter::writeFile for simple file writing --- AMDiS/src/ProblemScal.h | 12 +++++++++--- AMDiS/src/VtkWriter.cc | 14 ++++++++++++++ AMDiS/src/VtkWriter.h | 5 +++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index e9402da8..a61a1de1 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -177,18 +177,24 @@ namespace AMDiS { /** \brief * Returns number of managed problems */ - virtual int getNumProblems() { return 1; }; + virtual int getNumProblems() { + return 1; + }; /** \brief * Implementation of ProblemStatBase::getNumComponents() */ - virtual int getNumComponents() { return 1; }; + virtual int getNumComponents() { + return 1; + }; /** \brief * Returns the problem with the given number. If only one problem * is managed by this master problem, the number hasn't to be given. */ - virtual ProblemStatBase *getProblem(int number = 0) { return this; }; + virtual ProblemStatBase *getProblem(int number = 0) { + return this; + }; /** \brief * Writes output files. diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index 0b9799b3..f0a4a658 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -414,4 +414,18 @@ namespace AMDiS { } + void VtkWriter::writeFile(DOFVector<double> *values, + const char *filename) + { + DataCollector *dc = NEW DataCollector(values->getFESpace(), values); + std::vector<DataCollector*> dcList(0); + dcList.push_back(dc); + + VtkWriter *writer = NEW VtkWriter(&dcList); + writer->writeFile(filename); + + DELETE writer; + DELETE dc; + } + } diff --git a/AMDiS/src/VtkWriter.h b/AMDiS/src/VtkWriter.h index e974b61e..3443d993 100644 --- a/AMDiS/src/VtkWriter.h +++ b/AMDiS/src/VtkWriter.h @@ -45,6 +45,11 @@ namespace AMDiS { */ int writeFile(const char *name); + /** \brief + * May be used to simply write ParaView files. + */ + static void writeFile(DOFVector<double> *values, + const char *filename); /** \brief * Adds a new entry to a ParaView animation file. -- GitLab