AbstractTetrahedralMeshWriter.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 
00030 #ifndef _ABSTRACTTETRAHEDRALMESHWRITER_HPP_
00031 #define _ABSTRACTTETRAHEDRALMESHWRITER_HPP_
00032 
00033 // Forward declaration prevents circular include chain
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_
Generated on Thu Dec 22 13:00:16 2011 for Chaste by  doxygen 1.6.3