Skip to content
Snippets Groups Projects
Commit d2842e3c authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Add some documentation comments to DataCollector and Vtkwriter

parent bb580238
No related branches found
No related tags found
No related merge requests found
...@@ -127,7 +127,6 @@ namespace AMDiS { ...@@ -127,7 +127,6 @@ namespace AMDiS {
} }
// Traverse elements to create interpolation values. // Traverse elements to create interpolation values.
counter = 0;
elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_ | Mesh::FILL_COORDS); elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_ | Mesh::FILL_COORDS);
while (elInfo) { while (elInfo) {
if (!writeElem_ || writeElem_(elInfo)) if (!writeElem_ || writeElem_(elInfo))
...@@ -273,7 +272,9 @@ namespace AMDiS { ...@@ -273,7 +272,9 @@ namespace AMDiS {
const BasisFunction *basisFcts = feSpace_->getBasisFcts(); const BasisFunction *basisFcts = feSpace_->getBasisFcts();
const DegreeOfFreedom *localDOFs = basisFcts->getLocalIndices(elInfo->getElement(), localAdmin_, NULL); const DegreeOfFreedom *localDOFs = basisFcts->getLocalIndices(elInfo->getElement(), localAdmin_, NULL);
const int nBasisFcts = basisFcts->getNumber(); const int nBasisFcts = basisFcts->getNumber();
// First, traverse all DOFs at the vertices of the element, determine
// their coordinates and add them to the corresponding entry in dofCoords_.
for (int i = 0; i < mesh_->getGeo(VERTEX); i++) { for (int i = 0; i < mesh_->getGeo(VERTEX); i++) {
(*interpPointInd_)[localDOFs[i]] = -2; // mark as vertex (*interpPointInd_)[localDOFs[i]] = -2; // mark as vertex
...@@ -295,6 +296,11 @@ namespace AMDiS { ...@@ -295,6 +296,11 @@ namespace AMDiS {
} }
// Then, traverse all interpolation DOFs of the element, determine
// their coordinates and add them to the corresponding entry in
// interpPointCoords_.
for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts; i++) { for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts; i++) {
WorldVector<double> interpolCoords; WorldVector<double> interpolCoords;
elInfo->coordToWorld(*basisFcts->getCoords(i), &interpolCoords); elInfo->coordToWorld(*basisFcts->getCoords(i), &interpolCoords);
......
...@@ -245,7 +245,8 @@ namespace AMDiS { ...@@ -245,7 +245,8 @@ namespace AMDiS {
::std::vector< ::std::vector<int> > interpPoints_; ::std::vector< ::std::vector<int> > interpPoints_;
/** \brief /** \brief
* * Stores for each DOF a list of its coordinates. If there are now periodic
* boundaries than there is also only one coordinate per DOF.
*/ */
DOFVector< ::std::list<WorldVector<double> > > *interpPointCoords_; DOFVector< ::std::list<WorldVector<double> > > *interpPointCoords_;
...@@ -294,8 +295,6 @@ namespace AMDiS { ...@@ -294,8 +295,6 @@ namespace AMDiS {
* Pointer to a function which decides whether an element is considered. * Pointer to a function which decides whether an element is considered.
*/ */
bool (*writeElem_)(ElInfo*); bool (*writeElem_)(ElInfo*);
int counter;
}; };
} }
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <cmath> #include <cmath>
#include "VtkWriter.h" #include "VtkWriter.h"
#include "Traverse.h"
#include "DataCollector.h" #include "DataCollector.h"
#include "DOFVector.h" #include "DOFVector.h"
#include "SurfaceRegion_ED.h" #include "SurfaceRegion_ED.h"
...@@ -105,7 +104,7 @@ namespace AMDiS { ...@@ -105,7 +104,7 @@ namespace AMDiS {
DOFVector< ::std::list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS); DOFVector< ::std::list<VertexInfo> >::Iterator it(vertexInfos, USED_DOFS);
int counter = 0; int counter = 0;
// for all DOFs // For all DOFs of vertices, write the coordinates.
for (it.reset(); !it.end(); ++it) { for (it.reset(); !it.end(); ++it) {
// for all vertex infos of this DOF // for all vertex infos of this DOF
::std::list<VertexInfo>::iterator it2; ::std::list<VertexInfo>::iterator it2;
...@@ -115,6 +114,7 @@ namespace AMDiS { ...@@ -115,6 +114,7 @@ namespace AMDiS {
} }
} }
// For the second dim case, write also the interpolation points.
if ((dim_ == 2) && (degree_ > 1)) { if ((dim_ == 2) && (degree_ > 1)) {
DOFVector< ::std::list< WorldVector<double> > > *interpPointCoords = (*dc_)[0]->getInterpPointCoords(); DOFVector< ::std::list< WorldVector<double> > > *interpPointCoords = (*dc_)[0]->getInterpPointCoords();
DOFVector< ::std::list< WorldVector<double> > >::Iterator pointIt(interpPointCoords, USED_DOFS); DOFVector< ::std::list< WorldVector<double> > >::Iterator pointIt(interpPointCoords, USED_DOFS);
...@@ -139,6 +139,7 @@ namespace AMDiS { ...@@ -139,6 +139,7 @@ namespace AMDiS {
DOFVector<double>::Iterator valueIt(values, USED_DOFS); DOFVector<double>::Iterator valueIt(values, USED_DOFS);
DOFVector< ::std::list<WorldVector<double> > >::Iterator coordIt(dofCoords, USED_DOFS); DOFVector< ::std::list<WorldVector<double> > >::Iterator coordIt(dofCoords, USED_DOFS);
// Write the values for all vertex DOFs.
for (intPointIt.reset(), valueIt.reset(), coordIt.reset(); for (intPointIt.reset(), valueIt.reset(), coordIt.reset();
!intPointIt.end(); !intPointIt.end();
++intPointIt, ++valueIt, ++coordIt) { ++intPointIt, ++valueIt, ++coordIt) {
...@@ -150,6 +151,7 @@ namespace AMDiS { ...@@ -150,6 +151,7 @@ namespace AMDiS {
} }
} }
// For the second dim case, write also the values of the interpolation points.
if ((dim_ == 2) && (degree_ > 1)) { if ((dim_ == 2) && (degree_ > 1)) {
DOFVector< ::std::list<WorldVector<double> > >::Iterator DOFVector< ::std::list<WorldVector<double> > >::Iterator
interpCoordIt((*dc_)[componentNo]->getInterpPointCoords(), USED_DOFS); interpCoordIt((*dc_)[componentNo]->getInterpPointCoords(), USED_DOFS);
...@@ -170,6 +172,8 @@ namespace AMDiS { ...@@ -170,6 +172,8 @@ namespace AMDiS {
void VtkWriter::writeConnectivity(::std::ofstream &file) void VtkWriter::writeConnectivity(::std::ofstream &file)
{ {
// For the second dim case, and if higher order Lagrange elements are used,
// write the connectivity by extra functions.
if ((dim_ == 2) && (degree_ == 2)) { if ((dim_ == 2) && (degree_ == 2)) {
writeConnectivity_dim2_degree2(file); writeConnectivity_dim2_degree2(file);
} else if ((dim_ == 2) && (degree_ == 3)) { } else if ((dim_ == 2) && (degree_ == 3)) {
......
...@@ -32,12 +32,8 @@ namespace AMDiS { ...@@ -32,12 +32,8 @@ namespace AMDiS {
class VtkWriter class VtkWriter
{ {
public: public:
VtkWriter(::std::vector<DataCollector*> *dc, VtkWriter(::std::vector<DataCollector*> *dc)
int level = -1, : dc_(dc)
Flag traverseFlag = Mesh::CALL_LEAF_EL)
: dc_(dc),
level_(level),
traverseFlag_(traverseFlag)
{ {
degree_ = (*dc_)[0]->getFeSpace()->getBasisFcts()->getDegree(); degree_ = (*dc_)[0]->getFeSpace()->getBasisFcts()->getDegree();
dim_ = (*dc_)[0]->getMesh()->getDim(); dim_ = (*dc_)[0]->getMesh()->getDim();
...@@ -58,42 +54,47 @@ namespace AMDiS { ...@@ -58,42 +54,47 @@ namespace AMDiS {
const char *animationFilename); const char *animationFilename);
protected: protected:
/** \brief /** \brief
* * Writes all coordinates of vertices and interpolation points to an
* output file.
*/ */
void writeVertexCoords(::std::ofstream &file); void writeVertexCoords(::std::ofstream &file);
/** \brief /** \brief
* * Writes all values of vertices and interpolation point to an output
* file.
*/ */
void writeVertexValues(::std::ofstream &file, int componentNo); void writeVertexValues(::std::ofstream &file, int componentNo);
/** \brief /** \brief
* * Writes the connectivity of all simplices to an output file.
*/ */
void writeConnectivity(::std::ofstream &file); void writeConnectivity(::std::ofstream &file);
/** \brief /** \brief
* * Writes the connectivity for the case dim = 2 and degree = 2 to
* an output file.
*/ */
void writeConnectivity_dim2_degree2(::std::ofstream &file); void writeConnectivity_dim2_degree2(::std::ofstream &file);
/** \brief /** \brief
* * Writes the connectivity for the case dim = 2 and degree = 3 to
* an output file.
*/ */
void writeConnectivity_dim2_degree3(::std::ofstream &file); void writeConnectivity_dim2_degree3(::std::ofstream &file);
/** \brief /** \brief
* * Writes the connectivity for the case dim = 2 and degree = 4 to
* an output file.
*/ */
void writeConnectivity_dim2_degree4(::std::ofstream &file); void writeConnectivity_dim2_degree4(::std::ofstream &file);
/** \brief /** \brief
* * Writes a world coordinate to a given file.
*/ */
inline void writeCoord(::std::ofstream &file, WorldVector<double> coord) { inline void writeCoord(::std::ofstream &file, WorldVector<double> coord) {
for (int i = 0; i < Global::getGeo(WORLD); i++) { for (int i = 0; i < Global::getGeo(WORLD); i++) {
...@@ -107,31 +108,19 @@ namespace AMDiS { ...@@ -107,31 +108,19 @@ namespace AMDiS {
private: private:
/** /**
* * List of DataCollectors, for each component of the problem one.
*/ */
::std::vector<DataCollector*> *dc_; ::std::vector<DataCollector*> *dc_;
/** \brief /** \brief
* Level information for traversing the mesh. * Degree of the basis function of the problem.
*/
int level_;
/** \brief
* Flags for traversing the mesh.
*/
Flag traverseFlag_;
/** \brief
*
*/ */
int degree_; int degree_;
/** \brief /** \brief
* * Dimension of the geometry.
*/ */
int dim_; int dim_;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment