From 535ca95da4dd408167ddfe4206f10a07df9fa527 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Wed, 15 Oct 2008 14:13:51 +0000 Subject: [PATCH] * VtkWriter::writeFiles readded :) --- AMDiS/src/BasisFunction.h | 28 ++++++++++++++-------------- AMDiS/src/DOFAdmin.cc | 5 +++-- AMDiS/src/FiniteElemSpace.cc | 12 ++++++------ AMDiS/src/Mesh.cc | 2 +- AMDiS/src/SolutionDataStorage.h | 8 ++++++-- AMDiS/src/SolutionDataStorage.hh | 5 +++-- AMDiS/src/VtkWriter.cc | 13 +++++++++++++ AMDiS/src/VtkWriter.h | 7 ++++++- 8 files changed, 52 insertions(+), 28 deletions(-) diff --git a/AMDiS/src/BasisFunction.h b/AMDiS/src/BasisFunction.h index 80aaa3f0..56a68a35 100644 --- a/AMDiS/src/BasisFunction.h +++ b/AMDiS/src/BasisFunction.h @@ -64,9 +64,9 @@ namespace AMDiS { class BasFctType { public: - BasFctType() {}; + BasFctType() {} - virtual ~BasFctType() {}; + virtual ~BasFctType() {} virtual double operator()(const DimVec<double>&) const = 0; }; @@ -78,9 +78,9 @@ namespace AMDiS { class GrdBasFctType { public: - GrdBasFctType() {}; + GrdBasFctType() {} - virtual ~GrdBasFctType() {}; + virtual ~GrdBasFctType() {} virtual void operator()(const DimVec<double>&, DimVec<double>&) const = 0; @@ -93,9 +93,9 @@ namespace AMDiS { class D2BasFctType { public: - D2BasFctType() {}; + D2BasFctType() {} - virtual ~D2BasFctType() {}; + virtual ~D2BasFctType() {} virtual void operator()(const DimVec<double>&, DimMat<double>&) const = 0; @@ -131,7 +131,7 @@ namespace AMDiS { /** \brief * Creates a BasisFunction object of given dim and degree */ - BasisFunction(const std::string& name_, int dim_, int degree_); + BasisFunction(const std::string& name, int dim, int degree); /** \brief * destructor @@ -144,14 +144,14 @@ namespace AMDiS { */ virtual bool operator==(const BasisFunction& a) const { return a.getName() == name; - }; + } /** \brief * Returns !(*this == b) */ inline bool operator!=(const BasisFunction& b) const { return !(operator == (b)); - }; + } /** \brief * Used by \ref getDOFIndices and \ref getVec @@ -194,28 +194,28 @@ namespace AMDiS { */ inline const int getDegree() const { return degree; - }; + } /** \brief * Returns \ref dim of BasisFunction */ inline const int getDim() const { return dim; - }; + } /** \brief * Returns \ref nBasFcts which is the number of local basis functions */ inline const int getNumber() const { return nBasFcts; - }; + } /** \brief * Returns \ref name of BasisFunction */ inline const std::string& getName() const { return name; - }; + } /** \brief * Returns \ref nDOF[i] @@ -227,7 +227,7 @@ namespace AMDiS { */ inline DimVec<int>* getNumberOfDOFs() const { return nDOF; - }; + } /** \brief * Initialisation of the \ref nDOF vector. Must be implemented by sub classes diff --git a/AMDiS/src/DOFAdmin.cc b/AMDiS/src/DOFAdmin.cc index d62b63dc..8a1e3820 100755 --- a/AMDiS/src/DOFAdmin.cc +++ b/AMDiS/src/DOFAdmin.cc @@ -53,9 +53,10 @@ namespace AMDiS { usedCount = src.usedCount; holeCount = src.holeCount; sizeUsed = src.sizeUsed; - for (int i = 0; i < 4; nrDOF[i] = src.nrDOF[i++]) { + for (int i = 0; i < mesh->getDim(); i++) { + nrDOF[i] = src.nrDOF[i]; nr0DOF[i] = src.nr0DOF[i]; - }; + } dofIndexedList = src.dofIndexedList; dofContainerList = src.dofContainerList; } diff --git a/AMDiS/src/FiniteElemSpace.cc b/AMDiS/src/FiniteElemSpace.cc index dbec0d6e..c1a8ae7c 100644 --- a/AMDiS/src/FiniteElemSpace.cc +++ b/AMDiS/src/FiniteElemSpace.cc @@ -55,12 +55,12 @@ namespace AMDiS { if (&feSpace == this) return *this; - if (feSpace.admin == &(feSpace.mesh->getDOFAdmin(0))) { - std::cout << "JA, SIND GLEICH\n"; - } else { - std::cout << "NO, NICHT WIRKLICH\n"; - } - ERROR_EXIT("\n"); + mesh = NEW Mesh(feSpace.mesh->getName(), feSpace.mesh->getDim()); + *mesh = *(feSpace.mesh); + admin = &(const_cast<DOFAdmin&>(mesh->getDOFAdmin(0))); + + TEST_EXIT(feSpace.admin == &(feSpace.mesh->getDOFAdmin(0))) + ("Gut, dass muss ich mir noch mal ueberlegen!\n"); return *this; } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 46fa9223..ae0e0310 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -153,7 +153,7 @@ namespace AMDiS { admin.resize(m.admin.size()); for (int i = 0; i < static_cast<int>(admin.size()); i++) { admin[i] = NEW DOFAdmin(this); - *admin[i] = *(m.admin[i]); + *(admin[i]) = *(m.admin[i]); admin[i]->setMesh(this); } diff --git a/AMDiS/src/SolutionDataStorage.h b/AMDiS/src/SolutionDataStorage.h index 2f410456..b853043e 100644 --- a/AMDiS/src/SolutionDataStorage.h +++ b/AMDiS/src/SolutionDataStorage.h @@ -59,9 +59,13 @@ namespace AMDiS { bool pop(T **solution, double *timestep); + /** \brief + * + */ bool pop(T **solution, - double *timestep, - typename SolutionHelper<T>::type feSpace); + typename SolutionHelper<T>::type feSpace, + double *timestep); + /** \brief * Returns for a given solution number the corresponding fe Space. If the diff --git a/AMDiS/src/SolutionDataStorage.hh b/AMDiS/src/SolutionDataStorage.hh index 901d7908..95e5fb7f 100644 --- a/AMDiS/src/SolutionDataStorage.hh +++ b/AMDiS/src/SolutionDataStorage.hh @@ -92,8 +92,9 @@ namespace AMDiS { template<typename T> bool SolutionDataStorage<T>::pop(T **solution, - double *timestep, - typename SolutionHelper<T>::type feSpace) + typename SolutionHelper<T>::type feSpace, + double *timestep) + { if (!pop(solution, timestep)) return false; diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index 0e4aa54f..643d7d7e 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -75,5 +75,18 @@ namespace AMDiS { return 0; } + 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 1951e1d1..bb6fce4c 100644 --- a/AMDiS/src/VtkWriter.h +++ b/AMDiS/src/VtkWriter.h @@ -45,7 +45,7 @@ namespace AMDiS { { degree = (*dataCollector)[0]->getFeSpace()->getBasisFcts()->getDegree(); dim = (*dataCollector)[0]->getMesh()->getDim(); - }; + } /** \brief @@ -53,6 +53,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 * Set a compressing method for file output. -- GitLab