AbstractTetrahedralMeshWriter.hpp
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
00029
00030 #ifndef _ABSTRACTTETRAHEDRALMESHWRITER_HPP_
00031 #define _ABSTRACTTETRAHEDRALMESHWRITER_HPP_
00032
00033
00034 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00035 class AbstractTetrahedralMesh;
00036
00037 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00038 class DistributedTetrahedralMesh;
00039
00040 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00041 class MixedDimensionMesh;
00042
00043 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00044 struct MeshWriterIterators;
00045
00046 #include <fstream>
00047 #include <sstream>
00048 #include <iostream>
00049
00050 #include "AbstractMeshWriter.hpp"
00051 #include "AbstractMesh.hpp"
00052 #include "NodeMap.hpp"
00053
00057 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00058 class AbstractTetrahedralMeshWriter : public AbstractMeshWriter<ELEMENT_DIM, SPACE_DIM>
00059 {
00060 private:
00061
00068 virtual void WriteFilesUsingParallelMesh(bool keepOriginalElementIndexing=true);
00069
00077 void WriteNclFile(AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>& rMesh,
00078 bool invertMeshPermutation=false);
00079
00083 virtual void CreateFilesWithHeaders();
00084
00088 virtual void AppendLocalDataToFiles();
00089
00093 virtual void WriteFilesFooter();
00094
00095 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* mpMesh;
00097 NodeMap* mpNodeMap;
00099 protected:
00100
00101 unsigned mNodesPerElement;
00102 unsigned mNodesPerBoundaryElement;
00104 DistributedTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* mpDistributedMesh;
00105 MixedDimensionMesh<ELEMENT_DIM,SPACE_DIM>* mpMixedMesh;
00106 MeshWriterIterators<ELEMENT_DIM,SPACE_DIM>* mpIters;
00108 bool mIndexFromZero;
00109 bool mWriteMetaFile;
00110 unsigned mNodeCounterForParallelMesh;
00111 unsigned mElementCounterForParallelMesh;
00112 unsigned mBoundaryElementCounterForParallelMesh;
00113 unsigned mCableElementCounterForParallelMesh;
00114 bool mFilesAreBinary;
00116 public:
00117
00125 AbstractTetrahedralMeshWriter(const std::string& rDirectory,
00126 const std::string& rBaseName,
00127 const bool clearOutputDir=true);
00128
00132 ~AbstractTetrahedralMeshWriter();
00133
00143 virtual void WriteFilesUsingMesh(AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>& rMesh,
00144 bool keepOriginalElementIndexing=true);
00145
00155 void WriteFilesUsingMeshReaderAndMesh(AbstractMeshReader<ELEMENT_DIM, SPACE_DIM>& rMeshReader,
00156 AbstractTetrahedralMesh<ELEMENT_DIM, SPACE_DIM>& rMesh);
00157
00161 std::vector<double> GetNextNode();
00162
00163
00167 ElementData GetNextElement();
00168
00172 ElementData GetNextBoundaryElement();
00173
00177 ElementData GetNextCableElement();
00178 };
00179
00180 #endif //_ABSTRACTTETRAHEDRALMESHWRITER_HPP_