vtf-logo

file_io.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_mesh_iss_file_io_h__)
00009 #define __geom_mesh_iss_file_io_h__
00010 
00011 #include "IndSimpSet.h"
00012 
00013 #include <string>
00014 
00015 BEGIN_NAMESPACE_GEOM
00016 
00017 //-----------------------------------------------------------------------------
00069 
00070 // CONTINUE: I should raise an assertion if I can't write/read the file.
00071 // CONTINUE: Add support for comment lines starting with a #.
00072 
00073 
00075 template<int N, int M, typename VertForIter, typename ISForIter>
00076 void
00077 writeIssAscii(std::ostream& out, 
00078               VertForIter verticesBeginning, VertForIter verticesEnd,
00079               ISForIter indexedSimplicesBeginning, 
00080               ISForIter indexedSimplicesEnd);
00081 
00082 
00084 
00085 template<int N, int M, bool A, typename T, typename V, typename IS>
00086 inline
00087 void
00088 writeAscii(std::ostream& out, const IndSimpSet<N,M,A,T,V,IS>& x) {
00089   writeIssAscii<N,M>(out, x.getVerticesBeginning(), x.getVerticesEnd(),
00090                      x.getIndexedSimplicesBeginning(), 
00091                      x.getIndexedSimplicesEnd());
00092 }
00093 
00094 
00096 
00097 template<int N, int M, bool A, typename T, typename V, typename IS>
00098 void
00099 writeBinary(std::ostream& out, const IndSimpSet<N,M,A,T,V,IS>& x);
00100 
00101 
00103 template<int N, int M, typename VertForIter, typename ISForIter>
00104 void
00105 writeIssBinary(std::ostream& out, 
00106                VertForIter verticesBeginning, VertForIter verticesEnd,
00107                ISForIter indexedSimplicesBeginning, 
00108                ISForIter indexedSimplicesEnd);
00109 
00110 
00112 
00113 template<int N, int M, typename T, typename V, typename IS>
00114 void
00115 readAscii(std::istream& in, IndSimpSet<N,M,true,T,V,IS>* x);
00116 
00117 
00119 
00120 template<int N, int M, typename T, typename V, typename IS>
00121 void
00122 readBinary(std::istream& in, IndSimpSet<N,M,true,T,V,IS>* x);
00123 
00124 
00125 //--------------------------------------------------------------------------
00126 // VTK XML
00127 //--------------------------------------------------------------------------
00128 
00130 template<int N, int M, typename VertForIter, typename ISForIter, 
00131          typename ContainerIter, typename StringIter>
00132 void
00133 writeIssAndCellDataVtkXml(std::ostream& out, 
00134                           VertForIter verticesBeginning, 
00135                           VertForIter verticesEnd,
00136                           ISForIter indexedSimplicesBeginning, 
00137                           ISForIter indexedSimplicesEnd,
00138                           ContainerIter cellDataContainersBeginning,
00139                           ContainerIter cellDataContainersEnd,
00140                           StringIter dataNamesBeginning,
00141                           StringIter dataNamesEnd);
00142 
00143 
00145 template<int N, int M, typename VertForIter, typename ISForIter>
00146 void
00147 writeIssVtkXml(std::ostream& out, 
00148                VertForIter verticesBeginning, VertForIter verticesEnd,
00149                ISForIter indexedSimplicesBeginning, 
00150                ISForIter indexedSimplicesEnd);
00151 
00152 
00154 
00155 template<int N, int M, bool A, typename T, typename V, typename IS>
00156 inline
00157 void
00158 writeVtkXml(std::ostream& out, const IndSimpSet<N,M,A,T,V,IS>& x) {
00159   writeIssVtkXml<N,M>(out, x.getVerticesBeginning(), x.getVerticesEnd(), 
00160                       x.getIndexedSimplicesBeginning(), 
00161                       x.getIndexedSimplicesEnd());
00162 }
00163 
00164 
00166 
00167 template<int N, int M, bool A, typename T, typename V, typename IS,
00168          typename F, bool A2>
00169 inline
00170 void
00171 writeVtkXml(std::ostream& out, 
00172             const IndSimpSet<N,M,A,T,V,IS>& x,
00173             const ads::Array<1,F,A2>& cellData,
00174             std::string dataName) {
00175   writeIssAndCellDataVtkXml<N,M>(out, x.getVerticesBeginning(), 
00176                                  x.getVerticesEnd(), 
00177                                  x.getIndexedSimplicesBeginning(), 
00178                                  x.getIndexedSimplicesEnd(),
00179                                  &cellData, &cellData,
00180                                  &dataName, &dataName);
00181 }
00182 
00183 
00185 
00186 template<int N, int M, bool A, typename T, typename V, typename IS,
00187          typename ContainerIter, typename StringIter>
00188 inline
00189 void
00190 writeVtkXml(std::ostream& out, 
00191             const IndSimpSet<N,M,A,T,V,IS>& x,
00192             ContainerIter cellDataContainersBeginning,
00193             ContainerIter cellDataContainersEnd,
00194             StringIter dataNamesBeginning,
00195             StringIter dataNamesEnd) {
00196   writeIssAndCellDataVtkXml<N,M>(out, x.getVerticesBeginning(), 
00197                                  x.getVerticesEnd(), 
00198                                  x.getIndexedSimplicesBeginning(), 
00199                                  x.getIndexedSimplicesEnd(),
00200                                  cellDataContainersBeginning,
00201                                  cellDataContainersEnd,
00202                                  dataNamesBeginning,
00203                                  dataNamesEnd);
00204 }
00205 
00206 
00207 //--------------------------------------------------------------------------
00208 // VTK Legacy
00209 //--------------------------------------------------------------------------
00210 
00212 template<int N, int M, typename VertForIter, typename ISForIter>
00213 void
00214 writeIssVtkLegacy(std::ostream& out, 
00215                   VertForIter verticesBeginning, VertForIter verticesEnd,
00216                   ISForIter indexedSimplicesBeginning, 
00217                   ISForIter indexedSimplicesEnd,
00218                   std::string title = "");
00219 
00220 
00222 
00223 template<int N, int M, bool A, typename T, typename V, typename IS>
00224 inline
00225 void
00226 writeVtkLegacy(std::ostream& out, const IndSimpSet<N,M,A,T,V,IS>& x,
00227                std::string title = "") {
00228   writeIssVtkLegacy<N,M>(out, x.getVerticesBeginning(), 
00229                          x.getVerticesEnd(), 
00230                          x.getIndexedSimplicesBeginning(), 
00231                          x.getIndexedSimplicesEnd(), title);
00232 }
00233 
00235 
00236 END_NAMESPACE_GEOM
00237 
00238 #define __geom_mesh_iss_file_io_ipp__
00239 #include "file_io.ipp"
00240 #undef __geom_mesh_iss_file_io_ipp__
00241 
00242 #endif

Generated on Fri Aug 24 12:55:53 2007 for Computational Geometry Package by  doxygen 1.4.7