CmguiMeshWriter.hpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
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 #ifndef CMGUIWRITER_HPP_
00030 #define CMGUIWRITER_HPP_
00031 
00032 #include "AbstractTetrahedralMeshWriter.hpp"
00033 #include "OutputFileHandler.hpp"
00034 
00038 static const char CmguiNodeFileHeader3D[] = " #Fields=1\n\
00039  1) coordinates, coordinate, rectangular cartesian, #Components=3\n\
00040    x.  Value index= 1, #Derivatives= 0\n\
00041    y.  Value index= 2, #Derivatives= 0\n\
00042    z.  Value index= 3, #Derivatives= 0\n";
00043 
00047 static const char CmguiNodeFileHeader2D[] = " #Fields=1\n\
00048  1) coordinates, coordinate, rectangular cartesian, #Components=2\n\
00049    x.  Value index= 1, #Derivatives= 0\n\
00050    y.  Value index= 2, #Derivatives= 0\n";
00051 
00052 
00056 static const char CmguiNodeFileHeader1D[] = " #Fields=1\n\
00057  1) coordinates, coordinate, rectangular cartesian, #Components=1\n\
00058    x.  Value index= 1, #Derivatives= 0\n";
00059 
00063 static const char CmguiElementFileHeader3D[] = "Shape.  Dimension=3, simplex(2;3)*simplex*simplex\n\
00064  #Scale factor sets= 0\n\
00065  #Nodes= 4\n";
00066 
00070 static const char CmguiElementFileHeader2D[] = "Shape.  Dimension=2, simplex(2)*simplex\n\
00071  #Scale factor sets= 0\n\
00072  #Nodes= 3\n";
00073 
00077 static const char CmguiElementFileHeader1D[] = "Shape.  Dimension=1, line\n\
00078  #Scale factor sets= 0\n\
00079  #Nodes= 2\n";
00080 
00081 
00082 
00086 static const char CmguiCoordinatesFileHeader3D[] = " 1) coordinates, coordinate, rectangular cartesian, #Components=3\n\
00087    x.  l.simplex(2;3)*l.simplex*l.simplex, no modify, standard node based.\n\
00088      #Nodes= 4\n\
00089       1.  #Values=1\n\
00090        Value indices:     1\n\
00091        Scale factor indices:   1\n\
00092       2.  #Values=1\n\
00093        Value indices:     1\n\
00094        Scale factor indices:   2\n\
00095       3.  #Values=1\n\
00096        Value indices:     1\n\
00097        Scale factor indices:   3\n\
00098       4.  #Values=1\n\
00099        Value indices:     1\n\
00100        Scale factor indices:   4\n\
00101    y.  l.simplex(2;3)*l.simplex*l.simplex, no modify, standard node based.\n\
00102      #Nodes= 4\n\
00103       1.  #Values=1\n\
00104        Value indices:     1\n\
00105        Scale factor indices:   1\n\
00106       2.  #Values=1\n\
00107        Value indices:     1\n\
00108        Scale factor indices:   2\n\
00109       3.  #Values=1\n\
00110        Value indices:     1\n\
00111        Scale factor indices:   3\n\
00112       4.  #Values=1\n\
00113        Value indices:     1\n\
00114        Scale factor indices:   4\n\
00115    z.  l.simplex(2;3)*l.simplex*l.simplex, no modify, standard node based.\n\
00116      #Nodes= 4\n\
00117       1.  #Values=1\n\
00118        Value indices:     1\n\
00119        Scale factor indices:   1\n\
00120       2.  #Values=1\n\
00121        Value indices:     1\n\
00122        Scale factor indices:   2\n\
00123       3.  #Values=1\n\
00124        Value indices:     1\n\
00125        Scale factor indices:   3\n\
00126       4.  #Values=1\n\
00127        Value indices:     1\n\
00128        Scale factor indices:   4\n";
00129 
00133 static const char CmguiCoordinatesFileHeader2D[] = " 1) coordinates, coordinate, rectangular cartesian, #Components=2\n\
00134    x.  l.simplex(2)*l.simplex, no modify, standard node based.\n\
00135      #Nodes= 3\n\
00136       1.  #Values=1\n\
00137        Value indices:     1\n\
00138        Scale factor indices:   1\n\
00139       2.  #Values=1\n\
00140        Value indices:     1\n\
00141        Scale factor indices:   2\n\
00142       3.  #Values=1\n\
00143        Value indices:     1\n\
00144        Scale factor indices:   3\n\
00145    y.  l.simplex(2)*l.simplex, no modify, standard node based.\n\
00146      #Nodes= 3\n\
00147       1.  #Values=1\n\
00148        Value indices:     1\n\
00149        Scale factor indices:   1\n\
00150       2.  #Values=1\n\
00151        Value indices:     1\n\
00152        Scale factor indices:   2\n\
00153       3.  #Values=1\n\
00154        Value indices:     1\n\
00155        Scale factor indices:   3\n";
00156 
00161 static const char CmguiCoordinatesFileHeader1D[] = " 1) coordinates, coordinate, rectangular cartesian, #Components=1\n\
00162    x.  l.Lagrange, no modify, standard node based.\n\
00163      #Nodes= 2\n\
00164       1.  #Values=1\n\
00165        Value indices:     1\n\
00166        Scale factor indices:   1\n\
00167       2.  #Values=1\n\
00168        Value indices:     1\n\
00169        Scale factor indices:   2\n";
00170 
00175 static const char CmguiAdditonalFieldHeader3D[] = " field, rectangular cartesian, #Components=1\n\
00176    x.  l.simplex(2;3)*l.simplex*l.simplex, no modify, standard node based.\n\
00177      #Nodes= 4\n\
00178       1.  #Values=1\n\
00179        Value indices:     1\n\
00180        Scale factor indices:   1\n\
00181       2.  #Values=1\n\
00182        Value indices:     1\n\
00183        Scale factor indices:   2\n\
00184       3.  #Values=1\n\
00185        Value indices:     1\n\
00186        Scale factor indices:   3\n\
00187       4.  #Values=1\n\
00188        Value indices:     1\n\
00189        Scale factor indices:   4\n";
00190 
00195 static const char CmguiAdditonalFieldHeader2D[] = " field, rectangular cartesian, #Components=1\n\
00196    x.  l.simplex(2)*l.simplex, no modify, standard node based.\n\
00197      #Nodes= 3\n\
00198       1.  #Values=1\n\
00199        Value indices:     1\n\
00200        Scale factor indices:   1\n\
00201       2.  #Values=1\n\
00202        Value indices:     1\n\
00203        Scale factor indices:   2\n\
00204       3.  #Values=1\n\
00205        Value indices:     1\n\
00206        Scale factor indices:   3\n";
00207 
00212 static const char CmguiAdditonalFieldHeader1D[] = " field, rectangular cartesian, #Components=1\n\
00213    x.  l.Lagrange, no modify, standard node based.\n\
00214      #Nodes= 2\n\
00215       1.  #Values=1\n\
00216        Value indices:     1\n\
00217        Scale factor indices:   1\n\
00218       2.  #Values=1\n\
00219        Value indices:     1\n\
00220        Scale factor indices:   2\n";
00221 
00233 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00234 class CmguiMeshWriter : public AbstractTetrahedralMeshWriter<ELEMENT_DIM,SPACE_DIM>
00235 {
00236 protected:
00237 
00241     std::vector<std::string> mAdditionalFieldNames;
00242 
00249     std::string mGroupName;
00250 
00257     void WriteNodeFileHeader(out_stream& rpNodeFile);
00258 
00259 public:
00260 
00268     CmguiMeshWriter(const std::string& rDirectory,
00269                     const std::string& rBaseName,
00270                     bool cleanDirectory=true);
00271 
00275     void WriteFiles();
00276 
00282     void SetAdditionalFieldNames(std::vector<std::string>& rFieldNames);
00283 
00287     virtual ~CmguiMeshWriter()
00288     {}
00289     
00298     static bool CompareCmguiFiles(std::string& rPath1, std::string& rPath2);
00299 };
00300 
00301 #endif /*CMGUIWRITER_HPP_*/

Generated by  doxygen 1.6.2