00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VERTEXMESHWRITER_HPP_
00029 #define VERTEXMESHWRITER_HPP_
00030
00031
00032 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00033 class VertexMesh;
00034
00035 #ifdef CHASTE_VTK
00036
00037 #define _BACKWARD_BACKWARD_WARNING_H 1 //Cut out the strstream deprecated warning for now (gcc4.3)
00038 #include <vtkDoubleArray.h>
00039 #include <vtkCellData.h>
00040 #include <vtkPointData.h>
00041 #include <vtkConvexPointSet.h>
00042 #include <vtkPolygon.h>
00043 #include <vtkUnstructuredGrid.h>
00044 #include <vtkUnstructuredGridWriter.h>
00045 #include <vtkXMLUnstructuredGridWriter.h>
00046 #include <vtkDataCompressor.h>
00047 #endif //CHASTE_VTK
00048
00049 #include "VertexMesh.hpp"
00050 #include "AbstractMeshWriter.hpp"
00051 #include "NodeMap.hpp"
00052
00053
00054 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00055 class VertexMesh;
00056
00057 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00058 struct MeshWriterIterators;
00059
00063 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00064 class VertexMeshWriter : public AbstractMeshWriter<ELEMENT_DIM, SPACE_DIM>
00065 {
00066 private:
00071 VertexMesh<ELEMENT_DIM,SPACE_DIM>* mpMesh;
00072
00074 MeshWriterIterators<ELEMENT_DIM,SPACE_DIM>* mpIters;
00075
00077 NodeMap* mpNodeMap;
00079 unsigned mNodeMapCurrentIndex;
00080
00081 #ifdef CHASTE_VTK
00082
00084 vtkUnstructuredGrid* mpVtkUnstructedMesh;
00085 #endif //CHASTE_VTK
00086
00087 public:
00088
00096 VertexMeshWriter(const std::string& rDirectory,
00097 const std::string& rBaseName,
00098 const bool clearOutputDir=true);
00099
00103 ~VertexMeshWriter();
00104
00106
00111 void WriteFilesUsingMesh(VertexMesh<ELEMENT_DIM, SPACE_DIM>& rMesh);
00112
00119 void WriteVtkUsingMesh(VertexMesh<ELEMENT_DIM, SPACE_DIM>& rMesh, std::string stamp="");
00120
00127 void AddCellData(std::string dataName, std::vector<double> dataPayload);
00128
00135 void AddPointData(std::string dataName, std::vector<double> dataPayload);
00136
00140 std::vector<double> GetNextNode();
00141
00145 ElementData GetNextElement();
00146
00151 VertexElementData GetNextElementWithFaces();
00152
00157 void WriteFiles();
00158
00159 };
00160
00161 #endif