amirameshwriter.hh

00001 #ifndef DUNE_AMIRAMESH_WRITER_HH
00002 #define DUNE_AMIRAMESH_WRITER_HH
00003 
00004 #include <string>
00005 
00006 namespace Dune {
00007    
00012     template<class GridType, class IndexSetType>
00013     class AmiraMeshWriter {
00014 
00015         enum {dim = GridType::dimension};
00016 
00017     public:
00018 
00025         static void writeGrid(const GridType& grid, 
00026                               const std::string& filename,
00027                               const IndexSetType& indexSet);
00028 
00034         template <class VectorType>
00035         static void writeBlockVector(const VectorType& f,
00036                                      const std::string& filename,
00037                                      const IndexSetType& indexSet);
00038 
00039     };
00040 
00045     template<class GridType>
00046     class LevelAmiraMeshWriter {
00047 
00048         enum {dim = GridType::dimension};
00049 
00050         typedef AmiraMeshWriter<GridType,typename GridType::Traits::LevelIndexSet> WriterType;
00051 
00052     public:
00053 
00060         static void writeGrid(const GridType& grid, 
00061                               const std::string& filename,
00062                               int level) {
00063             WriterType::writeGrid(grid, 
00064                                   filename,
00065                                   grid.levelIndexSet(level));
00066         }
00067 
00074         template <class VectorType>
00075         static void writeBlockVector(const GridType& grid,
00076                                      const VectorType& f,
00077                                      const std::string& filename,
00078                                      int level) {
00079             
00080             WriterType::template writeBlockVector<VectorType>(f, filename, grid.levelIndexSet(level));
00081         }
00082 
00083     };
00084 
00089     template<class GridType>
00090     class LeafAmiraMeshWriter {
00091 
00092         enum {dim = GridType::dimension};
00093 
00094         typedef AmiraMeshWriter<GridType,typename GridType::Traits::LeafIndexSet> WriterType;
00095 
00096     public:
00097 
00103         static void writeGrid(const GridType& grid, 
00104                               const std::string& filename) {
00105             WriterType::writeGrid(grid, filename, grid.leafIndexSet());
00106         }
00107 
00113         template <class VectorType>
00114         static void writeBlockVector(const GridType& grid,
00115                                      const VectorType& f,
00116                                      const std::string& filename) {
00117             WriterType::template writeBlockVector<VectorType>(f, filename, grid.leafIndexSet());
00118         }
00119 
00120     };
00121 
00122 }
00123 
00124 // The default implementation
00125 #include "amiramesh/amirameshwriter.cc"
00126 
00127 // the amiramesh writer for SGrid
00128 //#include "amiramesh/amsgridwriter.cc"
00129 
00130 #endif

Generated on 12 Dec 2007 with Doxygen (ver 1.5.1)