-
Thomas Witkowski authoredThomas Witkowski authored
VtkWriter.h 3.81 KiB
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == crystal growth group ==
// == ==
// == Stiftung caesar ==
// == Ludwig-Erhard-Allee 2 ==
// == 53175 Bonn ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == http://www.caesar.de/cg/AMDiS ==
// == ==
// ============================================================================
/** \file VtkWriter.h */
#ifndef AMDIS_VTKWRITER_H
#define AMDIS_VTKWRITER_H
#include <fstream>
#include "BasisFunction.h"
#include "DataCollector.h"
namespace AMDiS {
class VtkWriter
{
public:
VtkWriter(std::vector<DataCollector*> *dc)
: dc_(dc)
{
degree_ = (*dc_)[0]->getFeSpace()->getBasisFcts()->getDegree();
dim_ = (*dc_)[0]->getMesh()->getDim();
};
/** \brief
* Writes a ParaView-VTK file.
*/
int writeFile(const char *name);
/** \brief
* Adds a new entry to a ParaView animation file.
*/
int updateAnimationFile(std::string valueFilename,
std::vector< std::string > *paraViewAnimationFrames,
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++) {
file << " " << std::scientific << coord[i];
}
for (int i = Global::getGeo(WORLD); i < 3; i++) {
file << " 0.0";
}
file << std::endl;
}
private:
/**
* List of DataCollectors, for each component of the problem one.
*/
std::vector<DataCollector*> *dc_;
/** \brief
* Degree of the basis function of the problem.
*/
int degree_;
/** \brief
* Dimension of the geometry.
*/
int dim_;
};
}
#endif