dune-grid
2.2.0
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set et ts=8 sw=2 sts=2: 00003 00004 #ifndef DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH 00005 #define DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH 00006 00007 #include <dune/grid/common/gridenums.hh> 00008 00009 #include <dune/grid/io/file/vtk/corner.hh> 00010 #include <dune/grid/io/file/vtk/corneriterator.hh> 00011 #include <dune/grid/io/file/vtk/functionwriter.hh> 00012 #include <dune/grid/io/file/vtk/pointiterator.hh> 00013 00014 namespace Dune { 00017 00018 namespace VTK { 00019 00020 template<typename GV> 00021 class ConformingVolumeIteratorFactory { 00022 const GV& gv; 00023 00024 typedef typename GV::IndexSet IndexSet; 00025 const IndexSet& indexSet() const { return gv.indexSet(); } 00026 friend class ConformingConnectivityWriter< 00027 ConformingVolumeIteratorFactory<GV> >; 00028 00029 public: 00030 static const unsigned dimCell = GV::dimension; 00031 00032 typedef typename GV::template Codim<0>::Entity Cell; 00033 typedef typename GV::template Codim<0>:: 00034 template Partition<InteriorBorder_Partition>::Iterator CellIterator; 00035 00036 typedef VTK::Corner<Cell> Corner; 00037 typedef VTK::CornerIterator<CellIterator> CornerIterator; 00038 00039 typedef VTK::Corner<Cell> Point; 00040 typedef VTK::PointIterator<CellIterator, 00041 typename GV::IndexSet> PointIterator; 00042 00043 typedef ConformingConnectivityWriter<ConformingVolumeIteratorFactory<GV> 00044 > ConnectivityWriter; 00045 typedef typename GV::CollectiveCommunication CollectiveCommunication; 00046 00047 explicit ConformingVolumeIteratorFactory(const GV& gv_) 00048 : gv(gv_) 00049 { } 00050 00051 CellIterator beginCells() const { 00052 return gv.template begin<0, InteriorBorder_Partition>(); 00053 } 00054 CellIterator endCells() const { 00055 return gv.template end<0, InteriorBorder_Partition>(); 00056 } 00057 00058 CornerIterator beginCorners() const { 00059 return CornerIterator(beginCells(), endCells()); 00060 } 00061 CornerIterator endCorners() const { 00062 return CornerIterator(endCells()); 00063 } 00064 00065 PointIterator beginPoints() const { 00066 return PointIterator(beginCells(), endCells(), gv.indexSet()); 00067 } 00068 PointIterator endPoints() const { 00069 return PointIterator(endCells()); 00070 } 00071 00072 ConnectivityWriter makeConnectivity() const { 00073 return ConnectivityWriter(*this); 00074 } 00075 const CollectiveCommunication& comm() const { 00076 return gv.comm(); 00077 } 00078 }; 00079 00080 template<typename GV> 00081 class NonConformingVolumeIteratorFactory { 00082 const GV& gv; 00083 00084 public: 00085 static const unsigned dimCell = GV::dimension; 00086 00087 typedef typename GV::template Codim<0>::Entity Cell; 00088 typedef typename GV::template Codim<0>:: 00089 template Partition<InteriorBorder_Partition>::Iterator CellIterator; 00090 00091 typedef VTK::Corner<Cell> Corner; 00092 typedef VTK::CornerIterator<CellIterator> CornerIterator; 00093 00094 typedef Corner Point; 00095 typedef CornerIterator PointIterator; 00096 00097 typedef NonConformingConnectivityWriter<Cell> ConnectivityWriter; 00098 typedef typename GV::CollectiveCommunication CollectiveCommunication; 00099 00100 explicit NonConformingVolumeIteratorFactory(const GV& gv_) 00101 : gv(gv_) 00102 { } 00103 00104 CellIterator beginCells() const { 00105 return gv.template begin<0, InteriorBorder_Partition>(); 00106 } 00107 CellIterator endCells() const { 00108 return gv.template end<0, InteriorBorder_Partition>(); 00109 } 00110 00111 CornerIterator beginCorners() const { 00112 return CornerIterator(beginCells(), endCells()); 00113 } 00114 CornerIterator endCorners() const { 00115 return CornerIterator(endCells()); 00116 } 00117 00118 PointIterator beginPoints() const { return beginCorners(); } 00119 PointIterator endPoints() const { return endCorners(); } 00120 00121 ConnectivityWriter makeConnectivity() const { 00122 return ConnectivityWriter(); 00123 } 00124 const CollectiveCommunication& comm() const { 00125 return gv.comm(); 00126 } 00127 }; 00128 00129 } // namespace VTK 00130 00132 00133 } // namespace Dune 00134 00135 #endif // DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH