Commit d2842e3c authored by Thomas Witkowski's avatar Thomas Witkowski

* Add some documentation comments to DataCollector and Vtkwriter

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